User:Jldupont/monobook.js

From MediaWiki.org

Jump to: navigation, search

Note - After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh); Konqueror: click Reload or press F5; Opera: clear the cache in Tools → Preferences; Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

// This function allows for dynamically loading scripts into the page's HEAD element
function importScript( url, cb ) 
{
     var scriptElem = document.createElement( 'script' );
     scriptElem.setAttribute( 'src' , url );
     scriptElem.setAttribute( 'type' , 'text/javascript' );
 
     // register our callback
     scriptElem.setAttribute( 'onload' , cb );
     document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}
 
function jQueryReady()
{
 // when the DOM is ready
 $(document).ready(function()
 {
  doStuff();
 });
}
 
// Import the always so useful jQuery library from the official CDN
//importScript( 'http://code.jquery.com/jquery-latest.min.js', 'jQueryReady();' );
 
 
// Insert the PNG images corresponding to the latest version of each extension on [[User:Jldupont]] 
function doStuff()
{
 //fix-up for [[User:Jldupont]] page
 $(".pear").each(function(i)
 {
  name=$(this).attr('id');
  // Use the Coral CDN 
  $(this).append("<img src='http://mediawiki.googlecode.com.nyud.net/svn/rest/r/"+name.toLowerCase()+"/latest.png' />" );
 });
 
}
 
var sURL = unescape(window.location.pathname);
 
function setupAutomaticRefresh()
{
 setTimeout( "refresh()", 180*1000 );
}
function refresh()
{
    //  This version does NOT cause an entry in the browser's
    //  page view history.  Most browsers will always retrieve
    //  the document from the web-server whether it is already
    //  in the browsers page-cache or not.
    //  
    window.location.replace( sURL );
}
 
// automatic refresh for [[Special:RecentChanges]] page
if (wgPageName == 'Special:RecentChanges' )
   setupAutomaticRefresh();