User:SeoR/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.
importScript('User:DStoykov/defaultsort.js');
 
//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }
 
popupFixDabs=true;
popupFixRedirs=true;
 
// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades
 
// Add an [edit] link to pages
addOnloadHook(function () {
  // if this is preview page or generated page, stop
  if(
    document.getElementById("wikiPreview") ||
    document.getElementById("histlegend‎") ||
    document.getElementById("difference‎") ||
    document.getElementById("watchdetails") ||
    document.getElementById("ca-viewsource") ||
    window.location.href.indexOf("/wiki/Special:") != -1
  ) {
    if(window.location.href.indexOf("&action=edit&section=0") != -1) {
      document.getElementById("wpSummary").value = "/* Intro */ ";
    }
    return;
  };
 
  // get the page title
  var pageTitle = mw.config.get('wgPageName');
 
  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="Edit section: '+pageTitle+'">edit intro</a>]</div>';
 
  // insert divContainer into the DOM below the h1
  if(window.location.href.indexOf("&action=edit") == -1) {
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
  }
 
});
 
 
// From Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs
// addPurge
addOnloadHook(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', 'p');
});
 
//
 
// Script from Wikipedia:WikiProject User scripts/Scripts/Show last diff
// Originally based on http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510  
//See [[Wikipedia:WikiProject User scripts/Scripts/Show last diff]]
// addLastDiff
// function addLastDiff()
//{
//    mw.util.addPortletLink('p-cactions', 'http://en.wikipedia.org/w/index.php?title=' + mw.config.get('wgPageName') + "&diff=cur&oldid=prev", 'last', 'ca-last', 'Show most recent diff');
//}
//addOnloadHook(addLastDiff);
 
 
// add Script from [[Wikipedia:WikiProject User scripts/Scripts/Replace]]
function wpTextboxReplace()
{
    var s = prompt("Search regexp:");
    if(s){
        var r = prompt("Replace /"+s+"/ with:");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "mg"), r);
    }
}
addOnloadHook(function () {
    if (document.forms.editform) {
        mw.util.addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'replace', 'ca-replace',
                       'Regexp replace for the edit window', 'R', document.getElementById('ca-history'));
    }
});
 
// script from Wikipedia:WikiProject User scripts/Scripts/Unreferenced tool
// <nowiki>If you are editing a page, click the unref button on your tab bar to add "{{Unreferenced|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked as unreferenced" as the edit summary, mark it as a minor edit, and submit.
 
function doQunref() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Unreferenced|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "Marked as unreferenced (see [[Wikipedia:Verifiability]], [[Wikipedia:No original research]] and [[WP:RS]]). Please don't remove the {{unreferenced}} tag until references have been added.";
  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:doQunref()", "unref", "ca-unref", "Mark as unreferenced", "");
  }
});
 
// by [[User:Jj137|jj137]]
//
 
// Script from [[User:Lupin/editcount.js]]
importScript('User:Lupin/editcount.js'); //[[User:Lupin/editcount.js]]
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';
 
// User:BrownHairedGirl/metadata.js - displays WikiProject assessments
// [[User:Outriggr/metadatatest.js]] <nowiki>
importScript('User:BrownHairedGirl/metadatatest.js'); 
assessmentMyTemplateCode = ["{{WikiProject Ireland |nested= |class= |importance= |attention= |peer-review= |old-peer-review= |image-needed= |needs-infobox= |listas= }}", "{{WPNI |nested= |class=stub |importance= |attention= |image-needed=yes }}", "{{WPBiography\n|small = \n|nested = \n|living = \n|class = \n|priority = \n|core = \n|attention = \n|past-collaboration = \n|peer-review = \n|old-peer-review = \n|needs-infobox = \n|a&e-work-group = \n|politician-work-group = \n|activepol = \n|british-royalty = \n|royalty-work-group = \n|military-work-group = \n|sports-work-group = \n|s&a-work-group = \n|musician-work-group = \n|peerage-work-group = \n|baronets-work-group = \n|filmbio-work-group = \n|non-bio = \n|removal = \n|listas =\n|needs-photo = \n}}",];
assessmentDefaultProject = "WikiProject Ireland";
assessmentMarkAsMinor = true;
// </nowiki>
 
importScript('User:BrownHairedGirl/Unref.js');
importScript('User:BrownHairedGirl/PrimarySources.js');

importScript('User:Galobtter/Shortdesc helper.js'); // shows short description and provides edit window with button to import from Wikidata
window.inputBoxSize = "150"; // edit window size

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
importScript('User:Dr pda/prosesize.js');