User:BryghtShadow/common.js

/* */ /* ######################################################################## */ /* ### JavaScript here is loaded for all users and all skins. ### */ /* ######################################################################## */

// From http://dragonage.wikia.com/wiki/MediaWiki:Common.js // Wikia's own WikiaScriptLoader isn't automatically included in other skins such as monobook. // Presumably this is because they no longer support them. This checks to see if WikiaScriptLoader // function reference has been declared, and if it has not, it creates it. Backwards compatibility // for everybody! - Blame User:Tierrie @ DA Wiki if this works. Blame someone else if it breaks. if(typeof WikiaScriptLoader === 'undefined') { var WikiaScriptLoader=WikiaScriptLoader?WikiaScriptLoader:function{var b=navigator.userAgent.toLowerCase;this.useDOMInjection=b.indexOf("opera")!=-1||b.indexOf("firefox")!=-1&&b.indexOf("/4.0b")==-1;this.isIE=b.indexOf("opera")==-1&&b.indexOf("msie")!=-1;this.headNode=document.getElementsByTagName("HEAD")[0]}; WikiaScriptLoader.prototype={loadScript:function(b,c){this.useDOMInjection?this.loadScriptDOMInjection(b,c):this.loadScriptDocumentWrite(b,c)},loadScriptDOMInjection:function(b,c){var a=document.createElement("script");a.type="text/javascript";a.src=b;var d=function{a.onloadDone=true;typeof c=="function"&&c};a.onloadDone=false;a.onload=d;a.onreadystatechange=function{a.readyState=="loaded"&&!a.onloadDone&&d};this.headNode.appendChild(a)},loadScriptDocumentWrite:function(b,c){document.write('<\/script>');var a=function{typeof c=="function"&&c};typeof c=="function"&&this.addHandler(window,"load",a)},loadScriptAjax:function(b,c){var a=this,d=this.getXHRObject;d.onreadystatechange=function{if(d.readyState==4){var e=d.responseText;if(a.isIE)eval(e);else{var f=document.createElement("script");f.type="text/javascript";f.text=e;a.headNode.appendChild(f)}typeof c=="function"&&c}};d.open("GET",b,true);d.send("")},loadCSS:function(b,c){var a=document.createElement("link"); a.rel="stylesheet";a.type="text/css";a.media=c||"";a.href=b;this.headNode.appendChild(a)},addHandler:function(b,c,a){if(window.addEventListener)window.addEventListener(c,a,false);else window.attachEvent&&window.attachEvent("on"+c,a)},getXHRObject:function{var b=false;try{b=new XMLHttpRequest}catch(c){for(var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"],d=a.length,e=0;e<d;e++){try{b=new ActiveXObject(a[e])}catch(f){continue}break}}return b}};window.wsl=new WikiaScriptLoader; }

importScriptPage('AjaxRC/code.js', 'dev');

importScriptPage('CollapsibleEdittools/code.js', 'dev');

importScriptPage('AjaxBatchDelete/code.js', 'dev');

/* Auto updating recent changes opt-in * See w:c:dev:AjaxRC for info & attribution */ AjaxRCRefreshText = 'Auto-Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev');

/** * Open chat in a new popup window */ $(".openchat a").click(function {  window.open('/wiki/Special:Chat', 'wikiachat', 'width=600,height=600,menubar=no,status=no,location=no,toolbar=no,scrollbars=no,resizable=yes');   return false; });

$(function {	if(skin == "oasis") {		var $sidebar = $('.WikiaPagesOnWikiModule:first');		var comboString = " ";		$sidebar.html($sidebar.html + comboString);	} else if(skin == "monobook") {		var $sidebar = $('#p-wikicities-nav');		var comboString = " Chat  ";		$sidebar.html($sidebar.html + comboString);	} })

/***********************************************************/ /* Sliders using jquery by User:Tierrie in Dragon Age Wiki */ /***********************************************************/ //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");

$(document).ready(function { 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.replace("portal_sliderlink_", "")); 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; }); });

// ============================================================ // displayTimer // ============================================================ //Add a clock to the WikiHeader //Using Monchoman45's code from: //http://community.wikia.com/wiki/User_blog:Monchoman45/Improving_your_interface_with_CSS/JS#Add_a_clock_to_the_header

hookEvent( 'load', displayTimer ); function displayTimer {   if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; if (skin == 'oasis') {   var timerParent = document.getElementById( 'WikiHeader' ).getElementsByTagName( 'div' )[0]; }   if (skin == 'monobook') {   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                 = 'displayTimer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight   = 'bold'; timerObj.style.fontSize     = '100%'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); if (skin == 'oasis') {       $('#displayTimer').css({'position': "inherit", 'right': "0px", 'top': "-28px"}); }   var month = new Array(12); month[0] = "Jan"; month[1] = "Feb"; month[2] = "Mar"; month[3] = "Apr"; month[4] = "May"; month[5] = "Jun"; month[6] = "Jul"; month[7] = "Aug"; month[8] = "Sep"; month[9] = "Oct"; month[10] = "Nov"; month[11] = "Dec"; function actualizeUTC {       timerDate           = new Date; timerLink.innerHTML = ( timerDate.getUTCDate    < 10 ? '0' : '' ) + timerDate.getUTCDate     + ' ' + ( timerDate.getUTCMonth   < 10 ?  :   ) + month[timerDate.getUTCMonth] + ' ' + ( timerDate.getUTCFullYear < 10 ? '0' : '' ) + timerDate.getUTCFullYear + ' ' + ( 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.getDate    < 10 ? '0' : '' ) + timerDate.getDate     + ' ' + ( timerDate.getMonth   < 10 ?  :   ) + month[timerDate.getMonth] + ' ' + ( timerDate.getFullYear < 10 ? '0' : '' ) + timerDate.getFullYear + ' ' + ( 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 ); } }

/** Username replace function (Template:USERNAME) ******************************* * Inserts user name into * Originally by User:Splarka * New version by User:Spang * Fixed with JS provided by User:Grunny, thanks! */ function UserNameReplace { if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return; $('.insertusername').html(wgUserName); } addOnloadHook(UserNameReplace);

/* Custom edit buttons for source mode */ if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/leagueoflegends/images/4/4d/Support_Button.png", "speedTip": "Support", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/leagueoflegends/images/9/9f/Oppose_Button.png", "speedTip": "Oppose", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/leagueoflegends/images/7/7e/Neutral_Button.png", "speedTip": "Neutral", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/leagueoflegends/images/6/6c/Vote_keep_Button.png", "speedTip": "Vote to keep", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/leagueoflegends/images/a/ab/Vote_delete_Button.png", "speedTip": "Vote to delete", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/leagueoflegends/images/0/07/Comment_Button.png", "speedTip": "Comment", "tagOpen": " ", "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/leagueoflegends/images/2/22/Question_Button.png", "speedTip": "Question", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/leagueoflegends/images/b/b3/Done_Button.png", "speedTip": "Done", "tagOpen": "✅ ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/leagueoflegends/images/c/cb/Not_done_Button.png", "speedTip": "Not done", "tagOpen": "❌ ", "tagClose": "", "sampleText": ""}; }

//HERE IS THE IRC REPLACER. Adds Embedded IRC to RS:IRC made by Green Reaper & ShadowTale $(function {	var nick = (wgUserName == null) ? ('LOL-Visitor-' + Math.floor(Math.random * 10)) : wgUserName.replace(/ /g, '_'); 	$('#IRCReplace').html(' '); }); //END IRC CODE

/* Summary filler * From RuneScape Wiki */

importScriptPage('MediaWiki:Common.js/standardeditsummaries.js', 'runescape');