User:Robyn Grayson/global.js

window.ajaxRefresh = 1000; window.ajaxPages = [ "Special:WikiActivity", "Special:RecentChanges", "Special:Log", "Special:Log/upload", "Special:Images", "Special:Video" ]; window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: true }; window.linkSweepConfirmation = true; window.LinkSweeperDelay = 1000; //milliseconds window.CategoryList = []; window.CategoryList = ["myfavcat", "spam"]; linkSweepConfirmation = true; LinkSweeperDelay = 1000;

window.cacheSkip = []; window.cacheSkipLimit = 1000; window.topLevelCat = ''; massRedirectDelay = 200; massCategorizationDelay = 200; massProtectDelay = 200; batchDeleteDelay = 500;

window.fdButtons = []; window.fdButtons.push(   {        summary: 'Housekeeping',        label: 'HK'    },    {        summary: 'Vandalism',        label: 'V'    },    {        summary: 'Spam',        label: 'S'    },    {        summary: 'Author\'s Request',        label: 'AR'    },    {        summary: 'Unused',        label: 'U'    },    {        summary: 'Duplicate',        label: 'D'    },    {        summary: 'Leak',        label: 'L'    },    {        summary: 'Inappropriate',        label: 'Lewd'    },    {        summary: 'Redirect',        label: 'R'    } );

window.AjaxBlock = { expiryTimes: { '2 hours': '2 hours', '1 day': 'A day', '1 week': 'A week', '2 months': '2 Months', 'infinite': 'Forever' },   blockReasons: { 'w:Help:Vandalism': 'Vandalism', 'w:Help:Spam': 'Spam', 'Under the legal age.': 'COPPA', 'Removing information/blanking articles.': 'Blanking', 'Failing to comply with the rules.': 'Rule break', },   check: { creation: true, talk: false, autoBlock: true, override: true } };

var MessageBlock = { title : 'Block', message : 'You have been blocked for $2 because you have failed to comply with one of our rules.', autocheck : true };

PRAoptions = { editSummary: 'Updating page links.' };

var i18n = { en: { addSummary: "Adding $1", addFail: "Failed to add $1 to $2", removeSummary: "Removing $1", replaceSummary: "Replacing $1 with $2", multiReplaceSummary: "Replacing categories: $1", noCategoryReplace: "No category to replace", automatic: " " },   };

PurgeButtonText = 'Purge';

window.pageCreatorAvatar = true; window.pageCreatorTimestamp = true; window.pageCreatorNamespaces = Object.keys(mw.config.get("wgFormattedNamespaces")).map(Number);

window.lastEdited = { namespaces: { include: Object.keys(mw.config.get("wgFormattedNamespaces")).map(Number) },   diffModal: false, };

YouTubePlayerSettings = { favorites: [{ name: 'Unhappy Refrain', id: 'fApfapRp-0Y' },       {            name: 'Online Game Addicts Sprechor', id: 'Yq0zBXN1o2A' },       {            name: 'Celldweller - The Lucky One', id: 'dMwK7RSVi7g' },       {            name: 'Celldweller - The Lucky One (Instrumental)', id: 'gv5okq8ZIfI' },       {            name: 'Electric Angel', id: 'cFYA7iYRrdI' },       {            name: 'Puppet Clown Pierrot', id: 'DDjcqu9uvUE' },       {            name: 'The Celestial Fox', id: 'GsxyXY4tuU0' },       {            name: 'Rolling Girl (Instrumental)', id: 'HRMumWO9eb0' }   ],    defaultVideo: 'gv5okq8ZIfI', defaultTheme: 'default', helpButton: 'hide', alwaysAutoplay: 'always', alwaysLoop: 'always', };

