User:Essjay/wikipediatag.js

//

function addsearchbuttons { var x = document.getElementById('ca-history'); var y = document.getElementById('ca-edit'); if((!x)&&(!y)) return; var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; var ptitle = document.getElementsByTagName('h1')[0].firstChild.nodeValue; if(ptitle.indexOf('Editing')==3) ptitle = ptitle.substring(11) addlilink(tabs, '/index.php?title=' + ptitle + '&action=edit&autotag=wikipedia', '', 'ca-wikipediatag'); addlilink(tabs, 'http://en.wikipedia.org/wiki/Special:Search?search='+ ptitle +'&go=Go', 'en.wp', 'ca-enwp'); ta['ca-enwp'] = ['`', 'Check en.wikipedia for this topic']; akeytt; } addOnloadHook(addsearchbuttons)

function autotag { if(queryString('autotag')=='wikipedia') { document.editform.wpSummary.value = ''; document.editform.wpMinoredit.checked = true; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '';

//   document.editform.wpSave.focus; document.editform.wpSave.click; } } addOnloadHook(autotag) function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; }

function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { }	}	return null; };

//