User:Spydar007/global.js

function UserIconsAndColors { /* Local Bureaucrats - bureaucrat */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'bureaucrat',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("sysop") == -1) { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: purple !important; font-weight: bold !important; font-style: italic !important;');                        }); } else { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: purple !important; font-weight: bold !important;');                        }); }               }            });        }    });

/* Local Administrators - sysop */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'sysop',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("bureaucrat") > -1) { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: purple !important; font-weight: bold !important; font-style: italic !important;');                        }); } else { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: purple !important; font-weight: bold !important;');                        }); }               } else { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: darkgreen !important; font-weight: bold !important; font-style: italic !important;');                        }); } else { $('a[href$="User:' + enc + '"]').each(function {                           $(this).attr('style', 'color: darkgreen !important; font-weight: bold !important;');                        }); }               }            });        }    });

/* Local Bots - bot */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'bot',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("sysop") == -1) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function {                       $(this).attr('style', 'color: gray !important; font-weight: bold !important; font-style: italic !important;');                    }); }           });        }    });

/* VSTF - vstf */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'vstf',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).attr('style', 'color: red !important; font-weight: bold !important;'); });       }    });

/* FANDOM Staff - staff */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'staff',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).attr('style', 'color: #FF7777 !important; font-weight: bold !important;'); });       }    });

/* Global Bots - bot-global */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'bot-global',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Authenticated - authenticated */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'authenticated',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* FANDOM Helpers - helper */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'helper',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* FANDOM Utilities - util */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'util',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Community Council - council */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'council',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Vanguards - vanguard */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'vanguard',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Volunteer Developers - voldev */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'voldev',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* FANDOM Translators - translator */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'translator',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Image Reviewers - reviewer */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'reviewer',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Content Reviewers - content-reviewer */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'content-reviewer',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Content Volunteers - content-volunteer */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'content-volunteer',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Global Discussions Moderator - global-discussions-moderator */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'global-discussions-moderator',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Restricted Login - restricted-login */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'restricted-login',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* News and Stories Wordpress access - fandom-editor */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'fandom-editor',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Local Check Users - checkuser */ $.get(mw.util.wikiScript('api'), {       action: 'query',        list: 'groupmembers',        gmgroups: 'checkuser',        gmlimit: 1000,        format: 'json'    }, function(data) {        var au = data.users;        for (var i in au) {            var user = au[i].name,            enc = encodeURIComponent(user);            enc = enc.replace(/\%20/g,"_");            $('a[href$="User:' + enc + '"]').each(function { $(this).append(''); });       }    });

/* Manual implementation for system accounts */ au = ["Abuse filter", "Delete page script", "Edit page script", "Maintenance script", "MediaWiki default"]; var i;   for (i = 0; i < au.length; ++i) { enc = encodeURIComponent(au[i]); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function {           $(this).append('');            $(this).attr('style', 'font-style: italic !important;');        }); } } addOnloadHook(UserIconsAndColors);

//** 1 - Configuration **// /* AdvancedOasisUI */ window.AdvancedOasisUI = { accountNavFollowedPages: true, accountNavWatchlist: true, categoryRedlink: true, RCHeader: true, lightbox: true, activity2RC: true, };

/* AjaxRC */ window.ajaxRefresh = 30000; window.ajaxPages = ["Special:RecentChanges","Special:Watchlist","Special:Log","Special:Contributions"]; window.AjaxRCRefreshText = 'Auto Refresh'; window.AjaxRCRefreshHoverText = 'Automatically refreshes the page every 30 seconds'; window.ajaxCallAgain = window.ajaxCallAgain || []; window.ajaxCallAgain.push(UserIconsAndColors);

/* AutoEditDropdown */ window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: true };

/* FileUsageAuto-update */ LIRoptions = { bottomMessage: '', editSummary: 'Updating file links', singleButtonText: 'Rename and update', queueButtonText: 'Add to queue', delay: 100 };

/* LastEdited */ window.lastEdited = { avatar: false, size: true, diff: true, comment: true, time: 'timestamp', lang: 'en', namespaces: { include: [], exclude: [] },   pages: [] };

/* MassRename */ massRenameDelay = 1000; massRenameSummary = '';

/* QuickModTools */ QuickModTools = { quickreasons: [ "Swearing", "Spamming", "Inappropriate talk", ], }

