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 = 1000; massCategorizationDelay = 200; batchDeleteDelay = 1000;

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'    } );

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 };

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',        'u:dev:AjaxBlock/code.js',        'u:dev:MarkBlocked.js',        'u:dev:MessageBlock/code.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js',        'u:dev:MediaWiki:View_Source/code.js',        'u:monchbox:MediaWiki:Torus.js',        'u:starmanw:MultiUpload/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:QuickComments/advanced.js',        'u:dev:MediaWiki:ViewRemoved/code.js',        'u:dev:MediaWiki:HoverEditCount/code.js',        'u:dev:User:Dorumin/wikia.js',        'u:dev:MediaWiki:AjaxBatchDelete/code.js',        'u:admintools:MediaWiki:Common.js/extraRollbacks.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:CategoryRenameAuto-update/code.js', 'u:dev:DupImageList/code.js', 'u:dev:FastDelete/code.js', 'u:dev:FastOldImageDelete/code.js', 'u:dev:Linksweeper/code.js', 'u:dev:ListFiles/code.js', 'u:dev:MarkForDeletion/code.js', 'u:dev:MassRedirect/code.1.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:ChatEditTools/code.js', 'u:dev:MediaWiki:CustomChatPings/code.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:kocka:MediaWiki:AjaxThreadDelete/code.js', ] });

massRenameDelay = 1000; massRenameSummary = 'Renaming.'; importScriptPage('User:Robyn_Grayson/ScriptBox', 'steven-universe');

$('.toolbar .tools').children('.mytools').after('  My Pages'); $('.custom-menu, .custom-tools-menu').hover(function {   $('.custom-tools-menu').css('display', 'block'); }, function {    setTimeout(function { if(!$('.custom-tools-menu').is(':hover') && !$('.custom-menu').is(':hover')) { $('.custom-tools-menu').css('display', 'none'); }   }, 1000); });

//Userpage $('').html('User Page') .prependTo('#my-pages-menu') .click(function {   $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Robyn Grayson', summary: 'Creating userpage', text: '', format: 'json', token: mw.user.tokens.get( 'editToken' ) }   } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }   } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } ); });

//ListFile $('').html('ListFile') .prependTo('#my-pages-menu') .click(function {   $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Robyn Grayson/ListFiles', summary: 'Creating subpage.', text: '', format: 'json', token: mw.user.tokens.get( 'editToken' ) }   } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }   } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } ); });

//DPL $('').html('DPL') .prependTo('#my-pages-menu') .click(function {   $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Robyn Grayson/DPL', summary: 'Creating DPL', text: ' \ \n\n\ File List \ \n\n\ \n\ \ \n\n\ Duplicate Images \ \n\n\ \ \n\n\ Uncategorised Images \n\ \n\ \n\ \ \n\n\ File List \n\ \n\ \n\ \n\ ',       format: 'json', token: mw.user.tokens.get( 'editToken' ) }   } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }   } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } ); });

//Form $(function {   $('').html('<a href="#">Form</a>')        .prependTo('#my-pages-menu')        .click(function { $.showCustomModal('Wikia Name', ' Please specify the Wikia name. <input id="wikiname" type="text" size="40"> ', {               id: 'wnModal',                buttons: [{                    id: 'createForm',                    defaultButton: true,                    message: 'Create',                    handler: function {                        var pagename = $('#wikiname').val;                        new mw.Api.post({ action: 'edit', title: pagename + ' Form', summary: 'Creating Form', text: '{| style="width:100%; border-radius: 5px; margin-bottom: 5px;"\n\
 * <div class="roundtop" style="background: transparent; border:2px solid white; padding:18px; font-family:comic sans ms; border-radius:10px; color:white;"> <font size="10" color="white">Form

Please note that how long it\'ll take may vary depending on how much work there is. \n\ \n\ Help \n\ \n\ | = Yes              O = No               Default = | \n\ Leave it blank if you don\'t want any specific set of changes.\n\ \n\ \n\ \n\ \n\ format: 'json', createonly: true, token: mw.user.tokens.get('editToken') }).done(function(data) { if (data.edit.result === 'Success') { new BannerNotification("Successfully created page!", "confirm").show; } else { new BannerNotification("An error occurred.", "error").show; }                       }).fail(function(data) { new BannerNotification("An error occurred.", "error").show; });                   }                }, {                    id: 'wnCancel',                    defaultButton: true,                    message: 'Cancel',                    handler: function {                        $('#wnModal').closeModal;                    }                }]            }); }); });
 * }',

//New Page $(function {   $('').html('<a href="#">New Page</a>')        .prependTo('#my-pages-menu')        .click(function { $.showCustomModal('New Page', ' Please specify the Page name. <input id="pagename" type="text" size="50">

Page\'s Text <textarea id="pagecontent" rows="10" cols="53">\

Summary: <input id="summary" type="text" size="50"> ', { id: 'npModal', buttons: [{ id: 'createPage', defaultButton: true, message: 'Create', handler: function { var pagename = $('#pagename').val; var pagecontent = $('#pagecontent').val; var summary = $('#summary').val; new mw.Api.post({                           action: 'edit',                            title: pagename,                            summary: summary,                            text: pagecontent,                            format: 'json',                            createonly: true,                            token: mw.user.tokens.get('editToken')                        }).done(function(data) {                            if (data.edit.result === 'Success') {                                new BannerNotification("Successfully created page!", "confirm").show;                            } else {                                new BannerNotification("An error occurred.", "error").show;                            }                        }).fail(function(data) {                            new BannerNotification("An error occurred.", "error").show;                        }); }               }, {                    id: 'pnCancel', defaultButton: true, message: 'Cancel', handler: function { $('#pnModal').closeModal; }               }]            });        }); });

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(' <a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a> | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + $(this).find('a:first').attr('title') + '">rollback</a>] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length == 0) $('.mw-usertoollinks:last').after('   [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a>] '); $('.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) {

importScriptPage('PageRenameUpdate', 'gmods-hideout');