window.preloadEditCount = true;

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:TokenRefresh.js',        'u:dev:MediaWiki:FixWantedFiles/code.js',        'u:dev:DraggableYouTubePlayer/code.js',        'u:dev:MediaWiki:AjaxBatchUndelete.js',        'u:dev:EditConflictAlert/code.js',        'u:clockwork-planet:User:Robyn Grayson/wikia.js',        'u:community:User:Robyn Grayson/wikia.js',        'u:dev:DisambiguationManagement/code.js',        'u:dev:ListFiles/code.js',        'u:dev:MediaWiki:MassCategorization/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',        'u:gmods-hideout:User:Robyn Grayson/wikia.js',        'u:dev:QuickComments/advanced.js',        'u:admintools:MediaWiki:Common.js/Maintenance.js',        'u:admintools:MediaWiki:Common.js/extraRollbacks.js',        'u:noreply:MediaWiki:HideWikiaLogs.js',        // 'u:josephhawk:User:Josephyr/categorycleanup.js',         // 'u:josephhawk:User:Josephyr/filecleanup.js', // 'u:josephhawk:User:Josephyr/tc.js', 'u:dev:MediaWiki:DifferentSkinEditor/code.js', 'u:kocka:MediaWiki:UncategorizedFileListing/code.js', 'u:k6ka-test:User:K6ka/scripts/Gadget-HotCat.js', 'u:dev:PortableCSSPad/code.js', 'u:noreply:MediaWiki:FileUsage.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:PageCreator/code2.js', 'u:dev:PurgeButton/code.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', 'u:dev:AjaxThreadUnfollow/code.js', 'u:dev:UserAccountAge/code2.js', 'u:dev:GlobalEditcount/code.js', 'u:dev:RecentChangesMultiple/code.2.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:View_Source/code.js', 'u:dev:PageRenameAuto-update/code.js', 'u:kocka:MediaWiki:AjaxThreadDelete/code.js', 'u:dev:CategoryRenameAuto-update/code.js', 'u:dev:MassRenameRevert/code.js', 'u:dev:MassProtect/code.js', 'u:dev:QuickThreads/code.js', 'u:dev:QuickDelete/code.js', 'u:dev:MediaWiki:CatNav/code.js', 'u:dev:MediaWiki:BotoneraPopups/BotoneraPopups.js', 'u:dev:MediaWiki:BotoneraPopups/WikiArticle.js', 'u:dev:MediaWiki:BotoneraPopups/UILang/en.js', 'u:dev:MediaWiki:BotoneraPopups/code.js', 'u:dev:ListPages/code.js', 'u:dev:AjaxPatrol/code.js', 'u:dev:MediaWiki:AjaxRename/code.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:AjaxBatchDelete/code.2.js', 'u:dev:AjaxBlock/code.js', 'u:dev:MarkBlocked.js', 'u:dev:MessageBlock/code.js', 'u:monchbox:MediaWiki:Torus.js', 'u:starmanw:MultiUpload/code.js', 'u:starmanw:QuickLogs/code.js', 'u:dev:WHAM/code.2.js', 'u:kocka:MediaWiki:AjaxCommentDelete/code.js', 'u:dev:GlobalChatJS.js', 'u:dev:QuickDiff/code.js', 'u:dev:QuickToolsv2/code.js', 'u:dev:MediaWiki:HoverEditCount/code.js', 'u:dev:MediaWiki:AjaxBatchDelete/code.js', 'u:dev:AjaxDelete/code.js', 'u:dev:AjaxRC/code.js', 'u:dev:AutoEditDropdown/code.js', 'u:dev:AutoEditPages/code.js', 'u:dev:CacheCheck/code.js', 'u:dev:DupImageList/code.js', 'u:dev:FastOldImageDelete/code.js', 'u:dev:Linksweeper/code.js', 'u:dev:MarkForDeletion/code.js', 'u:dev:MassRedirect/code.1.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:View Raw/code.js', 'u:gmods-hideout:User:Robyn Grayson/common.js', 'u:clockwork-planet:User:Robyn Grayson/PortableJSPad.javascript', ] });

importStylesheetPage('BotoneraPopups/code.css', 'dev');