/* UserTags */ window.UserTagsJS = { modules: {}, tags: { founder: { u:'Founder', order: 0 }, bureaucrat: { u:'Bureaucrat', link:'Project:Bureaucrats', order: 1 }, sysop: { u:'Administrator', link:'Project:Administrators', order: 2 }, rollback: { u:'Rollback', link:'Project:Rollbacks', order: 3 }, content-moderator: { u:'Content Moderator', link:'Project:Content Moderators', order: 4 }, threadmoderator: { u:'Discussions Moderator', link:'Project:Discussions Moderators', order: 5 }, chatmoderator: { u:'Chat Moderator', link:'Project:Chat Moderators', order: 6 }, bot: { u:'Bot', link:'Project:Bots', order: 7 }, checkuser: { u:'Check User', link:'Help:CheckUser', order: 8 }, 'bot-global': { u:'Global Bot', order: 9 }, staff: { u:'Wikia Staff', link:'Help:Staff', order: 10 }, vstf: { u:'VSTF', link:'Help:SpamTaskForce', order: 11 }, helper: { u:'Wikia Helper', link:'Help:Helper Group', order: 12 }, util: { u:'Wikia Utilities', order: 13 }, council: { u:'Counciler', link:'Help:Community Council', order: 14 }, voldev: { u:'Volunteer Developer', link:'http://dev.wikia.com/wiki/Volunteer_Developers', order: 15 }, vanguard: { u:'Vanguard', link:'http://community.wikia.com/wiki/Community_Central:Vanguard', order: 16 }, authenticated: { u:'Authenticated', link:'http://community.wikia.com/wiki/Help:User_access_levels#Authenticated', order: 17 }, } }; UserTagsJS.modules.mwGroups = ['bureaucrat', 'sysop', 'rollback', 'content-moderator', 'threadmoderator', 'chatmoderator', 'bot', 'bot-global', 'checkuser', 'staff', 'vstf', 'helper', 'util', 'council', 'voldev', 'vanguard', 'authenticated']; UserTagsJS.modules.inactive = 30;

UserTagsJS.modules.nonuser = true;

UserTagsJS.modules.autoconfirmed = true; UserTagsJS.modules.metafilter = { 'inactive': ['nonuser'], };

UserTagsJS.modules.isblocked = true;

//** 2 - Import **// importArticles({   type: 'script',    articles: [        'w:c:cod:User:Madnessfan34537/multikick.js',        'w:c:community:User:Joeytje50/ChatPMs.js',        'w:c:dev:MediaWiki:AdvancedOasisUI/code.js',        'w:c:dev:MediaWiki:AjaxBatchDelete/code.2.js',        'w:c:dev:MediaWiki:AjaxEmoticons/code.js',        'w:c:dev:MediaWiki:AjaxPatrol/code.js',        'w:c:dev:MediaWiki:AjaxRC/code.js',        'w:c:dev:MediaWiki:AjaxRedirect/code.js',        'w:c:dev:MediaWiki:AjaxUndo/code.js',        'w:c:dev:MediaWiki:AnchoredRollback/code.js',        'w:c:dev:MediaWiki:AutoEditDropdown/code.js',        'w:c:dev:MediaWiki:CapsFirst/code.js',        'w:c:dev:MediaWiki:CategoryRenameAuto-update/code.js',        'w:c:dev:MediaWiki:ChatBlockButton/code.2.js',        'w:c:dev:MediaWiki:ChatInterwikiLinks/code.js',        'w:c:dev:MediaWiki:ChatOptions/code.js',        'w:c:dev:MediaWiki:FindAndReplace/code.js', 'w:c:dev:MediaWiki:FileUsageAuto-update/code.js', 'w:c:dev:MediaWiki:FloatingToc/code.js', 'w:c:dev:MediaWiki:HideRail/code.js', 'w:c:dev:MediaWiki:LastEdited/code.js', 'w:c:dev:MediaWiki:MassCategorization/code.js', 'w:c:dev:MediaWiki:MassRedirect/code.2.js', 'w:c:dev:MediaWiki:MassRename/code.js', 'w:c:dev:MediaWiki:MassRenameRevert/code.js', 'w:c:dev:MediaWiki:MessageBlocker/code.js', 'w:c:dev:MediaWiki:MessageBlock/code.js', 'w:c:dev:MediaWiki:Message/code.js', 'w:c:dev:MediaWiki:PageRenameAuto-update/code.js', 'w:c:dev:MediaWiki:PurgeButton/code.js', //	'w:c:dev:MediaWiki:QuickModTools/loader.js', 'w:c:dev:MediaWiki:RecentChangesMultiple/code.js', 'w:c:dev:MediaWiki:RedirectManagement/code.js', 'w:c:dev:MediaWiki:RelocateEditDiscussionButtons/code.js', 'w:c:dev:MediaWiki:RevealAnonIP/usercode.js', 'w:c:dev:MediaWiki:Thread_Inspection/code.js', 'w:c:dev:MediaWiki:UserTags/code.js', 'w:c:dev:MediaWiki:View Source/code.js', 'w:c:dev:MediaWiki:WallGreetingButton/code.js', 'w:c:dev:MediaWiki:WHAM/code.2.js', 'w:c:dev:MediaWiki:WikiaNavBarHider/code.js', 'u:dev:MediaWiki:Wikimarks/code.js', 'w:c:spydar007:MediaWiki:AdditionalUserTools.js', ] }); importScriptURI('//en.wikipedia.org/w/index.php?title=User:Joeytje50/AWB.js/load.js&action=raw&ctype=text/javascript');

