User:LUModder/global.js

/* get all personal code files in chat */ /* Important: you must click the chat button in the rail for this to work. */   /* Very important: Chat is still a beta feature. Chat hacks may break as the feature is changed and updated, as it is a work in progress. */   $(setTimeout('ChatCheck', 200)); function ChatCheck { if($('.chat-join button').length != 0) { $('.chat-join button').replaceWith('Join the Chat'); } else { setTimeout('ChatCheck', 200); }   }    function OpenChatWindow { window.chatwindow = window.open('/index.php?title=Special:Chat&useskin=wikia'); window.chatwindow.onload = function { //addOnloadHook, importScript, and importStylesheet window.chatwindow.$('body').prepend(' \nfunction importScript(b){var a=wgScript+"?title="+encodeURIComponent(b.replace(/ /g,"_")).replace(/%2F/ig,"/").replace(/%3A/ig,":")+"&action=raw&ctype=text/javascript";return importScriptURI(a)}\nfunction importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b}\nfunction importScriptPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/javascript";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importScriptURI(a)}\nfunction importStylesheet(a){return importStylesheetURI(wgScript+"?action=raw&ctype=text/css&title="+encodeURIComponent(a.replace(/ /g,"_")))}\nfunction importStylesheetURI(b,d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=b;if(d){a.media=d}document.getElementsByTagName("head")[0].appendChild(a);return a}\nfunction importStylesheetPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/css";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importStylesheetURI(a)}\n//This isn\'t the same as the regular addOnloadHook, because the regular one runs from a script tag in the body that I don\'t feel like appending. It\'s easier to just make it $(function), which is essentially equivalent\nfunction addOnloadHook(func) {$(func);}\n ');                   //global.js                    window.chatwindow.importScriptURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.js&action=raw&ctype=text/javascript');                    //wikia.js                    window.chatwindow.importScriptURI(wgServer + '/index.php?title=User:' + wgUserName + '/wikia.js&action=raw&ctype=text/javascript');                    //global.css                    window.chatwindow.importStylesheetURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.css&action=raw&ctype=text/css');                    //wikia.css                    window.chatwindow.importStylesheetURI(wgServer + '/index.php?title=User:' + wgUserName + '/wikia.css&action=raw&ctype=text/css');                    //These are my chat hacks. If you don't want them, you can delete this line. window.chatwindow.importScriptURI('http://fate.wikia.com/index.php?title=ChatHacks.js&action=raw&ctype=text/javascript'); }   }

// ============================================================ // displayTimer - 2/1/11 // ============================================================ //Add a clock to the WikiHeader //Modified from work by Patrick Westerhoff [poke]: //http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js 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 ); } } // ============================================================ // wikiSidething // // Function: Adds a counter // ============================================================ $(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 = "";		$sidebar.html($sidebar.html + comboString);	} }); /* shrink the side rail to add content space when rail is present - 2/1/11 */ /* only works with proper css - see Forum:Why not get rid of the right sidebar altogether? */ function ShrinkRail { if( $('article#WikiaMainContent.WikiaMainContent').width < 1000 ) { $('header#WikiaPageHeader.WikiaPageHeader details').css({"width": '750px'}); $('article#WikiaMainContent.WikiaMainContent').css({"width": '760px'}); $('div#catlinks.catlinks').css({"width": '718px'}); $('div#WikiaRail.WikiaRail').css({"width": '220px'}); $('form#WikiaSearch').css({"width": '218px'}); $('form#WikiaSearch input[type="text"]').css({"width": '210px'}); $('div#WikiaRail a.wikia-button.upphotos').replaceWith('  '); $('div#WikiaRail a.wikia-button.createpage').replaceWith('  '); $('div#WikiaRail a.wikia-button[href="/wiki/Special:CreateBlogPage"]').replaceWith(''); } } addOnloadHook(ShrinkRail); /* add a button that increases the content size and hides the rail - 2/1/11 */ function CreateContentResizeButton { var headerWidth = $('header#WikiaPageHeader.WikiaPageHeader details').width; var contentWidth = $('article#WikiaMainContent.WikiaMainContent').width; var catlinksWidth = $('div#catlinks.catlinks').width; if(contentWidth < 1000) { $('section article header ul.wikia-menu-button').after(' Expand <--> </ul>'); $('section article header a.wikia-button').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"> Expand <--> </a></ul>'); $('section article header a.view-source').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"> Expand <--> </a></ul>'); if(wgCanonicalNamespace == 'User_blog') { $('section article div#WikiaUserPagesHeader a.wikia-button').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"> Expand <--> </a></ul>'); }	} } addOnloadHook(CreateContentResizeButton); function ExpandContent(headerWidth, contentWidth, catlinksWidth) { $('header#WikiaPageHeader.WikiaPageHeader details').css({"width": '980px'}); $('article#WikiaMainContent.WikiaMainContent').css({"width": '1000px'}); $('div#catlinks.catlinks').css({"width": '1000px'}); $('div#WikiaRail.WikiaRail').css({"display": 'none'}); $('ul#resizeButton').replaceWith('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"> Compress >--< </a></ul>'); } function CompressContent(headerWidth, contentWidth, catlinksWidth) { $('header#WikiaPageHeader.WikiaPageHeader details').css({"width": headerWidth}); $('article#WikiaMainContent.WikiaMainContent').css({"width": contentWidth}); $('div#catlinks.catlinks').css({"width": catlinksWidth}); $('div#WikiaRail.WikiaRail').css({"display": 'block'}); $('ul#resizeButton').replaceWith('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"> Expand <--> </a></ul>'); } if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png", "speedTip": "Add sig on Wiki", "tagOpen": "", "tagClose": "", "sampleText": ""} } /////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADVANCED AJAX AUTO-REFRESHING ARTICLES // Code courtesy of "pcj" of WoWWiki. // Bug fixes and maintenance by Grunny /////////////////////////////////////////////////////////////////////////////////////////////////////////// var indicator = 'http://i25.servimg.com/u/f25/16/05/86/66/poptar10.gif'; if (!window.ajaxPages) ajaxPages = new Array("Special:WikiActivity"); var ajaxTimer; var ajaxRefresh = 60000; var refreshText = 'Automatically refresh'; if( typeof AjaxRCRefreshText == "string" ) { refreshText = AjaxRCRefreshText; } var refreshHover = 'Enable auto-refreshing page loads'; if( typeof AjaxRCRefreshHoverText == "string" ) { refreshHover = AjaxRCRefreshHoverText; } var doRefresh = true; function setCookie(c_name,value,expiredays) { var exdate=new Date exdate.setDate(exdate.getDate+expiredays) document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString) } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" } function preloadAJAXRL { ajaxRLCookie = (getCookie("ajaxload-"+wgPageName)=="on") ? true:false; appTo = ($("#WikiaPageHeader").length)?$("#WikiaPageHeader"):$(".firstHeading"); appTo.append(' <span style="border-bottom: 1px dotted; cursor: help;" id="ajaxToggleText" title="' + refreshHover + '">' + refreshText + ': <input type="checkbox" style="margin-bottom: 0;" id="ajaxToggle"> <img src="' + indicator + '" style="vertical-align: baseline;" border="0" alt="AJAX operation in progress" /> '); $("#ajaxLoadProgress").bind("ajaxSend", function { $(this).show; }).bind("ajaxComplete", function { $(this).hide; }); $("#ajaxToggle").click(toggleAjaxReload); $("#ajaxToggle").attr("checked", ajaxRLCookie); if (getCookie("ajaxload-"+wgPageName)=="on") loadPageData; } function toggleAjaxReload { if ($("#ajaxToggle").attr("checked") == true) { setCookie("ajaxload-"+wgPageName, "on", 30); doRefresh = true; loadPageData; } else { setCookie("ajaxload-"+wgPageName, "off", 30); doRefresh = false; clearTimeout(ajaxTimer); } } function loadPageData { var cC = ($("#WikiaArticle").length)?"#WikiaArticle":"#bodyContent"; $(cC).load(location.href + " " + cC + " > *", function (data) { if (doRefresh) ajaxTimer = setTimeout("loadPageData;", ajaxRefresh); }); } $(function { for (x in ajaxPages) { if (wgPageName == ajaxPages[x] && $("#ajaxToggle").length==0) preloadAJAXRL; } }); /////////////////////////////////////////////////////////////////////////////////////////////////////////// // END OF AJAX AUTO-REFRESH /////////////////////////////////////////////////////////////////////////////////////////////////////////// importScriptURI("http://vda.wikia.com/index.php?action=raw&ctype=text/javascript&title=MediaWiki%3AVDA2.js&cache=" + Math.random); window.addEventListener("load", function {    var eb = document.getElementById("wpTextbox1");    if (eb) {        eb.select;    } }, false); window.addEventListener("load", function {    var me = document.getElementById("wpMinoredit");    if (me) {        me.setAttribute("checked", "checked");    }    var eb = document.getElementById("wpTextbox1");    eb.value = eb.value.replace(/<\/?noinclude>/, ""); }, false);

// ***************************************************************** // Add Tab For X Skin function addTabForXSkin ( id, href , title , text ) { if ( document.getElementById( id ) ) { return; } 	switch ( skin ) { case 'answers': $( '<div id="qa_toolbox_advancedtools"> ' ).appendTo( '#qa_toolbox_advancedtools_wrapper' ); $( ' <img src="http://images1.wikia.nocookie.net/common/skins/common/blank.gif" class="sprite" />' + text + '</a> ' ).appendTo( '#qa_toolbox_advancedtools' ); break; case 'awesome': case 'monaco_old': case 'monaco': $( '<li id="' + id + '" class=""><img src="http://images1.wikia.nocookie.net/common/skins/common/blank.gif" class="sprite" />' + text + '</a></li>' ).appendTo( '#page_controls' ); break; case 'uncyclopedia': case 'wowwiki': case 'lostbook': case 'monobook': $( '<li id="' + id + '">' + text + '</a></li>' ).appendTo( '#p-cactions > .pBody > ul' ); break; case 'oasis': case 'wikia': if ( $( 'a[data-id="' + id + '"]' ).length == 0 ) { return; } 			atfxs = '' + text + '</a>'; switch ( wgNamespaceNumber ) { case 1: case 5: case 7: case 9: case 11: case 13: case 14: case 15: case 111: case 401: $( 'header.WikiaPageHeader > h2').before( atfxs ); break; case 2: case 3: $( 'div.WikiaUserPagesHeader > ul.wikia-avatar' ).after( atfxs ); break; case 500: case 502: $( 'div.WikiaUserPagesHeader > h1' ).after( atfxs ); break; default: $( 'header.WikiaPageHeader > details' ).before( atfxs ); break; } 			break; } }; /* if ( wgNamespaceNumber == -1 ) { importScriptPage ( 'User:Cizagna/contribtools.js', 'community' ); importScriptPage ( 'User:Cizagna/filelisttools.js', 'community' ); } else { importScriptPage ( 'User:Cizagna/mwcustomeditbtns.js', 'community' ); importScriptPage ( 'User:Cizagna/forumtools.js', 'community' ); importScriptPage ( 'User:Cizagna/ajaxpatrollinks.js', 'community' ); importScriptPage ( 'FastDelete/code.js', 'dev' ); // ***************************************************************** 	// Adds custom automatic one-click delete tabs to any deletable page. var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label' : 'S'}; if ( skin != 'answers' || wgAction != 'view' ) { importScriptPage( 'EditIntroButton2/code.js', 'dev' ); } 	// ***************************************************************** 	// Subpages tab if ( wgNamespaceNumber!= -1 ) { addOnloadHook ( function { 			addTabForXSkin ( 'ca-subpages','/wiki/Special:Prefixindex/' + encodeURIComponent ( wgPageName ), 'Show subages of ' + wgPageName , 'SubP' ); 		} ); } }*/ // ***************************************************************** // Alternating skin tabs function skinview { var skinlink = document.location.href; var antiskin; if ( skinlink.indexOf( '?' ) == -1 ) { skinlink += '?useskin='; } else { skinlink += '&useskin='; } 	switch ( skin ) { case 'awesome': case 'monaco_old': case 'monaco': case 'oasis': case 'wikia': antiskin = 'monobook'; break; case 'uncyclopedia': case 'wowwiki': case 'lostbook': case 'monobook': antiskin = 'wikia'; break; case 'answers': return; } 	addTabForXSkin ( 'ca-skin', skinlink + antiskin , 'View ' + antiskin + ' skin' , 'CS' ); } $( skinview );