User:Gerbrant/gui/window.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
new function() { var docLoaded = false; document.write("\ <style>\ .gerbrant-window\ {\ position:absolute;\ z-index:256;\ left:1em;top:3em;\ padding:1px;\ border:1px solid #888;\ background:#fff;\ }\ .gerbrant-titlebar\ {\ border:1px solid #88f;\ background:#ddf;\ color:#000;\ }\ .gerbrant-windowcontent\ {\ padding:1em;\ background:#eee;\ color:#000;\ }\ </style>"); hookEvent("load", function() { docLoaded = true; }); loadModule("Gerbrant.gui.taskbar", function(tb) { module("Gerbrant.gui.window", function(t) { var s; var divWindow = document.createElement("DIV"); var divTitle = document.createElement("DIV"); var divContent = document.createElement("DIV"); var visible = true; divTitle.className = "gerbrant-titlebar"; divContent.className = "gerbrant-windowcontent"; divWindow.className = "gerbrant-window"; divWindow.appendChild(divTitle); divWindow.appendChild(divContent); this.getCaption = function(){return divTitle.innerHTML;}; this.setCaption = function(t){divTitle.innerHTML = t;}; this.getVisible = function(){return visible;}; this.setVisible = function(b){divWindow.style.display = ((visible = b) ? "" : "none");}; this.getContent = function(){return divContent;}; this.getContentHTML = function(){return divContent.innerHTML;}; this.setContentHTML = function(t){divContent.innerHTML = t;}; this.setCaption(t); function show() { document.body.appendChild(divWindow); } if(docLoaded) show(); else hookEvent("load", show); tb.addWindow(this); }); }); }