MediaWiki:Vector.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 Vector skin */
/* Any JavaScript here will be loaded for users using the MonoBook skin */

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 (mw.config.get( 'wgPageName' ) == 'Special:RecentChanges' ) { setupAutomaticRefresh(); }

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

tmpPageName = mw.config.get( 'wgPageName' );

if(mw.config.get( 'wgNamespaceNumber' )  == 14)
   if(tmpPageName.substr(0,17) == 'Category:Image_by' )
    {
      if (!tEXT.value) 
         { tEXT.value =              '__HIDDENCAT__\n';
           tEXT.value = tEXT.value + 'See [http://www.flickr.com/photos/' + tmpPageName.substr(18) + ' ' + tmpPageName.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(tmpPageName.substr(0,16) == 'Category:Scan_by' )
    {
      if (!tEXT.value) 
         { tEXT.value =              '__HIDDENCAT__\n\n';
           tEXT.value = tEXT.value + '[[Category:Image_by_' + tmpPageName.substr(17) + ']]\n\n';
           tEXT.value = tEXT.value + '[[Category:scans]]';
         }
         
    }
   return;
});