User:CPW Community Admin/global.js

// Chat scripts importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Madnessfan34537/multikick.js', 'cod'); importScriptPage('User:Joeytje50/ChatPMs.js', 'c'); importScriptPage('QuickModTools/code.js', 'dev'); // AjaxBatchDelete batchDeleteDelay = 01; // Standard Edit Summary window.dev = window.dev || {}; window.dev.editSummaries = { select: [ '(click to browse)', 'Maintenance', [ 'Fixing double redirect', 'Licensing', ]   ] }; // AjaxRC window.ajaxPages = ["Special:NewPages","Special:Log","Special:NewFiles","Special:RecentChanges","Special:UnusedFiles","Special:WhatLinksHere","Special:DoubleRedirects"]; window.ajaxRefresh = 10000; // FastDelete var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Unused file', 'label': 'Unused' }; // FileUsageAuto-update LIRoptions = { editSummary: 'Updating file link (automatic)', singleButtonText: 'Rename and replace', queueButtonText: 'Rename and add to queue' } // LastEdited window.lastEdited = { avatar: false, size: false, diff: true, comment: false, time: 'timeago', lang: 'en', namespaces: { include: [], exclude: [] },   pages: [] }; //ChatBlockButton chatBlockReason = "Chat disruption"; chatBlockExpiry = "3 days"; // Editing scripts importArticles({   type: 'script',    articles: [        'u:dev:AjaxPatrol/code.js',        'u:dev:AjaxBatchDelete/code.2.js',        'u:dev:FastDelete/code.js',        'u:dev:TopEditors/code.js',        'u:dev:Standard_Edit_Summary/code.js',        'u:dev:DisplayClock/code.js',        'u:dev:FileUsageAuto-update/code.js',        'u:dev:Message/code.js',        'u:dev:AjaxUndo/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:AnchoredRollback/code.js',        'u:dev:WHAM/code.2.js',        'u:dev:LastEdited/code.js',        'u:dev:ChatBlockButton/code.2.js',    ] }) // VERecentChanges // Written by Penguin-Pal if (mw.config.get("wgCanonicalSpecialPageName") == "WikiActivity") { $(".activity-nav > ul").prepend('VisualEditor RC'); } if (mw.config.get("wgTitle") == "VERecentChanges" && mw.config.get("wgNamespaceNumber") == -1) { $("head title").html("Recent VisualEditor Activity - Club Penguin Wiki - The free, editable encyclopedia about Club Penguin"); $("#mw-content-text").html(' '); $("#rcvisualeditor").html(	'\n' +		'\thide patrolled &bull;' +		'\tRequest size:  &bull;' +		'\tSince days ago:  &bull;' +		'\t\n' +		'\t \n' +		'\t\n' +	' ' ); mw.util.addCSS(	'#rcvisualeditor-feed li {\n' +		'\tlist-style: none;\n' +	'}' +	'#rcvisualeditor-feed > li > ul {\n' +		'\tdisplay: none;\n' +	'}' +	'#rcvisualeditor-feed > li.rcvisualeditor-shown > ul {\n' +		'\tdisplay: block;\n' +	'}' +	'#rcvisualeditor-feed .rcvisualeditor-chevron{' +		'\tdisplay: inline-block;\n' +		'\rmargin-right: 6px;\n' +		'\tborder-width: 5px 0 5px 9px;\n' +		'\tborder-color: transparent transparent transparent #333;\n' +		'\tborder-style: solid;\n' +		'\tcursor: hand;\n' +		'\tcursor: pointer;\n' +	'}' +	'#rcvisualeditor-feed > li.rcvisualeditor-shown .rcvisualeditor-chevron {\n' +		'\rmargin-right: 5px;\n' +		'\tborder-width: 9px 5px 0 5px;\n' +		'\tborder-color: #333 transparent transparent transparent;\n' +	'}' ); $("#rcve-go").click(function {	function enc(s) {		return s.replace(/ /g, "_").replace(/[^\/]/g, function(m) { return encodeURIComponent(m); });	}	function encHTML(s) {		var a = {			"&": "amp",			"<": "lt",			">": "gt"		};		return s.replace(/&<>/g, function(m) { return "&" + a[m] + ";"; });	}	$(this).attr("disabled", "disabled");	$.getJSON("/api.php?action=query&format=json&list=recentchanges&rcprop=timestamp|title|ids|flags|tags|patrolled|ids|user|timestamp|sizes&rctag=visualeditor&rctype=edit&rclimit=" + $("#rcve-limit").val + "&rcend=" + (new Date(new Date.getTime - $("#rcve-since").val * 86400000).toJSON.split(".")[0].replace(/\D/g,"")) + ($("#rcve-hidepatrolled:checked").length == 1 ? "&rcshow=!patrolled" : "") + "&cb=" + new Date.getTime, function(data) { $("#rcve-go").removeAttr("disabled"); console.log(data); window.a = data; var list = {}, markup = $(' '); function parseItems(parent) { var output = ""; for (var i in parent) { output += (					'' +						(typeof parent[i].patrolled !== "string" ? '! ' : '') +						parent[i].time +						' (diff | <a href="/wiki/' + enc(parent[i].title) + '?action=history">hist</a>) .. <span class="mw-plusminus-' + (parent[i].len > 0 ? "pos" : parent[i].len < 0 ? "neg" : "null") + '" title="' + parent[i].newlen.toLocaleString + ' bytes after change">(' + (parent[i].len > 0 ? "+" : "") + parent[i].len.toLocaleString + ') .. <a href="/wiki/User:' + enc(parent[i].user) + '">' + encHTML(parent[i].user) + '</a>' +					'</li>'				); }			return "" + output + "</ul>"; }		for (var i in data.query.recentchanges) { var a = data.query.recentchanges[i]; if (typeof list[a.title] === "undefined") { list[a.title] = []; }			list[a.title].push({				title: a.title,				user: a.user,				curid: a.pageid,				oldid: a.old_revid,				revid: a.revid,				patrolled: a.patrolled,				rcid: a.rcid,				len: a.newlen - a.oldlen,				newlen: a.newlen,				time: a.timestamp.match(/\d{4}\-\d{2}\-\d{2}/)[0] + ", " + a.timestamp.match(/\d{2}\:\d{2}/)[0]			}); }		console.log(list); for (var i in list) { markup.append(				'<a href="/wiki/' + enc(i) + '">' + encHTML(i) + '</a>: ' + list[i].length + ' change' + (list[i].length == 1 ? "" : "s") + ':\n' + parseItems(list[i]) + '</li>'			); }		$(markup).children(":has(.unpatrolled)").each(function {			$(this).prepend('<abbr class="unpatrolled" title="This edit has not yet been patrolled">! ');		});		$(markup).children.each(function {			$(this).prepend(' ');		}); $("#rcvisualeditor-feed").html($(markup).html); $("#rcvisualeditor-feed .rcvisualeditor-chevron").click(function {			$(this).parent.toggleClass("rcvisualeditor-shown");		}); }).error(function { $("#rcve-go").removeAttr("disabled"); alert("Some error has occured"); }); }); }