User:Geagea/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:Geagea/common.css. |
- Report page listing warnings and errors.
mw.loader.using( 'mediawiki.util' ).done(function(){
(function( mw, $ ) {
window.mrg_queue = []; // In-progress queue
window.mrg_count = 0; // Total count
window.mrg_done = 0; // Already moved count
window.mrg_movetoken = null; // Populated later
function fetch_cat_members( name, cont, callback ) {
var params ={
action: 'query',
rawcontinue: '',
list: 'categorymembers',
cmtitle: 'Category:' + name,
cmnamespace: 6,
cmlimit: 'max'
};
if ( cont !== undefined ) {
params.cmcontinue = cont;
}
( new mw.Api() ).get(params).done( function( data ) {
if ( data['query-continue'] ) {
fetch_cat_members(
name,
data['query-continue'].categorymembers.cmcontinue,
callback
);
}
callback( data.query.categorymembers );
});
}
function refresh_progressbar() {
var selector = $('#mrg-progress');
selector.progressbar('option', 'max', window.mrg_count);
selector.progressbar('option', 'value', window.mrg_done);
}
function rename_file( old, newname, reason, callback ) {
( new mw.Api() ).post({
action: 'move',
from: old,
to: newname,
reason: reason,
movetalk: 1,
bot: 1,
token: window.mrg_movetoken
}, {
async: false // Don't run parallel requests, be nice to sever kittens!
}).done( callback );
}
function queue() {
fetch_cat_members( $('#mrg-cat').val(), undefined, function( members ) {
var old_length = window.mrg_queue.length;
$.each( members, function( _, val ) {
window.mrg_queue.push(val.title);
});
window.mrg_count += members.length;
if ( old_length === 0 ) {
run();
}
refresh_progressbar();
});
}
function escapeRegExp(str) {
// From MDN
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function run() {
while ( window.mrg_queue.length > 0 ) {
var old_name = window.mrg_queue.shift(),
new_name, find = $('#mrg-find').val(), replace = $('#mrg-rep').val(),
reason = $('#mrg-son').val();
new_name = old_name.replace(new RegExp(escapeRegExp(find), 'g'), replace);
rename_file( old_name, new_name, reason, function( data ) {
window.mrg_done += 1;
refresh_progressbar();
});
}
}
function init() {
var html = [
'<div id="mrg-dialog">',
'<form>',
'<label for="mrg-cat">Category name (without namespace):</label>',
'<input type="text" name="mrg-cat" id="mrg-cat"',
'<label for="mrg-find">Find:</label>',
'<input type="text" name="mrg-find" id="mrg-find"',
'<label for="mrg-rep">Replace:</label>',
'<input type="text" name="mrg-rep" id="mrg-rep"',
'<label for="mrg-son">Reason:</label>',
'<input type="text" name="mrg-son" id="mrg-son"',
'</form>',
'<div id="mrg-progress"></div>',
'</div>'
].join("\n");
$('#mw-content-text').after($(html)); // Stick it somewhere in the DOM
mw.util.addCSS('label, input { display: block; }');
mw.loader.using(['jquery.ui'], function() {
$('#mrg-dialog').dialog({
buttons: [
{
text: 'Move',
click: queue
}
],
title: 'Mass Rename Gadget'
});
$('#mrg-progress').progressbar({max: 1});
});
( new mw.Api() ).getToken( 'move').done( function( token ) {
window.mrg_movetoken = token;
});
}
function small_init() {
mw.loader.using('mediawiki.util', function(){
var portletlink = mw.util.addPortletLink( 'p-cactions', '#', 'Mass Rename', 'ca-mrg', 'Rename stuff');
$( portletlink).click( function( e ) {
e.preventDefault();
init();
});
});
}
$( small_init() );
}( mediaWiki, jQuery ));
//<nowiki>
//catALot///////////////////////////////////////
////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = {"watchlist":"preferences","minor":false,"editpages":true,"docleanup":false,"subcatcount":5};
////////////////////////////////////catALotEnd//
//</nowiki>
importScript('User:Sreejithk2000/JustReplace.js');
importScript('User:Rillke/SVGedit.js');
importScript('User:Steinsplitter/tagPersonalityRight.js');
importScript('User:Geagea/tagFoPIsrael.js');
importScript('User:Geagea/adminwatch.js');
importScript('User:Rillke/LicenseReview.js');
importScript('User:Magog the Ogre/cleanup.js');
window.AjaxDeleteExtraButtons = [
{
'label': 'Logo',
'tag': '{'+'{subst:logo}}',
'img_summary': 'This is a non-simple logo, which is not allowed on Commons',
'talk_tag': '{'+'{subst:copyvionote|%FILE%}}',
'talk_summary': 'Non-simple logos. such as %FILE%, are not allowed on Commons',
}, {
'label': 'Wrong License',
'tag': '{'+'{wrong license}}',
'img_summary': 'License seems to be wrong',
'talk_tag': '{'+'{subst:Wrong license note|1=%FILE%}}',
'talk_summary': 'License seems to be wrong for %FILE%',
}, {
'label': 'Watermark',
'tag': '{'+'{watermark}}',
'img_summary': 'There is a watermark and/or a timestamp on the image',
}, {
'label': 'Watermark Removed',
'tag': '{'+'{Attribution metadata from licensed image}}',
'img_summary': 'There was a watermark and/or a timestamp on the image',
}, {
'label': 'Duplicate',
'tag': '{'+'{duplicate|1=%PARAMETER%|user=%USER%}}',
'img_summary': 'Tagging as duplicate of [[%PARAMETER%]]',
'prompt_text': 'Which is file is this a duplicate of?'
}
];
importScript('User:Rillke/bigChunkedUpload.js');
});
//<nowiki>
//vFCvFCCfg/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFCSettings = {"userNote":"Yours sincerely,","firstTest":0,"testEdits":0,"defaultAction":"c_replace","watchlistUserTalk":"watch","watchlistFiles":"watch","watchlistReplace":"nochange","watchlistOTRS":"watch","loadBatchSize":1000,"maxSimultaneousReq":10,"summaryChacheLen":5,"loadThumbs":true,"loadWikitext":true};
//////////////////////////////////vFCvFCCfgEnd//
//</nowiki>
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Writ_Keeper/Scripts/massRevdel.js&action=raw&ctype=text/javascript');
importScript('User:Magnus Manske/sdc tool.js');
importScript('Magnus Manske/sdc tool.js');
importScript('User:Jheald/wdcat.js');
importScript('User:Magnus Manske/sdc tool.js');