User:JackSchmidt/JS FDG.js

FloatingDumpingGround = function(arg) { return FloatingDumpingGround.Alert(arg); };

(function{

var FDG = FloatingDumpingGround;

FDG.Alert = function(arg) { var txt = ""; if(typeof(arg)==typeof("")) { arg = [arg]; }; for(var i in arg) { try{ txt+=arg[i]+" "; } catch(e) { txt+="? "; } } var pre; pre = document.createElement("pre"); pre.style.maxWidth='80em'; pre.style.overflowX='auto'; pre.appendChild(document.createTextNode(txt)); FDG.Init; FDG.content.appendChild(pre); FDG.Ring; };

FDG.Ring = function { if(FDG.content.style.display != 'none') { FDG.clear_button.firstChild.data = "☒"; FDG.minimize_button.firstChild.data = "▽"; } else if(FDG.content.childNodes.length > 0) { FDG.ringy = !FDG.ringy; FDG.clear_button.firstChild.data = FDG.content.childNodes.length; FDG.minimize_button.firstChild.data = FDG.ringy?"☎":"☏"; } else { FDG.clear_button.firstChild.data = ""; FDG.minimize_button.firstChild.data = ""; } }

FDG.Minimize = function { var b = (FDG.content.style.display!='none'); FDG.content.style.display = b?'none':'inline'; FDG.parent.style.border = b?'none':'1px dotted gray'; FDG.parent.style.backgroundColor=b?'':'#ffd'; FDG.Ring; if(!FDG.interval) FDG.interval = setInterval( FDG.Ring, 450 ); return false; }

FDG.Clear = function { if(FDG.content.style.display=='none') return FDG.Minimize; while( FDG.content.lastChild ) FDG.content.removeChild(FDG.content.lastChild); FDG.Minimize; }

FDG.Init = function { if(FDG.init) return; var par, min, clr, con; par = document.createElement("div"); min = document.createElement("div"); clr = document.createElement("div"); con = document.createElement("div"); clr.style.cursor = 'pointer'; clr.style.display = 'inline'; clr.style.float = 'right'; clr.style.position = 'absolute'; clr.style.right = '0.5em'; clr.style.top = '0.1em'; con.style.padding='0em'; con.style.lineHeight='0em'; min.style.cursor = 'pointer'; min.style.display = 'inline'; min.style.float = 'right'; min.style.position = 'absolute'; min.style.right = '1.5em'; min.style.top = '0.1em'; par.style.border='1px solid black'; par.style.display='none'; par.style.padding='1em'; par.style.position='absolute'; par.style.right='1em'; par.style.zIndex=10000; par.style.top='1em'; min.onclick = FDG.Minimize; clr.onclick = FDG.Clear; min.appendChild(document.createTextNode("")); clr.appendChild(document.createTextNode("")); par.appendChild(min); par.appendChild(clr); par.appendChild(con); document.getElementsByTagName("body")[0].appendChild(par); FDG.parent = par; FDG.content = con; FDG.clear_button = clr; FDG.minimize_button = min; FDG.init=true; FDG.Minimize; par.style.display='inline'; };

try { alert = FDG; } catch(e) { }; });