From Wikipedia, the free encyclopedia
[edit] 2nd attempt at undo restyle
if(queryString('undo') && queryString('undoafter')) addOnloadHook(undoStyle)
function undoStyle() {
//yes, icky, should work in IE7 though.
var t = document.getElementById('toolbar');
var e = document.getElementById('editform')
var w = document.getElementById('wikiPreview');
var tb = t.innerHTML
var tb = '<div id="toolbar">' + tb + '</div>';
var ef = e.innerHTML
var efw = e.parentNode.innerHTML.match(/\<form[^>]*\>/ig)[0];
ef = efw + ef + '</form>';
w.innerHTML += tb + ef;
t.innerHTML = ''; t.id = '';
e.innerHTML = ''; e.id = ''; e.action = '';
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
--Splarka (rant) 09:43, 24 May 2008 (UTC)