User:Budlight/monobook.js

From CycleChaos
Jump to navigation Jump to search

Note: After saving, 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.
/* <pre> */

addOnloadHook(function () {  // add onload handler using code from wikibits.js
    var title;
    if (!(title = document.getElementById('t-whatlinkshere') )) return;
    if (!(title = title.getElementsByTagName('a')[0] )) return;
    if (!(title = title.href )) return;
    if (!(title = title.replace(/^.*title=Special:Whatlinkshere&target=/, '') )) return;
    if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return;
    if (!(title = title.replace(/("|%22)/g, '') )) return;
    if (!(title = title.replace(/_/g, '%20') )) return;
 
 var pagetitleRe=/[^:]*:\/\/www\.cyclechaos\.com\/(wiki\/|w\/index\.php\?title=)([^&?]*)/;
 title=pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
 
    addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&;ie=utf-8&oe=utf-8',
            'Google search', 't-googlesearch', 'Search Google for "'+decodeURIComponent(title)+'"', 'G', null);
    addLink('p-tb', 'http://search.yahoo.com/search?p=%22'+title+'%22%20-Wikipedia&;ei=UTF-8',
            'Yahoo! search', 't-yahoosearch', 'Search Yahoo! for "'+decodeURIComponent(title)+'"', 'Y', null);
});

/* </pre> */