User:Lacrymocéphale/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 can be added at User:Lacrymocéphale/common.css. |
- Report page listing warnings and errors.
/* Custom Watch List Edition Functions */
if (-1 < document.location.href.indexOf('Special:EditWatchlist')) {
//TOC
tmpElement = $('<br />').insertBefore('#toc + form > fieldset > fieldset:first');
tmpElement = $('<button onclick="selectRedirects(); return false;">Select redirections</button>').insertAfter(tmpElement);
//User
tmpElement = $('fieldset#editwatchlist-ns2 legend');
tmpElement = $('<button onclick="selectUsersWithoutContribution(); return false;">Select users without contribution</button>').insertAfter(tmpElement);
tmpElement = $('<button onclick="selectIndefinitelyBlockedUsers(); return false;">Select indefinitely blocked users</button>').insertAfter(tmpElement);
tmpElement = $('<button onclick="selectUnregisteredUsers(); return false;">Select unregistered users</button>').insertAfter(tmpElement);
//Commons
tmpElement = $('fieldset#editwatchlist-ns4 legend');
tmpElement = $('<button onclick="selectClosedDeletionRequests(); return false;">Select closed deletion requests</button>').insertAfter(tmpElement);
tmpElement = $('<button onclick="selectDeletionRequests(); return false;">Select deletion requests</button>').insertAfter(tmpElement);
//File
tmpElement = $('fieldset#editwatchlist-ns6 legend');
tmpElement = $('<button onclick="selectRedirections(); return false;">Select redirections</button>').insertAfter(tmpElement);
tmpElement = $('<button onclick="selectUnexistingFiles(); return false;">Select unexisting files</button>').insertAfter(tmpElement);
tmpElement = $('<button onclick="selectPermittedFiles(); return false;">Select files with OTRS permission</button>').insertAfter(tmpElement);
//Category
tmpElement = $('fieldset#editwatchlist-ns14 legend');
$('<button onclick="selectUnexistingCategories(); return false;">Select unexisting categories</button>').insertAfter(tmpElement);
}
function selectRedirects() {
$('fieldset label span.watchlistredir').parent('label').prev('input[type="checkbox"]').prop('checked', true);
}
function selectUsersWithoutContribution() {
$('fieldset#editwatchlist-ns2 a:contains("contribs")').each(function() {
var a = $(this);
$.get(a.attr('href'), function(data) {
if (-1 < data.indexOf('No changes were found matching these criteria.')) {
a.closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
});
});
}
function selectIndefinitelyBlockedUsers() {
$('fieldset#editwatchlist-ns2 a:contains("contribs")').each(function() {
var a = $(this);
$.get(a.attr('href'), function(data) {
if (-1 < data.indexOf('<span class="blockExpiry" title="‎infinite">indefinite</span>')) {
a.closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
});
});
}
function selectUnregisteredUsers() {
$('fieldset#editwatchlist-ns2 a:contains("contribs")').each(function() {
var a = $(this);
$.ajax({
url: a.attr('href'),
error:function (xhr, ajaxOptions, thrownError){
if (xhr.status==404) {
a.closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
}
})
});
}
function selectDeletionRequests() {
$('fieldset#editwatchlist-ns4 input[value^="Commons:Deletion requests"]').prop('checked', true);
}
function selectClosedDeletionRequests() {
$('fieldset#editwatchlist-ns4 a:contains("Commons:Deletion requests")').each(function() {
var a = $(this);
$.get(a.attr('href'), function(data) {
if (-1 < data.indexOf('deletion debate is now closed')) {
a.closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
});
});
}
function selectRedirections() {
$('fieldset#editwatchlist-ns6 label a.mw-redirect:first-child').closest('.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
function selectUnexistingFiles() {
$('fieldset#editwatchlist-ns6 label a.new:first-child').closest('.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
function selectPermittedFiles() {
console.log('selectPermittedFiles()');
$('fieldset#editwatchlist-ns6 label a:first-child').each(function() {
var a = $(this);
console.log(a, a.attr('href'));
$.get(a.attr('href'), function(data) {
if (-1 < data.indexOf('Wikimedia has received an e-mail confirming that the copyright holder has approved publication under the terms mentioned on this page.')) {
a.closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}
});
});
}
function selectUnexistingCategories() {
$('fieldset#editwatchlist-ns14 label a.new:first-child').closest('div.oo-ui-fieldLayout-body').find('input[type="checkbox"]').prop('checked', true);
}