Jump to content

User:Discospinster/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.
<!-- QUICK SOURCES -->

// This script adds a "sources" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doSources() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Sources|' + 'date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Tagged for sources.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

addOnloadHook(function() {
  if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {
     return;
  }
  if (document.editform) {
     mw.util.addPortletLink("p-cactions", "javascript:doSources()", "sources", "ca-sources", "Tag for sources", "");
  }
});

// 

<!-- QUICK WIKIFY -->

// <nowiki>If you are editing a page, click the wikify button on your tab bar to add "{{Wikify|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked for wikification." as the edit summary, mark it as a minor edit, and submit.</nowiki>

function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|' + 'date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

addOnloadHook(function() {
  if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {
     // wouldn't it make more sense to just check for mw.config.get('wgCanonicalNamespace') != "", or am I missing something?
     return;
  }
  if (document.editform) {
     mw.util.addPortletLink("p-cactions", "javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
  }
});

// by [[User:Raylu|raylu]]
// 
//

function inc (file) {
  mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s');
}
inc("User:Lightdarkness/aiv.js");

<!-- RECENT CHANGES -->

// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

<!-- POPUPS -->

// [[User:Lupin/popups.js]]

importScript('User:Lupin/popups.js');

//

<!-- USER WARNING SCRIPT -->


function tnaddlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}

function testn(number)
{
  var page = prompt("Vandalism to which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "uw-vandalism" + number + "|" + page + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Your edits to [[" + page + "]]";
  f.wpMinoredit.checked = false;
  f.wpWatchthis.checked = false;
}

function add_testn_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(tnaddlilink('javascript:testn(1)',"t1"));
      tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2"));
      tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3"));
      tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4"));
    }
}

addOnloadHook(add_testn_tabs);

//

<!--EASY DB-->
//<pre><nowiki>
//Please leave the following line
//[[user:Where/easy db]]
//Start db script

addOnloadHook(function()
{
  //check if called from deletion request
  if (document.title.indexOf("Editing ") != -1)
  {
    if (document.URL.lastIndexOf("&fakeaction=huff") == -1)
      return;
    if (document.URL.lastIndexOf("&reason=off") != -1)
    {
      var type = prompt("Enter criteria for speedy deletion, e.g. A1, G3");
      var f = document.editform, t = f.wpTextbox1;
      t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;
      f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type + "]])";
      f.wpMinoredit.checked = false;
      f.wpWatchthis.checked = true;
<!-- //    f.wpSave.click(); - don't automatically save -->
      return;
    }
    else if (document.URL.lastIndexOf("&reason=on") != -1)
    {
      var type = prompt("Enter reason for speedy deletion");
      var f = document.editform, t = f.wpTextbox1;
      t.value = "{{db|" + type + "}}\n" + t.value;
      f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD]]) – " + type;
      f.wpMinoredit.checked = false;
      f.wpWatchthis.checked = true;
<!-- //    f.wpSave.click(); - don't automatically save -->
      return;
    }
  }
  if (mw.config.get('wgCanonicalNamespace') == "Special")
    return;

  mw.util.addPortletLink("p-cactions", "javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");
  mw.util.addPortletLink("p-cactions", "javascript:easyDb(1)", "db (reason)", "ca-db1", "Request speedy deletion with reason", "");
});
 
function easyDb(n)
{
  if (n == 0)
  {
    //edit page

    location.assign("/w/index.php?title=" + mw.config.get('wgPageName') + "&action=edit&fakeaction=huff&reason=off");
  }  
   
  if (n == 1)
  {
    //edit page

    location.assign("/w/index.php?title=" + mw.config.get('wgPageName') + "&action=edit&fakeaction=huff&reason=on");
  }
}


//End db script
//</nowiki></pre>

<!--TWINKLE-->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklexfd.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinkleprod.js');
TwinkleConfig = {
        showSharedIPNotice              :       true,
        summaryAd                       :       " using [[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
        protectionSummaryAd             :       " using [[WP:TWINKLE|TW]]",
        watchWarnings                   :       false,
        markAIVReportAsMinor            :       false,
};

<!-- HIDE MY CONTRIBS -->
// [[User:Ais523/hidetopcontrib.js]]
// By a suggestion by [[User:Discospinster]]
 
// This script color-codes lines according to who has the top contribution for a page.
//<pre><nowiki>
 
function hidetopcontrib()
{
  var i,li,a;
  li=document.getElementById("bodyContent");
  li=li.getElementsByTagName("li");
  i=-1;
  a=new Array();
  while(++i<li.length)
  {
    var s,t;
    t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1];
    if(li[i].getElementsByTagName("strong").length>0)
      s="none";
    else
      s="";
    if(a[t]!=undefined) s=a[t]; else a[t]=s;
    if(s!="") li[i].style.display=(li[i].style.display=="none"?"list-item":"none");
  }
}
 
addOnloadHook(function () {
  if((location.href.indexOf("Special:Contributions")!=-1||
      location.href.indexOf("Special%3AContributions")!=-1)
     &&location.href.indexOf("&ais523")==-1&&location.href.indexOf("?ais523")==-1)
    mw.util.addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',
                   "Show/hide pages for which you're the top contributor", '');
});
//</nowiki></pre>
//[[Category:Wikipedia scripts]]

<!-- WIKED -->
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

<!-- USER WATCH -->

importScript('User:Tra/userwatchlist.js'); //[[User:Tra/userwatchlist.js]]