User:Staw-Hat Luffy/global.js

// ============================================================ //                      Chat Hacks // ============================================================ /*Roranoa's chat hacks*/ importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:APIQuery.js&action=raw&ctype=text/javascript'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:B3.js&action=raw&ctype=text/javascript'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:WhamAPI.js&action=raw&ctype=text/javascript'); importScriptURI('http://c.wikia.com/index.php?title=User:Monchoman45/ChatHacks.js&action=raw&ctype=text/javascript'); /* Chat options */ var chatOptionsLoaded; if (chatOptionsLoaded != 1){ chatOptionsLoaded = 1; importScriptPage('MediaWiki:Chat.js/options.js','cod'); } /* Block Chat Messages */ if (mw.config.get('wgPageName') === 'Special:Chat') { $(function {        "use strict";        function createUl(blockee) {            var isBlocked = $("#WikiChatList>li[data-user='"+blockee+"']").hasClass("blockee");            if (isBlocked === false) {                $('.regular-actions').after('  Block Messages ');            } else {                $('.regular-actions').after('  Allow Messages ');            }	            $("li.ignore").click(function { ignore(blockee); });        }        function ignore(blockee) {            var blockStyle;			var blockee = blockee;            var isBlocked = $("#WikiChatList>li[data-user='"+blockee+"']").hasClass("blockee");            var isMod = $("#WikiChatList>li[data-user='"+blockee+"']").hasClass("chat-mod");            if (isMod === false) {                if (isBlocked === false) {                    $("li.ignore").addClass("blue");                    blockStyle = document.createElement("style"); blockStyle.innerHTML = ("li[data-user='"+blockee+"']:not(.User){display: none;}"); blockStyle.setAttribute("id", "blockStyle-"+blockee); document.head.appendChild(blockStyle); $("#WikiChatList>li[data-user='"+blockee+"']").addClass("blockee"); $(".UserStatsMenu li.ignore>span.label").replaceWith(" Allow Messages "); } else { $("li.ignore").removeClass("blue"); blockStyle = document.getElementById("blockStyle-"+blockee); blockStyle.parentNode.removeChild(blockStyle); $("#WikiChatList>li[data-user='"+blockee+"']").removeClass("blockee"); $(".UserStatsMenu li.ignore>span.label").replaceWith(" Block Messages "); }           } else { var lastMsg = $('.Chat>ul>li:last-child'); var lastMsgIsAlert = lastMsg.hasClass("inline-alert"); if (lastMsgIsAlert === true) { lastMsg.after("You cannot block chat moderators, administrators, or Wikia staff members."); } else { lastMsg.after("You cannot block chat moderators, administrators, or Wikia staff members."); }           }        }        function createUlCall { var blockee = $(this).attr('data-user'); setTimeout(function { createUl(blockee); }, 0); }       $("#WikiChatList").on("click", "li.User", createUlCall); var messageBlockerStyle = document.createElement("style"); messageBlockerStyle.innerHTML = ".UserStatsMenu .actions li.ignore .icon { background-image: url('http://images.wikia.com/dzy/images/8/81/Sprite-chat-ignore.png'); } .UserStatsMenu .actions li.ignore .icon { background-position: -0px 0; } .UserStatsMenu .actions li.ignore:hover .icon { background-position: -31px 0; } .UserStatsMenu .actions li.ignore.blue .icon { background-position: -67px 0; } .UserStatsMenu .actions li.ignore.blue:hover .icon { background-position: -98px 0; } #WikiChatList>li.blockee { background: #FFE6D8; !important } .ignore span.label { position: relative; bottom: 5px; left: 3px; }"; document.head.appendChild(messageBlockerStyle); }); } /* cookie init */ function CheckCookie {	if(readCookie('globalJS') == null) {		createCookie('globalJS', 'true', 99999);	}	if(skin == 'oasis') {$('#AccountNavigation').prepend(' JS ');} } addOnloadHook(CheckCookie); function ToggleGlobalJSCookie {	if(readCookie('globalJS') == 'true') {		createCookie('globalJS', 'false', 99999);		$('#GlobalJSText').html('Off');	}	else {		createCookie('globalJS', 'true', 99999);		$('#GlobalJSText').html('On');	}	window.location.reload(true); }

