User:Roy17/1.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.
Documentation for this user script can be added at User:Roy17/1. |
/*
copypasted codes from oldid=66698072 and oldid=354643255
hope it works
*/
/*jshint curly:false*/
/*global mw:false, $:false*/
$(function() {
'use strict';
if (mw.config.get('wgNamespaceNumber') !== 6 || mw.config.get('wgAction') !== 'edit') {
return;
}
window.killTagAndCat =
{
run : function(undef) {
var $passHref = $(mw.libs.commons.ui.addEditLink('#', 'killTagAndCat', 'lPlus', "", undef, undef, 'p-cactions')).find('a');
$passHref.click(function (e) {
e.preventDefault();
var text = document.getElementById ('wpTextbox1');
if (!text) return;
// Remove "Incomplete upload" tag
text.value = (text.value || "").replace (/\{\{[Ii]ncomplete[ _]upload\}\}\n*/g, "");
// Remove "[[Category:Incomplete JPG files (5 MB interruption)]]"
text.value = (text.value || "").replace (/\[\[[Cc]ategory\:\[Ii]ncomplete JPG files \(5 MB interruption\)\]\]\n*/g, "");
// Set edit summary
var summary = document.getElementById ('wpSummary');
if (!summary) return;
var val = summary.value || "";
summary.value = val + (val ? ' ' : "") +
"Incomplete upload overwritten";
});
var $lrNode = $('div.LR');
$lrNode.append($('<span>', { id: 'lPlus2' }).append(' [', $passHref.clone(true).removeAttr('id'), '] '));
}
};
mw.loader.using(['jquery.ui', 'ext.gadget.editDropdown'], function() {
killTagAndCat.run();
mw.loader.load( ['mediawiki.user', 'mediawiki.util'] );
});
});