Jump to content

User:Nick Wilson/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<pre><nowiki>
//First loads
importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Voice_of_All/Google/monobook.js');
importScript('User:Voice_of_All/UTCclock.js');
importScript('User:Voice_of_All/History/monobook.js');
 
//</nowiki></pre>
 
////<pre><nowiki>
//Toolbox links
function changelinks()
{
    if(!document.getElementById) return;
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;
 if (document.title.indexOf('User:' + user_name + '/xml') != -1 || document.title.indexOf('User:' + user_name + '/XML') != -1)
    {addlilink(toplinks, 'javascript:XMLrequestprompt()', 'Request XML', 'Request XML');}
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'my Talk page';
    document.getElementById('pt-preferences').firstChild.innerHTML = 'Change Preferences';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'Check my Watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'My Contributions';
    document.getElementById('pt-logout').firstChild.innerHTML = 'Log out';
    if(document.getElementById('ca-delete'))
      {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} 
}
 
function navigationlinks()
{
    addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln');
    addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln');
    addnavbox_link('/wiki/Wikipedia:Requests for page protection#Current_requests_for_protection','Protection requests','rfpp-ln');
    addnavbox_link('/wiki/Wikipedia:Usernames for administrator attention','UAA','UAA-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard/Edit_warring','3RR','AN3-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard','Noticeboard','AN-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard/Incidents','Incidents','ANI-ln');
}
 
function addtoolboxlinks()
 {
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
    addlilink(tb, '/wiki/Special:Log/newusers', 'New users', '');
    addlilink(tb, '/wiki/WP:PP', 'Protected pages', '');
}
//</nowiki></pre>
 
////<pre><nowiki>
// USER TABS
function userlogs()
{
//no subpages or history
   if (document.title.search("/") != -1 || location.href.search(/Special:|&action=[^p]|&diff=/) !=-1)
   {return;}
   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) 
   {
      username_a = document.URL.match(/:.*:(.*)/);
      username=username_a[1];
      addTab("http://wiki.riteme.site/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "log", "ca-blog", "block log", "");
      addTab("http://toolserver.org/~soxred93/pcount/index.php?name=" + username + "&lang=en&wiki=wikipedia", "info", "ca-Xi", "user info", "");
   }
}
 
 
// This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
var edittop = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>';
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
  if(document.title.indexOf("Main Page") != -1) return;
 
  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 
 
  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>';
 
  // insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
  document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//</nowiki></pre>
 
////<pre><nowiki>
//MAIN
$(Mainfast)
function Mainfast() 
{
    userlogs();
    changelinks();
    navigationlinks();
    addtoolboxlinks();
}
 
window.onload = Main;
function Main() 
{
    watchlist_tab();
    block_check();
    lastdiff();
    addtoplink();
}
//END
//************
 
function watchlist_tab()
{
if (location.href.indexOf('Special:Watchlist/edit') !=-1)
  {addTab("javascript:watchlist_clean()", "check deleted pages", "ca-clean", "check all deleted pages", "");}
}
 
function watchlist_clean()
{
//monobook
if (document.getElementById('bodyContent'))
  {
  var body = document.getElementById('bodyContent');
  }
//cologneblue
else if (document.getElementById('quickbar'))
  {
  if (!document.getElementById('content')){return;}
  var body = document.getElementById('content');
  }
  var l = body.getElementsByTagName('li');
  for (var i=0; i<l.length; i++)
    {
    if (l[i].getElementsByTagName('a')[0].href.indexOf('&action=') !=-1)
      {l[i].getElementsByTagName('input')[0].checked=true;}
    }
}
 
function block_check()
{
if (document.title.indexOf('Block user') !=0){return;}
  //monobook
  if (document.getElementById('pt-userpage'))
     {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;}
  //cologneblue
  else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
      {
      var toplinks = document.getElementById('quickbar');
      var user_name = toplinks.innerHTML.split('<h6>My pages</h6>')[1].split('title="User:')[1].split('"')[0];
      }
if (document.getElementsByTagName('input')[0].value == user_name)
  {alert('Are you sure you want to block yourself?');}
else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_'))
  {alert('Are you sure you want to block yourself?');}
}
 
//
$(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'move';
Rvaluejs_class = 'edit';
Uvaluejs_class = 'upload';
}
//
 
//************
//popups
//************
 
 
mw.loader.load(
             'https://wiki.riteme.site/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');
 
popupOnEditSelection=false;
popupLastEditLink=true;
popupOnlyArticleLinks=false;
popupShortcutKeys=true; 
popupAdminLinks=true;  
popupSubpopups=true;
popupStructure='original';
popupDelay = 2;
popupFixDabs = true;
popupPreviewKillTemplates=false;
popupPreviewFirstParOnly=false;
popupFixRedirs=true;
 
//END
//************
LocalComments = {
	dateDifference: false,
	dateFormat: 'mdy',
	timeFirst: true,
};
 
importScript('User:John254/mass rollback.js');
importScript('User:Mr.Z-man/closeAFD.js');
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
 
if (document.title.indexOf('User talk:') != -1) {
  importScript('User:AzaToth/twinklewarn.js');
} else {
  importScript('User:AzaToth/twinklespeedy.js');
  importScript('User:AzaToth/twinklediff.js');
  importScript('User:AzaToth/twinkleprotect.js');
  importScript('User:AzaToth/salt.js');
  importScript('User:AzaToth/twinkleprod.js');
  importScript('User:AzaToth/twinklexfd.js');
  importScript('User:AzaToth/twinkleunlink.js');
  importScript('User:AzaToth/twinklebatchdelete.js');
 
 
}
 
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       "[[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       "[[WP:TWINKLE|TW]]",
        protectionSummaryAd             :       "[[WP:TWINKLE|TW]]",
        watchSpeedyPages                :       "[[WP:TWINKLE|TW]]",
        openUserTalkPageOnSpeedyDelete  :       [  ],
        watchRevertedPages              :       [  ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       true,
        watchWarnings                   :       false,
        markWarningsAsMinor             :       false,
        markSpeedyPagesAsMinor          :       false,
};
 
if (location.href.indexOf('Special:Watchlist') != -1) {
  importScript('User:Misza13/watchlistSorter.js');
}
 
importScript('User:Misza13/statusChanger.js');
 
// for testing from monobook.js: 
 
if (window.location.href.indexOf("&action=history") != -1)
{
$(addOldids);
}
//</nowiki></pre>