User:GeorgeMoney/UserScripts/ClerkAutoTag

// if(wgPageName.indexOf('Wikipedia:Requests_for_checkuser/Case/') == 0&&wgIsArticle || wgPageName == 'Special:Log') { addOnloadHook(function {		var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];		addlilink(tbs, "javascript:fix_links", "prepare for tagging", 'ca-taglinks', 'Alter all the links on this page to autotag the page when clicked');	}); }

if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('autotag=') != -1) { addOnloadHook(function {		var tag = _GET('autotag');		var box = document.getElementById('wpTextbox1');		var txt = box.value;		if(txt.toLowerCase.indexOf(tag.toLowerCase) != -1) {			var contt = confirm("The requested tag was already found on this page.\nPress ok to continue to add the tag");			if(!contt) return;		}		box.value = tag;		document.getElementById('wpSummary').value = 'Tagging page with: '+tag;		document.getElementById('wpMinoredit').checked = 'checked';		document.getElementById('wpWatchthis').checked = '';		document.getElementById('wpSave').click;	}); }

function fix_links { var teer = wgTitle.split('/')[wgTitle.split('/').length - 1]; var tag = prompt('Please enter the tag you would like to use.\nExample: {'+'{sockpuppetCheckuser|'+teer+'|'+teer+'}'+'}'); if(tag == null) { alert('Action canceled.'); return; } if(tag == "") tag = '{'+'{sockpuppetCheckuser|'+teer+'|'+teer+'}'+'}'; var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0; i]+)>)/g, ''); }	var btn = document.getElementById('ca-taglinks').firstChild; btn.href = 'javascript:unfix_links;'; btn.innerHTML = 'UNprepare for tagging'; btn.title = ''; }

function unfix_links { var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0; i<links.length; i++) { var link = links[i]; link.href = link.href.split('linkmodified=yes')[0]; link.style.color = ""; }	alert('All links will now be safe to click...'); var btn = document.getElementById('ca-taglinks').firstChild; btn.href = 'javascript:fix_links;'; btn.innerHTML = 'prepare for tagging'; btn.title = ''; }

//parse paramName out of query string //stolen from Lupin's popups function _GET(paramName) { var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); var h=document.location; var m; if (m=cmdRe.exec(h)) { try { return unescape(m[1]); } catch (someError) {} } return null; }; //