var main = { init: function { //check if user has rollback permission already var userGroups = ["rollback","content-moderator","sysop","vstf","helper","staff"], ownGroups = mw.config.get('wgUserGroups'), hasPermissionAlready = false; for (var i in ownGroups) { if (userGroups.indexOf(ownGroups[i]) !== -1) { hasPermissionAlready = true; break; }		}		if (hasPermissionAlready) return; if (mw.config.get('wgAction') == "history" && $('#pagehistory li').length > 1) $('#pagehistory li:first .mw-history-undo a').before(' rollback | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [rollback] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length == 0) $('.mw-usertoollinks:last').after('   [rollback] '); $('.mw-custom-rollback-link a').click(function {			main.getRevisionIdAndContent($(this).attr('data-id'));		}); },	getRevisionIdAndContent: function(title) { var API = new mw.Api; API.get({		action: 'query',		prop: 'revisions',		titles: title,		rvprop: 'user|ids',		rvlimit: 500,		cb: new Date.getTime		}) .done(function(d) {			if (!d.error) {				var revisions;				for (var i in d.query.pages) {					revisions = d.query.pages[i].revisions;				}				var currentUser = revisions[0].user, //current user rollbacking from				lastUser,				revId;				for (var i in revisions) {					if (revisions[i].user != currentUser) {						lastUser = revisions[i].user; //remember last author						revId = revisions[i].revid; //get revision to revert to						break;					}				}				if (lastUser) {					API.get({ action: 'query', prop: 'revisions', rvprop: 'content', revids: revId, cb: new Date.getTime })					.done(function(d) { if (!d.error) { var content = ""; //can be no content on page so initialise empty as failsafe for (var i in d.query.pages) { if (d.query.pages[i].revisions) content = d.query.pages[i].revisions[0]["*"]; }							main.performRollback(title,content,currentUser,lastUser); }						else new BannerNotification('Unable to rollback (failed to get page content): ' + d.error.code,'error').show; })					.fail(function { new BannerNotification('Unable to rollback: failed to get page content!','error').show; });				}				else					new BannerNotification('Unable to rollback: no different editor found!','error').show;			}			else				new BannerNotification('Unable to rollback (failed to get revisions): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to get revisions!','error').show;		}); },	performRollback: function(page,text,user,user2) { var API = new mw.Api; API.post({		action: 'edit',		title: page,		text: text,		summary: 'Undo revision by ' + user + '',		token: mw.user.tokens.values.editToken		}) .done(function(d) {			if (!d.error) {				new BannerNotification('Rollback successful!','confirm').show;							}			else				new BannerNotification('Unable to rollback (failed to publish edit): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to publish edit!','error').show;		}); } }; main.init; }) (this.jQuery, this.mediaWiki);
 * (function($, mw) {

/* View Removed */ $(".message-removed.hide").removeClass("hide").each(function {   var $this = $(this),    id = $this.attr('data-id'),    relativeid = $this.attr('id'),    isBoardThread = !!$('.voting-controls').length,    Api = new mw.Api;    Api.get({ action: 'query', prop: 'revisions', rvprop: 'timestamp|user', pageids: id, rvlimit: 500 }).done(function(ts) { var rev = ts.query.pages[id].revisions[0], name = rev.user, time = rev.timestamp, d = new Date(time), // this may be a readable string, but the code certainly isn't :P readableTime = d.getHours + d.getTimezoneOffset / 60 + ':' + d.getMinutes + ', ' + wgMonthNames[d.getMonth + 1] + ' ' + d.getDate + ', ' + d.getFullYear; $.get('/api/v1/User/Details', {           ids: name,            size: 50        }).done(function(avi) {            avi = avi.items[0].avatar;            Api.get({ action: 'parse', pageid: id           }).done(function(d) { var html = d.parse.text['*'], $avatar = $(' ', {                   class: 'speech-bubble-avatar'                }).append($('', { href: wgArticlePath.replace('$1', 'Message_Wall:' + name), append: $(' ', {                       src: avi,                        width: '30',                        height: '30',                        class: 'avatar',                        alt: name                    }) })),               $msg = $(' ', {                    class: 'speech-bubble-message'                }).append($(' ', { class: 'MiniEditorWrapper', 'data-min-height': '100', 'data-max-height': '400', append: [ $(' ', {                           class: 'edited-by',                            append: [                                $('', { text: name, href: wgArticlePath.replace('$1', 'Message_Wall:' + name) }),                               $('', { class: 'subtle', href: wgArticlePath.replace('$1', 'Message_Wall:' + name) })                           ]                        }),                        $(' ', {                            class: 'editarea',                            'data-space-type': 'editarea',                            append: [                                $(' ', { class: 'msg-body', id: 'WallMessage_' + id, html: html }),                               $(' ', {                                    class: 'loading-indicator', 'data-space-type': 'loading-status', append: [ $(' ', {                                           class: 'loading-background'                                        }), $(' ', {                                           class: 'loading-message',                                            append: [                                                $(' ', { class: 'loading-throbber', html: ' ' }),                                               $(' ', {                                                    class: 'loading-text', html: 'Loading editor' })                                           ]                                        })                                    ]                                })                            ]                        }),                        $(' ', {                            class: 'toolbar',                            'data-space-type': 'toolbar'                        }), $(' ', {                           class: 'msg-toolbar',                            append: [                                $(' ', { class: 'timestamp', append: $('', {                                       class: 'permalink',                                        tabindex: '-1',                                        href: '#' + relativeid,                                        append: [                                            $(' ', { class: 'timeago abstimeago', title: time, alt: readableTime, each: function { $(this).timeago; }                                           }),                                            $(' ', {                                                class: 'timeago-fmt', text: readableTime })                                       ]                                    })                                })/*, not adding buttons  coz it's way too hard (also idk why you'd want to quote a removed message)                                $(' ', { class: 'buttonswrapper', append: the_buttons :P })*/                           ]                        })                    ]                }));                $this.append($avatar, $msg); });       });    }); });

importScriptPage('JWB/code.js', 'dev'); $('', {id: 'JWB'}) .html('JWB') .prependTo('#my-tools-menu');

/* FetchLatestRevision mw.loader.using('mediawiki.api').then(function {   var Api = new mw.Api;    var latestRevision = function  {        $.when( Api.get({               action: 'query',                 list: 'recentchanges',                 rcprop: 'ids|title|loginfo',                 rclimit: '1'            }), Api.get({               action: 'query',                 list: 'recentchanges',                 rcprop: 'ids|title',                rctype: 'edit|new',                rclimit: '1'            }) ).then(function(logs, edit) { logs = logs[0].query.recentchanges[0]; edit = edit[0].query.recentchanges[0]; if (logs.type == 'log' && ['upload', 'move'].indexOf(logs.logtype) + 1) { Api.get({                   action: 'query',                    prop: 'revisions',                    rvprop: 'ids',                    titles: logs.title                }).then(function(d) {                    var edit = d.query.pages[Object.keys(d.query.pages)[0]].revisions[0];                    $('.latestrev').html(' Revision: ' + edit.revid+ ' ');                }); return; }           $('.latestrev').html(' Revision: ' + edit.revid+ '</a> '); $('#latestrevwrap a').attr('href', '/?diff=' + edit.revid); });   };    $(function  { $('.page-header__contribution').prepend('  '); latestRevision; });   setInterval(latestRevision, 1000); });
 * @author A-Salt-Rifle
 * Fetches latest revision of wiki, and fetches diff link

// Less than 10 lines baby! Scree || Scratch that it's EXACTLY 10 lines now. Yay! if (-1 < [0, 1, 2, 3, 4, 6, 8, 10, 14, 500, 502, 828].indexOf(mw.config.get('wgNamespaceNumber'))) { $('body').keydown(function(e) {   var keyCode = e.keyCode;    if (e.metaKey && !e.shiftKey && keyCode === 82)  {        var url = new mw.Uri;        url.query.action = 'raw';        window.location.href=url.toString;    } }); }

if (-1 < [0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 500, 502, 828].indexOf(mw.config.get('wgNamespaceNumber'))) { $('body').keydown(function(e) {   if (e.keyCode === 81 && e.keyCode === 87)  {        window.open('/wiki/Special:WhatLinksHere/' + wgPageName, '_self');    } }); } /* CSS var background = [ '#06030c url(https://images.wikia.com/robyns-little-land/images/0/0b/WikiBackground.png) 50% -30px/cover no-repeat fixed', 'url("https://images.wikia.com/robyns-little-land/images/5/5c/WikiBackground2.jpg") 0 0 / cover no-repeat fixed rgb(6, 3, 12)' ]; var final = background[Math.floor(Math.random * background.length)]; $('body.skin-oasis').css({  'background' : final });