//** 3 - Other Stuff **// /* AjaxRollback */ function SetAjaxRollback { $('.mw-rollback-link').click(function(e) {		e.preventDefault;		var $rblink = $(this);		var href = this.getElementsByTagName('a')[0].href;		this.innerHTML = ' <img src="https://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Rollbacking..." />';		$.ajax({ url: href, success: function { $rblink.text(function (i, val) {return val + ' [success]';}); loadPageData; },			error: function { $rblink.text(function (i, val) {return val + ' [failed]';}); loadPageData; }		});	}); } addOnloadHook(SetAjaxRollback);

/* adding link to contribs for anons article/blog comments */ $('.details span[title]').each(function{	var t = $(this),	title = $(this).attr("title");	t.html('Unregistered user (IP: <a href="/wiki/Special:Contributions/' + title + '" target="_blank" rel="nofollow">' + title + ')</a>'); });

/* making source mode default */ $(function ($) {	"use strict";	$('.wikia-menu-button a, .editsection a').each(function { var href = this.href; if (href.indexOf('action=edit') !== -1 && href.indexOf('useeditor=source') === -1) { this.href += "&useeditor=source"; }	}); });

/* make Visual Editor links load the regular editor instead */ if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action'));

/* changing forum links from talk page to user page */ $("#Wall .SpeechBubble.message > .speech-bubble-avatar > a, #Wall .edited-by > a").each(function {	$(this).attr("href", mw.config.get("wgServer") + "/wiki/User:" + $(this) .attr("href") .substr((wgServer +"/wiki/").length + 1 +				$(this)					.attr("href")					.substr((wgServer +"/wiki/").length)					.split(":")[0]					.length		) ); });

/* small windowed chat */ chatWindowConfigs = { url: mw.config.get("wgServer") + "/wiki/Special:Chat", title: "Wiki Chat - " + mw.config.get("wgSiteName"), config: "menubar=no, location=no, resizable=yes, scrollbars=yes, status=yes, width=600, height=600" } function openRequestedPopup { windowObjectReference = window.open(chatWindowConfigs.url, chatWindowConfigs.title, chatWindowConfigs.config); } $(document).ready(function {	$('nav.WikiNav a[data-canonical="chat"], button[onclick="ChatEntryPoint.onClickChatButton(\'/wiki/Special:Chat\')"]').attr("onclick","openRequestedPopup; return false;");	$('nav.WikiNav a[data-canonical="chat"]').removeAttr("href");	mw.util.addCSS('a[data-canonical="chat"] {cursor: hand; cursor: pointer;}'); });

/* removing 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) { if (a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }		}	} } addOnloadHook(changeimagelinks);

/* changing Wiki Activity to Recent Changes */ function WikiActivity2RecentChanges { $('.wikia-button[data-id$="wikiactivity"]').replaceWith('<a data-id="recentchanges" class="wikia-button secondary" accesskey="g" title="Special:RecentChanges" href="/wiki/Special:RecentChanges"><img height="0" width="0" class="sprite activity" src="https://images1.wikia.nocookie.net/common/skins/common/blank.gif">Recent Changes</a>'); } addOnloadHook(WikiActivity2RecentChanges);

/* adding checkbox to Special:ListUsers for poweruser and fb-user */ if (wgCanonicalSpecialPageName == "Listusers") $("fieldset.lu_fieldset tr:last-child").prepend('<td valign="middle" style="padding:0px 2px 0px 1px;"><label for="checkBoxForpoweruser"> <input type="checkbox" name="lu_target" class="lu_target" value="poweruser" id="checkBoxForpoweruser"> Power Users '); if (wgCanonicalSpecialPageName == "Listusers") $("fieldset.lu_fieldset tr:last-child").prepend('<td valign="middle" style="padding:0px 2px 0px 1px;"><label for="checkBoxForfbuser"> <input type="checkbox" name="lu_target" class="lu_target" value="fb-user" id="checkBoxForfbuser"> Facebook Users ');