User:JPhil2.0/global.js

/* =========================================================================    JS for monobook and oasis applied to all wikia wikis. @author JPhil2.0 ========================================================================== */ importArticles({   type: 'script',    articles: [ 'u:dev:PortableCSSPad/code.js', 'u:dev:HeaderLinks/code.js', 'u:dev:LastEdited/code.js', 'u:dev:Wikimarks/code.js', 'u:dev:DisplayTimer/code.js', 'u:dev:InactiveUsers/code.js', 'u:dev:AjaxBatchDelete/code.2.js', 'u:dev:AjaxUndo/code.js', 'u:dev:QuickAccessToCSSAndJS/code.js', 'u:dev:ExpandGlobalNavDropdownsOnHover/code.js', 'u:dev:AjaxRedirect/code.js', 'u:kocka:MediaWiki:Emoticons.js', 'u:dev:MediaWiki:ChatHacks.js', 'u:dev:RelocateEditDiscussionButtons/code.js'

] });

/* LastEdited Customization */ window.lastEdited = { avatar: false, size: false };

/* Thread modifications */ if ((wgNamespaceNumber == 1201) && !$(".msg-title a").text) { $("ul.replies").prepend("Link to parent thread "); } if ($(".replies .SpeechBubble.message").length) $(".replies .SpeechBubble.message").each(function{ $(".timestamp", this).append("(link)"); }); /* add powerusers checkbox to Special:Listuers */ if (wgCanonicalSpecialPageName == "Listusers") $("fieldset.lu_fieldset tr:last-child").prepend('  Power Users ');

/* Adding Editcount to Masthead */ if ($("#UserProfileMasthead").size) $("#UserProfileMasthead .tally em").wrap($("").attr("href", "/wiki/Special:EditCount/"+$("#UserProfileMasthead h1[itemprop=name]").html));

/* NoImageLightbox Customization */ window.NoImageLightbox = { novideo: true };

/* Change Input Type of Edit Summary From Text To TextArea - Created by Slyst */ if ($.getUrlVar('action') == 'edit' &&  $('#wpSummary').length &&   !mw.config.get('wgEditPageWideSourceMode')   ) { var val = ''; if ($('#wpSummary').val) { val = $('#wpSummary').val; }   $('#wpSummary').replaceWith($(' ').attr({ id: 'wpSummary', name: 'wpSummary', placeholder: 'Add a summary of your edit' }).val(val)); }

/* New Footer improvements */ // move bottom bar to the top var elm = $(".wds-global-footer__bottom-bar"); $('.wds-global-footer').prepend(elm); // change Community link so that the user's preferences can determine which page they land on first $('a.wds-global-footer__link[href="http://community.wikia.com/wiki/Community_Central"]').prop('href', 'http://community.wikia.com/'); // change Support link to direct user towards current wiki's S:C page $('a.wds-global-footer__link[href="http://community.wikia.com/wiki/Special:Contact"]').prop('href', '/wiki/Special:Contact');

/* Scripts by 452, many thanks. :) */ var nocache = mw.util.getParamValue('nocache');

window.DragDropUploader = true; var loadUserScripts = new Array;

if(wgPageName == "Special:RecentChanges") { loadUserScripts.push('u:452:user:452/AjaxRC'); } else if ($("#mw-upload-form").size) { loadUserScripts.push('u:452:user:452/DragDropUploader'); } else if (typeof wgIsEditPage != "undefined"|| mw.util.getParamValue('action') == "edit" || mw.util.getParamValue('action') == "submit" || wgPageName == "Special:CreateBlogPage" ) {

} else {

loadUserScripts.push('u:452:user:452/NullEditButton'); loadUserScripts.push('u:452:user:452/View_Source'); loadUserScripts.push('u:452:user:452/AutoEditDropdown'); loadUserScripts.push('u:452:user:452/PurgeButton'); loadUserScripts.push('u:452:user:452/RevealAnonIP'); }

if (nocache) { for(var cachebuster=0;cachebuster < (Math.floor(Math.random*10)+10);cachebuster++) loadUserScripts.push(''); loadUserScripts.sort(function { return 0.5 - Math.random }); }

importArticles({ type: 'script', articles: loadUserScripts });

/* Kill image popups */ window.wgEnableImageLightboxExt = false; function changeimagelinks { $('#WikiaArticle, .LatestPhotosModule, #article-comments').unbind('click.lightbox'); var a = document.getElementsByTagName('a'); for(var t = 0; t < a.length; ++t) { var a2 = a[t]; var img = a2.getElementsByTagName('img'); if(img[0] != null && a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }	} } if(skin == 'oasis') {addOnloadHook(changeimagelinks);}

/* Chat */ function OpenChatWindow { 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');                    //global.css                    window.chatwindow.importStylesheetURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.css&action=raw&ctype=text/css');

}   }