User:DoorkBot/global.js

//—————————————————————————————— ! ! ! ———————————————————————————————// /* Import scripts. NOTE: Place scripts configurations above this line */ /* These must import/load or the world will end */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:ColoredColors/code.js', 'u:dev:MediaWiki:ViewRemoved/code.js', 'u:dev:MediaWiki:Sine/code.js', 'u:dev:MediaWiki:AdvancedOasisUI/code.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:Wikimarks/code.js' ]   }); });				/* Important imports/scripts */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:View_Source/code.js', 'u:dev:MediaWiki:WallGreetingButton/code.js', 'u:dev:MediaWiki:PurgeButton/code.js' ]   }); });	/* Semi-important imports/scripts */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js', 'u:dev:MediaWiki:NullEditButton/code.js', 'u:dev:MediaWiki:SignatureCheck/code.js', 'u:dev:MediaWiki:QQX/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:DupImageList/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:AutoEditDropdown/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:DisplayClock/code.js' ]   }); });	/* Do I even use these? */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:Nuke/code.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:ExternalImageLoader/code.js', 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:ListFiles/code.js', 'u:dev:MediaWiki:FixWantedFiles/code.js', 'u:dev:MediaWiki:MultipleFileDelete/code.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:MessageBlock/code.js', 'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:MarkForDeletion/code.js', 'u:dev:MediaWiki:PageRenameAuto-update/code.js', 'u:dev:MediaWiki:QuickComments/code.js', 'u:dev:MediaWiki:UnsafeScripts/code.js', 'u:dev:MediaWiki:QuickDelete/code.js', 'u:dev:MediaWiki:QuickThreads/code.js', 'u:dev:MediaWiki:AntiUnicruft/code.js' ]   }); }); /* Chat imports */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:kocka:MediaWiki:Emoticons/code.js', 'u:runescape:User:Joeytje50/tabinsert.js', 'u:shining-armor:MediaWiki:ChatTags/code.js', 'u:dev:MediaWiki:ChatAnnouncements/code.js', 'u:dev:MediaWiki:ChatOptions/code.js', 'u:dev:MediaWiki:ChatTimestamps/code.js', 'u:dev:MediaWiki:PrivateMessageAlert/code.js', 'u:dev:MediaWiki:QuickModTools/loader.js', 'u:dev:MediaWiki:MessageBlocker/code.js', 'u:dev:MediaWiki:!ban/code.js' ]   }); });	/* Ajax and Mass imports/scripts */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:AjaxPatrol/code.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:AjaxRename/code.js', 'u:dev:MediaWiki:AjaxBatchUndelete/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:AjaxPatrol/code.js', 'u:dev:MediaWiki:AjaxBatchDelete/code.js', 'u:dev:MediaWiki:AjaxThreadUnfollow/code.js', 'u:dev:MediaWiki:MassRedirect/code.1.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:MassNullEdit/code.js', 'u:dev:MediaWiki:MassBlock/code.js', 'u:dev:MediaWiki:MassProtect/code.js', 'u:dev:MediaWiki:MassUserRights/code.js', 'u:dev:MediaWiki:MassRenameRevert/code.js' ]   }); });

/* Update site staff avatars */ window.avatars = {}; function getURL(user) { $.get("/wiki/Special:Contributions/" + user + "?useskin=oasis", function(data) {       window.avatars[user] = //ig.exec(data)[1] + '';    }); } if ( wgPageName == "Peridot_Wikia:Site_Staff" || wgPageName == "Stevidot_Wikia:Site_Staff" || wgPageName == "Navid_Wikia:Site_Staff" ) { $(window).load(function {       $('.wikinav2 .WikiaPageHeader').css('padding-right', '0');        $('#WikiaPageHeader .comments').after( 'Update avatars ' );       $('#update-avatars').click(function { var usrs = []; var matches; var PC; var pageNewContent; $('.staff-usr-template').each(function {               usrs.push($(this).text.trim);            }); var API = new mw.Api; API.get({               action: 'query',                prop: 'revisions',                rvprop: 'content',                titles: wgPageName            }).done(function(data) {                for (var i in data.query.pages) {                    PC = data.query.pages[i].revisions[0]['*'];                    page = data.query.pages[Object.keys(data.query.pages)[0]];        		}                matches = PC.match(/\|(\s+|)link(\s+|)=(\s+|).+/gi);                pageNewContent = PC;                for (var i in matches) {                    matches[i] = matches[i].split('=')[1].trim;                }                for (var i in usrs) {                    if (usrs[i] !== '') {                        getURL(usrs[i]);                    }                }                setTimeout(function { for (var i in usrs) { if (usrs[i] !== '') { usrs[i] = window.avatars[usrs[i]]; usrs[i] = usrs[i].replace('static', 'images1') + '/scale-to-width-down/' + matches[i].split('/scale-to-width-down/')[1]; }                   }                    for (var i in usrs) { if (usrs[i] !== '') { pageNewContent = pageNewContent.replace(matches[i], usrs[i]); }                   }                    if ( PC != pageNewContent ) { var config = { 'minor': 'yes', 'bot': 'yes', 'summary': 'Updating user avatars. (automatic)', 'action': 'edit', 'title': wgPageName, 'token': mw.user.tokens.get('editToken'), 'text': pageNewContent };                       $.ajax({                            url: mw.util.wikiScript('api'),                            data: config,                            dataType: 'json',                            type: 'POST',                            success: function(d) {                                if (!d.error) {                                    new BannerNotification('Avatars successfully updated!', 'confirm').show;                                } else {                                    new BannerNotification('Failed while updating avatars: ' + d.error.code, 'error').show;                                }                            }                        }); } else { new BannerNotification('No avatars to update.', 'error').show; }               }, 7000);            });        });    }); }