Difference between revisions of "MediaWiki:Monobook.js"

From Camera-wiki.org
Jump to: navigation, search
m
m
(24 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
if (wgPageName == 'Special:RecentChanges' )
 
if (wgPageName == 'Special:RecentChanges' )
 
   setupAutomaticRefresh();
 
   setupAutomaticRefresh();
 +
 +
function eraseButton(i) {
 +
if (wgPageName == 'MediaWiki:Monobook.js' )
 +
 +
var y = mwEditButtons.length;
  
 
if (mwEditButtons) {
 
if (mwEditButtons) {
     var xy=mwEditButtons.length - 1;
+
alert(y);
    mwEditButtons[n]={
+
     if( i < y ) {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
+
    var x = -1;
    "speedTip": "Redirect",
+
    while( x++ < y ) {
    "tagOpen": "#REDIRECT [[",
+
      if( x >= i)
    "tagClose": "]]",
+
      mwEditButtons[x] = mwEditButtons[x+1];
     "sampleText": " "
+
alert(x);
    };
+
      if( x == y)
}
+
      mwEditButtons.pop();
 +
    }
 +
     }
 +
}
 +
};
  
 
if (mwCustomEditButtons) {
 
if (mwCustomEditButtons) {
Line 55: Line 64:
 
   });
 
   });
 
}
 
}
 +
 +
if ((wgAction=="edit") || (wgAction=="submit")) eraseButton(0);
  
 
addOnloadHook(function() {
 
addOnloadHook(function() {

Revision as of 21:31, 24 February 2011

/* 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 (wgPageName == 'Special:RecentChanges' )
   setupAutomaticRefresh();

function eraseButton(i) {
if (wgPageName == 'MediaWiki:Monobook.js' )

var y = mwEditButtons.length;

if (mwEditButtons) {
alert(y);
    if( i < y ) {
     var x = -1;
     while( x++ < y ) {
      if( x >= i)
       mwEditButtons[x] = mwEditButtons[x+1];
alert(x);
      if( x == y)
       mwEditButtons.pop();
     }
    }
 }
};

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": '{{Flickr_image\n|image_source= \n|image= ',
     "tagClose": '\n|image_align= \n|image_text= \n|image_by= \n|image_rights= \n}}\n',
     "sampleText": " "
  });
}

if ((wgAction=="edit") || (wgAction=="submit")) eraseButton(0);

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 = 'more images of ' + wgPageName.substr(18) + '?   see [http://www.flickr.com Flickr-Address]           [[Category:Flickr_image|*]]';
    }
   return;
});