MediaWiki:Common.js: Difference between revisions
From Katawa Shoujo Wiki
mNo edit summary |
No edit summary |
||
Line 74: | Line 74: | ||
/* Link to Game Download */ | /* Link to Game Download */ | ||
$('div#p-tb div.mw-portlet-body ul li: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.php">Download Katawa Shoujo</a></li>'); | ||
/**** function displayTimer.js | |||
* by Patrick Westerhoff [poke] - copied from https://bulbapedia.bulbagarden.net/wiki/MediaWiki:Bulba.js | |||
*/ | |||
function displayTimer () | |||
{ | |||
if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) | |||
return; | |||
var date; | |||
var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; | |||
var timerLink = document.createElement( 'a' ); | |||
var timerObj = document.createElement( 'li' ); | |||
timerLink.href = '/wiki/' + wgPageName + '?action=purge'; | |||
timerLink.title = 'Purge the server cache and update the contents of this page.' | |||
timerObj.id = 'pt-timer'; | |||
timerObj.style.textTransform = 'none'; | |||
timerObj.style.fontWeight = 'bold'; | |||
timerObj.style.fontSize = '100%'; | |||
timerObj.appendChild( timerLink ); | |||
timerParent.insertBefore( timerObj, timerParent.firstChild ); | |||
function actualizeUTC () | |||
{ | |||
timerDate = new Date(); | |||
timerLink.innerHTML = ( timerDate.getUTCHours() < 10 ? '0' : '' ) + timerDate.getUTCHours() + ':' | |||
+ ( timerDate.getUTCMinutes() < 10 ? '0' : '' ) + timerDate.getUTCMinutes() + ':' | |||
+ ( timerDate.getUTCSeconds() < 10 ? '0' : '' ) + timerDate.getUTCSeconds() + ' (UTC)'; | |||
} | |||
function actualizeCustom () | |||
{ | |||
timerDate = new Date(); | |||
timerDate.setMinutes( timerDate.getMinutes() + timerDate.getTimezoneOffset() + timerTimezone * 60 ); | |||
timerLink.innerHTML = ( timerDate.getHours() < 10 ? '0' : '' ) + timerDate.getHours() + ':' | |||
+ ( timerDate.getMinutes() < 10 ? '0' : '' ) + timerDate.getMinutes() + ':' | |||
+ ( timerDate.getSeconds() < 10 ? '0' : '' ) + timerDate.getSeconds() | |||
+ ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')'; | |||
} | |||
// start | |||
if ( typeof( timerTimezone ) !== 'number' ) | |||
{ | |||
actualizeUTC(); | |||
setInterval( actualizeUTC, 1000 ); | |||
} | |||
else | |||
{ | |||
actualizeCustom(); | |||
setInterval( actualizeCustom, 1000 ); | |||
} | |||
} |
Revision as of 13:58, 15 March 2025
/* 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"> /** Toggles the display of elements on a page Author/contact: Austin Che http://openwetware.org/wiki/User:Austin_J._Che See http://openwetware.org/wiki/OpenWetWare:Toggle for examples and documentation */ // </syntax> /* Adds {{CreativeCommons}} template to all uploads in [[Special:Upload]]. Code by "[[wikipedia:User:Pinky49]]", created and coded specifically for [[wikia:c:cdnmilitary|Duty & Valour]]. */ function preloadUploadDesc() { if (wgPageName.toLowerCase() != 'special:upload' && wgPageName.toLowerCase() != 'special:multipleupload') { return; } document.getElementById('wpUploadDescription').appendChild(document.createTextNode("<!--For official Katawa Shoujo images and other images licensed under Creative Commons-->\r{{CreativeCommons}}")); } addOnloadHook (preloadUploadDesc) importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'}); /* Replaces {{Visitor}} with the name of the user browsing the page. Requires copying Template:USERNAME. */ function UserNameReplace() { if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return; $("span.insertusername").html(wgUserName); } addOnloadHook(UserNameReplace); /* End of the {{Visitor}} replacement */ importArticles({ type: 'script', articles: [ // ... 'w:c:dev:SignatureCheck/code.js', 'u:dev:Standard_Edit_Summary/code.js', 'u:dev:UserTags/code.js' // ... ] }); /***User Tags***/ window.UserTagsJS = { modules: {}, tags: { // group: { associated tag data } sysop: { u:'Administrator', link:'Katawa Shoujo Wiki:Administrators' }, bureaucrat: { u:'Administrator', link:'Katawa Shoujo Wiki:Administrators' } } }; UserTagsJS.modules.metafilter = { 'inactive': ['sysop', 'bureaucrat', 'autoconfirmed-user'], 'new-user': ['sysop', 'bureaucrat', 'autoconfirmed-user'], 'new-editor': ['sysop', 'bureaucrat', 'autoconfirmed-user'] }; /* Link to Game Download */ $('div#p-tb div.mw-portlet-body ul li:first-child').after('<li><a href="http://katawa-shoujo.com/download.php">Download Katawa Shoujo</a></li>'); /**** function displayTimer.js * by Patrick Westerhoff [poke] - copied from https://bulbapedia.bulbagarden.net/wiki/MediaWiki:Bulba.js */ function displayTimer () { if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; var timerLink = document.createElement( 'a' ); var timerObj = document.createElement( 'li' ); timerLink.href = '/wiki/' + wgPageName + '?action=purge'; timerLink.title = 'Purge the server cache and update the contents of this page.' timerObj.id = 'pt-timer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight = 'bold'; timerObj.style.fontSize = '100%'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); function actualizeUTC () { timerDate = new Date(); timerLink.innerHTML = ( timerDate.getUTCHours() < 10 ? '0' : '' ) + timerDate.getUTCHours() + ':' + ( timerDate.getUTCMinutes() < 10 ? '0' : '' ) + timerDate.getUTCMinutes() + ':' + ( timerDate.getUTCSeconds() < 10 ? '0' : '' ) + timerDate.getUTCSeconds() + ' (UTC)'; } function actualizeCustom () { timerDate = new Date(); timerDate.setMinutes( timerDate.getMinutes() + timerDate.getTimezoneOffset() + timerTimezone * 60 ); timerLink.innerHTML = ( timerDate.getHours() < 10 ? '0' : '' ) + timerDate.getHours() + ':' + ( timerDate.getMinutes() < 10 ? '0' : '' ) + timerDate.getMinutes() + ':' + ( timerDate.getSeconds() < 10 ? '0' : '' ) + timerDate.getSeconds() + ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')'; } // start if ( typeof( timerTimezone ) !== 'number' ) { actualizeUTC(); setInterval( actualizeUTC, 1000 ); } else { actualizeCustom(); setInterval( actualizeCustom, 1000 ); } }