blob: cc28959724f20c183f618882f01e7acb29f00d9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<?php // vim:filetype=javascript
if ($conf['debug']) { ?>
var debugrow=0;
var debugenabled=1;
var debug_queue=[];
// Print debug info
function debug (subtype, text) {
if (debugenabled==0) {
return;
}
if (text==null) {
text=subtype;
subtype=null;
}
text+="";
text=text.replace(/(\r\n|\r|\n)/g,'<br/>');
text=text.replace(/ /g, ' ');
if (debugrow > 0) {
hidedebug(debugrow);
}
div=document.createElement('div');
div.className='debug '+(++debugrow%2?'odd':'even');
div.id='debug'+debugrow;
big=text.match('<br') || text.length > 150;
div.innerHTML='<span class="type'+(big?' pointer" onclick="toggledebug('+debugrow+')':'')+'">'+(big?'<img id="debugmanager'+debugrow+'" src="'+url('images/minusbox.gif')+'" alt="[Hide]" /> ':'')+(subtype!=null?subtype+':':'')+'</span><span> '+text+'</span>';
document.getElementById("debugbox").appendChild(div);
document.getElementById("debugcount").childNodes[0].nodeValue=debugrow;
}
function toggledebugbox () {
if(document.getElementById('debugbox').style.display=="none") {
document.getElementById('debugbox').style.display="";
document.getElementById("debugbox").scrollTop = document.getElementById("debugbox").scrollHeight;
} else {
document.getElementById('debugbox').style.display="none"
}
}
function toggledebug(row) {
if (document.getElementById('debug'+row).style.maxHeight=="1.3em") {
showdebug(row);
} else {
hidedebug(row);
}
}
function showdebug(row) {
if (document.getElementById('debugmanager'+row)) {
document.getElementById('debug'+row).style.maxHeight="";
document.getElementById('debugmanager'+row).src=url('images/minusbox.gif');
document.getElementById('debugmanager'+row).alt='[Hide]';
}
}
function hidedebug(row) {
if (document.getElementById('debugmanager'+row)) {
document.getElementById('debug'+row).style.maxHeight="1.3em";
document.getElementById('debugmanager'+row).src=url('images/plusbox.gif');
document.getElementById('debugmanager'+row).alt='[Show]';
}
}
function errordebug(message,script,line) {
subcat='<span style="color: red">ERROR: '+script.replace(/.*[/]/g,"")+':'+line+'</span>';
text='<span style="color: red">'+message+'</span>';
if (document.getElementById("debugbox")) {
debug(subcat, text);
} else {
debug_queue[debug_queue.length]=[subcat, text];
}
}
function cleardebug() {
document.getElementById('debugbox').innerHTML='';
document.getElementById('debugcount').childNodes[0].nodeValue=0;
debugrow=0;
}
function closedebug() {
document.getElementById('debug').style.display="none";
debugenabled=0;
}
function queueddebugs() {
for (var i=0; i<debug_queue.length; i++) {
debug(debug_queue[i][0], debug_queue[i][1]);
}
}
window.onerror=errordebug;
window.onload=queueddebugs;
<?php } else { ?>
function debug() {}
<?php } ?>
|