User:Erwin Springer/monobook.js

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
addOnloadHook(function () {
  if (!(hist = document.getElementById('ca-history') )) return;
  addPortletLink('p-cactions', wgServer + wgScript + '?title=' + 
    wgPageName + "&diff=prev&oldid=" + wgCurRevisionId, 'diff', 'ca-last', 'Show most recent diff');
});
 

addOnloadHook(function() {
    var tab = document.getElementById('ca-addsection');
    if(!tab) return;
    var tablink = tab.getElementsByTagName('a')[0];
    if(!tablink) return;
    tablink.firstChild.nodeValue = 'new section';
    tablink.style.paddingLeft = ".4em";
    tablink.style.paddingRight = ".4em";
 
});

// **********************************************************************
// **                 ***WARNING GLOBAL GADGET FILE***                 **
// **             changes to this file affect many users.              **
// **           please discuss on the talk page before editing         **
// **                                                                  **
// **********************************************************************
// Imported from [[User:Alex Smotrov/edittop.js]], version as of: 2007-06-19T04:28:52 
if ((wgAction == 'view' || wgAction == 'purge') && wgNamespaceNumber >=0)
addOnloadHook(function edittop_hook(){
 var localtitles = {
   en: 'Edit lead section',
   fr: 'Modifier le résumé introductif',
   it: 'Modifica della sezione iniziale',
   ja: '導入部を編集'
 };
 var h2s = document.getElementsByTagName('H2');
 var h2 = h2s[0];
 if (!h2) return;
 if (h2.parentNode.id == 'toctitle') h2 = h2s[1];
 if (!h2) return;
 var span = h2.firstChild;
 if (!span || span.className != 'editsection') return;
 var zero = span.cloneNode(true);
 if (document.getElementById('featured-star') || document.getElementById('commons-icon')) zero.style.marginRight = '25px';
 if (document.getElementById('spoken-icon')) zero.style.marginRight = '45px';
 if (document.getElementById('protected-icon') && zero.style.marginRight) zero.style.marginRight = '70px';
 var parent = document.getElementsByTagName('H1')[0];
 parent.insertBefore(zero, parent.firstChild);
 var a = zero.getElementsByTagName('A')[0];
 if (a.href.indexOf('&section=T') == -1){
   a.title = a.title.replace(/:.*$/,': 0')
   a.setAttribute('href', a.href.replace(/&section=\d+/,'&section=0'));
 }else{//transcluded
   a.title = localtitles['en']
   a.setAttribute('href', wgScript+'?title='+encodeURIComponent(wgPageName)+'&action=edit&section=0')
 }
 if (localtitles[wgUserLanguage]) a.title = localtitles[wgUserLanguage]
})

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;
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', '0');
});