1
|
//\/////
|
2
|
|
3
|
//\ overLIB Debug Plugin
|
4
|
|
5
|
//\ This file requires overLIB 4.10 or later.
|
6
|
|
7
|
//\
|
8
|
|
9
|
//\ overLIB 4.05 - You may not remove or change this notice.
|
10
|
|
11
|
//\ Copyright Erik Bosrup 1998-2003. All rights reserved.
|
12
|
|
13
|
//\ Contributors are listed on the homepage.
|
14
|
|
15
|
//\ See http://www.bosrup.com/web/overlib/ for details.
|
16
|
|
17
|
// $Revision$ $Date$
|
18
|
|
19
|
//
|
20
|
|
21
|
//\/////
|
22
|
|
23
|
//\mini
|
24
|
|
25
|
////////
|
26
|
|
27
|
// PRE-INIT
|
28
|
|
29
|
// Ignore these lines, configuration is below.
|
30
|
|
31
|
////////
|
32
|
|
33
|
if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Debug Plugin.');
|
34
|
|
35
|
else {
|
36
|
|
37
|
var olZindex;
|
38
|
|
39
|
registerCommands('allowdebug');
|
40
|
|
41
|
////////
|
42
|
|
43
|
// PLUGIN FUNCTIONS
|
44
|
|
45
|
////////
|
46
|
|
47
|
// Parses Debug Parameters
|
48
|
|
49
|
function parseDebugExtras(pf, i, ar) {
|
50
|
|
51
|
var k = i, v;
|
52
|
|
53
|
|
54
|
|
55
|
if (k < ar.length) {
|
56
|
|
57
|
if (ar[k] == ALLOWDEBUG) { v = ar[k + 1]; if(typeof v == 'string') {v = ar[++k]; if (pf != 'ol_') setCanShowParm(v);} return k; }
|
58
|
|
59
|
}
|
60
|
|
61
|
|
62
|
|
63
|
return -1;
|
64
|
|
65
|
}
|
66
|
|
67
|
// Debug main routine
|
68
|
|
69
|
function showProperties() {
|
70
|
|
71
|
var args = showProperties.arguments, sho, shoObj, vis, lvl = 0, istrt = 0, theDiv = 'showProps', txt = '';
|
72
|
|
73
|
|
74
|
|
75
|
if (args.length == 0) return;
|
76
|
|
77
|
if (args.length % 2 && typeof args[0] == 'string') {
|
78
|
|
79
|
istrt = 1;
|
80
|
|
81
|
theDiv = args[0];
|
82
|
|
83
|
}
|
84
|
|
85
|
|
86
|
|
87
|
sho = createDivContainer(theDiv);
|
88
|
|
89
|
|
90
|
|
91
|
if (olNs4) {
|
92
|
|
93
|
shoObj = sho;
|
94
|
|
95
|
txt += '<table cellpadding="1" cellspacing="0" border="0" bgcolor="#000000"><tr><td>';
|
96
|
|
97
|
} else {
|
98
|
|
99
|
with(sho.style) {
|
100
|
|
101
|
backgroundColor = '#ffffcc';
|
102
|
|
103
|
padding = '5px';
|
104
|
|
105
|
border = '1px #000000 solid';
|
106
|
|
107
|
}
|
108
|
|
109
|
shoObj = sho.style;
|
110
|
|
111
|
}
|
112
|
|
113
|
|
114
|
|
115
|
lvl = getLayerLevel(theDiv);
|
116
|
|
117
|
|
118
|
|
119
|
if(typeof sho.position == 'undefined') {
|
120
|
|
121
|
sho.position = new Pagelocation(10 + lvl*20, 10, 1);
|
122
|
|
123
|
if(typeof olZindex == 'undefined') olZindex = getDivZindex();
|
124
|
|
125
|
shoObj.zIndex = olZindex + 1 + lvl;
|
126
|
|
127
|
}
|
128
|
|
129
|
|
130
|
|
131
|
txt += '<table cellpadding="5" border="0" cellspacing="0"' + (olNs4 ? ' bgcolor="#ffffcc"' : '') + '>';
|
132
|
|
133
|
txt += '<tr><td><strong><A HREF="javascript:moveToBack(\'' + theDiv + '\');" title="Move to back">' + theDiv + '</A></strong></td><td align="RIGHT"><strong><a href="javascript:closeLayer(\'' + theDiv + '\');" TITLE="Close Layer' + (!olNs4 ? '" style="background-color: #CCCCCC; border:2px #333369 outset; padding: 2px;' : '') + '">X</a></strong></td></tr>';
|
134
|
|
135
|
txt += '<tr><td style="text-decoration: underline;"><strong>Item</strong></td><td style="text-decoration: underline;"><strong>Value</strong></td></tr>';
|
136
|
|
137
|
for (var i = istrt; i<args.length-1; i++)
|
138
|
|
139
|
txt += '<tr><td align="right"><strong>' + args[i] + ': </strong></td><td>' + args[++i] + '</td></tr>';
|
140
|
|
141
|
txt += '</table>' + (olNs4 ? '</td></tr></table>' : '');
|
142
|
|
143
|
|
144
|
|
145
|
if (olNs4) {
|
146
|
|
147
|
sho.document.open();
|
148
|
|
149
|
sho.document.write(txt);
|
150
|
|
151
|
sho.document.close();
|
152
|
|
153
|
} else {
|
154
|
|
155
|
if(olIe5&&isMac) sho.innerHTML = '';
|
156
|
|
157
|
sho.innerHTML = txt;
|
158
|
|
159
|
}
|
160
|
|
161
|
|
162
|
|
163
|
showAllVisibleLayers();
|
164
|
|
165
|
}
|
166
|
|
167
|
function getLayerLevel(lyr) {
|
168
|
|
169
|
var i = 0;
|
170
|
|
171
|
|
172
|
|
173
|
if (typeof document.popups == 'undefined') {
|
174
|
|
175
|
document.popups = new Array(lyr);
|
176
|
|
177
|
} else {
|
178
|
|
179
|
var l = document.popups;
|
180
|
|
181
|
for (var i = 0; i<l.length; i++) if (lyr == l[i]) break;
|
182
|
|
183
|
if(i == l.length) l[l.length++] = lyr;
|
184
|
|
185
|
}
|
186
|
|
187
|
|
188
|
|
189
|
return i;
|
190
|
|
191
|
}
|
192
|
|
193
|
function getDivZindex(id) {
|
194
|
|
195
|
var obj;
|
196
|
|
197
|
|
198
|
|
199
|
if(id == '' || id == null) id = 'overDiv';
|
200
|
|
201
|
|
202
|
|
203
|
obj = layerReference(id);
|
204
|
|
205
|
obj = (olNs4 ? obj : obj.style);
|
206
|
|
207
|
|
208
|
|
209
|
return obj.zIndex;
|
210
|
|
211
|
}
|
212
|
|
213
|
function setCanShowParm(debugID) {
|
214
|
|
215
|
var lyr, pLyr;
|
216
|
|
217
|
|
218
|
|
219
|
if(typeof debugID != 'string') return;
|
220
|
|
221
|
|
222
|
|
223
|
pLyr = debugID.split(',');
|
224
|
|
225
|
for(var i = 0; i<pLyr.length; i++) {
|
226
|
|
227
|
lyr = layerReference(pLyr[i]);
|
228
|
|
229
|
if(lyr != null && typeof lyr.position != 'undefined') lyr.position.canShow = 1;
|
230
|
|
231
|
}
|
232
|
|
233
|
}
|
234
|
|
235
|
function Pagelocation(x, y, canShow) {
|
236
|
|
237
|
this.x = x;
|
238
|
|
239
|
this.y = y;
|
240
|
|
241
|
this.canShow = (canShow == null) ? 0 : canShow;
|
242
|
|
243
|
}
|
244
|
|
245
|
function showAllVisibleLayers(){
|
246
|
|
247
|
var lyr, lyrObj, l = document.popups;
|
248
|
|
249
|
|
250
|
|
251
|
for (var i = 0; i<l.length; i++) {
|
252
|
|
253
|
lyr = layerReference(l[i]);
|
254
|
|
255
|
lyrObj = (olNs4 ? lyr : lyr.style);
|
256
|
|
257
|
if(lyr.position.canShow) {
|
258
|
|
259
|
positionLayer(lyrObj, lyr.position.x, lyr.position.y);
|
260
|
|
261
|
lyrObj.visibility = 'visible';
|
262
|
|
263
|
}
|
264
|
|
265
|
}
|
266
|
|
267
|
}
|
268
|
|
269
|
function positionLayer(Obj, x, y) { // Obj is obj.style for IE/NS6+ but obj for NS4
|
270
|
|
271
|
Obj.left = x + (olIe4 ? eval(docRoot + '.scrollLeft') : window.pageXOffset) + (olNs4 ? 0 : 'px');
|
272
|
|
273
|
Obj.top = y + (olIe4 ? eval(docRoot + '.scrollTop') : window.pageYOffset) + (olNs4 ? 0 : 'px');
|
274
|
|
275
|
}
|
276
|
|
277
|
function closeLayer(lyrID) {
|
278
|
|
279
|
var lyr = layerReference(lyrID);
|
280
|
|
281
|
|
282
|
|
283
|
lyr.position.canShow = 0;
|
284
|
|
285
|
lyr = (olNs4 ? lyr : lyr.style);
|
286
|
|
287
|
lyr.visibility = 'hidden';
|
288
|
|
289
|
}
|
290
|
|
291
|
function moveToBack(layer) {
|
292
|
|
293
|
var l = document.popups, lyr, obj, i, x = 10, y = 10, dx = 20, z = olZindex + 1;
|
294
|
|
295
|
|
296
|
|
297
|
if(l.length == 1) return;
|
298
|
|
299
|
|
300
|
|
301
|
lyr = layerReference(layer);
|
302
|
|
303
|
lyr.position.x = x;
|
304
|
|
305
|
lyr.position.y = y;
|
306
|
|
307
|
obj = (olNs4 ? lyr : lyr.style);
|
308
|
|
309
|
obj.zIndex = z;
|
310
|
|
311
|
|
312
|
|
313
|
for (i = 0; i<l.length; i++) {
|
314
|
|
315
|
if (layer == l[i]) continue;
|
316
|
|
317
|
lyr = layerReference(l[i]);
|
318
|
|
319
|
if(lyr.position.canShow == 0) continue;
|
320
|
|
321
|
obj = (olNs4 ? lyr : lyr.style);
|
322
|
|
323
|
obj.zIndex += 1;
|
324
|
|
325
|
lyr.position.x += dx;
|
326
|
|
327
|
lyr.position.y = y;
|
328
|
|
329
|
}
|
330
|
|
331
|
|
332
|
|
333
|
showAllVisibleLayers();
|
334
|
|
335
|
}
|
336
|
|
337
|
function rawTxt(txt) {
|
338
|
|
339
|
if (typeof txt != 'string') return;
|
340
|
|
341
|
return txt.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");
|
342
|
|
343
|
}
|
344
|
|
345
|
////////
|
346
|
|
347
|
// PLUGIN REGISTRATIONS
|
348
|
|
349
|
////////
|
350
|
|
351
|
registerCmdLineFunction(parseDebugExtras);
|
352
|
|
353
|
}
|