User:Synoman Barris/Danny Edit filter helper.js
Jump to navigation
Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
- Konqueror: simply click the Reload button, or press F5;
- Opera users may need to completely clear their cache in Tools→Preferences.
Warning: Malicious code can compromise your account. Page preview will cause your web browser to execute this page's content as code under some skins, including Monobook. If you have any questions about any code you plan to add, you can ask at the appropriate reading room. |
![]() |
Documentation for this script can be added at User:Synoman Barris/Danny Edit filter helper. |
//<nowiki>
//Largely based on [[User:Enterprisey/AFCFFU.js]]
//Copied from [[User:Abelmoschus Esculentus/EFFPRH.js]
var EFFPRH_config = {
name: '[[w:User:DannyS712/EFFPRH|EFFPRH]]',
version: 1.2,
debug: false
};
var effp_ending = ' (' + EFFPRH_config.name + ' v.' + EFFPRH_config.version + ')';
var effp_effpPageName = wgPageName.replace(/_/g, ' ');
var effp_effpSubmissions = new Array();
var effp_effpSections = new Array();
var effp_numTotal = 0;
var effp_AJAXnumber = 0;
var effp_Submissions = new Array();
function effp_editPage(title, newtext, summary, createonly, nopatrol) {
var edittoken = mw.user.tokens.get('csrfToken');
summary += effp_ending;
$("#effp_finished_wrapper").html('<span id="effp_AJAX_finished_' + effp_AJAXnumber + '" style="display:none">' + $("#effp_finished_wrapper").html() + '</span>');
var func_id = effp_AJAXnumber;
effp_AJAXnumber++;
$('#effp_status').html($('#effp_status').html() + '<li id="effp_edit' + jqEsc(title) + '">Editing <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></li>');
var request = {
'action': 'edit',
'title': title,
'text': newtext,
'summary': summary,
'token': edittoken
};
if (createonly) request.createonly = true;
var api = new mw.Api();
api.post(request)
.done(function ( data ) {
if ( data && data.edit && data.edit.result && data.edit.result == 'Success' ) {
$('#effp_edit' + jqEsc(title)).html('Saved <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a>');
} else {
$('#effp_edit' + jqEsc(title)).html('<span class="effp_notice"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></span>. Error info: ' + JSON.stringify(data));
window.console && console.error('Edit failed on %s (%s). Error info: %s', wgArticlePath.replace("$1", encodeURI(title)), title, JSON.stringify(data));
}
} )
.fail( function ( error ) {
if (createonly && error == "articleexists")
$('#effp_edit' + jqEsc(title)).html('<span class="effp_notice"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></span>. Error info: The article already exists!');
else
$('#effp_edit' + jqEsc(title)).html('<span class="effp_notice"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></span>. Error info: ' + error);
})
.always( function () {
$("#effp_AJAX_finished_" + func_id).css("display", '');
});
if (!nopatrol) {
if ($('.patrollink').length) {
var patrolhref = $('.patrollink a').attr('href');
var rcid = mw.util.getParamValue('rcid', patrolhref);
if (rcid) {
$('#effp_status').html($('#effp_status').html() + '<li id="effp_patrol' + jqEsc(title) + '">Marking <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + ' as patrolled</a></li>');
var patrolrequest = {
'action': 'patrol',
'format': 'json',
'token': mw.user.tokens.get('patrolToken'),
'rcid': rcid
};
api.post(patrolrequest)
.done(function ( data ) {
if ( data ) {
$('#effp_patrol' + jqEsc(title)).html('Marked <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a> as patrolled');
} else {
$('#effp_patrol' + jqEsc(title)).html('<span class="effp_notice"><b>Patrolling failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></span> with an unknown error');
window.console && console.error('Patrolling failed on %s (%s) with an unknown error.', wgArticlePath.replace("$1", encodeURI(title)), title);
}
} )
.fail( function ( error ) {
$('#effp_patrol' + jqEsc(title)).html('<span class="effp_notice"><b>Patrolling failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></span>. Error info: ' + error);
});
}
}
}
}
function effp_escapeHtmlChars(original) {
return original.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}
function jqEsc(expression) {
return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~ ]/g, '');
}
function effp_generateSelect(title, options, onchange) {
var text = '<select name="' + title + '" id="' + title + '" ';
if (onchange !== null) text += 'onchange = "' + onchange + '" ';
text += '>';
for (var i = 0; i < options.length; i++) {
var o = options[i];
text += '<option value="' + effp_escapeHtmlChars(o.value) + '" ';
if (o.selected) text += 'selected="selected" ';
if (o.disabled) text += 'disabled ';
text += '>' + o.label + '</option>';
}
text += "</select>";
return text;
}
function effp_getPageText(title, show, redirectcheck, timestamp) {
if (show) $('#effp_status').html($('#effp_status').html() + '<li id="effp_get' + jqEsc(title) + '">Getting <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></li>');
var request = {
'action': 'query',
'prop': 'revisions',
'rvprop': 'content',
'format': 'json',
'indexpageids': true,
'titles' : title
};
if (redirectcheck) request.redirects = true;
if (timestamp) request.rvprop = 'content|timestamp';
var response = JSON.parse(
$.ajax({
url: mw.util.wikiScript('api'),
data: request,
async: false
})
.responseText
);
pageid = response['query']['pageids'][0];
if (pageid === "-1") {
if (show) $('#effp_get' +jqEsc(title)).html('The page <a class="new" href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a> does not exist');
return '';
}
var newtext = response['query']['pages'][pageid]['revisions'][0]['*'];
if (redirectcheck && response['query']['redirects'] /* If &redirects if specified but there is no redirect, this stops us from getting an error */){
var oldusername = response['query']['redirects'][0]['from'];
var newusername = response['query']['redirects'][0]['to'];
if ((typeof(oldusername) !== 'undefined') && (typeof(newusername) !== 'undefined') && (oldusername != newusername)){
usertalkpage = newusername;
if (show) {
$('#effp_status').html($('#effp_status').html() + '<li id="effp_get' + jqEsc(title) + '">Got <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + newusername + '">' + newusername + '</a> (page was renamed from ' + oldusername + ')</li>');
}
} else {
redirectcheck = false;
}
} else {
redirectcheck = false;
}
if (show && !redirectcheck) $('#effp_status').html($('#effp_status').html() + '<li id="effp_get' + jqEsc(title) + '">Got <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></li>');
if (!timestamp) return newtext;
else return {'pagetext':newtext,'timestamp':response['query']['pages'][pageid]['revisions'][0]['timestamp']};
}
function effp_init() {
var pagetext = effp_getPageText(effp_effpPageName, false);
var section_re = /==[^=]*==/;
pagetext = pagetext.substring(pagetext.search(section_re));
section_re = /==[^=]*==/g;
var section_headers = pagetext.match(section_re);
for (var i = 0; i < section_headers.length; i++) {
var section_start = pagetext.indexOf(section_headers[i]);
var section_text = pagetext.substring(section_start);
if (i < section_headers.length - 1) {
var section_end = section_text.substring(section_headers[i].length).indexOf(section_headers[i + 1]) + section_headers[i].length;
section_text = section_text.substring(0, section_end);
}
effp_effpSections.push(section_text);
}
for (var i = 0; i < effp_effpSections.length; i++) {
var header = effp_effpSections[i].match(section_re)[0];
header = header.slice(2, (header.length - 2));
var submission = {
type: 'effp',
from: new Array(),
section: i,
blockeduser: '',
admin: '',
cmt: '',
filteruser: '',
user: '',
title: header,
action: 'none',
blockuser : false,
expiry : '',
blockreason: '',
blockacc: false,
blockemail: false,
blocktalk: false,
blockauto: false,
anononly: false,
watch: false,
comment: ''
};
effp_effpSubmissions.push(submission);
effp_numTotal++;
}
for (var k = 0; k < effp_effpSubmissions.length; k++) {
var text = '<ul>';
text += '<li>Response: ';
selectoptions = [
{ label: 'None', selected: true, value: 'none' },
{ label: 'Done (no change to filter)', value: 'done' },
{ label: 'Done (may need a change to filter)', value: 'defm' },
{ label: 'Not Done (filter working properly)', value: 'notdone' },
{ label: 'Not Done (may need a change to filter)', value: 'ndefm' },
{ label: 'Already Done', value: 'alreadydone' },
{ label: 'Decline (edits are vandalism)', value: 'denied' },
{ label: 'Checking', value: 'checking' },
{ label: 'User blocked', value: 'blocked' },
{ label: 'Request on article talk page', value: 'talk' },
{ label: 'Fixed filter', value: 'fixed' },
{ label: 'Question', value: 'question' },
{ label: 'Note', value: 'note' },
{ label: 'Private filter', value: 'private' }
];
text += '<br/><label for="effp_effp_action' + '">Action: </label>' + effp_generateSelect('effp_effp_action_'+k, selectoptions, 'effp_effp_onActionChange(' + k + ')') + '<div id="effp_effp_extra_' + k + '"></div></li>';
text += '</ul></li>';
text += '</ul>';
text += '<input type="button" id="effp_effp_done_button" name="effp_effp_done_button" value="Done" onclick="effp_effp_performActions(' + k + ')" />';
displayMessage_inline(text, 'effp-review-' + effp_effpSubmissions[k].section);
}
}
function effp_effp_performActions(sectionNumber) {
for (var i = 0; i < effp_effpSubmissions.length; i++) {
var action = $("#effp_effp_action_" + i).val();
effp_effpSubmissions[i].action = action;
if (action == 'none') continue;
if (action == 'blocked') {
effp_effpSubmissions[i].blockeduser = $.trim($("#effp_effp_blockeduser_" + i).val());
effp_effpSubmissions[i].admin = $.trim($("#effp_effp_admin_" + i).val());
effp_effpSubmissions[i].cmt = $.trim($("#effp_effp_cmt_" + i).val());
if (document.getElementById('effp_effp_blockuser_'+i).checked) {
effp_effpSubmissions[i].blockuser = true;
if ($('#effp_effp_blockreason_'+i).val() == 'custom') {
effp_effpSubmissions[i].blockreason = $.trim($('#effp_effp_customblockreason_'+i).val());
}
else effp_effpSubmissions[i].blockreason = $.trim($('#effp_effp_blockreason_'+i).val());
effp_effpSubmissions[i].expiry = $.trim($('#effp_effp_blockexpiry_'+i).val());
effp_effpSubmissions[i].blockacc = document.getElementById('effp_effp_blockacc_'+i).checked;
effp_effpSubmissions[i].blockemail = document.getElementById('effp_effp_blockemail_'+i).checked;
effp_effpSubmissions[i].blocktalk = document.getElementById('effp_effp_blocktalk_'+i).checked;
effp_effpSubmissions[i].anononly = document.getElementById('effp_effp_anononly_'+i).checked;
effp_effpSubmissions[i].watch = document.getElementById('effp_effp_watch_'+i).checked;
}
}
if (action == 'fixed') {
effp_effpSubmissions[i].filteruser = $.trim($("#effp_effp_filteruser_" + i).val());
effp_effpSubmissions[i].cmt = $.trim($("#effp_effp_cmt_" + i).val());
}
if (action == 'alreadydone') {
effp_effpSubmissions[i].user = $.trim($("#effp_effp_user_" + i).val());
effp_effpSubmissions[i].cmt = $.trim($("#effp_effp_cmt_" + i).val());
}
if (action == 'talk') {
effp_effpSubmissions[i].talk = $.trim($("#effp_effp_talk_" + i).val());
effp_effpSubmissions[i].cmt = $.trim($("#effp_effp_cmt_" + i).val());
}
if (action != 'none' && action != 'blocked' && action != 'fixed' && action != 'alreadydone') {
effp_effpSubmissions[i].cmt = $.trim($("#effp_effp_cmt_" + i).val());
}
}
displayMessage_inline('<ul><li><b>Now processing...</li></ul><ul id="effp_status"></ul><ul id="effp_finish"></ul>', 'effp-review-' + sectionNumber);
$('#effp_finish').html('<span id="effp_finished_main" style="display:none"><li id="effp_done"><b>Done (<a href="' + wgArticlePath.replace("$1", encodeURI(effp_effpPageName)) + '?action=purge" title="' + effp_effpPageName + '">Reload page</a>)</b></li></span>');
pagetext = effp_getPageText(effp_effpPageName, true);
var effp_total = 0;
for (var i = 0; i < effp_effpSubmissions.length; i++) {
var sub = effp_effpSubmissions[i];
if (pagetext.indexOf(effp_effpSections[sub.section]) == -1) {
$('#effp_status').html($('#effp_status').html() + '<li>Skipping ' + sub.title + ': Cannot find section. Perhaps it was modified in the mean time?</li>');
continue;
}
var origtext = effp_effpSections[sub.section];
var text = effp_effpSections[sub.section];
var startindex = pagetext.indexOf(effp_effpSections[sub.section]);
var endindex = startindex + text.length;
if (text === origtext) {
var sub_m = effp_effpSubmissions[i];
if (sub_m.blockuser == true) {
var match = /\[\[(?:User[_ ]talk:|User:|Special:Contributions\/)([^\||\]\]]*)([^\]]*?)\]\]/i.exec(text);
if (match) {
var vandal = match[1];
var API = new mw.Api();
API.postWithToken("block", {
'action': 'block',
'expiry': sub_m.expiry,
'allowusertalk': !sub_m.blocktalk,
'noemail': sub_m.blockemail,
'anononly': sub_m.anononly,
'autoblock': sub_m.blockauto,
'nocreate': sub_m.blockacc,
'reason': sub_m.blockreason,
'watchuser': sub_m.watch,
'user': vandal
}).done(function(blockData) {
$('#effp_status').html($('#effp_status').html()+'<li>Blocked '+vandal+' succesfully</li>');
effp_effp_templateUser(sub_m.expiry, vandal);
}).fail(function(error) {
$("#effp_status").html(
$('#effp_status').html()+"<li><b>Error</b> blocking <a href='"+mw.util.getUrl('User:'+vandal)+"'>"+vandal+"</a>: "+error+"</li>"
);
effp_effp_templateUser(sub_m.expiry, vandal);
});
}
}
if (sub_m.action == 'blocked') {
text += '\n*\{\{effp|blocked|'+sub_m.blockeduser+'|'+sub_m.admin+'\}\} '+sub_m.cmt+' \~\~\~\~\n';
effp_total++;
}
if (sub_m.action == 'fixed') {
text += '\n*\{\{effp|fixed|'+sub_m.filteruser+'\}\} '+sub_m.cmt+' \~\~\~\~\n';
effp_total++;
}
if (sub_m.action == 'alreadydone') {
text += '\n*\{\{effp|alreadydone|'+sub_m.user+'\}\} '+sub_m.cmt+' \~\~\~\~\n';
effp_total++;
}
if (sub_m.action == 'talk') {
text += '\n*\{\{effp|talk|'+sub_m.talk+'\}\} '+sub_m.cmt+' \~\~\~\~\n';
effp_total++;
}
if (sub_m.action != 'none' && sub_m.action != 'blocked' && sub_m.action != 'talk' && sub_m.action != 'fixed' && sub_m.action != 'alreadydone') {
text += '\n*\{\{effp|'+sub_m.action+'\}\} '+sub_m.cmt+' \~\~\~\~\n';
effp_total++;
}
pagetext = pagetext.substring(0, startindex) + text + pagetext.substring(endindex);
}
}
var summary;
if (effp_total==1) summary = "Responding to "+effp_total+" report";
else summary = "Responding to "+effp_total+" reports";
pagetext = pagetext.replace(/[\n\r]{3,}/g,"\n\n");
pagetext = pagetext.replace(/[\n\r]+==/g,"\n\n==");
effp_editPage(effp_effpPageName, pagetext, summary, false);
$(document).ajaxStop(function () {
$("#effp_finished_main").css("display", "");
});
}
function effp_effp_templateUser(duration, vandal) {
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
d = new Date();
var ApI = new mw.Api();
ApI.postWithToken( "edit", {
action: "edit",
section: 'new',
watchlist: "nochange",
sectiontitle: monthNames[d.getMonth()] + ' ' + d.getFullYear(),
summary: "You have been blocked from editing for abuse of editing privileges."+effp_ending,
text: "\n{{subst:uw-block|time="+duration+"|sig=yes}}",
title: "User talk:"+vandal
}).done(function(editData) {
$('#effp_status').html($('#effp_status').html()+'<li>Successfully posted block notice on <a href="' + wgArticlePath.replace("$1", encodeURI('User talk:'+vandal)) + '">User talk:'+vandal+'</a></li>');
}).fail(function(error) {
$('#effp_status').html($('#effp_status').html()+'<li>Error posting block notice on <a href="' + wgArticlePath.replace("$1", encodeURI('User talk:'+vandal)) + '">User talk:'+vandal+'</a></li>');
});
}
function effp_effp_onActionChange(id) {
var extra = $("#effp_effp_extra_" + id);
var selectValue = $("#effp_effp_action_" + id).val();
if (selectValue == 'none') extra.html('');
if (selectValue == 'blocked' && !Morebits.userIsInGroup('sysop')) {
extra.html('<label for="effp_effp_blockeduser_'+id+'">Which user is blocked? </label><input type="text" '+'name="effp_effp_blockeduser_'+id+'" id="effp_effp_blockeduser_'+id+'"><br/><label for="effp_effp_admin_'+id+'">Who blocked the user? </label><input type="text" '+'name="effp_effp_admin_'+id+'" id="effp_effp_admin_'+id+'"><br/><label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'">');
}
if (selectValue == 'fixed') {
extra.html('<label for="effp_effp_filteruser_'+id+'">Who fixed the filter? </label><input type="text" '+'name="effp_effp_filteruser_'+id+'" id="effp_effp_filteruser_'+id+'"><br/><label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'">');
}
if (selectValue == 'alreadydone') {
extra.html('<label for="effp_effp_user_'+id+'">Who made the edit? </label><input type="text" '+'name="effp_effp_user_'+id+'" id="effp_effp_user_'+id+'"><br/><label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'">');
}
if (selectValue == 'talk') {
extra.html('<label for="effp_effp_talk_'+id+'">Please enter the article name: </label><input type="text" '+'name="effp_effp_talk_'+id+'" id="effp_effp_talk_'+id+'"><br/><label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'">');
}
if (selectValue != 'none' && selectValue != 'blocked' && selectValue != 'fixed' && selectValue != 'talk' && selectValue != 'alreadydone') {
extra.html('<label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'">');
}
if (Morebits.userIsInGroup('sysop')) {
if (selectValue == 'blocked') {
extra.html('<label for="effp_effp_blockeduser_'+id+'">Which user is blocked? </label><input type="text" '+'name="effp_effp_blockeduser_'+id+'" id="effp_effp_blockeduser_'+id+'"><br/><label for="effp_effp_admin_'+id+'">Who blocked the user? </label><input type="text" '+'name="effp_effp_admin_'+id+'" id="effp_effp_admin_'+id+'"><br/><label for="effp_effp_cmt_'+id+'">Comment: </label><input type="text" '+'name="effp_effp_cmt_'+id+'" id="effp_effp_cmt_'+id+'"><br/><input type="checkbox" '+'name="effp_effp_blockuser_'+id+'" id="effp_effp_blockuser_'+id+'" onclick="effp_effp_onActionChange2('+id+');"/><label for="effp_effp_blockuser_'+id+'">Block user</label><br/><div id="effp_effp_blockuserdiv_'+id+'"></div>');
}
}
}
function effp_effp_onActionChange2(id) {
var blockuserdiv = $("#effp_effp_blockuserdiv_"+id);
if (!document.getElementById('effp_effp_blockuser_'+id).checked) {
blockuserdiv.html('');
}
else {
var blockreasons = [
{ label: 'None', selected: true, value: '' },
{ label: 'Vandalism', value: '[[WP:V|Vandalism]]' },
{ label: 'Deliberately triggering the edit filter', value: 'Deliberately triggering the [[WP:FILTER|edit filter]]' },
{ label: 'Disruptive editing', value: '[[WP:DE|Disruptive editing]]' },
{ label: 'Clearly not here to contribute to the encyclopedia', value: 'Clearly [[WP:NOTHERE|not here to contribute to the encyclopedia]]' },
{ label: 'Custom', value: 'custom' }
];
var blockexpiration = [
{ label: '31 hours', selected: true, value: '31 hours' },
{ label: 'indefinite', value: 'indefinite' },
{ label: '24 hours', value: '24 hours' },
{ label: '48 hours', value: '48 hours' },
{ label: '72 hours', value: '72 hours' },
{ label: '1 week', value: '1 week' },
{ label: '2 weeks', value: '2 weeks' },
{ label: '3 weeks', value: '3 weeks' },
{ label: '1 month', value: '1 month' },
{ label: '2 months', value: '2 months' },
{ label: '3 months', value: '3 months' },
{ label: '6 months', value: '6 months' },
{ label: '1 year', value: '1 year' },
{ label: '2 years', value: '2 years' }
];
blockuserdiv.html('<label for="effp_effp_blockreason_'+id+'">Block reason: </label>'+effp_generateSelect('effp_effp_blockreason_'+id, blockreasons)+'<label for="effp_effp_customblockreason_'+id+'"> Custom block reason (if "custom" is selected): </label><input type="text" id="effp_effp_customblockreason_'+id+'" name="effp_effp_customblockreason_'+id+'"><br/><label for="effp_effp_customblockreason_'+id+'">Expiration: </label>'+effp_generateSelect('effp_effp_blockexpiry_'+id, blockexpiration)+'<br/><input type="checkbox" '+'name="effp_effp_blockacc_'+id+'" id="effp_effp_blockacc_'+id+'"><label for="effp_effp_blockacc_'+id+'">Prevent account creation</label><br/><input type="checkbox" '+'name="effp_effp_blockemail_'+id+'" id="effp_effp_blockemail_'+id+'"><label for="effp_effp_blockemail_'+id+'">Prevent user from sending Email</label><br/><input type="checkbox" '+'name="effp_effp_blocktalk_'+id+'" id="effp_effp_blocktalk_'+id+'"><label for="effp_effp_blocktalk_'+id+'">Block user from editing their talk page</label><br/><input type="checkbox" '+'name="effp_effp_blockauto_'+id+'" id="effp_effp_blockauto_'+id+'"><label for="effp_effp_blockauto_'+id+'">Automatically block the last IP address used by this user, and any subsequent IP addresses they try to edit from</label><br/><input type="checkbox" '+'name="effp_effp_anononly_'+id+'" id="effp_effp_anononly_'+id+'"><label for="effp_effp_anononly_'+id+'">Prevent logged-in users from editing from this IP address</label><br/><input type="checkbox" '+'name="effp_effp_watch_'+id+'" id="effp_effp_watch_'+id+'"><label for="effp_effp_watch_'+id+'">Watch this user'+"'"+'s user and talk pages</label>');
}
}
function displayMessage_inline(message, div, className) {
var divtitle = '#' + div;
if (message === '' || message === null) {
$(divtitle).empty().hide();
return true;
} else {
var $messageDiv = $(divtitle);
$messageDiv.attr('style', "margin:1em;padding:0.5em 2.5%;border:solid 1px #ddd;background-color:#fcfcfc");
if (!$messageDiv.length) {
if (mw.util.$content.length) {
mw.util.$content.prepend($messageDiv);
} else {
return false;
}
}
if (typeof message === 'object') {
$messageDiv.empty();
$messageDiv.append(message);
} else {
$messageDiv.html(message);
}
$messageDiv.slideDown();
return true;
}
}
function effp_links() {
var sectionHeaders = $("#mw-content-text h2");
var offset = 1;
sectionHeaders.each(function(index, element) {
var not_archived = !$(element).next().length || $(element).next().html().indexOf('This is an archived discussion.') == -1;
if (index > 0)
var idtitle = "effp-review-" + (index - 1);
$('<div id="' + idtitle + '" style="display:none;"></div>').insertAfter(element);
var editSectionLink = $(element).children(".mw-editsection");
if ((editSectionLink.length > 0) && (not_archived)) {
editSectionLink = editSectionLink[0];
var reviewlink = document.createElement("a");
reviewlink.href = "#" + idtitle;
$(reviewlink).attr("sectionIndex", index + offset);
reviewlink.innerHTML = "Review report";
var editSectionContents = $(editSectionLink).html();
editSectionLink.innerHTML = "[";
editSectionLink.appendChild(reviewlink);
editSectionLink.innerHTML = editSectionLink.innerHTML + "] " + editSectionContents;
reviewlink.onclick = (function() {
$(reviewlink).remove();
effp_init();
});
} else {
offset = offset - 1;
}
});
$('body [sectionIndex]').click((function() {
$('body [sectionIndex]').each(function(i) {
$(this).html("Reviewing reports...").contents().unwrap();
});
effp_init();
}));
}
mw.loader.using(['ext.gadget.Twinkle', 'mediawiki.util', 'mediawiki.api', 'mediawiki.Title'], function() {
$(document).ready( function () {
setTimeout(function (){
if ( mw.config.get( "wgPageName" ) === "Wikipedia:Edit_filter/False_positives/Reports" || mw.config.get( "wgPageName" ) === "User:DannyS712/EFFPRH/sandbox" ) {
effp_links();
}
}, 1000);
} );
});
//</nowiki>