1 var Debug = {window: undefined, pploaded: false};
3 Debug.openwindow = function() {
4 if (navigator.userAgent.toLowerCase().indexOf('msie 6') == -1) {
5 title = 'Debug Window';
12 var output = window.open('', title, "toolbar=no,scrollbars,resizable=yes,width=400,height="+height);
15 output.document.open("text/html");
16 output.document.write("<html><head><title>" + title + "</title></head>\n");
17 output.document.write("<body>\n");
19 output.document.write('<p><input type="button" value="Close window" onClick="self.debug.closewindow()">');
20 output.document.write('<input type="button" value="Clear window" onClick="self.debug.clear()"><br>');
21 // output.document.write('Inspect: <input type="text" value="" onClick="self.debug.clear()"></p>');
23 output.document.write('<div style="font-size: 10px;" id="debug_output"></div>');
25 output.document.write("</body></html>\n");
26 output.document.close();
33 Debug.closewindow = function()
36 var win = Debug.window;
39 Debug.window = undefined;
42 Debug.clear = function()
45 var div = Debug.window.document.getElementById('debug_output');
49 Debug.window = Debug.openwindow();
52 Debug.output = function(text)
55 Debug.window = Debug.openwindow();
57 var div = Debug.window.document.getElementById('debug_output');
62 Debug.write = function(text)
65 Debug.window = Debug.openwindow();
67 var div = Debug.window.document.getElementById('debug_output');
69 div.innerHTML += '<br>' + text;
72 Debug.ObjInfoRaw = function(obj)
74 var text = 'Elements:';
81 // boolean (Ja/Nein-Variable),
82 // string (Zeichenkettenvariable),
83 // number (numerische Variable),
84 // function (Funktion),
86 // undefined (unbestimmter Typ).
88 Debug.ObjInfo = function(obj)
90 var text = '<p><b>Elements:</b><br><ul>';
94 switch (typeof obj[e]) {
97 case 'function': text += ' ('+typeof obj[e]+')'; break;
98 default: text += ' = '+obj[e]; break;
107 Debug.ObjDump = function(obj)
109 var text = 'Object dump:<br><ul>';
111 text += '<li><strong>Element ' + e + '</strong>: '+obj[e]+'</li>';
117 Debug.ObjDumpRaw = function(obj)
119 var text = "Object dump:\n<pre>\n";
134 t = '<' + e.tagName + ' size="'+e.clientWidth+'"';
139 // Requires: git clone git://github.com/jamespadolsey/prettyPrint.js.git
140 Debug.PrettyPrint = function(obj)
143 Debug.window = Debug.openwindow();
145 var div = Debug.window.document.getElementById('debug_output');
147 if (!Debug.pploaded) {
148 pp = document.createElement("script");
149 pp.type = 'text/javascript';
150 pp.src = 'lib/prettyprint.js';
151 document.body.appendChild(pp);
152 Debug.pploaded = true;
155 var ppTable = prettyPrint(obj);
156 div.appendChild(ppTable);
161 // obj = grid_tab_2.buffer;
163 // temp += x + ": " + obj*[x] + "\n";
164 // var Fenster = window.open('','Fenstername','scrollbars');
165 // Fenster.document.open("text/html");
166 // Fenster.document.write("<pre>\n" + temp + "\n</pre>");
167 // // Fenster.document.close();