// <pre><nowiki>
importScript('User:Henrik/js/automod.js');
afch_declines = Array();
afch_accepts = Array();
afch_accepts["accept"] = 'accepted';
afch_accepts["redir"] = 'accepted';
afch_accepts["manual"] = 'accepted';
afch_declines["exists"] = 'already exists';
afch_declines["v"] = 'not verifiable';
afch_declines["bio"] = 'not a notable person';
afch_declines["nn"] = 'not a notable entity';
afch_declines["web"] = 'not a notable website';
afch_declines["corp"] = 'not a notable corporation';
afch_declines["band"] = 'not a notable band or musician';
afch_declines["dict"] = 'dictionary definition';
afch_declines["context"] = 'lacks context';
afch_declines["cv"] = 'copyright violation';
afch_declines["blank"] = 'blank entry';
afch_declines["adv"] = 'advertising';
afch_declines["neo"] = 'neologism';
afch_declines["lang"] = 'not in English';
afch_declines["joke"] = 'appears to be a joke';
afch_declines["npov"] = 'not neutrally written';
afch_declines["blp"] = 'defamatory';
afch_declines["not"] = 'not suitable for wikipedia';
function afc_helper() {
if (typeof auto_mod !== 'undefined' && auto_mod())
return;
var anchors = new Array();
{
var oldanchors = document.getElementById('bodyContent').getElementsByTagName('a');
for (var i=0; i < oldanchors.length; i )
anchors[i] = oldanchors[i];
}
var url_re = /\?title=Wikipedia:Articles_for_creation\/([^&] )&action=edit&/;
//var url_re = /\?title=User:Henrik\/sandbox\/([^&] )&action=edit&/;
var url, matches;
for (var i=0; i < anchors.length; i ) {
if (!(matches = anchors[i].href.match(url_re))
|| (anchors[i].parentNode.parentNode.tagName != 'H2'))
continue;
bla = "<span id=\"afc-helper-accept\" style=\"background-color: #A0FFA0;\">";
for (var key in afch_accepts) {
if( !afch_accepts.hasOwnProperty(key) ) { // Twinke workaround?
continue;
}
link = "javascript:afc_vote('" encodeURIComponent(anchors[i].href) "','" key "','" afch_accepts[key] "','accept')";
bla = "[<a href=\"" link "\">" key "</a>]";
}
bla = "</span><span id=\"afc-helper-decline\" style=\"background-color: #ffcece;\">";;
for (var key in afch_declines) {
if( !afch_declines.hasOwnProperty(key) ) { // Twinke workaround?
continue;
}
link = "javascript:afc_vote('" encodeURIComponent(anchors[i].href) "','" key "','decline - " afch_declines[key] "','')";
bla = "[<a href=\"" link "\">" key "</a>]";
}
bla = "</span>";
anchors[i].parentNode.innerHTML = bla;
}
}
function afc_vote(edit_link,type,reason,action) {
var type2 = type;
if (type == "manual")
type2 = "accept";
var url = edit_link
'&amfind=' encodeURIComponent("==(.*)==")
'&amreplace=' encodeURIComponent('$0\n{{subst:afc top|' action '}}')
'&amlocal=1'
'&amaddafter=' encodeURIComponent("{{subst:afc " type2 "}} ~~" "~~\n" "{{subst:afc b}}")
'&amsummary=' encodeURIComponent(reason);
if (action == '') {
url = "&amautosave=yes;";
}
window.location.href = url;
if (action == "accept" && type != "manual") {
title = window.prompt("Create at title?");
url = mw.config.get('wgScript') "?title=" encodeURIComponent(title) "&action=edit";
window.open(url, "afd_helper_vote");
}
}
$(afc_helper);
// </nowiki></pre>