User:CWii/js/ifu-helper.js

//

document.write(' ');

ifuh_declines = Array; ifuh_accepts = Array;

ifuh_accepts["accept"] = 'accepted'; ifuh_accepts["manual"] = 'accepted';

ifuh_declines["decline"] = 'decline'; ifuh_declines["on hold"] = 'on hold';

function ifu_helper { if (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:Images_for_upload\/([^&]+)&action=edit&/; var url_re = /\?title=User:Compwhizii\/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 = ""; for (var key in ifuh_accepts) { if( !ifuh_accepts.hasOwnProperty(key) ) { // Twinke workaround? continue; }               link = "javascript:ifu_vote('"+escape(anchors[i].href)+"','"+key+"','"+ifuh_accepts[key]+"','accept')"; bla += "["+key+"]"; }       bla += " ";; for (var key in ifuh_declines) { if( !ifuh_declines.hasOwnProperty(key) ) { // Twinke workaround? continue; }               link = "javascript:ifu_vote('"+escape(anchors[i].href)+"','"+key+"','decline - "+ifuh_declines[key]+"','')"; bla += "["+key+"]"; }       bla += " "; anchors[i].parentNode.innerHTML += bla;

} }

function ifu_vote(edit_link,type,reason,action) { var type2 = type; if (type == "manual") type2 = "accept";

var url = edit_link + '&amfind='+escape("===(.*)===")+ '&amreplace='+escape('$0\n'+action+'')+ '&amlocal=1'+ '&amaddafter='+escape(" "+"\n"+"") + '&amsummary='+escape(reason); if (action == '') { url += "&amautosave=yes;"; }   window.location.href = url;

if (action == "accept" && type != "manual") { title = window.prompt("Create at title?"); url = "http://en.wikipedia.org/w/index.php?title="+escape(title)+"&action=edit"; window.open(url, "afd_helper_vote"); } } $(ifu_helper);

//