var Debug = {window: undefined, pploaded: false};
Debug.openwindow = function() {
if (navigator.userAgent.toLowerCase().indexOf('msie 6') == -1) {
title = 'Debug Window';
height = '250'
} else {
title = 'DebugWindow';
height = '500'
}
var output = window.open('', title, "toolbar=no,scrollbars,resizable=yes,width=400,height="+height);
if (output) {
output.document.open("text/html");
output.document.write("
" + title + "\n");
output.document.write("\n");
output.document.write('');
output.document.write('
');
// output.document.write('Inspect:
');
output.document.write('');
output.document.write("\n");
output.document.close();
output.debug = Debug;
}
return output;
}
Debug.closewindow = function()
{
if (Debug.window) {
var win = Debug.window;
win.close();
}
Debug.window = undefined;
}
Debug.clear = function()
{
if (Debug.window) {
var div = Debug.window.document.getElementById('debug_output');
if (div)
div.innerHTML = '';
} else
Debug.window = Debug.openwindow();
}
Debug.output = function(text)
{
if (!Debug.window)
Debug.window = Debug.openwindow();
var div = Debug.window.document.getElementById('debug_output');
if (div)
div.innerHTML = text;
}
Debug.write = function(text)
{
if (!Debug.window)
Debug.window = Debug.openwindow();
var div = Debug.window.document.getElementById('debug_output');
if (div)
div.innerHTML += '
' + text;
}
Debug.ObjInfoRaw = function(obj)
{
var text = 'Elements:';
for (var e in obj)
text += ' ' + e;
Debug.write(text);
}
// boolean (Ja/Nein-Variable),
// string (Zeichenkettenvariable),
// number (numerische Variable),
// function (Funktion),
// object (Objekt),
// undefined (unbestimmter Typ).
Debug.ObjInfo = function(obj)
{
var text = 'Elements:
';
for (var e in obj) {
text += '- ' + e;
switch (typeof obj[e]) {
case 'object':
case 'undefined':
case 'function': text += ' ('+typeof obj[e]+')'; break;
default: text += ' = '+obj[e]; break;
}
}
text += '
';
Debug.write(text);
}
Debug.ObjDump = function(obj)
{
var text = 'Object dump:
';
for (var e in obj)
text += '- Element ' + e + ': '+obj[e]+'
';
text += '
';
Debug.write(text);
}
Debug.ObjDumpRaw = function(obj)
{
var text = "Object dump:\n\n";
for (var e in obj) {
text += e + ': ';
text += obj[e];
text += "\n";
}
text += "
\n";
Debug.write(text);
}
function eleminfo(e)
{
var t = '';
if (!e) return;
t = '<' + e.tagName + ' size="'+e.clientWidth+'"';
t += '>';
return t;
}
// Requires: git clone git://github.com/jamespadolsey/prettyPrint.js.git
Debug.PrettyPrint = function(obj)
{
if (!Debug.window)
Debug.window = Debug.openwindow();
var div = Debug.window.document.getElementById('debug_output');
if (div) {
if (!Debug.pploaded) {
pp = document.createElement("script");
pp.type = 'text/javascript';
pp.src = 'lib/prettyprint.js';
document.body.appendChild(pp);
Debug.pploaded = true;
}
var ppTable = prettyPrint(obj);
div.appendChild(ppTable);
}
}
// var temp = "";
// obj = grid_tab_2.buffer;
// for (x in obj)
// temp += x + ": " + obj*[x] + "\n";
// var Fenster = window.open('','Fenstername','scrollbars');
// Fenster.document.open("text/html");
// Fenster.document.write("\n" + temp + "\n
");
// // Fenster.document.close();