Jump to content

User:Gan Luo/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.
// {{commons ok}} tagger
function commonsOK() {
  document.editform.wpTextbox1.value += "\n{{commons ok}}";
  document.editform.wpSummary.value = "{{[[Template:commons ok|commons ok]]}}";
  document.editform.submit();
}
function nrd() {
  document.editform.wpTextbox1.value += "\n{{subst:nrd}" + "}";
  document.editform.wpSummary.value = "no rationale given";
  document.editform.submit();
}
function nsd() {
  document.editform.wpTextbox1.value += "\n{{subst:nsd}" + "}";
  document.editform.wpSummary.value = "no source given";
  document.editform.submit();
}
function addCommonsOK(){
  if (document.editform && wgCanonicalNamespace == "Image") {
    mw.util.addPortletLink("p-cactions", "javascript:commonsOK()", "{{commons ok}}", "");
    mw.util.addPortletLink("p-cactions", "javascript:nrd()", "nrd", "");
    mw.util.addPortletLink("p-cactions", "javascript:nsd()", "nsd", "");
  }
}
$(addCommonsOK);

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

popupDelay=0;
popupAdminLinks=true;

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

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

/* <pre><nowiki> */

/**** Initialize on window load ****/

$( myLoadFuncs );

/**** Load custom functions ****/

function myLoadFuncs()
{
    if(!document.getElementById) return;
    // add a clock
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(toplinks, '#', '', 'utcdate');
    showtime();
    morelinks();
}

/**** Add generic tab ****/

function addlilink(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}