MediaWiki:Common.js

/** Archive edit tab disabling ************************************* * Disables the edit tab on old forum topic pages to stop new people bumping old topics. * Page can still be edited by going via the edit tab on the history etc, or by * typing the edit address manually. * By Spang * Monaco support by Uberfuzzy * Oasis support by Uberfuzzy */ window.MessageWallUserTags = { tagColor: '#000', glow: false, users: { 'MetallicKaiser': 'Admin', 'Eckilsax': 'Admin', 'Drummer le Chuck': 'Content Moderator', } }; function disableOldForumEdit { if( typeof( enableOldForumEdit ) != 'undefined' && enableOldForumEdit ) { return; }	if( !document.getElementById('old-forum-warning') ) { return; }	if( skin == 'oasis' ) {		$("#WikiaPageHeader .wikia-menu-button li a:first").html('Archived').removeAttr('href' ); $('#WikiaPageHeader .wikia-button').html('Archived').removeAttr('href'); return; }	if( !document.getElementById('ca-edit') ) { return; }	var editLink = null; if( skin == 'monaco' ) {		editLink = document.getElementById('ca-edit'); }	else if( skin == 'monobook' ) {		editLink = document.getElementById('ca-edit').firstChild; }	else {		return; }	editLink.removeAttribute('href', 0); editLink.removeAttribute('title', 0); editLink.style.color = 'gray'; editLink.innerHTML = 'Archived'; $('span.editsection-upper').remove; } if (wgNamespaceNumber == 110) { disableOldForumEdit; }

//============================================================================= // IRC support // from http://dev.wikia.com/wiki/Freenode_IRC#Embedding_Wikia.27s_IRC_gateway //============================================================================= function onloadhookcustomirc { var replace = document.getElementById("JRChatReplace"); if (null !== replace) { replace.innerHTML=' '; if (window.attachEvent) window.attachEvent("onbeforeunload",confirmexitjrchat); else window.onbeforeunload = confirmexitjrchat; }	//alert(document.getElementById("JRChatReplace").innerHTML); } if (window.addEventListener) window.addEventListener("load",onloadhookcustomirc,false); else if (window.attachEvent) window.attachEvent("onload",onloadhookcustomirc);

/* Auto Refresh */ AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; // BEGINNING: JavaScript for placing the fair use rationale template inside the summary box on Special:Upload. Code by "wikipedia:User:Pinky49", created and coded specifically for Duty & Valour.

$(function {   $('.wikinav2 .WikiaPageHeader > .comments').before('   Monobook '); });

$(function FairUseRationale {	if((wgPageName == 'Special:Upload') && document.getElementById('wpDestFile').value === ) {		document.getElementById('wpUploadDescription').value = ;	} }); // ****** END: JavaScript for Special:Upload ******

// ************************************************** // Experimental javascript countdown timer (Splarka) // Version 0.0.3 // ************************************************** // // Usage example: // //  Only January 01 2007 00:00:00 PST until New years. // //  Javascript disabled.

function updatetimer(i) { var now = new Date; var then = timers[i].eventdate; var diff = count=Math.floor((then.getTime-now.getTime)/1000);

// catch bad date strings if(isNaN(diff)) { timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **' ; return; }

// determine plus/minus if(diff<0) { diff = -diff; } var tpm = ' '; // calcuate the diff var left = (diff%60) + ' seconds'; diff=Math.floor(diff/60); if(diff > 0) left = (diff%60) + ' minutes ' + left; diff=Math.floor(diff/60); if(diff > 0) left = (diff%24) + ' hours ' + left; diff=Math.floor(diff/24); if(diff > 0) left = diff + ' days ' + left; timers[i].firstChild.nodeValue = tpm + left;

// a setInterval is more efficient, but calling setTimeout // makes errors break the script rather than infinitely recurse timeouts[i] = setTimeout('updatetimer(' + i + ')',1000); }

$(function checktimers { //hide 'nocountdown' and show 'countdown'  var nocountdowns = getElementsByClassName(document, 'span', 'nocountdown');  for(var i in nocountdowns) nocountdowns[i].style.display = 'none';  var countdowns = getElementsByClassName(document, 'span', 'countdown');  for(var i in countdowns) countdowns[i].style.display = 'inline';

//set up global objects timers and timeouts. timers = getElementsByClassName(document, 'span', 'countdowndate'); //global timeouts = new Array; // generic holder for the timeouts, global if(timers.length === 0) return; for(var i in timers) { timers[i].eventdate = new Date(timers[i].firstChild.nodeValue); updatetimer(i); //start it up  } });

// ************************************************** // - end -  Experimental javascript countdown timer // **************************************************

//User tags window.UserTagsJS = { modules: {}, tags: { editmaster: { u:'JoJolion Head Editor', title:'This user is in charge of editting the JoJolion Articles' }, } }; UserTagsJS.modules.custom = { 'Death-dodger is you!': ['editmaster'], };

// insertusername $(function UserNameReplace {   if(typeof(disableUsernameReplace) !== 'undefined' && disableUsernameReplace || wgUserName === null) return;    $("span.insertusername").html(wgUserName); });

//Spoilers SpoilerAlert = { categories: "Spoiler", }

/****************************************/ /* sliders using jquery by User:Tierrie */ /****************************************/ mw.loader.using( ['jquery.cookie']); /****************************************/ /* sliders using jquery by User:Tierrie */ /****************************************/ //wsl.loadScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"); //wsl.loadScript("http://dragonage.wikia.com/index.php?title=MediaWiki:Jquery-ui.min.js&action=raw&ctype=text/javascript"); mw.loader.using( ['jquery.ui.tabs'], function { $( "[class^=portal_vtab]" ).tabs.addClass( "ui-tabs-vertical ui-helper-clearfix" );  $( "[class^=portal_vtab] li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );  var $tabs = $("#portal_slider").tabs({ fx: {opacity:'toggle', duration:100} } );  $("[class*=portal_sliderlink]").click(function { // bind click event to link $tabs.tabs('select', this.className.match(/portal_sliderlink-(\d+)/)[1]); console.log("Sliding to " + this.className.match(/portal_sliderlink-(\d+)/)[1]); return false; }); $('#portal_next').click(function { $tabs.tabs('select', ($tabs.tabs('option', 'selected') == ($tabs.tabs('length'))-1) ? 0 : $tabs.tabs('option', 'selected') + 1 ); // switch to next tab return false; }); $('#portal_prev').click(function { // bind click event to link $tabs.tabs('select', ($tabs.tabs('option', 'selected') == 0) ? ($tabs.tabs('length')-1) : $tabs.tabs('option', 'selected') - 1 ); // switch to previous tab return false; }); });