//When using this script, please remember to import chathacks too, and set your ping phrases to a long random string that will never be said in the chat, so that the logs won't show the red highlight. //import this using importScript('User:Joeytje50/ChatLogger.js') //To set an interval of submitting logs, put var logInterval = (amount of milliseconds); above the import. Default is 1 hour. var logInterval = (120000); importScript('User:Joeytje50/ChatLogger.js');

// ============================================================ //                      Imports // ============================================================ importArticles({	type: 'script',	articles: [		// ...		'w:c:dev:SignatureCheck/code.js',		'w:c:dev:ListFiles/code.js',		'w:c:dev:RevealAnonIP/code.js',		'w:c:dev:View_Source/code.js',		'w:c:dev:EditIntroButton/code.js',		'w:c:dev:Thread Inspection/code.js',		'w:c:dev:FastOldImageDelete/code.js',		'w:c:dev:FixWantedFiles/code.js',		'w:c:dev:CacheCheck/code.js',		'w:c:dev:WHAM/code.js',		'w:c:dev:SkinSwitchButton/code.js',		'w:c:dev:FloatingToc/code.js',		'w:c:dev:AjaxBatchDelete/code.js',		'w:c:dev:AjaxUndo/code.js',		'w:c:dev:MiniComplete/code.js',               'w:c:community:User:LiaSakura/Gadget-HotCat.js',                'w:c:admintools:MediaWiki:Wikia.js/cancelButton.js',                'w:c:admintools:MediaWiki:Wikia.js/editCount.js'		// ...	] });

/* Auto Refresh */ AjaxRCRefreshText = 'Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity","Special:Contributions","Special:NewFiles","Special:BlockList","Special:Log"]; importScriptPage('AjaxRC/code.js', 'dev');

/* Creates Back To Top Button In Footer */ importScriptPage('BackToTopButton/code.js', 'dev'); var Speed = 50;

/* InactiveUsers */ InactiveUsers = { months: 1 }; importScriptPage('InactiveUsers/code.js', 'dev');

/* AdvancedOasisUI */ window.AdvancedOasisUI = { accountNavFollowedPages: true, accountNavWatchlist: true, categoryRedlink: true, RCHeader: true, DefaultSourceMode: true, lightbox: false, randomPageLimitedTo: '', activity2RC: false, userLang: true, }; importScriptPage('AdvancedOasisUI/code.js', 'dev');

// ============================================================ //            Random Scripts Taken From Various Places // ============================================================

//Advanced Tools $.getScript('https://raw.github.com/PrincessPlatinum/Ajax-Scripts/master/Advanced%20Tools.js');

/* Make Forum Talk Button Appear */ (function($, mw) {   var title = mw.config.get('wgTitle'), numcomments = 0;    if (mw.config.get('wgPageName').substring(0, 6) === 'Forum:') {        $('#WikiaPageHeader .wikia-menu-button').after( ' Talk </a>' );       $('a.talk').attr('href', '/wiki/Forum talk:' + title);        $.getJSON('/api.php?action=query&prop=revisions&titles=Forum talk:' + title + '&rvlimit=max&format=json', function(data) { for (var pageID in data.query.pages) break; if (data.query.pages[pageID].revisions) { numcomments = data.query.pages[pageID].revisions.length; }           $('.talk .commentsbubble').text(numcomments); });   } }(jQuery, mediaWiki));

//Most Helpful Script There Is (FileLinksAutoUpdate) if (wgPageName.indexOf("Special:MovePage/File:") != -1 || (wgCanonicalNamespace == "File" && Storage)){ importScriptPage("FileUsageAuto-update/code.js/min.js", "dev"); }