MediaWiki:Common.js: Difference between revisions

mNo edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
/* Auto Refresh */
AjaxRCRefreshText = 'Auto-refresh';
AjaxRCRefreshHoverText = 'Automatically refresh the page';
ajaxPages = ["Special:RecentChanges","Special:WikiActivity"];
importScriptPage('AjaxRC/code.js', 'dev');
/* Collapsible */
importScriptPage('ShowHide/code.js', 'dev');


// <syntax type="javascript">
// <syntax type="javascript">
Line 23: Line 15:


function preloadUploadDesc() {
function preloadUploadDesc() {
if (wgPageName.toLowerCase() != 'special:upload' && wgPageName.toLowerCase() != 'special:multipleupload') {
if (mw.config.get('wgPageName').toLowerCase() != 'special:upload' && mw.config.get('wgPageName').toLowerCase() != 'special:multipleupload') {
return;
return;
}
}
Line 32: Line 24:
addOnloadHook (preloadUploadDesc)
addOnloadHook (preloadUploadDesc)


importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'});
/* importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'}); */


/* Replaces {{Visitor}} with the name of the user browsing the page.
/* Replaces {{Visitor}} with the name of the user browsing the page.
Line 38: Line 30:
   
   
function UserNameReplace() {
function UserNameReplace() {
     if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;
     if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || mw.config.get('wgUserName') == null) return;
     $("span.insertusername").html(wgUserName);
     $("span.insertusername").html(mw.config.get('wgUserName'));
  }
  }
  addOnloadHook(UserNameReplace);
  addOnloadHook(UserNameReplace);
Line 45: Line 37:
/* End of the {{Visitor}} replacement */
/* End of the {{Visitor}} replacement */


importArticles({
/* importArticles({
type: 'script',
type: 'script',
articles: [
articles: [
Line 54: Line 46:
// ...
// ...
]
]
});
}); */


/***User Tags***/
/***User Tags***/
Line 73: Line 65:


/* Link to Game Download */
/* Link to Game Download */
$('div#p-tb h3:first-child').after('<li><a href="http://katawa-shoujo.com/download.php">Download Katawa Shoujo</a></li>');
$('div#p-tb div.mw-portlet-body ul li:first-child').after('<li><a href="http://katawa-shoujo.com/download">Download Katawa Shoujo</a></li>');


hookEvent( 'load', displayTimer );


/**** function displayTimer.js
/**** function displayTimer.js
Line 89: Line 80:
   var timerLink  = document.createElement( 'a' );
   var timerLink  = document.createElement( 'a' );
   var timerObj    = document.createElement( 'li' );
   var timerObj    = document.createElement( 'li' );
   timerLink.href              = '/wiki/' + wgPageName + '?action=purge';
   timerLink.href              = '/wiki/' + mw.config.get('wgPageName') + '?action=purge';
   timerLink.title              = 'Purge the server cache and update the contents of this page.'
   timerLink.title              = 'Purge the server cache and update the contents of this page.'
   timerObj.id                  = 'pt-timer';
   timerObj.id                  = 'pt-timer';
Line 128: Line 119:
   }
   }
}
}
addOnloadHook(displayTimer);