User:The JPS/monobook.js

Source: 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.
// [[User:Lupin/popups.js]] - please include this line 

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

// [[User:Mdd4696/Image Autotagger/lib.js]]
document.write(
        "<script type='text/javascript' "
        + "src='http://en.wikipedia.org/w/index.php?title=User:Mdd4696/Image Autotagger/lib.js"
        + "&action=raw&ctype=text/javascript&dontcountme=s'></script>"
);

//<nowiki><pre>
// [[User:Lupin/popups.js]] - please include this line 


 function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", or "p-navigation".
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //* name is what will appear as the name of the button.
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //* key is the char you want for the accesskey. Optional.
    //* after is the id of the button you want to follow this one. Optional.
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

 /**** afd helper ****/
 document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' +
  'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

 /* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */


 document.write('<script type="text/javascript"  src="http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

 popupAdminLinks = true;
 popupFixDabs = true;
 popupFixRedirs = true;

 function addForceSummary()
 {
    if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
    if(/&section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = forceSummary;
 }

 function forceSummary()
 {
    if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
    {
        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
        if(r == null) { return false; }
        document.forms.editform.wpSummary.value = r;
    }
    return true;
 }
 addOnloadHook(addForceSummary);

 addOnloadHook( function (){
    var x = document.getElementById('ca-history');
    if(!x) return;
    if(x.children) x = x.children[0].href;
    else x = x.childNodes[0].href;
    addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0);
 });

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key);
}

function doORFU() {
  //var uploader = prompt('Name of uploader', '');
  document.editform.wpTextbox1.value = "{" + "{subst:Orfud}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "Orphaned Fair Use. Uploader informed. [[WP:UI]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = false;
  document.editform.submit();
}

function doNoSource() {
  //var uploader = prompt('Name of uploader', '');
  document.editform.wpTextbox1.value = "{" + "{no source|day={{subs" +"t:CURRENTDAY}}|month={{subs"+"t:CURRENTMONTHNAME}}|year={{subs"+"t:CURRENTYEAR}}}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "No source, uploader notified. [[WP:UI]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = true;
  document.editform.submit();
}

function doNoLicense() {
  //var uploader = prompt('Name of uploader', '');
  document.editform.wpTextbox1.value = "{" + "{no license|day={{subs" +"t:CURRENTDAY}}|month={{subs"+"t:CURRENTMONTHNAME}}|year={{subs"+"t:CURRENTYEAR}}}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "No © tag, uploader notified. [[WP:UI]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = true;
  document.editform.submit();
}

function doIfD() {
  document.editform.wpTextbox1.value = "{" + "{subs"+ "t:IFD}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "Image is now listed for [[WP:IFD|deletion]], uploader notified. [[WP:UI]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = false;
  document.editform.submit();
}

function doWPUI() {
  document.editform.wpSummary.value = "Thousands of pictures are untagged. [[WP:UI|You can help!]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = false;
  document.editform.submit();
}

function addORFU() {
  addTab("javascript:doORFU()", "orfu", "ca-orfu", "Tag as Orphaned Fair Use", "");
  akeytt();
}

function addNoSource() {
  addTab("javascript:doNoSource()", "-s", "ca-nosource", "Tag as No source", "");
  akeytt();
}

function addNoLicense() {
  addTab("javascript:doNoLicense()", "-©", "ca-nolicense", "Tag as No license", "");
  akeytt();
}

function addIfD() {
  addTab("javascript:doIfD()", "ifd", "ca-ifd", "Tag for deletion", "");
  akeytt();
}

function addWPUI() {
  addTab("javascript:doWPUI()", "UI", "ca-WPUI", "Tag for deletion", "");
  akeytt();
}

if (document.title.indexOf("Editing Image:") == 0) {
  if (window.addEventListener) window.addEventListener("load", addNoSource, false);
    else if (window.attachEvent) window.attachEvent("onload", addNoSource);

  if (window.addEventListener) window.addEventListener("load", addNoLicense, false);
    else if (window.attachEvent) window.attachEvent("onload", addNoLicense);

  if (window.addEventListener) window.addEventListener("load", addIfD, false);
    else if (window.attachEvent) window.attachEvent("onload", addIfD);

  if (window.addEventListener) window.addEventListener("load", addWPUI, false);
    else if (window.attachEvent) window.attachEvent("onload", addWPUI);

  if (window.addEventListener) window.addEventListener("load", addORFU, false);
    else if (window.attachEvent) window.attachEvent("onload", addORFU);
}

addOnloadHook(function () {
  for (var i=0; i<document.links.length; ++i) {
    if (document.links[i].href.indexOf('Special:Watchlist')>0) {
      document.links[i].href+='?hideOwn=1';
      break;
    }
  }
});

//</pre></nowiki>



// [[User:Zocky/SearchBox.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


//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'); }

importScript('User:Ioeth/friendly.js');
importScript('User:Smith609/toolbox.js');