User:Jeserator/global.js

// AbuseLogRC abuseLogRC_entries = 1; abuseLogRC_position = 'before'; abuseLogRC_collapsible = true; abuseLogRC_userInfo = true;

// AjaxBatchDelete batchDeleteDelay = 1;

// AjaxRC window.ajaxPages = ["Special:RecentChanges","Special:Log","Special:Images",]; window.ajaxRefresh = 10000;

// FastDelete var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Unused', '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: [] };

// MultiUpload var MultiUploadoption = { max: 100, defaultlicence:'CopyrightedGame' };

// PreloadFileDescription PFD_license = 'Copyrighted Game';

// Editing scripts importArticles({   type: 'script',    articles: [        'u:dev:AbuseLogRC.js',        'u:dev:AjaxBatchDelete/code.2.js',        'u:dev:AjaxPatrol/code.js',        'u:dev:AjaxRC/code.js',        'u:kocka:MediaWiki:AjaxThreadDelete/code.js',        'u:dev:AnchoredRollback/code.js',        'u:dev:DisplayClock/code.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js',        'u:dev:FixWantedFiles/code.js',        'u:dev:LastEdited/code.js',        'u:dev:MediaWiki:MultiUpload/code.js',        'u:dev:PreloadFileDescription.js',        'u:dev:MediaWiki:RedirectManagement/code.js',        'u:dev:MediaWiki:RevealAnonIP/usercode.js',        'u:dev:TopEditors/code.js',        'u:dev:WHAM/code.2.js',    ] })

// Navigation Bar Chat Button $(function {	$('.wds-tabs__tab-label a[href="http://clubpenguin.wikia.com/wiki/Special:Forum"]').attr("href", "/wiki/Special:Chat").attr("target", "_blank").find("span").text("Chat"); });

// 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 | 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 + ') .. ' + 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(				'' + 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('! ');		});		$(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"); }); });

}

// old FastDelete /** * Ajax Fast Delete * * @author Splarka * @author Uberfuzzy * @author Grunny * * @version 2.3 */

/*global jQuery, mediaWiki */

"use strict";
 * (function (window, $, mw, undefined) {

window.dev = window.dev || {}; // Don't load twice... if (window.dev.ajaxFastDelete !== undefined) { return false; }

var conf = mw.config.get([           'wgNamespaceNumber',            'wgPageName',            'skin'        ]),

self = { version: '2.3',

init: function {

if (conf.wgNamespaceNumber === -1 || !window.fdButtons || !$('#ca-delete').length) { return; }               var deleteButtons = '';

switch (conf.skin) { case 'uncyclopedia': case 'wowwiki': case 'monobook': deleteButtons = window.fdButtons.map(function (b) {                           var sum = b.summary;                            return '' + b.label + '</a></li>';                        }).join('');

$('#p-cactions > .pBody > ul').append(deleteButtons); break;

case 'oasis': case 'wikia': var $profile = $('.UserProfileActionButton'); deleteButtons = window.fdButtons.map(function (b) {                           var sum = b.summary;                            return '' + b.label + '</a>';                        }).join(' ');

if ($profile.exists) { $profile.append(deleteButtons); } else if ($('.page-header__subtitle-blog-post').exists) { $('.page-header__subtitle-blog-post').append(deleteButtons); $('.page-header__blog-post-details').css('margin-right', '5px'); } else { $('.page-header__title').append(deleteButtons); mw.util.addCSS('a[data-id="fastdelete"]:nth-child(1){margin-left:5px}'); }

break; }

if ($('a[data-id="fastdelete"]').length) { $('a[data-id="fastdelete"]').click(function {                       self.deletePage($(this).attr('data-summary'));                    }); }               mw.hook('fastdelete.init').fire(deleteButtons); },

deletePage: function (deleteReason) { (new mw.Api) .post({                       action: 'delete',                        title: conf.wgPageName,                        reason: deleteReason,                        token: mw.user.tokens.get('editToken')                    }) .done(function (res) {                       location.reload;                    }); }       };

window.dev.ajaxFastDelete = self;

mw.loader.using(['mediawiki.util', 'mediawiki.api'], function {        $(self.init);    });

}(window, jQuery, mediaWiki));