MediaWiki:Monobook.js

From Camera-wiki.org
Jump to: navigation, 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: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for users using the MonoBook skin */
/* Any working changes here shall be transfered to MediaWiki:Vector.js  */

var sURL = unescape(window.location.pathname);
 
function setupAutomaticRefresh()
{
 setTimeout( "refresh()", 720000 ); /* refresh after 12 minutes */
}
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();

if (mwCustomEditButtons) {
  mwCustomEditButtons.push({
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
    "speedTip": "Redirect",
    "tagOpen": "#REDIRECT [[",
    "tagClose": "]]",
    "sampleText": " "
  });
  mwCustomEditButtons.push({
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/58/Button_small.png",
     "speedTip": "Small",
     "tagOpen": '<small>',
     "tagClose": '</small>',
     "sampleText": " "
  });
  mwCustomEditButtons.push({
     "imageFile": "http://camera-wiki.org/skins/common/images/button_image.png",
     "speedTip": "Flickr image",
     "tagOpen": '\n{{Flickr_image\n|image_source= \n|image= ',
     "tagClose": '\n|image_align= \n|image_text= \n|image_by= \n|image_rights= \n}}\n',
     "sampleText": " "
  });
}

addOnloadHook(function() {
var tEXT = window.document.getElementsByTagName("textarea")[0];

if(wgNamespaceNumber == 14)
   if(wgPageName.substr(0,17) == 'Category:Image_by' )
    {
      if (!tEXT.value) 
         { tEXT.value =              '__HIDDENCAT__\n';
           tEXT.value = tEXT.value + 'See [http://www.flickr.com/photos/' + wgPageName.substr(18) + ' ' + wgPageName.substr(18) + '\'s Flickr stream],'
           tEXT.value = tEXT.value + ' or images added to the [http://www.flickr.com/groups/camerawiki/pool/ Camera-wiki.org photo pool].\n\n';
           tEXT.value = tEXT.value + '[[Category:Flickr_image]]';
         }
    }
   if(wgPageName.substr(0,16) == 'Category:Scan_by' )
    {
      if (!tEXT.value) 
         { tEXT.value =              '__HIDDENCAT__\n\n';
           tEXT.value = tEXT.value + '[[Category:Image_by_' + wgPageName.substr(17) + ']]\n\n';
           tEXT.value = tEXT.value + '[[Category:scans]]';
         }
         
    }
   return;
});