User:Kylu/irradiate.js

// // Blatantly stolen from User:Splarka/electrocute.js // $(function { mw.util.addPortletLink('p-tb','/wiki/Special:Irradiate','Irradiations'); });

if(wgPageName == 'Special:Irradiate') { document.title = 'User irradiation'; appendCSS('#content {visibility:hidden;}'); addOnloadHook(irradiationForm); }

function irradiationForm { var con = (document.getElementById('content')) ? document.getElementById('content') : document.getElementById('mw_content') var bcon = (document.getElementById('bodyContent')) ? document.getElementById('bodyContent') : document.getElementById('mw_contentholder') var fh = getElementsByClassName(con,'h1','firstHeading')[0]; while(fh.firstChild) fh.removeChild(fh.firstChild) fh.appendChild(document.createTextNode('User irradiation')); for(var i=0;i ' + 'User " + queryString('user') + " has been irradiated per the following parameters:' + ' dosage = ' + queryString('dosage') + ' type = ' + queryString('abgxn') + ' duration = ' + queryString('duration') + '' }

//Note: I was writing this as nice dom, but since it is for a gag anyways, it is too much work' bcon.innerHTML += '' + ' Irradiate a deserving user ' + ' User:  ' + ' Dosage in Grays: ' + ' 2 Gy 4 Gy  6 Gy ' + ' 8 Gy 10 Gy 12 Gy ' + ' 24 Gy 48 Gy  2000 Gy  60,000 Gy  ' + 'Alpha ' + '<label for="abgxn_beta">Beta ' + '<input id="abgxn_gamma" value="Gamma" name="abgxn" type="radio" /><label for="abgxn_gamma">Gamma ' + '<input id="abgxn_xray" value="X-Rays" name="abgxn" type="radio" /><label for="abgxn_xray">X-Rays ' + '<input id="abgxn_neutron" value="Neutron bombardment" name="abgxn" type="radio" /><label for="abgxn_neutron">Neutron bombardment ' + ' (<a href="http://en.wikipedia.org/wiki/Radiation#Ionizing_radiationk">help</a>) ' + ' Duration: <input id="duration" type="text" name="duration" value="100 milliseconds"/> ' + '<input type="submit" value="Apply" name="submit" />' + ' '  appendCSS('#content {visibility:visible;}');

if(queryString('user')) document.getElementById('user').value = queryString('user'); if(queryString('duration')) document.getElementById('duration').value = queryString('duration'); }

function appendCSS(text) { var s = document.createElement('style'); s.type = 'text/css'; s.rel = 'stylesheet'; if (s.styleSheet) s.styleSheet.cssText = text //IE else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null document.getElementsByTagName('head')[0].appendChild(s); return s; }

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