Jump to content

User talk:Happy-melon/vector.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

2nd attempt at undo restyle

[edit]
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)[reply]