/[cvs]/nfo/js/com.cross-browser.cbe/cbe_debug.js
ViewVC logotype

Contents of /nfo/js/com.cross-browser.cbe/cbe_debug.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Fri Apr 18 16:14:42 2003 UTC (21 years, 7 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
File MIME type: application/javascript
rest of main cbe include files (currently not required)

1 /* cbe_debug.js $Revision: 0.11 $
2 * CBE v4.19, Cross-Browser DHTML API from Cross-Browser.com
3 * Copyright (c) 2002 Michael Foster (mike@cross-browser.com)
4 * Distributed under the terms of the GNU LGPL from gnu.org
5 */
6 var cbeIDE=new Object(), cbeDebugObj=new Object(), cbeRefWin=null, cbeRefWinName='cbeRefWin', cbeDebugWin=null, cbeDebugWinName='cbeDebugWindow', cbeDebugSelected=null, cbeMMSL = false;
7 function cbeMouseMoveStatus() {
8 if (cbeMMSL) { document.cbe.removeEventListener('mouseMove', cbeMMStatusListener, false); cbeMMSL = false; }
9 else {
10 if (window.opera) window.defaultStatus="";
11 document.cbe.addEventListener('mouseMove', cbeMMStatusListener, false);
12 cbeMMSL = true;
13 }
14 }
15 function cbeMMStatusListener(e) {
16 if (e.cbeTarget) window.status = 'MOUSE:' + ' X: ' + e.pageX + ' Y: ' + e.pageY + ' OBJECT:' + ' ID: ' + e.cbeTarget.id + ' P: ' + e.cbeTarget.parentNode.id + ' L: ' + e.cbeTarget.left() + ' T: ' + e.cbeTarget.top() + ' X: ' + e.cbeTarget.pageX() + ' Y: ' + e.cbeTarget.pageY() + ' Z: ' + e.cbeTarget.zIndex() + ' W: ' + e.cbeTarget.width() + ' H: ' + e.cbeTarget.height() + ' B: ' + e.cbeTarget.background();
17 }
18 function cbeMUListener(e) { cbeDebugSetSelected(e.cbeTarget.id); }
19 function cbeDebugSetSelected(id) {
20 if (cbeDebugWin) if (cbeDebugWin.closed) cbeDebugWindow();
21 if (id == window.cbeWindowId) cbeDebugSelected = window.cbe;
22 else if (id == window.cbeDocumentId) cbeDebugSelected = document.cbe;
23 else cbeDebugSelected = cbeGetElementById(id).cbe;
24 if (!cbeDebugSelected) cbeDebugSelected = window.cbe;
25 }
26 function cbeDebugWindow(sBaseUrl) {
27 if (cbeDebugWin) {
28 cbeDebugWin.close(); cbeDebugWin = null; document.cbe.removeEventListener('mouseUp', cbeMUListener, false);
29 return;
30 }
31 cbeIDEInit();
32 if (!sBaseUrl) { sBaseUrl = window.cbeBasePath ? cbeBasePath : ""; }
33 cbeDebugSetSelected(window.cbeWindowId);
34 var features = "width="+cbeIDE.dw+",height="+cbeIDE.dh+",scrollbars=1,resizable=1";
35 if (document.layers) features += ",screenx="+cbeIDE.dx+",screeny="+cbeIDE.dy;
36 else features += ",left="+cbeIDE.dx+",top="+cbeIDE.dy;
37 window.cbeDebugWin = window.open(sBaseUrl + "cbe_debug.html", cbeDebugWinName, features);
38 cbeDebugWin.resizeTo(cbeIDE.dw, cbeIDE.dh);
39 cbeDebugWin.moveTo(cbeIDE.dx,cbeIDE.dy);
40 document.cbe.addEventListener('mouseUp', cbeMUListener, false);
41 cbeDebugObj.cmdLine = "";
42 cbeDebugUpdate();
43 }
44 function cbeRefWindow(sBaseUrl) {
45 if (window.cbeRefWin) { cbeRefWin.close(); cbeRefWin = null; return; }
46 cbeIDEInit();
47 if (!sBaseUrl) { sBaseUrl = window.cbeBasePath ? cbeBasePath : ""; }
48 var features = "width="+cbeIDE.rw+",height="+cbeIDE.rh+",scrollbars=1,resizable=1";
49 if (document.layers) features += ",screenx="+cbeIDE.rx+",screeny="+cbeIDE.ry;
50 else features += ",left="+cbeIDE.rx+",top="+cbeIDE.ry;
51 window.cbeRefWin = window.open(sBaseUrl + "cbe_reference.html", cbeRefWinName, features);
52 cbeRefWin.resizeTo(cbeIDE.rw, cbeIDE.rh);
53 cbeRefWin.moveTo(cbeIDE.rx, cbeIDE.ry);
54 }
55 function cbeTileWindows() { cbeIDEInit(); cbeDebugWindow(); if (!cbeDebugWin) {cbeDebugWindow();} window.resizeTo(cbeIDE.aw, cbeIDE.ah); window.moveTo(cbeIDE.ax, cbeIDE.ay); }
56 function cbeIDEInit() {
57 cbeIDE.dx = 0; cbeIDE.dy = 0; cbeIDE.dw = 200; cbeIDE.dh = screen.availHeight - 10; // Debug Window
58 cbeIDE.rh = Math.round(screen.availHeight / 2); cbeIDE.rw = screen.availWidth - cbeIDE.dw; cbeIDE.rx = 0; cbeIDE.ry = cbeIDE.rh - 10; // Reference Window
59 cbeIDE.ax = cbeIDE.dw; cbeIDE.ay = 0; cbeIDE.aw = screen.availWidth - cbeIDE.dw - 10; cbeIDE.ah = screen.availHeight - 10; // Application Window
60 }
61 function cbeDebugUpdate() {
62 if (cbeDebugWin) { if (!cbeDebugWin.closed) setTimeout("cbeDebugUpdate()", 750); }
63 if (cbeDebugObj.cmdLine.length) { var tmp = cbeDebugObj.cmdLine; cbeDebugObj.cmdLine = ""; eval(tmp); }
64 cbeDebugObj.id = cbeDebugSelected.id;
65 cbeDebugObj.left = cbeDebugSelected.left();
66 cbeDebugObj.top = cbeDebugSelected.top();
67 cbeDebugObj.zIndex = cbeDebugSelected.zIndex();
68 cbeDebugObj.pageX = cbeDebugSelected.pageX();
69 cbeDebugObj.pageY = cbeDebugSelected.pageY();
70 cbeDebugObj.offsetLeft = cbeDebugSelected.offsetLeft();
71 cbeDebugObj.offsetTop = cbeDebugSelected.offsetTop();
72 cbeDebugObj.scrollLeft = cbeDebugSelected.scrollLeft();
73 cbeDebugObj.scrollTop = cbeDebugSelected.scrollTop();
74 cbeDebugObj.width = cbeDebugSelected.width();
75 cbeDebugObj.height = cbeDebugSelected.height();
76 cbeDebugObj.visibility = cbeDebugSelected.visibility();
77 cbeDebugObj.color = cbeDebugSelected.color();
78 cbeDebugObj.background = cbeDebugSelected.background();
79 cbeDebugObj.childNodes = cbeDebugSelected.childNodes;
80 cbeDebugObj.firstChild = cbeDebugSelected.firstChild ? cbeDebugSelected.firstChild.id : null;
81 cbeDebugObj.lastChild = cbeDebugSelected.lastChild ? cbeDebugSelected.lastChild.id : null;
82 cbeDebugObj.parentNode = cbeDebugSelected.parentNode ? cbeDebugSelected.parentNode.id : null;
83 cbeDebugObj.previousSibling = cbeDebugSelected.previousSibling ? cbeDebugSelected.previousSibling.id : null;
84 cbeDebugObj.nextSibling = cbeDebugSelected.nextSibling ? cbeDebugSelected.nextSibling.id : null;
85 }
86 function cbeDebugMsg(sMsg) { if (cbeDebugWin) { if (!cbeDebugWin.closed) { cbeDebugWin.setMsg(sMsg); } } }
87 function cbeShowProps(obj, obj_name, showValues) {
88 var i = null, win = null, result = "", objType = "", objValue = " ";
89 if (!obj) { alert("obj is null"); return; }
90 if (!obj_name) { if (obj.nodeName) obj_name = obj.nodeName; else obj_name = "this"; }
91 result = "<head><title>Property Viewer</title>\n" +"</head>\n" +"<body bgcolor='#bbbbbb'>\n" +"<form>\n" +"<input type='button' value='Close' onclick='window.close()'>\n" +"</form>\n" +"<h3>" + obj_name + " Properties:</h3>\n" +"<table border='1' bgcolor='#eeeeee'><tr><th>Property</th><th>Type</th><th>Value</th></tr>\n";
92 for (i in obj) {
93 objType = typeof(obj[i]);
94 if (showValues) {
95 if (objType.indexOf('string') != -1 && obj[i] == "") objValue = "&nbsp;";
96 else if (objType.indexOf('object') != -1) objValue = "...";
97 else if (objType.indexOf('function') != -1) objValue = "...";
98 else if (i.indexOf('HTML') != -1) objValue = "...";
99 else if (i.indexOf('erText') != -1) objValue = "...";
100 else if (i.indexOf('domain') != -1) objValue = "...";
101 else {objValue = obj[i];}
102 }
103 result += "<tr><td>" + obj_name + "." + i + "</td><td>" + objType + "</td><td>" + objValue + "</td></tr>\n";
104 }
105 result += "</table><br>" +"<form>\n" +"<input type='button' value='Close' onclick='window.close()'>\n" +"</form>\n" +"</body></html>";
106 var features = "width=600,height=440,scrollbars=1,resizable=1";
107 if (document.layers) features += ",screenX=0,screenY=0";
108 else features += ",left=0,top=0";
109 win = window.open("", "PropertyViewerWindow", features); win.document.write(result); win.document.close();
110 return false;
111 }
112 function cbeShowParentChain(child) {
113 var s = "", parent = child;
114 while (parent) {
115 s += "id: "
116 + (parent.id || "null")
117 + " tag: " + (parent.tagName || parent.nodeName || "null")
118 + "\n";
119 parent = cbeGetParentElement(parent);
120 }
121 alert(s);
122 }
123 var cbeDebugJsLoaded = true;
124 // End cbe_debug.js

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed