4 function showExtendedDebug() {
5 if (debugWindow
!= null) {
9 if (debugWindow
== null) {
10 commandHistory
= new Array();
13 debugWindow
= new Window('debug_window', {className
: 'dialog',width
:250, height
:100, right
:4, minWidth
:250, bottom
:42, zIndex
:1000, opacity
:1, showEffect
: Element
.show
, resizable
: true, title
: "Debug"})
14 debugWindow
.getContent().innerHTML
= "<style>#debug_window .dialog_content {background:#000;}</style> <div font='monaco' id='debug' style='padding:3px;color:#0F0;font-family:monaco'></div>";
16 //create hourglass icon and attach events to it.
17 var cont
= "<div id=\"debug_window_inspect\" style=\"width: 15px; height: 15px; background: transparent url(themes/default/inspect.gif) no-repeat 0 0; position:absolute; top:5px; left:70px; cursor:pointer; z-index:3000;\"></div>";
19 new Insertion
.After('debug_window_maximize', cont
);
20 Event
.observe('debug_window_inspect', 'click', enterInspectionMode
, false);
22 //create command text box
23 cont
= "Eval:<input id=\"debug_window_command\" type=\"textbox\" style=\"width:150px; height: 12px; color: black;\">"
24 debugWindow
.setStatusBar(cont
);
26 Event
.observe('debug_window_command', 'mousedown', donothing
);
27 Event
.observe('debug_window_command', 'keypress', evalJS
, false);
32 function donothing(evt
){
33 Field
.activate('debug_window_command');
38 if(evt
.keyCode
== Event
.KEY_RETURN
){
39 var js
= $F('debug_window_command');
47 $('debug_window_command').value
= '';
49 Field
.activate('debug_window_command');
50 commandHistory
.push(js
);
54 if(evt
.keyCode
== Event
.KEY_UP
){
55 if(commandHistory
.length
> historyIndex
){
57 var js
= commandHistory
[commandHistory
.length
-historyIndex
];
58 $('debug_window_command').value
= js
;
60 Field
.activate('debug_window_command');
64 if(evt
.keyCode
== Event
.KEY_DOWN
){
65 if(commandHistory
.length
>= historyIndex
&& historyIndex
> 1){
67 var js
= commandHistory
[commandHistory
.length
-historyIndex
];
68 $('debug_window_command').value
= js
;
70 Field
.activate('debug_window_command');
75 function enterInspectionMode(evt
){
76 //stop observing magnifying glass
77 Event
.stopObserving('debug_window_inspect', 'click', enterInspectionMode
, false);
79 document
.body
.style
.cursor
='help';
80 //start observing mouse clicks
81 Event
.observe(window
, 'click', inspectItem
, false);
84 function inspectItem(evt
){
85 // the element that triggered the event
86 var element
= Event
.element(evt
);
87 if(element
.id
!="debug_window_inspect"){
90 document
.body
.style
.cursor
='default';
93 //stop observing mouse clicks
94 Event
.stopObserving(window
, 'click', inspectItem
, false);
95 //alert('doing something');
97 Event
.observe('debug_window_inspect', 'click', enterInspectionMode
, false);
101 function clearDebug() {
102 var win
= $('debug');
107 //clear inspections too
108 var divs
= document
.getElementsByClassName('inspector');
109 divs
.each(function(div
){