1/* 2 * Copyright (c) 2021. ComboStrap, Inc. and its affiliates. All Rights Reserved. 3 * 4 * This source code is licensed under the GPL license found in the 5 * COPYING file in the root directory of this source tree. 6 * 7 * @license GPL 3 (https://www.gnu.org/licenses/gpl-3.0.en.html) 8 * @author ComboStrap <support@combostrap.com> 9 * 10 */ 11 12var firebug = { 13 version:[1.231,20100118], 14 el:{}, 15 env:{ 16 "css":"https://getfirebug.com/releases/lite/1.2/firebug-lite.css", 17 "debug":true, 18 "detectFirebug":true, 19 "dIndex":"console", 20 "height":295, 21 "hideDOMFunctions":false, 22 "openInPopup": false, 23 "override":false, 24 "ml":false, 25 "showIconWhenHidden":true, 26 "popupTop":1, 27 "popupLeft":1, 28 "popupWidth":undefined, 29 "popupHeight":undefined, 30 "textNodeChars":0 31 }, 32 internal:{ 33 "cache":{}, 34 "extConsole":null, 35 "init":false, 36 "isPopup":false, 37 "liteFilename":null, 38 "minimized":false, 39 "popupWin":null, 40 "targetWindow":undefined 41 }, 42 initConsole:function(){ 43 /* 44 * initialize the console - user defined values are not available within this method because FBLite is not yet initialized 45 */ 46 var command; 47 try{ 48 if((!window.console || (window.console && !window.console.firebug)) || (firebug.env.override && !(/Firefox\/3/i.test(navigator.userAgent)))){ 49 window.console = { "provider":"Firebug Lite" }; 50 51 for(command in firebug.d.console.cmd){ 52 window.console[command] = firebug.lib.util.Curry(firebug.d.console.run,window,command); 53 }; 54 } 55 window.onerror = function(_message,_file,_line){ 56 firebug.d.console.run('error',firebug.lib.util.String.format('{0} ({1},{2})',_message,firebug.getFileName(_file),_line)); 57 }; 58 } catch(e){} 59 }, 60 overrideConsole:function(){ 61 with (firebug){ 62 env.override=true; 63 try{ 64 internal.extConsole=window.console; 65 } catch(e){} 66 initConsole(); 67 } 68 }, 69 restoreConsole:function(){ 70 with(firebug){ 71 if(internal.extConsole){ 72 env.override=false; 73 try{ 74 window.console=internal.extConsole; 75 } catch(e){} 76 internal.extConsole=null; 77 } 78 } 79 }, 80 init:function(_css){ 81 var i, 82 cssLoaded=false, 83 iconTitle = "Click here or press F12, (CTRL|CMD)+SHIFT+L or SHIFT+ENTER to show Firebug Lite. CTRL|CMD click this icon to hide it."; 84 85 with(firebug){ 86 if(document.getElementsByTagName('html')[0].attributes.getNamedItem('debug')){ 87 env.debug = document.getElementsByTagName('html')[0].attributes.getNamedItem('debug').nodeValue !== "false"; 88 } 89 90 if(internal.isPopup) { 91 env.openInPopup = false; 92 internal.targetWindow = window.opener; 93 env.popupWidth = window.opener.firebug.env.popupWidth || window.opener.firebug.lib.util.GetViewport().width; 94 env.popupHeight = window.opener.firebug.env.popupHeight || window.opener.firebug.lib.util.GetViewport().height; 95 } else { 96 internal.targetWindow = window; 97 env.popupWidth = env.popupWidth || lib.util.GetViewport().width; 98 env.popupHeight = env.popupHeight || lib.util.GetViewport().height; 99 } 100 101 settings.readCookie(); 102 103 if(internal.init || (env.detectFirebug && window.console && window.console.firebug)) { 104 return; 105 } 106 107 for(i=0;i<document.styleSheets.length;i++) { 108 if(/firebug-lite\.css/i.test(document.styleSheets[i].href)) { 109 cssLoaded=true; 110 break; 111 } 112 } 113 114 if(!cssLoaded){ 115 document.getElementsByTagName("head")[0].appendChild( 116 new lib.element("link").attribute.set("rel","stylesheet").attribute.set("type","text/css").attribute.set("href",env.css).element 117 ); 118 } 119 120 if(env.override){ 121 overrideConsole(); 122 } 123 124 /* 125 * Firebug Icon 126 */ 127 el.firebugIcon = new lib.element("div").attribute.set('firebugIgnore',true).attribute.set("id","firebugIconDiv").attribute.set("title",iconTitle).attribute.set("alt",iconTitle).event.addListener("mousedown",win.iconClicked).insert(document.body); 128 129 /* 130 * main interface 131 */ 132 el.content = {}; 133 el.mainiframe = new lib.element("IFRAME").attribute.set("id","FirebugIFrame").attribute.set('firebugIgnore',true).environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body); 134 el.main = new lib.element("DIV").attribute.set("id","Firebug").attribute.set('firebugIgnore',true).environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body); 135 if(!internal.isPopup){ 136 el.resizer = new lib.element("DIV").attribute.addClass("Resizer").event.addListener("mousedown",win.resizer.start).insert(el.main); 137 } 138 el.header = new lib.element("DIV").attribute.addClass("Header").insert(el.main); 139 el.left = {}; 140 el.left.container = new lib.element("DIV").attribute.addClass("Left").insert(el.main); 141 el.right = {}; 142 el.right.container = new lib.element("DIV").attribute.addClass("Right").insert(el.main); 143 el.main.child.add(new lib.element("DIV").attribute.addClass('Clear')); 144 145 /* 146 * buttons 147 */ 148 el.button = {}; 149 el.button.container = new lib.element("DIV").attribute.addClass("ButtonContainer").insert(el.header); 150 el.button.logo = new lib.element("A").attribute.set("title","Firebug Lite").attribute.set("target","_blank").attribute.set("href","http://getfirebug.com/lite.html").update(" ").attribute.addClass("Button Logo").insert(el.button.container); 151 el.button.inspect = new lib.element("A").attribute.addClass("Button").event.addListener("click",internal.targetWindow.firebug.d.inspector.toggle).update("Inspect").insert(el.button.container); 152 el.button.dock = new lib.element("A").attribute.addClass("Button Dock").event.addListener("click", win.dock).insert(el.button.container); 153 el.button.newWindow = new lib.element("A").attribute.addClass("Button NewWindow").event.addListener("click", win.newWindow).insert(el.button.container); 154 155 if(!internal.isPopup){ 156 el.button.maximize = new lib.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container); 157 el.button.minimize = new lib.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container); 158 el.button.close = new lib.element("A").attribute.addClass("Button Close").event.addListener("click",win.hide).insert(el.button.container); 159 } 160 161 if(lib.env.ie||lib.env.webkit){ 162 el.button.container.environment.addStyle({ "paddingTop":"12px" }); 163 } 164 165 /* 166 * navigation 167 */ 168 el.nav = {}; 169 el.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.left.container); 170 el.nav.console = new lib.element("A").attribute.addClass("Tab Selected").event.addListener("click",lib.util.Curry(d.navigate,window,"console")).update("Console").insert(el.nav.container); 171 el.nav.html = new lib.element("A").attribute.addClass("Tab").update("HTML").event.addListener("click",lib.util.Curry(d.navigate,window,"html")).insert(el.nav.container); 172 el.nav.css = new lib.element("A").attribute.addClass("Tab").update("CSS").event.addListener("click",lib.util.Curry(d.navigate,window,"css")).insert(el.nav.container); 173 if(!internal.isPopup){ 174 el.nav.scripts = new lib.element("A").attribute.addClass("Tab").update("Script").event.addListener("click",lib.util.Curry(d.navigate,window,"scripts")).insert(el.nav.container); 175 } 176 el.nav.dom = new lib.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",lib.util.Curry(d.navigate,internal.targetWindow,"dom")).insert(el.nav.container); 177 el.nav.xhr = new lib.element("A").attribute.addClass("Tab").update("XHR").event.addListener("click",lib.util.Curry(d.navigate,window,"xhr")).insert(el.nav.container); 178 el.nav.optionsdiv = new lib.element("DIV").attribute.addClass("Settings").insert(el.nav.container); 179 el.nav.options = new lib.element("A").attribute.addClass("Tab Button Options").update("Options ").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv); 180 181 /* 182 * inspector 183 */ 184 el.borderInspector = new lib.element("DIV").attribute.set("id","FirebugBorderInspector").attribute.set('firebugIgnore',true).event.addListener("click",listen.inspector).insert(document.body); 185 el.bgInspector = new lib.element("DIV").attribute.set("id","FirebugBGInspector").attribute.set('firebugIgnore',true).insert(document.body); 186 187 /* 188 * console 189 */ 190 el.left.console = {}; 191 el.left.console.container = new lib.element("DIV").attribute.addClass("Console").insert(el.left.container); 192 el.left.console.mlButton = new lib.element("A").attribute.addClass("MLButton").event.addListener("click",d.console.toggleML).insert(el.left.console.container); 193 el.left.console.monitor = new lib.element("DIV").insert( 194 new lib.element("DIV").attribute.addClass("Monitor").insert(el.left.console.container) 195 ); 196 el.left.console.container.child.add( 197 new lib.element("DIV").attribute.addClass("InputArrow").update(">>>") 198 ); 199 el.left.console.input = new lib.element("INPUT").attribute.set("type","text").attribute.addClass("Input").event.addListener("keydown",listen.consoleTextbox).insert( 200 new lib.element("DIV").attribute.addClass("InputContainer").insert(el.left.console.container) 201 ); 202 203 el.right.console = {}; 204 el.right.console.container = new lib.element("DIV").attribute.addClass("Console Container").insert(el.right.container); 205 el.right.console.mlButton = new lib.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.console.container); 206 el.right.console.input = new lib.element("TEXTAREA").attribute.addClass("Input").insert(el.right.console.container); 207 el.right.console.input.event.addListener("keydown",lib.util.Curry(tab,window,el.right.console.input.element)); 208 el.right.console.run = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.runMultiline).update("Run").insert(el.right.console.container); 209 el.right.console.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.clean,window,el.right.console.input)).update("Clear").insert(el.right.console.container); 210 211 el.button.console = {}; 212 el.button.console.container = new lib.element("DIV").attribute.addClass("ButtonSet").insert(el.button.container); 213 el.button.console.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",d.console.clear).update("Clear").insert(el.button.console.container); 214 215 /* 216 * html 217 */ 218 219 el.left.html = {}; 220 el.left.html.container = new lib.element("DIV").attribute.addClass("HTML").insert(el.left.container); 221 222 el.right.html = {}; 223 el.right.html.container = new lib.element("DIV").attribute.addClass("HTML Container").insert(el.right.container); 224 225 el.right.html.nav = {}; 226 el.right.html.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.right.html.container); 227 el.right.html.nav.computedStyle = new lib.element("A").attribute.addClass("Tab Selected").event.addListener("click",lib.util.Curry(d.html.navigate,firebug,"computedStyle")).update("Computed Style").insert(el.right.html.nav.container); 228 el.right.html.nav.dom = new lib.element("A").attribute.addClass("Tab").event.addListener("click",lib.util.Curry(d.html.navigate,firebug,"dom")).update("DOM").insert(el.right.html.nav.container); 229 230 el.right.html.content = new lib.element("DIV").attribute.addClass("Content").insert(el.right.html.container); 231 232 el.button.html = {}; 233 el.button.html.container = new lib.element("DIV").attribute.addClass("ButtonSet HTML").insert(el.button.container); 234 235 /* 236 * css 237 */ 238 239 el.left.css = {}; 240 el.left.css.container = new lib.element("DIV").attribute.addClass("CSS").insert(el.left.container); 241 242 el.right.css = {}; 243 el.right.css.container = new lib.element("DIV").attribute.addClass("CSS Container").insert(el.right.container); 244 245 el.right.css.nav = {}; 246 el.right.css.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.right.css.container); 247 el.right.css.nav.runCSS = new lib.element("A").attribute.addClass("Tab Selected").update("Run CSS").insert(el.right.css.nav.container); 248 249 el.right.css.mlButton = new lib.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.css.container); 250 el.right.css.input = new lib.element("TEXTAREA").attribute.addClass("Input").insert(el.right.css.container); 251 el.right.css.input.event.addListener("keydown",lib.util.Curry(firebug.tab,window,el.right.css.input.element)); 252 el.right.css.run = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.runCSS).update("Run").insert(el.right.css.container); 253 el.right.css.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.clean,window,el.right.css.input)).update("Clear").insert(el.right.css.container); 254 255 el.button.css = {}; 256 el.button.css.container = new lib.element("DIV").attribute.addClass("ButtonSet CSS").insert(el.button.container); 257 el.button.css.selectbox = new lib.element("SELECT").event.addListener("change",listen.cssSelectbox).insert(el.button.css.container); 258 259 /* 260 * scripts 261 */ 262 263 el.left.scripts = {}; 264 el.left.scripts.container = new lib.element("DIV").attribute.addClass("Scripts").insert(el.left.container); 265 266 el.right.scripts = {}; 267 el.right.scripts.container = new lib.element("DIV").attribute.addClass("Scripts Container").insert(el.right.container); 268 269 el.button.scripts = {}; 270 el.button.scripts.container = new lib.element("DIV").attribute.addClass("ButtonSet Scripts").insert(el.button.container); 271 el.button.scripts.selectbox = new lib.element("SELECT").event.addListener("change",listen.scriptsSelectbox).insert(el.button.scripts.container); 272 el.button.scripts.lineNumbers = new lib.element("A").attribute.addClass("Button").event.addListener("click",d.scripts.toggleLineNumbers).update("Show Line Numbers").insert(el.button.scripts.container); 273 274 /* 275 * dom 276 */ 277 278 el.left.dom = {}; 279 el.left.dom.container = new lib.element("DIV").attribute.addClass("DOM").insert(el.left.container); 280 281 el.right.dom = {}; 282 el.right.dom.container = new lib.element("DIV").attribute.addClass("DOM Container").insert(el.right.container); 283 284 el.button.dom = {}; 285 el.button.dom.container = new lib.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container); 286 el.button.dom.label = new lib.element("LABEL").update("Object Path:").insert(el.button.dom.container); 287 el.button.dom.textbox = new lib.element("INPUT").event.addListener("keydown",listen.domTextbox).update(internal.isPopup?"window.opener":"window").insert(el.button.dom.container); 288 289 /* 290 * str 291 */ 292 el.left.str = {}; 293 el.left.str.container = new lib.element("DIV").attribute.addClass("STR").insert(el.left.container); 294 295 el.right.str = {}; 296 el.right.str.container = new lib.element("DIV").attribute.addClass("STR").insert(el.left.container); 297 298 el.button.str = {}; 299 el.button.str.container = new lib.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container); 300 el.button.str.watch = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.navigate,window,"xhr")).update("Back").insert(el.button.str.container); 301 302 /* 303 * xhr 304 */ 305 el.left.xhr = {}; 306 el.left.xhr.container = new lib.element("DIV").attribute.addClass("XHR").insert(el.left.container); 307 308 el.right.xhr = {}; 309 el.right.xhr.container = new lib.element("DIV").attribute.addClass("XHR").insert(el.left.container); 310 311 312 el.button.xhr = {}; 313 el.button.xhr.container = new lib.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container); 314 el.button.xhr.label = new lib.element("LABEL").update("XHR Path:").insert(el.button.xhr.container); 315 el.button.xhr.textbox = new lib.element("INPUT").event.addListener("keydown",listen.xhrTextbox).insert(el.button.xhr.container); 316 el.button.xhr.watch = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.addXhrObject).update("Watch").insert(el.button.xhr.container); 317 318 /* 319 * settings 320 */ 321 el.settings = {}; 322 el.settings.container = new lib.element("DIV").child.add( 323 new lib.element("DIV").attribute.addClass("Header").child.add( 324 new lib.element().attribute.addClass("Title").update('Firebug Lite Settings') 325 ) 326 ).attribute.addClass("SettingsDiv").insert(el.main); 327 el.settings.content = new lib.element("DIV").attribute.addClass("Content").insert(el.settings.container); 328 el.settings.progressDiv = new lib.element("DIV").attribute.addClass("ProgressDiv").insert(el.settings.content); 329 el.settings.progress = new lib.element("DIV").attribute.addClass("Progress").insert(el.settings.progressDiv); 330 el.settings.cbxDebug = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 331 el.settings.content.child.add(document.createTextNode("Start visible")); 332 new lib.element("BR").insert(el.settings.content); 333 el.settings.cbxDetectFirebug = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 334 el.settings.content.child.add(document.createTextNode("Hide when Firebug active")); 335 new lib.element("BR").insert(el.settings.content); 336 el.settings.cbxHideDOMFunctions = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 337 el.settings.content.child.add(document.createTextNode("Hide DOM functions")); 338 new lib.element("BR").insert(el.settings.content); 339 el.settings.cbxOverride = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 340 el.settings.content.child.add(document.createTextNode("Override window.console")); 341 new lib.element("BR").insert(el.settings.content); 342 el.settings.cbxShowIcon = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 343 el.settings.content.child.add(document.createTextNode("Show icon when hidden")); 344 new lib.element("BR").insert(el.settings.content); 345 el.settings.cbxOpenInPopup = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 346 el.settings.content.child.add(document.createTextNode("Open in popup")); 347 new lib.element("BR").insert(el.settings.content); 348 el.settings.content.child.add(document.createTextNode("Trim textnode to ")); 349 el.settings.textNodeChars = new lib.element("INPUT").attribute.set("type","text").attribute.addClass("SettingsTextbox").insert(el.settings.content); 350 el.settings.content.child.add(document.createTextNode(" chars")); 351 el.settings.buttonDiv = new lib.element("DIV").insert(el.settings.content); 352 el.settings.buttonLeftDiv = new lib.element("DIV").attribute.addClass("ButtonsLeft").insert(el.settings.buttonDiv); 353 el.settings.resetButton = new lib.element("INPUT").attribute.set("type","button").update("Reset").event.addListener("click",settings.reset).insert(el.settings.buttonLeftDiv); 354 el.settings.buttonRightDiv = new lib.element("DIV").attribute.addClass("ButtonsRight").insert(el.settings.buttonDiv); 355 el.settings.cancelButton = new lib.element("INPUT").attribute.set("type","button").update("Cancel").event.addListener("click",settings.hide).insert(el.settings.buttonRightDiv); 356 el.settings.buttonRightDiv.child.add(document.createTextNode(" ")); 357 el.settings.saveButton = new lib.element("INPUT").attribute.set("type","button").update("Save").event.addListener("click",settings.saveClicked).insert(el.settings.buttonRightDiv); 358 359 lib.util.AddEvent(document,"mousemove",listen.mouse)("mousemove",win.resizer.resize)("mouseup",win.resizer.stop)("keydown",listen.keyboard); 360 361 internal.init = true; 362 363 for(var i=0, len=d.console.cache.length; i<len; i++){ 364 var item = d.console.cache[i]; 365 d.console.cmd[item.command].apply(window,item.arg); 366 }; 367 368 if(lib.env.ie6){ 369 window.onscroll = lib.util.Curry(win.setVerticalPosition,window,null); 370 var buttons = [ 371 el.button.inspect, 372 el.button.close, 373 el.button.inspect, 374 el.button.console.clear, 375 el.right.console.run, 376 el.right.console.clear, 377 el.right.css.run, 378 el.right.css.clear 379 ]; 380 for(var i=0, len=buttons.length; i<len; i++) 381 buttons[i].attribute.set("href","#"); 382 win.refreshSize(); 383 } 384 385 if(env.showIconWhenHidden) { 386 if(!internal.popupWin) { 387 el.firebugIcon.environment.addStyle({ "display": env.debug&&'none'||'block' }); 388 } 389 } 390 391 lib.util.AddEvent(window, "unload", win.unload); 392 393 if (internal.isPopup) { 394 env.height=lib.util.GetViewport().height; 395 lib.util.AddEvent(window, "resize", win.fitToPopup); 396 win.fitToPopup(); 397 } else { 398 lib.util.AddEvent(window, "resize", win.refreshSize); 399 } 400 401 win.setHeight(env.height); 402 403 if(env.openInPopup&&!internal.isPopup) { 404 win.newWindow(); 405 } else { 406 el.main.environment.addStyle({ "display":env.debug&&'block'||'none' }); 407 el.mainiframe.environment.addStyle({ "display":env.debug&&'block'||'none' }); 408 } 409 } 410 }, 411 inspect:function(){ 412 return firebug.d.html.inspect.apply(window,arguments); 413 }, 414 watchXHR:function(){ 415 with(firebug){ 416 d.xhr.addObject.apply(window,arguments); 417 if(env.dIndex!="xhr"){ 418 d.navigate("xhr"); 419 } 420 } 421 }, 422 settings:{ 423 isVisible:false, 424 show: function() { 425 with(firebug){ 426 var posXY=lib.util.Element.getPosition(firebug.el.nav.options.element); 427 settings.refreshForm(); 428 429 el.settings.container.environment.addStyle({ 430 "display": "block", 431 "left": (posXY.offsetLeft-107)+"px" 432 }); 433 el.settings.progressDiv.environment.addStyle({ 434 "display": "none" 435 }); 436 firebug.settings.isVisible = true; 437 } 438 }, 439 hide: function() { 440 with(firebug){ 441 firebug.el.settings.container.environment.addStyle({ 442 "display": "none" 443 }); 444 firebug.settings.isVisible = false; 445 } 446 }, 447 toggle: function(){ 448 with(firebug){ 449 settings[!settings.isVisible && 'show' || 'hide'](); 450 } 451 }, 452 saveClicked: function() { 453 firebug.el.settings.progressDiv.environment.addStyle({ 454 "display": "block" 455 }); 456 setTimeout(firebug.settings.formToSettings,0); 457 }, 458 formToSettings: function() { 459 var fe=firebug.env, 460 ofe, 461 elSet=firebug.el.settings, 462 exdate; 463 464 fe.debug=elSet.cbxDebug.element.checked; 465 fe.detectFirebug=elSet.cbxDetectFirebug.element.checked; 466 fe.hideDOMFunctions=elSet.cbxHideDOMFunctions.element.checked; 467 fe.override=elSet.cbxOverride.element.checked; 468 fe.showIconWhenHidden=elSet.cbxShowIcon.element.checked; 469 fe.openInPopup=elSet.cbxOpenInPopup.element.checked; 470 471 if(isFinite(elSet.textNodeChars.element.value)&&elSet.textNodeChars.element.value>0) { 472 fe.textNodeChars=elSet.textNodeChars.element.value; 473 } else { 474 fe.textNodeChars=0; 475 } 476 477 if(firebug.internal.isPopup) { 478 window.opener.firebug.env = firebug.lib.util.Hash.clone(fe); 479 } 480 481 with(firebug) { 482 settings.writeCookie(); 483 settings.hide(); 484 win.refreshDOM(); 485 d.html.openHtmlTree(); 486 if(internal.isPopup) { 487 with(opener.firebug) { 488 win.refreshDOM(); 489 d.html.openHtmlTree(); 490 } 491 } 492 } 493 }, 494 reset: function() { 495 var exdate=new Date(); 496 497 exdate.setTime(exdate.getTime()-1); 498 document.cookie='FBLiteSettings=;expires='+exdate.toGMTString(); 499 location.reload(true); 500 }, 501 readCookie: function() { 502 var i,cookieArr,valueArr,item,value; 503 504 with(firebug.env){ 505 if(firebug.internal.targetWindow.document.cookie.length>0) { 506 cookieArr=firebug.internal.targetWindow.document.cookie.split('; '); 507 508 for(i=0;i<cookieArr.length;i++) { 509 if(cookieArr[i].split('=')[0]=='FBLiteSettings') { 510 valueArr=cookieArr[i].split('=')[1].split(','); 511 } 512 } 513 514 if(valueArr) { 515 for(i=0;i<valueArr.length;i++) { 516 item=valueArr[i].split(':')[0]; 517 value=valueArr[i].split(':')[1]; 518 519 switch(item) { 520 case 'debug': 521 debug=value=="true"; 522 break; 523 case 'detectFirebug': 524 detectFirebug=value=="true"; 525 break; 526 case 'hideDOMFunctions': 527 hideDOMFunctions=value=="true"; 528 break; 529 case 'override': 530 override=value=="true"; 531 break; 532 case 'showIconWhenHidden': 533 showIconWhenHidden=value=="true"; 534 break; 535 case 'openInPopup': 536 openInPopup=value=="true"; 537 break; 538 case 'textNodeChars': 539 textNodeChars=isFinite(value)?parseInt(value,10):0; 540 break; 541 case 'popupTop': 542 popupTop=parseInt(value,10); 543 break; 544 case 'popupLeft': 545 popupLeft=parseInt(value,10); 546 break; 547 case 'popupWidth': 548 popupWidth=parseInt(value,10); 549 break; 550 case 'popupHeight': 551 popupHeight=parseInt(value,10); 552 break; 553 case 'height': 554 height=parseInt(value,10); 555 break; 556 } 557 } 558 } 559 } 560 } 561 }, 562 writeCookie: function() { 563 var values; 564 565 with(firebug.env){ 566 values='debug:'+debug+','; 567 values+='detectFirebug:'+detectFirebug+','; 568 values+='hideDOMFunctions:'+hideDOMFunctions+','; 569 values+='override:'+override+','; 570 values+='showIconWhenHidden:'+showIconWhenHidden+','; 571 values+='openInPopup:'+openInPopup+','; 572 values+='textNodeChars:'+textNodeChars+','; 573 574 if(firebug.internal.isPopup) { 575 if(window.outerWidth===undefined) { 576 values+='popupTop:'+(window.screenTop-56)+','; 577 values+='popupLeft:'+(window.screenLeft-8)+','; 578 values+='popupWidth:'+document.body.clientWidth+','; 579 values+='popupHeight:'+document.body.clientHeight+','; 580 } else { 581 values+='popupTop:'+window.screenY+','; 582 values+='popupLeft:'+window.screenX+','; 583 values+='popupWidth:'+window.outerWidth+','; 584 values+='popupHeight:'+window.outerHeight+','; 585 } 586 } else { 587 values+='popupTop:'+popupTop+','; 588 values+='popupLeft:'+popupLeft+','; 589 values+='popupWidth:'+popupWidth+','; 590 values+='popupHeight:'+popupHeight+','; 591 } 592 593 values+='height:'+(parseInt(firebug.internal.targetWindow.firebug.el.main.element.style.height.replace(/px/,''),10)-38); 594 595 exdate=new Date(); 596 exdate.setDate(exdate.getDate()+365); 597 firebug.internal.targetWindow.document.cookie='FBLiteSettings='+values+';expires='+exdate.toGMTString(); 598 } 599 }, 600 refreshForm: function() { 601 var fe=firebug.env, 602 elSet=firebug.el.settings; 603 604 elSet.cbxDebug.element.checked=fe.debug; 605 elSet.cbxDetectFirebug.element.checked=fe.detectFirebug; 606 elSet.cbxHideDOMFunctions.element.checked=fe.hideDOMFunctions; 607 elSet.cbxOverride.element.checked=fe.override; 608 elSet.cbxShowIcon.element.checked=fe.showIconWhenHidden; 609 elSet.cbxOpenInPopup.element.checked=fe.openInPopup; 610 elSet.textNodeChars.element.value=fe.textNodeChars; 611 } 612 }, 613 win:{ 614 hide:function(){ 615 with(firebug){ 616 el.main.environment.addStyle({ 617 "display": "none" 618 }); 619 el.mainiframe.environment.addStyle({ 620 "display": "none" 621 }); 622 if(env.showIconWhenHidden) { 623 el.firebugIcon.environment.addStyle({ 624 "display": "block" 625 }); 626 } 627 } 628 }, 629 show:function(){ 630 with(firebug){ 631 el.main.environment.addStyle({ 632 "display": "block" 633 }); 634 el.mainiframe.environment.addStyle({ 635 "display": "block" 636 }); 637 if(env.showIconWhenHidden) { 638 el.firebugIcon.environment.addStyle({ 639 "display": "none" 640 }); 641 } 642 } 643 }, 644 iconClicked:function(_event) { 645 with(firebug) { 646 if(_event.ctrlKey==true||_event.metaKey==true) { 647 el.firebugIcon.environment.addStyle({ "display": "none" }); 648 env.showIconWhenHidden=false; 649 } else { 650 win.show(); 651 } 652 } 653 }, 654 minimize:function(){ 655 with(firebug){ 656 internal.minimized=true; 657 el.main.environment.addStyle({ "height":"35px" }); 658 el.mainiframe.environment.addStyle({ "height":"35px" }); 659 el.button.maximize.environment.addStyle({ "display":"block" }); 660 el.button.minimize.environment.addStyle({ "display":"none" }); 661 win.refreshSize(); 662 } 663 }, 664 maximize:function(){ 665 with(firebug){ 666 internal.minimized=false; 667 el.button.minimize.environment.addStyle({ "display":"block" }); 668 el.button.maximize.environment.addStyle({ "display":"none" }); 669 win.setHeight(env.height); 670 } 671 }, 672 newWindow: function() { 673 var interval,scripts,script,scriptPath, 674 fe=firebug.env, 675 fi=firebug.internal; 676 677 if (!fi.popupWin) { 678 scripts = document.getElementsByTagName('script'); 679 680 fi.popupWin = window.open("", "_firebug", 681 "status=0,menubar=0,resizable=1,top="+fe.popupTop+",left="+fe.popupLeft+",width=" + fe.popupWidth + 682 ",height=" + fe.popupHeight + ",scrollbars=0,addressbar=0,outerWidth="+fe.popupWidth+",outerHeight="+fe.popupHeight+ 683 "toolbar=0,location=0,directories=0,dialog=0"); 684 685 if(!fi.popupWin) { 686 alert("Firebug Lite could not open a pop-up window, most likely because of a popup blocker.\nPlease enable popups for this domain"); 687 } else { 688 firebug.settings.hide(); 689 690 for (i=0,len=scripts.length; i<len; i++) { 691 if (scripts[i].src.indexOf(fi.liteFilename) > -1) { 692 scriptPath = scripts[i].src; 693 break; 694 } 695 } 696 697 if (scriptPath) { 698 done = false; 699 script = fi.popupWin.document.createElement('script'); 700 script.type = 'text/javascript'; 701 script.src = scriptPath; 702 703 script[firebug.lib.env.ie?"onreadystatechange":"onload"] = function(){ 704 if(!done && (!firebug.lib.env.ie || this.readyState == "complete" || this.readyState=="loaded")){ 705 done = true; 706 if(fi.popupWin.firebug) { 707 with(fi.popupWin.firebug) { 708 internal.isPopup = true; 709 env.css = fe.css; 710 init(); 711 el.button.dock.environment.addStyle({ "display": "block"}); 712 el.button.newWindow.environment.addStyle({ "display": "none"}); 713 } 714 } 715 } 716 }; 717 718 if (!done && firebug.lib.env.webkit) { 719 interval = setInterval(function() { 720 if (firebug.internal.popupWin.firebug) { 721 clearInterval(interval); 722 done = true; 723 with(firebug.internal.popupWin.firebug) { 724 internal.isPopup = true; 725 env.css = fe.css; 726 init(); 727 el.button.dock.environment.addStyle({ "display": "block"}); 728 el.button.newWindow.environment.addStyle({ "display": "none"}); 729 } 730 } 731 }, 10); 732 }; 733 734 if(!firebug.lib.env.ie) { 735 firebug.internal.popupWin.document.write('<html><head><title>Firebug Lite - '+document.location.href+'</title></head><body></body></html>'); 736 } 737 if (!done) { 738 firebug.internal.popupWin.document.getElementsByTagName('head')[0].appendChild(script); 739 firebug.el.main.environment.addStyle({"display": "none"}); 740 firebug.el.mainiframe.environment.addStyle({"display": "none"}); 741 } 742 } else { 743 alert("Unable to detect the following script \"" + firebug.internal.liteFilename + 744 "\" ... if the script has been renamed then please set the value of firebug.internal.liteFilename to reflect this change"); 745 firebug.internal.popupWin.close(); 746 firebug.internal.popupWin=null; 747 } 748 } 749 } 750 }, 751 dock: function() { 752 with(opener.firebug) { 753 internal.popupWin = null; 754 el.main.environment.addStyle({ 755 "display": "block" 756 }); 757 el.mainiframe.environment.addStyle({ 758 "display": "block" 759 }); 760 settings.readCookie(); 761 window.close(); 762 }; 763 }, 764 unload: function() { 765 with(firebug){ 766 if(internal.isPopup) { 767 win.dock(); 768 } else if(internal.popupWin) { 769 internal.popupWin.close(); 770 } 771 } 772 }, 773 fitToPopup: function() { 774 with(firebug) { 775 var viewport = lib.util.GetViewport(window); 776 win.setHeight((window.innerHeight||viewport.height) - 38); 777 el.main.environment.addStyle({ 778 "width": (viewport.width) + "px" 779 }); 780 el.mainiframe.environment.addStyle({ 781 "width": (viewport.width) + "px" 782 }); 783 } 784 }, 785 resizer:{ 786 y:[], enabled:false, 787 start:function(_event){ 788 with(firebug){ 789 if(internal.minimized)return; 790 win.resizer.y=[el.main.element.offsetHeight,_event.clientY]; 791 if(lib.env.ie6){ 792 win.resizer.y[3]=parseInt(el.main.environment.getPosition().top); 793 } 794 win.resizer.enabled=true; 795 } 796 }, 797 resize:function(_event){ 798 with(firebug){ 799 if(!win.resizer.enabled)return; 800 win.resizer.y[2]=(win.resizer.y[0]+(win.resizer.y[1]-_event.clientY)); 801 el.main.environment.addStyle({ "height":win.resizer.y[2]+"px" }); 802 el.mainiframe.environment.addStyle({ "height":win.resizer.y[2]+"px" }); 803 if(lib.env.ie6){ 804 el.main.environment.addStyle({ "top":win.resizer.y[3]-(win.resizer.y[1]-_event.clientY)+"px" }); 805 el.mainiframe.environment.addStyle({ "top":win.resizer.y[3]-(win.resizer.y[1]-_event.clientY)+"px" }); 806 } 807 } 808 }, 809 stop:function(_event){ 810 with(firebug){ 811 if(win.resizer.enabled){ 812 win.resizer.enabled=false; 813 win.setHeight(win.resizer.y[2]-35); 814 } 815 } 816 } 817 }, 818 setHeight:function(_height){ 819 with(firebug){ 820 env.height=_height; 821 822 el.left.container.environment.addStyle({ "height":_height+"px" }); 823 el.right.container.environment.addStyle({ "height":_height+"px" }); 824 el.main.environment.addStyle({ "height":_height+38+"px" }); 825 el.mainiframe.environment.addStyle({ "height":_height+38+"px" }); 826 827 win.refreshSize(); 828 829 // console 830 el.left.console.monitor.element.parentNode.style.height=_height-47+"px"; 831 el.left.console.mlButton.environment.addStyle({ "top":_height+19+"px" }); 832 el.right.console.mlButton.environment.addStyle({ "top":_height+19+"px" }); 833 el.right.console.input.environment.addStyle({ "height":_height-29+"px" }); 834 835 // html 836 el.left.html.container.environment.addStyle({"height":_height-23+"px"}); 837 el.right.html.content.environment.addStyle({"height":_height-23+"px"}); 838 839 // css 840 el.left.css.container.environment.addStyle({"height":_height-33+"px"}); 841 el.right.css.input.environment.addStyle({ "height":_height-55+"px" }); 842 843 // script 844 el.left.scripts.container.environment.addStyle({"height":_height-23+"px"}); 845 846 // dom 847 el.left.dom.container.environment.addStyle({"height":_height-31+"px"}); 848 849 // xhr 850 el.left.xhr.container.environment.addStyle({"height":_height-32+"px"}); 851 852 // string 853 el.left.str.container.environment.addStyle({"height":_height-32+"px"}); 854 } 855 }, 856 refreshDOM:function(){ 857 with(firebug){ 858 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container); 859 if(d.html.nIndex=="dom"){ 860 firebug.d.html.navigate("dom") 861 } 862 } 863 }, 864 refreshSize:function(){ 865 with(firebug){ 866 if(!internal.init) 867 return; 868 869 var dim = lib.util.GetViewport(); 870 el.main.environment.addStyle({ "width":dim.width+"px"}); 871 el.mainiframe.environment.addStyle({ "width":dim.width+"px"}); 872 if(lib.env.ie6) 873 win.setVerticalPosition(dim); 874 } 875 }, 876 setVerticalPosition:function(_dim,_event){ 877 with(firebug){ 878 var dim = _dim||lib.util.GetViewport(); 879 el.main.environment.addStyle({ "top":dim.height-el.main.environment.getSize().offsetHeight+Math.max(document.documentElement.scrollTop,document.body.scrollTop)+"px" }); 880 el.mainiframe.environment.addStyle({ "top":dim.height-el.main.environment.getSize().offsetHeight+Math.max(document.documentElement.scrollTop,document.body.scrollTop)+"px" }); 881 } 882 } 883 }, 884 d: { 885 clean:function(_element){ 886 with(firebug){ 887 _element.update(""); 888 } 889 }, 890 console:{ 891 addLine:function(){ 892 with (firebug) { 893 return new lib.element("DIV").attribute.addClass("Row").insert(el.left.console.monitor); 894 } 895 }, 896 cache:[], 897 clear:function(){ 898 with(firebug){ 899 d.clean(el.left.console.monitor); 900 d.console.cache = []; 901 } 902 }, 903 formatArgs:function(){ 904 with(firebug){ 905 var content = []; 906 for(var i=0, len=arguments.length; i<len; i++){ 907 content.push( d.highlight(arguments[i],false,false,true) ); 908 } 909 return content.join(" "); 910 } 911 }, 912 history:[], historyIndex:0, 913 openObject:function(_index){ 914 with (firebug) { 915 d.dom.open(d.console.cache[_index], el.left.dom.container, lib.env.ie); 916 d.navigate("dom"); 917 } 918 }, 919 print: function(_cmd,_text){ 920 with (firebug){ 921 d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd); 922 d.console.addLine().update(d.highlight(_text,false,false,true)); 923 d.console.scroll(); 924 } 925 }, 926 printException: function(_exception){ 927 with(firebug){ 928 var message = _exception.description||_exception.message||_exception; 929 if(_exception.fileName){ 930 message+=' ('+(_exception.name&&(_exception.name+', ')||'')+getFileName(_exception.fileName)+', '+_exception.lineNumber+')'; 931 } 932 d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+message,true); 933 } 934 }, 935 eval:function(_cmd){ 936 var result; 937 with(firebug){ 938 if(_cmd.length==0) 939 return; 940 941 el.left.console.input.environment.getElement().value = ""; 942 d.console.historyIndex = d.console.history.push(_cmd); 943 944 try { 945 if(_cmd==='console.firebug') { 946 d.console.addLine().attribute.addClass("Arrow").update(firebug.version); 947 } else { 948 result = eval.call(window,_cmd); 949 d.console.print(_cmd,result); 950 } 951 } catch(e){ 952 d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd); 953 d.console.printException(e); 954 } 955 d.console.scroll(); 956 } 957 }, 958 scroll:function(){ 959 with(firebug){ 960 el.left.console.monitor.environment.getElement().parentNode.scrollTop = Math.abs(el.left.console.monitor.environment.getSize().offsetHeight-(el.left.console.monitor.element.parentNode.offsetHeight-11)); 961 } 962 }, 963 run:function(_command){ 964 with(firebug){ 965 if(!internal.init){ 966 d.console.cache.push({ "command":_command, "arg":Array.prototype.slice.call(arguments,1) }); 967 } else { 968 d.console.cmd[_command].apply(window,Array.prototype.slice.call(arguments,1)); 969 } 970 } 971 }, 972 toggleML:function(){ 973 with(firebug){ 974 var open = !env.ml; 975 env.ml = !env.ml; 976 d.navigateRightColumn("console",open); 977 el[open?"left":"right"].console.mlButton.environment.addStyle({ display:"none" }); 978 el[!open?"left":"right"].console.mlButton.environment.addStyle({ display:"block" }); 979 el.left.console.mlButton.attribute[(open?"add":"remove")+"Class"]("CloseML"); 980 } 981 }, 982 countMap:{}, timeMap: {}, 983 cmd:{ 984 log: function(_value){ 985 with(firebug){ 986 var args = d.console.formatArgs.apply(window,arguments); 987 d.console.addLine().attribute.addClass("Log").update(args); 988 d.console.scroll(); 989 } 990 }, 991 warn: function(_value){ 992 with(firebug){ 993 var args = d.console.formatArgs.apply(window,arguments); 994 d.console.addLine().attribute.addClass("Warn").update(args); 995 d.console.scroll(); 996 } 997 }, 998 info: function(_value){ 999 with(firebug){ 1000 var args = d.console.formatArgs.apply(window,arguments); 1001 d.console.addLine().attribute.addClass("Info").update(args); 1002 d.console.scroll(); 1003 } 1004 }, 1005 debug: function(_value){ 1006 with(firebug){ 1007 var args = d.console.formatArgs.apply(window,arguments); 1008 d.console.addLine().attribute.addClass("Debug").update(args); 1009 d.console.scroll(); 1010 } 1011 }, 1012 error: function(_value){ 1013 with(firebug){ 1014 var args = d.console.formatArgs.apply(window,arguments); 1015 d.console.addLine().attribute.addClass("Error").update(args); 1016 d.console.scroll(); 1017 } 1018 }, 1019 trace: function(_value){ 1020 with(firebug){ 1021 var stackAmt = 3, f = arguments.caller, isArray = lib.util.IsArray(f); //function that called trace 1022 1023 if((!isArray&&f)||(isArray&&f.length>0)){ 1024 d.console.addLine().attribute.addClass("Arrow").update(">>> console.trace(stack)"); 1025 for(var i=0;i<stackAmt;i++){ 1026 var func = f.toString(), args = f.arguments; 1027 d.dom.open({"function":func, "arguments":args},d.console.addLine()); 1028 f = f.caller; 1029 } 1030 } 1031 } 1032 }, 1033 dir:function(_value){ 1034 with(firebug){ 1035 d.console.addLine().attribute.addClass("Arrow").update(">>> console.dir("+_value+")"); 1036 d.dom.open(_value,d.console.addLine()); 1037 } 1038 }, 1039 dirxml: function(){ 1040 with(firebug){ 1041 d.console.cmd.log.apply(this, arguments); 1042 } 1043 }, 1044 time: function(_name){ 1045 with(firebug){ 1046 d.console.timeMap[_name] = new Date().getTime(); 1047 } 1048 }, 1049 timeEnd: function(_name){ 1050 with(firebug){ 1051 if(_name in d.console.timeMap){ 1052 var delta = new Date().getTime() - d.console.timeMap[_name], 1053 args = d.console.formatArgs.apply(window,[_name+":", delta+"ms"]); 1054 d.console.addLine().attribute.addClass("log").update(args); 1055 delete d.console.timeMap[_name]; 1056 } 1057 } 1058 }, 1059 count: function(_name){ 1060 with(firebug){ 1061 if(!d.console.countMap[_name]) 1062 d.console.countMap[_name] = 0; 1063 d.console.countMap[_name]++; 1064 d.console.cmd.log.apply(window, [_name, d.console.countMap[_name]]); 1065 } 1066 }, 1067 group:function(){ 1068 with(firebug){ 1069 d.console.cmd.log.apply(this, ["console.group is not supported"]); 1070 } 1071 }, 1072 groupEnd:function(){ 1073 with(firebug){ 1074 d.console.cmd.log.apply(this, ["console.groupEnd is not supported"]); 1075 } 1076 }, 1077 profile:function(){ 1078 with(firebug){ 1079 d.console.cmd.log.apply(this, ["console.profile is not supported"]); 1080 } 1081 }, 1082 profileEnd:function(){ 1083 with(firebug){ 1084 d.console.cmd.log.apply(this, ["console.profileEnd is not supported"]); 1085 } 1086 } 1087 } 1088 }, 1089 css:{ 1090 index:-1, 1091 open:function(_index){ 1092 with (firebug) { 1093 var item = internal.targetWindow.document.styleSheets[_index], 1094 uri = item.href; 1095 try { 1096 var rules = item[lib.env.ie ? "rules" : "cssRules"], str = ""; 1097 for (var i=0; i<rules.length; i++) { 1098 var item = rules[i]; 1099 var selector = item.selectorText; 1100 var cssText = lib.env.ie?item.style.cssText:item.cssText.match(/\{(.*)\}/)[1]; 1101 str+=d.css.printRule(selector, cssText.split(";"), el.left.css.container); 1102 } 1103 } catch(e) { 1104 str="<em>Access to restricted URI denied</em>"; 1105 } 1106 el.left.css.container.update(str); 1107 } 1108 }, 1109 printRule:function(_selector,_css,_layer){ 1110 with(firebug){ 1111 var str = "<div class='Selector'>"+_selector+" {</div>"; 1112 for(var i=0,len=_css.length; i<len; i++){ 1113 var item = _css[i]; 1114 str += "<div class='CSSText'>"+item.replace(/(.+\:)(.+)/,"<span class='CSSProperty'>$1</span><span class='CSSValue'>$2;</span>")+"</div>"; 1115 } 1116 str+="<div class='Selector'>}</div>"; 1117 return str; 1118 } 1119 }, 1120 refresh:function(){ 1121 with(firebug){ 1122 el.button.css.selectbox.update(""); 1123 var collection = internal.targetWindow.document.styleSheets; 1124 for(var i=0,len=collection.length; i<len; i++){ 1125 var uri = getFileName(collection[i].href); 1126 d.css.index=d.css.index<0?i:d.css.index; 1127 el.button.css.selectbox.child.add( 1128 new lib.element("OPTION").attribute.set("value",i).update(uri) 1129 ) 1130 }; 1131 d.css.open(d.css.index); 1132 } 1133 } 1134 }, 1135 dom: { 1136 open: function(_object,_layer){ 1137 with (firebug) { 1138 _layer.clean(); 1139 var container = new lib.element("DIV").attribute.addClass("DOMContent").insert(_layer); 1140 d.dom.print(_object, container); 1141 } 1142 }, 1143 print:function(_object,_parent, _inTree){ 1144 with (firebug) { 1145 var obj = _object || window, parentElement = _parent; 1146 parentElement.update(""); 1147 1148 if(parentElement.opened&&parentElement!=el.left.dom.container){ 1149 parentElement.environment.getParent().lib.child.get()[0].lib.child.get()[0].lib.attribute.removeClass("Opened"); 1150 parentElement.opened = false; 1151 parentElement.environment.addStyle({ "display":"none" }); 1152 return; 1153 } 1154 if(_inTree) 1155 parentElement.environment.getParent().lib.child.get()[0].lib.child.get()[0].lib.attribute.addClass("Opened"); 1156 parentElement.opened = true; 1157 1158 for (var key in obj) { 1159 try { 1160 if (env.hideDOMFunctions && typeof(obj[key]) == "function") continue; 1161 var value = obj[key], property = key, container = new lib.element("DIV").attribute.addClass("DOMRow").insert(parentElement), 1162 left = new lib.element("DIV").attribute.addClass("DOMRowLeft").insert(container), right = new lib.element("DIV").attribute.addClass("DOMRowRight").insert(container); 1163 1164 container.child.add( 1165 new lib.element("DIV").attribute.addClass('Clear') 1166 ); 1167 1168 var link = new lib.element("A").attribute.addClass( 1169 typeof value=="object"&&Boolean(value)?"Property Object":"Property" 1170 ).update(property).insert(left); 1171 1172 right.update(d.highlight(value,false,true)); 1173 1174 var subContainer = new lib.element("DIV").attribute.addClass("DOMRowSubContainer").insert(container); 1175 1176 if(typeof value!="object"||Boolean(value)==false) 1177 continue; 1178 1179 link.event.addListener("click",lib.util.Curry(d.dom.print,window,value, subContainer, true)); 1180 }catch(e){ 1181 } 1182 } 1183 parentElement.environment.addStyle({ "display":"block" }); 1184 } 1185 } 1186 }, 1187 highlight:function(_value,_inObject,_inArray,_link){ 1188 with(firebug){ 1189 var isArray = false, isHash, isElement = false, vtype=typeof _value, result=[]; 1190 1191 if(vtype=="object"){ 1192 if(Object.prototype.toString.call(_value) === "[object Date]"){ 1193 vtype = "date"; 1194 } else if(Object.prototype.toString.call(_value) === "[object String]"){ 1195 vtype = "string"; 1196 } else if(Object.prototype.toString.call(_value) === "[object Boolean]"){ 1197 vtype = "boolean"; 1198 } else if(Object.prototype.toString.call(_value) === "[object RegExp]"){ 1199 vtype = "regexp"; 1200 } 1201 } 1202 1203 try { 1204 isArray = lib.util.IsArray(_value); 1205 isHash = lib.util.IsHash(_value); 1206 isElement = _value!=undefined&&Boolean(_value.nodeName)&&Boolean(_value.nodeType); 1207 1208 // number, string, boolean, null, function 1209 if(_value==null||vtype=="number"||vtype=="string"||vtype=="boolean"||(vtype=="function"&&_value.nodeName!="OBJECT")||vtype=="regexp"||vtype=="date"){ 1210 if(_value==null){ 1211 if(_value===undefined) { 1212 result.push("<span class='Null'>undefined</span>"); 1213 } else { 1214 result.push("<span class='Null'>null</span>"); 1215 } 1216 }else if (vtype=="regexp") { 1217 result.push("<span class='Maroon'>" + _value + "</span>"); 1218 }else if (vtype=="date") { 1219 result.push("<span class='DarkBlue'>'" + _value + "'</span>"); 1220 } else if (vtype=="boolean"||vtype=="number") { 1221 result.push("<span class='DarkBlue'>" + _value + "</span>"); 1222 } else if(vtype=="function"){ 1223 result.push("<span class='"+(_inObject?"Italic Gray":"Green")+"'>function()</span>"); 1224 } else { 1225 result.push("<span class='Red'>\""+( !_inObject&&!_inArray?_value : _value.substring(0,35)+(_value.length>35?" ...":"") ).replace(/\n/g,"\\n").replace(/\s/g," ").replace(/>/g,">").replace(/</g,"<")+"\"</span>"); 1226 } 1227 } 1228 // element 1229 else if(isElement){ 1230 1231 if(_value.nodeType==3) 1232 result.push(d.highlight(_value.nodeValue)); 1233 else if(_inObject){ 1234 result.push("<span class='Gray Italic'>"+_value.nodeName.toLowerCase()+"</span>"); 1235 } else { 1236 result.push("<span class='Blue"+ ( !_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.html.inspect(firebug.d.console.cache[" +( d.console.cache.push( _value ) -1 )+"])'" ) + "'>"); 1237 1238 if(_inArray){ 1239 result.push(_value.nodeName.toLowerCase()); 1240 if(_value.getAttribute){ 1241 if(_value.getAttribute&&_value.getAttribute("id")) 1242 result.push("<span class='DarkBlue'>#"+_value.getAttribute("id")+"</span>"); 1243 var elClass = _value.getAttribute(lib.env.ie&&!lib.env.ie8?"className":"class")||""; 1244 result.push(!elClass?"":"<span class='Red'>."+elClass.split(" ")[0]+"</span>"); 1245 } 1246 result.push("</span>"); 1247 } else { 1248 result.push("<span class='DarkBlue'><<span class='Blue TagName'>"+ _value.nodeName.toLowerCase()); 1249 1250 if(_value.attributes){ 1251 for(var i=0,len=_value.attributes.length; i<len; i++){ 1252 var item = _value.attributes[i]; 1253 1254 if(!lib.env.ie||item.nodeValue) 1255 result.push(" <span class='DarkBlue'>"+item.nodeName+"=\"<span class='Red'>"+item.nodeValue+"</span>\"</span>"); 1256 } 1257 } 1258 1259 result.push("</span>></span>"); 1260 } 1261 } 1262 } 1263 // array, hash 1264 else if(isArray||isHash){ 1265 if(isArray){ 1266 if(_inObject){ 1267 result.push("<span class='Gray Italic'>["+_value.length+"]</span>"); 1268 } else { 1269 result.push("<span class='Strong'>[ "); 1270 1271 for(var i=0,len=_value.length; i<len; i++){ 1272 if((_inObject||_inArray)&&i>3){ 1273 result.push(", <span class='Strong Gray'>"+(len-4)+" More...</span>"); 1274 break; 1275 } 1276 result.push( (i > 0 ? ", " : "") + d.highlight(_value[i], false, true, true) ); 1277 } 1278 1279 result.push(" ]</span>"); 1280 } 1281 } else if(_inObject){ 1282 result.push("<span class='Gray Italic'>Object</span>"); 1283 } else { 1284 result.push("<span class='Strong Green"+ ( !_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.console.openObject(" +( d.console.cache.push( _value ) -1 )+")'" ) + ">Object"); 1285 var i=0; 1286 for(var key in _value){ 1287 var value = _value[key]; 1288 if((_inObject||_inArray)&&i>3){ 1289 result.push(" <span class='Strong Gray'>More...</span>"); 1290 break; 1291 } 1292 result.push(" "+key+"="+d.highlight(value,true)); 1293 i++; 1294 } 1295 result.push("</span>"); 1296 } 1297 } else { 1298 result.push(["<span class'Gray Italic'>"+_value+"</span>"]); 1299 } 1300 } catch(e){ 1301 result.push(".."); 1302 } 1303 return result.join(""); 1304 } 1305 }, 1306 html:{ 1307 nIndex:"computedStyle", 1308 current:null, 1309 highlight:function(_element,_clear,_event){ 1310 with(firebug){ 1311 if(_element.firebugElement){ 1312 return; 1313 } 1314 if(_clear){ 1315 internal.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" }); 1316 return; 1317 } 1318 d.inspector.inspect(_element,true); 1319 } 1320 }, 1321 inspect:function(_element){ 1322 var map = [], 1323 parentLayer, 1324 t, 1325 link, 1326 tagName, 1327 searchEl, 1328 parent = _element; 1329 while (parent) { 1330 map.push(parent); 1331 if (parent == firebug.internal.targetWindow.document.body) break; 1332 parent = parent.parentNode; 1333 } 1334 map = map.reverse(); 1335 with(firebug) { 1336 if (env.dIndex != "html") { 1337 internal.targetWindow.firebug.d.navigate("html"); 1338 } 1339 1340 internal.targetWindow.firebug.d.inspector.toggle(false); 1341 1342 for (t = 0; t < el.left.html.container.child.get().length; t++) { 1343 searchEl=el.left.html.container.child.get()[t]; 1344 if(/<body/i.test(searchEl.innerText||searchEl.textContent)) { 1345 parentLayer = el.left.html.container.child.get()[t].childNodes[1].lib; 1346 break; 1347 } 1348 } 1349 1350 if (!parentLayer) { 1351 parentLayer = el.left.html.container.child.get()[3].childNodes[1].lib; 1352 } 1353 1354 for (t = 0, len = map.length; map[t]; t++) { 1355 if (t == len - 1) { 1356 link = parentLayer.environment.getElement().previousSibling.lib; 1357 link.attribute.addClass("Selected"); 1358 1359 if(link.element.scrollIntoView) { 1360 link.element.scrollIntoView(false); 1361 } 1362 1363 if (d.html.current) { 1364 d.html.current[1].attribute.removeClass("Selected"); 1365 } 1366 d.html.current = [_element, link]; 1367 d.html.openProperties(); 1368 return; 1369 } 1370 parentLayer = d.html.openHtmlTree(map[t], parentLayer, map[t + 1]); 1371 } 1372 } 1373 }, 1374 navigate:function(_index,_element){ 1375 with(firebug){ 1376 el.right.html.nav[d.html.nIndex].attribute.removeClass("Selected"); 1377 el.right.html.nav[_index].attribute.addClass("Selected"); 1378 d.html.nIndex = _index; 1379 d.html.openProperties(); 1380 } 1381 }, 1382 openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){ 1383 with(firebug){ 1384 var element = _element || internal.targetWindow.document.documentElement, 1385 parent = _parent || el.left.html.container, 1386 returnParentEl = _returnParentElementByElement || null, 1387 returnParentVal = null, 1388 len = element.childNodes.length, 1389 nodeLink; 1390 1391 if (!window.Node) { 1392 window.Node = {TEXT_NODE:3,COMMENT_NODE:8}; 1393 } 1394 1395 if(parent!=el.left.html.container){ 1396 nodeLink = parent.environment.getParent().lib.child.get()[0].lib; 1397 if (d.html.current) { 1398 d.html.current[1].attribute.removeClass("Selected"); 1399 } 1400 nodeLink.attribute.addClass("Selected"); 1401 1402 d.html.current = [_element,nodeLink]; 1403 d.html.openProperties(); 1404 }; 1405 1406 if(element.childNodes&&(len==0||(len==1&&element.childNodes[0].nodeType==Node.TEXT_NODE)))return; 1407 parent.clean(); 1408 1409 if(parent.opened&&Boolean(_returnParentElementByElement)==false){ 1410 parent.opened = false; 1411 parent.element.previousSibling.lib.attribute.removeClass("Open"); 1412 parent.element.lib.attribute.removeClass("OpenSubContainer"); 1413 return; 1414 }; 1415 1416 if (parent != el.left.html.container) { 1417 parent.element.previousSibling.lib.attribute.addClass("Open"); 1418 parent.element.lib.attribute.addClass("OpenSubContainer"); 1419 parent.opened = true; 1420 }; 1421 1422 if(element==document.documentElement){ 1423 new lib.element("A").attribute.addClass("Block").update("<span class='DarkBlue'><<span class='Blue'>html</span>>").insert(parent); 1424 }; 1425 1426 for(var i=0; i<=len; i++){ 1427 if(i==len){ 1428 new lib.element("A").attribute.addClass("Block").update("<span class='DarkBlue'></<span class='Blue'>"+element.nodeName.toLowerCase()+"</span>>").insert(container); 1429 break; 1430 } 1431 var item = element.childNodes[i]; 1432 1433 if (item.nodeType == 1 && !item.getAttribute('firebugIgnore')){ 1434 var container = new lib.element().attribute.addClass("Block").insert(parent), 1435 link = new lib.element("A").attribute.addClass("Link").insert(container), 1436 spacer = new lib.element("SPAN").attribute.addClass("Spacer").update(" ").insert(link), 1437 html = new lib.element("SPAN").attribute.addClass("Content").update(d.highlight(item)).insert(link), 1438 subContainer = new lib.element("DIV").attribute.addClass("SubContainer").insert(container), 1439 view; 1440 1441 view = lib.util.Element.getView(item); 1442 link.event.addListener("click", lib.util.Curry(d.html.openHtmlTree, window, item, subContainer, false)); 1443 link.event.addListener("mouseover", lib.util.Curry(d.html.highlight, window, item, false)); 1444 link.event.addListener("mouseout", lib.util.Curry(d.html.highlight, window, item, true)); 1445 1446 returnParentVal = returnParentEl == item ? subContainer : returnParentVal; 1447 1448 if(d.html.current==null&&item==document.body){ 1449 link.attribute.addClass("Selected"); 1450 link.attribute.addClass("Parent"); 1451 d.html.current = [item,link]; 1452 d.html.openHtmlTree(item,subContainer); 1453 } 1454 1455 if(element.nodeName!="HEAD"&&element!=document.documentElement&&(view.visibility=="hidden"||view.display=="none")){ 1456 container.attribute.addClass("Unvisible"); 1457 }; 1458 1459 if (item.childNodes){ 1460 var childLen = item.childNodes.length; 1461 if (childLen == 1 && item.childNodes[0].nodeType == Node.TEXT_NODE) { 1462 if(isFinite(env.textNodeChars)&&parseInt(env.textNodeChars)>0) { 1463 html.child.add(document.createTextNode(item.childNodes[0].nodeValue.substring(0, env.textNodeChars))); 1464 } else { 1465 html.child.add(document.createTextNode(item.childNodes[0].nodeValue)); 1466 } 1467 html.child.add(document.createTextNode("</")); 1468 html.child.add(new lib.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement()); 1469 html.child.add(document.createTextNode(">")); 1470 continue; 1471 } 1472 else if (childLen > 0) { 1473 link.attribute.addClass("Parent"); 1474 } 1475 } 1476 } 1477 }; 1478 return returnParentVal; 1479 } 1480 }, 1481 openProperties:function(){ 1482 with(firebug){ 1483 var index = d.html.nIndex; 1484 var node = d.html.current[0]; 1485 d.clean(el.right.html.content); 1486 var str = ""; 1487 switch(index){ 1488 case "computedStyle": 1489 var property = ["opacity","filter","azimuth","background","backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderCollapse","borderColor","borderSpacing","borderStyle","borderTop","borderRight","borderBottom","borderLeft","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderWidth","bottom","captionSide","clear","clip","color","content","counterIncrement","counterReset","cue","cueAfter","cueBefore","cursor","direction","display","elevation","emptyCells","cssFloat","font","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginTop","marginRight","marginBottom","marginLeft","markerOffset","marks","maxHeight","maxWidth","minHeight","minWidth","orphans","outline","outlineColor","outlineStyle","outlineWidth","overflow","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pause","pauseAfter","pauseBefore","pitch","pitchRange","playDuring","position","quotes","richness","right","size","speak","speakHeader","speakNumeral","speakPunctuation","speechRate","stress","tableLayout","textAlign","textDecoration","textIndent","textShadow","textTransform","top","unicodeBidi","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","wordSpacing","zIndex"].sort(); 1490 var view = document.defaultView?document.defaultView.getComputedStyle(node,null):node.currentStyle; 1491 for(var i=0,len=property.length; i<len; i++){ 1492 var item = property[i]; 1493 if(!view[item])continue; 1494 str+="<div class='CSSItem'><div class='CSSProperty'>"+item+"</div><div class='CSSValue'>"+d.highlight(view[item])+"</div></div>"; 1495 } 1496 el.right.html.content.update(str); 1497 break; 1498 case "dom": 1499 d.dom.open(node,el.right.html.content,lib.env.ie); 1500 break; 1501 } 1502 } 1503 } 1504 }, 1505 inspector:{ 1506 enabled:false, 1507 el:null, 1508 inspect:function(_element,_bgInspector){ 1509 with(firebug){ 1510 var pos = internal.targetWindow.firebug.lib.util.Element.getPosition(_element); 1511 1512 internal.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({ 1513 "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px", 1514 "top":pos.offsetTop-(_bgInspector?0:2)+"px", "left":pos.offsetLeft-(_bgInspector?0:2)+"px", 1515 "display":"block" 1516 }); 1517 1518 if(!_bgInspector){ 1519 d.inspector.el = _element; 1520 } 1521 }; 1522 }, 1523 toggle:function(_absoluteValue,_event){ 1524 with (firebug) { 1525 if(_absoluteValue==d.inspector.enabled) 1526 return; 1527 d.inspector.enabled = _absoluteValue!=undefined&&!_absoluteValue.clientX?_absoluteValue:!d.inspector.enabled; 1528 el.button.inspect.attribute[(d.inspector.enabled ? "add" : "remove") + "Class"]("Enabled"); 1529 if(d.inspector.enabled==false){ 1530 el.borderInspector.environment.addStyle({ "display":"none" }); 1531 d.inspector.el = null; 1532 } else if(lib.env.dIndex!="html") { 1533 if (internal.popupWin) { 1534 internal.popupWin.firebug.d.navigate("html"); 1535 } else { 1536 d.navigate("html"); 1537 } 1538 } 1539 } 1540 } 1541 }, 1542 scripts:{ 1543 index:-1, 1544 lineNumbers:false, 1545 open:function(_index){ 1546 with(firebug){ 1547 d.scripts.index = _index; 1548 el.left.scripts.container.update(""); 1549 var i=0,script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source; 1550 try { 1551 if(uri!=document.location.href){ 1552 source = internal.cache[uri]||lib.xhr.get(uri).responseText; 1553 internal.cache[uri] = source; 1554 } else { 1555 source = script.innerHTML; 1556 } 1557 source = source.replace(/<|>/g,function(_ch){ 1558 return ({"<":"<",">":">"})[_ch]; 1559 }); 1560 1561 if(d.scripts.lineNumbers){ 1562 source = source.replace(/(^)|\n/g,function(_ch){ 1563 i++; 1564 return "\n"+i+" "; 1565 }); 1566 } 1567 1568 el.left.scripts.container.update(source); 1569 } catch(e){ 1570 el.left.scripts.container.child.add( 1571 new lib.element("DIV").attribute.addClass("CodeContainer").update("<em>Access to restricted URI denied</em>") 1572 ); 1573 } 1574 } 1575 }, 1576 toggleLineNumbers:function(){ 1577 with(firebug){ 1578 d.scripts.lineNumbers = !d.scripts.lineNumbers; 1579 el.button.scripts.lineNumbers.attribute[(d.scripts.lineNumbers ? "add" : "remove") + "Class"]("Enabled"); 1580 d.scripts.open( d.scripts.index ); 1581 } 1582 }, 1583 refresh:function(){ 1584 with(firebug){ 1585 el.button.scripts.selectbox.clean(); 1586 var collection = internal.targetWindow.document.getElementsByTagName("script"); 1587 for(var i=0,len=collection.length; i<len; i++){ 1588 var item = collection[i], 1589 fileName = getFileName(item.src||item.baseURI||".."); 1590 d.scripts.index=d.scripts.index<0?i:d.scripts.index; 1591 el.button.scripts.selectbox.child.add( 1592 new lib.element("OPTION").attribute.set("value",i).update(fileName) 1593 ); 1594 } 1595 d.scripts.open( d.scripts.index ); 1596 } 1597 } 1598 }, 1599 str: { 1600 open:function(_str){ 1601 with(firebug){ 1602 d.navigate("str"); 1603 el.left.str.container.update(_str.replace(/\n/g,"<br />")) 1604 } 1605 } 1606 }, 1607 xhr:{ 1608 objects:[], 1609 addObject:function(){ 1610 with(firebug){ 1611 for(var i=0,len=arguments.length; i<len; i++){ 1612 try { 1613 var item = arguments[i], 1614 val = internal.targetWindow.eval(item); 1615 d.xhr.objects.push([item, val]); 1616 } catch(e){ 1617 continue; 1618 } 1619 } 1620 } 1621 }, 1622 open:function(){ 1623 with(firebug){ 1624 el.left.xhr.container.update(""); 1625 el.left.xhr.name = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"20%" }).insert(el.left.xhr.container)); 1626 el.left.xhr.nameTitle = new lib.element("STRONG").update("Object Name:").insert(el.left.xhr.name); 1627 el.left.xhr.nameContent = new lib.element("DIV").insert(el.left.xhr.name); 1628 el.left.xhr.status = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"10%" }).insert(el.left.xhr.container)); 1629 el.left.xhr.statusTitle = new lib.element("STRONG").update("Status:").insert(el.left.xhr.status); 1630 el.left.xhr.statusContent = new lib.element("DIV").insert(el.left.xhr.status); 1631 el.left.xhr.readystate = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").environment.addStyle({ "width":"15%" }).attribute.addClass("Block").insert(el.left.xhr.container)); 1632 el.left.xhr.readystateTitle =el.left.xhr.nameTitle = new lib.element("STRONG").update("Ready State:").insert(el.left.xhr.readystate); 1633 el.left.xhr.readystateContent = new lib.element("DIV").insert(el.left.xhr.readystate); 1634 el.left.xhr.response = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").environment.addStyle({ "width":(lib.env.ie?"50":"55")+"%" }).attribute.addClass("Block").insert(el.left.xhr.container)); 1635 el.left.xhr.responseTitle = new lib.element("STRONG").update("Response:").insert(el.left.xhr.response); 1636 el.left.xhr.responseContent = new lib.element("DIV").insert(el.left.xhr.response); 1637 setTimeout(d.xhr.refresh,500); 1638 } 1639 }, 1640 refresh:function(){ 1641 with(firebug){ 1642 el.left.xhr.nameContent.update(""); 1643 el.left.xhr.statusContent.update(""); 1644 el.left.xhr.readystateContent.update(""); 1645 el.left.xhr.responseContent.update(""); 1646 for(var i=0,len=d.xhr.objects.length; i<len; i++){ 1647 var item = d.xhr.objects[i], 1648 response = item[1].responseText; 1649 if(Boolean(item[1])==false)continue; 1650 el.left.xhr.nameContent.child.add(new lib.element("span").update(item[0])); 1651 try { 1652 el.left.xhr.statusContent.child.add(new lib.element("span").update(item[1].status)); 1653 } catch(e){ el.left.xhr.statusContent.child.add(new lib.element("span").update(" ")); } 1654 el.left.xhr.readystateContent.child.add(new lib.element("span").update(item[1].readyState)); 1655 1656 el.left.xhr.responseContent.child.add(new lib.element("span").child.add( 1657 new lib.element("A").event.addListener("click",lib.util.Curry(d.str.open,window,response)).update(" "+response.substring(0,50)) 1658 )); 1659 }; 1660 if(env.dIndex=="xhr") 1661 setTimeout(d.xhr.refresh,500); 1662 } 1663 } 1664 }, 1665 navigateRightColumn:function(_index,_open){ 1666 with(firebug){ 1667 el.left.container.environment.addStyle({ "width":_open?"70%":"100%" }); 1668 el.right.container.environment.addStyle({ "display":_open?"block":"none" }); 1669 } 1670 }, 1671 navigate:function(_index){ 1672 with(firebug){ 1673 var open = _index, close = env.dIndex; 1674 env.dIndex = open; 1675 1676 settings.hide(); 1677 1678 el.button[close].container.environment.addStyle({ "display":"none" }); 1679 el.left[close].container.environment.addStyle({ "display":"none" }); 1680 el.right[close].container.environment.addStyle({ "display":"none" }); 1681 1682 el.button[open].container.environment.addStyle({ "display":"inline" }); 1683 el.left[open].container.environment.addStyle({ "display":"block" }); 1684 el.right[open].container.environment.addStyle({ "display":"block" }); 1685 1686 if(el.nav[close]) 1687 el.nav[close].attribute.removeClass("Selected"); 1688 if(el.nav[open]) 1689 el.nav[open].attribute.addClass("Selected"); 1690 1691 switch(open){ 1692 case "console": 1693 d.navigateRightColumn(_index); 1694 break; 1695 case "html": 1696 d.navigateRightColumn(_index,true); 1697 if(!d.html.current){ 1698 var t=Number(new Date); 1699 d.html.openHtmlTree(); 1700 } 1701 break; 1702 case "css": 1703 d.navigateRightColumn(_index,true); 1704 d.css.refresh(); 1705 break; 1706 case "scripts": 1707 d.navigateRightColumn(_index); 1708 d.scripts.refresh(); 1709 break; 1710 case "dom": 1711 d.navigateRightColumn(_index); 1712 if(el.left.dom.container.environment.getElement().innerHTML==""){ 1713 var t=Number(new Date); 1714 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container); 1715 } 1716 break; 1717 case "xhr": 1718 d.navigateRightColumn(_index); 1719 d.xhr.open(); 1720 break; 1721 } 1722 } 1723 } 1724 }, 1725 getFileName:function(_path){ 1726 var match = _path&&_path.match(/[\w\-\.\?\=\&]+$/); 1727 return match&&match[0]||_path; 1728 }, 1729 cancelEvent:function(_event){ 1730 if(_event.stopPropagation) 1731 _event.stopPropagation(); 1732 if(_event.preventDefault) 1733 _event.preventDefault(); 1734 }, 1735 getSelection:function(_el){ 1736 with(firebug){ 1737 if(lib.env.ie){ 1738 var range = document.selection.createRange(),stored = range.duplicate(); 1739 stored.moveToElementText(_el); 1740 stored.setEndPoint('EndToEnd', range); 1741 _el.selectionStart = stored.text.length - range.text.length; 1742 _el.selectionEnd = _el.selectionStart + range.text.length; 1743 } 1744 return { 1745 start:_el.selectionStart, 1746 length:_el.selectionEnd-_el.selectionStart 1747 } 1748 } 1749 }, 1750 tab:function(_el,_event){ 1751 with(firebug){ 1752 if(_event.keyCode==9){ 1753 if(_el.setSelectionRange){ 1754 var position = firebug.getSelection(_el); 1755 _el.value = _el.value.substring(0,position.start) + String.fromCharCode(9) + _el.value.substring(position.start+position.length,_el.value.length); 1756 _el.setSelectionRange(position.start+1,position.start+1); 1757 } else if(document.selection) { 1758 var range = document.selection.createRange(), isCollapsed = range.text == ''; 1759 range.text = String.fromCharCode(9); 1760 range.moveStart('character', -1); 1761 } 1762 firebug.cancelEvent(_event); 1763 if(lib.env.ie) 1764 setTimeout(_el.focus,100); 1765 }; 1766 } 1767 }, 1768 listen: { 1769 addXhrObject:function(){ 1770 with(firebug){ 1771 d.xhr.addObject.apply(internal.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(",")); 1772 } 1773 }, 1774 consoleTextbox:function(_event){ 1775 with(firebug){ 1776 if(_event.keyCode==13&&(env.multilinemode==false||_event.shiftKey==false)){ 1777 d.console.historyIndex = d.console.history.length; 1778 d.console.eval(el.left.console.input.environment.getElement().value); 1779 return false; 1780 } 1781 1782 switch(_event.keyCode){ 1783 case 40: 1784 if(d.console.history[d.console.historyIndex+1]){ 1785 d.console.historyIndex+=1; 1786 el.left.console.input.update( d.console.history[d.console.historyIndex] ); 1787 } 1788 break; 1789 case 38: 1790 if(d.console.history[d.console.historyIndex-1]){ 1791 d.console.historyIndex-=1; 1792 el.left.console.input.update( d.console.history[d.console.historyIndex] ); 1793 } 1794 break; 1795 } 1796 } 1797 }, 1798 cssSelectbox:function(){ 1799 with(firebug){ 1800 d.css.open(el.button.css.selectbox.environment.getElement().selectedIndex); 1801 } 1802 }, 1803 domTextbox:function(_event){ 1804 with(firebug){ 1805 if(_event.keyCode==13){ 1806 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container); 1807 } 1808 } 1809 }, 1810 inspector:function(){ 1811 with(firebug){ 1812 if (internal.popupWin) { 1813 internal.popupWin.firebug.d.html.inspect(firebug.d.inspector.el); 1814 } else { 1815 firebug.d.html.inspect(firebug.d.inspector.el); 1816 } 1817 } 1818 }, 1819 keyboard:function(_event){ 1820 with(firebug){ 1821 if(_event.keyCode==27 && d.inspector.enabled){ 1822 d.inspector.toggle(); 1823 } else if(_event.keyCode === 123 && (_event.ctrlKey || _event.metaKey)) { 1824 if(internal.isPopup){ 1825 win.dock(); 1826 }else { 1827 win.newWindow(); 1828 } 1829 } else if( 1830 (_event.keyCode === 123 && (!_event.ctrlKey && !_event.metaKey)) || 1831 (_event.keyCode === 76 && (_event.ctrlKey || _event.metaKey) && _event.shiftKey) || 1832 (_event.keyCode === 13 && _event.shiftKey)) { 1833 1834 if(internal.isPopup){ 1835 win.dock(); 1836 } else if (el.main.environment.getStyle("display") === 'none') { 1837 win.show(); 1838 } else { 1839 win.hide(); 1840 } 1841 } 1842 } 1843 }, 1844 mouse:function(_event){ 1845 with(firebug){ 1846 1847 // TODO: xxxpedro 1848 if(d.inspector.enabled){ 1849 var target; 1850 var borderInspector = el.borderInspector.environment.getElement(); 1851 var display = el.borderInspector.environment.getStyle("display"); 1852 1853 borderInspector.style.display = "none"; 1854 if(document.elementFromPoint) { 1855 target = document.elementFromPoint(_event.clientX, _event.clientY); 1856 } else { 1857 if(lib.env.ie) { 1858 target = _event.srcElement; 1859 } else { 1860 target = _event.explicitOriginalTarget || _event.target; 1861 } 1862 } 1863 borderInspector.style.display = display; 1864 1865 if(target!=document.body&& 1866 target!=document.firstChild&& 1867 target!=document.childNodes[1]&& 1868 target!=borderInspector&& 1869 target!=el.main.environment.getElement()&& 1870 target.offsetParent!=el.main.environment.getElement() ) { 1871 d.inspector.inspect(target); 1872 } 1873 } 1874 1875 } 1876 }, 1877 runMultiline:function(){ 1878 with(firebug){ 1879 d.console.eval.call(window,el.right.console.input.environment.getElement().value); 1880 } 1881 }, 1882 runCSS:function(){ 1883 with(firebug){ 1884 var source = el.right.css.input.environment.getElement().value.replace(/\n|\t/g,"").split("}"); 1885 for(var i=0, len=source.length; i<len; i++){ 1886 var item = source[i]+"}", rule = !lib.env.ie?item:item.split(/{|}/), 1887 styleSheet = document.styleSheets[0]; 1888 if(item.match(/.+\{.+\}/)){ 1889 if(lib.env.ie) 1890 styleSheet.addRule(rule[0],rule[1]); 1891 else 1892 styleSheet.insertRule( rule, styleSheet.cssRules.length ); 1893 } 1894 } 1895 } 1896 }, 1897 scriptsSelectbox:function(){ 1898 with(firebug){ 1899 d.scripts.open(parseInt(el.button.scripts.selectbox.environment.getElement().value)); 1900 } 1901 }, 1902 xhrTextbox:function(_event){ 1903 with(firebug){ 1904 if(_event.keyCode==13){ 1905 d.xhr.addObject.apply(internal.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(",")); 1906 } 1907 } 1908 } 1909 } 1910}; 1911 1912(function(_scope){ 1913 _scope.lib = {}; 1914 var pi = _scope.lib; pi.version = [1.1,2008091000]; 1915 1916 pi.env = { 1917 ie: /MSIE/i.test(navigator.userAgent), 1918 ie6: /MSIE 6/i.test(navigator.userAgent), 1919 ie7: /MSIE 7/i.test(navigator.userAgent), 1920 ie8: /MSIE 8/i.test(navigator.userAgent), 1921 firefox: /Firefox/i.test(navigator.userAgent), 1922 opera: /Opera/i.test(navigator.userAgent), 1923 webkit: /Webkit/i.test(navigator.userAgent), 1924 camino: /Camino/i.test(navigator.userAgent) 1925 }; 1926 1927 pi.get = function(){ 1928 return document.getElementById(arguments[0]); 1929 }; 1930 pi.get.byTag = function(){ 1931 return document.getElementsByTagName(arguments[0]); 1932 }; 1933 pi.get.byClass = function(){ return document.getElementsByClassName.apply(document,arguments); }; 1934 1935 pi.util = { 1936 Array:{ 1937 clone:function(_array,_undeep){ 1938 var tmp = []; 1939 Array.prototype.push.apply(tmp,_array); 1940 pi.util.Array.forEach(tmp,function(_item,_index,_source){ 1941 if(_item instanceof Array&&!_undeep) 1942 _source[_index] = pi.util.Array.clone(_source[_index]); 1943 }); 1944 return tmp; 1945 }, 1946 count:function(_array,_value){ 1947 var count = 0; 1948 pi.util.Array.forEach(_array,function(){ 1949 count+=Number(arguments[0]==_value); 1950 }); 1951 return count; 1952 }, 1953 forEach:function(_array,_function){ 1954 if(_array.forEach) 1955 return _array.forEach(_function); 1956 for(var i=0,len=_array.length; i<len; i++) 1957 _function.apply(_array,[_array[i],i,_array]); 1958 }, 1959 getLatest:function(_array){ 1960 return _array[_array.length-1]; 1961 }, 1962 indexOf:function(_array,_value){ 1963 if(!pi.env.ie){ 1964 return _array.indexOf(_value); 1965 }; 1966 1967 var index = -1; 1968 for(var i=0, len=_array.length; i<len; i++){ 1969 if(_array[i]==_value){ 1970 index = i; 1971 break; 1972 } 1973 } 1974 return index; 1975 }, 1976 remove:function(_array,_index){ 1977 var result = _array.slice(0,_index); 1978 _array = Array.prototype.push.apply(result,_array.slice(_index+1)); 1979 return result; 1980 } 1981 }, 1982 Curry:function(_fn,_scope){ 1983 var fn = _fn, scope = _scope||window, args = Array.prototype.slice.call(arguments,2); 1984 return function(){ 1985 return fn.apply(scope,args.concat( Array.prototype.slice.call(arguments,0) )); 1986 }; 1987 }, 1988 Extend:function(_superClass,_prototype,_skipClonning){ 1989 var object = new pi.base; 1990 if(_prototype["$Init"]){ 1991 object.init = _prototype["$Init"]; 1992 delete _prototype["$Init"]; 1993 }; 1994 1995 object.body = _superClass==pi.base?_prototype:pi.util.Hash.merge(_prototype,_superClass.prototype); 1996 object.init=object.init||function(){ 1997 if(_superClass!=pi.base) 1998 _superClass.apply(this,arguments); 1999 }; 2000 2001 return object.build(_skipClonning); 2002 }, 2003 IsArray:function(_object){ 2004 if(_object===null){ 2005 return false; 2006 } 2007 if(window.NodeList&&window.NamedNodeMap&&!pi.env.ie8){ 2008 if(_object instanceof Array||_object instanceof NodeList||_object instanceof NamedNodeMap||(window.HTMLCollection&&_object instanceof HTMLCollection)) 2009 return true; 2010 }; 2011 if(!_object||_object==window||typeof _object=="function"||typeof _object=="string"||typeof _object.length!="number"){ 2012 return false 2013 }; 2014 var len = _object.length; 2015 if(len>0&&_object[0]!=undefined&&_object[len-1]!=undefined){ 2016 return true; 2017 } else { 2018 for(var key in _object){ 2019 if(key!="item"&&key!="length"&&key!="setNamedItemNS"&&key!="setNamedItem"&&key!="getNamedItem"&&key!="removeNamedItem"&&key!="getNamedItemNS"&&key!="removeNamedItemNS"&&key!="tags"){ 2020 return false; 2021 } 2022 } 2023 return true 2024 }; 2025 }, 2026 IsHash:function(_object){ 2027 return _object && typeof _object=="object"&&(_object==window||_object instanceof Object)&&!_object.nodeName&&!pi.util.IsArray(_object) 2028 }, 2029 Init:[], 2030 AddEvent: function(_element,_eventName,_fn,_useCapture){ 2031 _element[pi.env.ie?"attachEvent":"addEventListener"]((pi.env.ie?"on":"")+_eventName,_fn,_useCapture||false); 2032 return pi.util.Curry(pi.util.AddEvent,this,_element); 2033 }, 2034 RemoveEvent: function(_element,_eventName,_fn,_useCapture){ 2035 _element[pi.env.ie?"detachEvent":"removeEventListener"]((pi.env.ie?"on":"")+_eventName,_fn,_useCapture||false); 2036 return pi.util.Curry(pi.util.RemoveEvent,this,_element); 2037 }, 2038 Element:{ 2039 addClass:function(_element,_class){ 2040 if( !pi.util.Element.hasClass(_element,_class) ) 2041 pi.util.Element.setClass(_element, pi.util.Element.getClass(_element) + " " + _class ); 2042 }, 2043 getClass:function(_element){ 2044 return _element.getAttribute(pi.env.ie&&!pi.env.ie8?"className":"class")||""; 2045 }, 2046 hasClass:function(_element,_class){ 2047 return pi.util.Array.indexOf(pi.util.Element.getClass(_element).split(" "),_class)>-1; 2048 }, 2049 removeClass:function(_element,_class){ 2050 if( pi.util.Element.hasClass(_element,_class) ){ 2051 var names = pi.util.Element.getClass(_element,_class).split(" "); 2052 pi.util.Element.setClass( 2053 _element, 2054 pi.util.Array.remove(names,pi.util.Array.indexOf(names,_class)).join(" ") 2055 ); 2056 } 2057 }, 2058 setClass:function(_element,_value){ 2059 if(pi.env.ie8){ 2060 _element.setAttribute("className", _value ); 2061 _element.setAttribute("class", _value ); 2062 } else { 2063 _element.setAttribute(pi.env.ie?"className":"class", _value ); 2064 } 2065 }, 2066 toggleClass:function(){ 2067 if(pi.util.Element.hasClass.apply(this,arguments)) 2068 pi.util.Element.removeClass.apply(this,arguments); 2069 else 2070 pi.util.Element.addClass.apply(this,arguments); 2071 }, 2072 getOpacity:function(_styleObject){ 2073 var styleObject = _styleObject; 2074 if(!pi.env.ie) 2075 return styleObject["opacity"]; 2076 2077 var alpha = styleObject["filter"].match(/opacity\=(\d+)/i); 2078 return alpha?alpha[1]/100:1; 2079 }, 2080 setOpacity:function(_element,_value){ 2081 if(!pi.env.ie) 2082 return pi.util.Element.addStyle(_element,{ "opacity":_value }); 2083 _value*=100; 2084 pi.util.Element.addStyle(_element,{ "filter":"alpha(opacity="+_value+")" }); 2085 return this._parent_; 2086 }, 2087 getPosition:function(_element){ 2088 var parent = _element,offsetLeft = document.body.offsetLeft, offsetTop = document.body.offsetTop, view = pi.util.Element.getView(_element); 2089 while(parent&&parent!=document.body&&parent!=document.firstChild){ 2090 offsetLeft +=parseInt(parent.offsetLeft); 2091 offsetTop += parseInt(parent.offsetTop); 2092 parent = parent.offsetParent; 2093 }; 2094 return { 2095 "bottom":view["bottom"], 2096 "clientLeft":_element.clientLeft, 2097 "clientTop":_element.clientTop, 2098 "left":view["left"], 2099 "marginTop":view["marginTop"], 2100 "marginLeft":view["marginLeft"], 2101 "offsetLeft":offsetLeft, 2102 "offsetTop":offsetTop, 2103 "position":view["position"], 2104 "right":view["right"], 2105 "top":view["top"], 2106 "zIndex":view["zIndex"] 2107 }; 2108 }, 2109 getSize:function(_element){ 2110 var view = pi.util.Element.getView(_element); 2111 return { 2112 "height":view["height"], 2113 "clientHeight":_element.clientHeight, 2114 "clientWidth":_element.clientWidth, 2115 "offsetHeight":_element.offsetHeight, 2116 "offsetWidth":_element.offsetWidth, 2117 "width":view["width"] 2118 } 2119 }, 2120 addStyle:function(_element,_style){ 2121 for(var key in _style){ 2122 key = key=="float"?pi.env.ie?"styleFloat":"cssFloat":key; 2123 if (key == "opacity" && pi.env.ie) { 2124 pi.util.Element.setOpacity(_element,_style[key]); 2125 continue; 2126 } 2127 try { 2128 _element.style[key] = _style[key]; 2129 }catch(e){} 2130 } 2131 }, 2132 getStyle:function(_element,_property){ 2133 _property = _property=="float"?pi.env.ie?"styleFloat":"cssFloat":_property; 2134 if(_property=="opacity"&&pi.env.ie) 2135 return pi.util.Element.getOpacity(_element.style); 2136 return typeof _property=="string"?_element.style[_property]:_element.style; 2137 }, 2138 getValue:function(_element){ 2139 switch(_element.nodeName.toLowerCase()){ 2140 case "input": 2141 case "textarea": 2142 return _element.value; 2143 case "select": 2144 return _element.options[_element.selectedIndex].value; 2145 default: 2146 return _element.innerHTML; 2147 break; 2148 } 2149 }, 2150 getView:function(_element,_property){ 2151 var view = document.defaultView?document.defaultView.getComputedStyle(_element,null):_element.currentStyle; 2152 _property = _property=="float"?pi.env.ie?"styleFloat":"cssFloat":_property; 2153 if(_property=="opacity"&&pi.env.ie) 2154 return pi.util.Element.getOpacity(_element,view); 2155 return typeof _property=="string"?view[_property]:view; 2156 } 2157 }, 2158 Hash: { 2159 clone:function(_hash,_undeep){ 2160 var tmp = {}; 2161 for(var key in _hash){ 2162 if( !_undeep&&pi.util.IsArray( _hash[key] ) ){ 2163 tmp[key] = pi.util.Array.clone( _hash[key] ); 2164 } else if( !_undeep&&pi.util.IsHash( _hash[key] ) ){ 2165 tmp[ key ] = pi.util.Hash.clone(_hash[key]); 2166 } else { 2167 tmp[key] = _hash[key]; 2168 } 2169 } 2170 return tmp; 2171 }, 2172 merge:function(_hash,_source,_undeep){ 2173 for(var key in _source){ 2174 var value = _source[key]; 2175 if (!_undeep&&pi.util.IsArray(_source[key])) { 2176 if(pi.util.IsArray( _hash[key] )){ 2177 Array.prototype.push.apply( _source[key], _hash[key] ) 2178 } 2179 else 2180 value = pi.util.Array.clone(_source[key]); 2181 } 2182 else if (!_undeep&&pi.util.IsHash(_source[key])) { 2183 if (pi.util.IsHash(_hash[key])) { 2184 value = pi.util.Hash.merge(_hash[key], _source[key]); 2185 } else { 2186 value = pi.util.Hash.clone( _source[key] ); 2187 } 2188 } else if( _hash[key] ) 2189 value = _hash[ key ]; 2190 _hash[key] = value; 2191 }; 2192 return _hash; 2193 } 2194 }, 2195 String:{ 2196 format:function(_str){ 2197 var values = Array.prototype.slice.call(arguments,1); 2198 return _str.replace(/\{(\d)\}/g,function(){ 2199 return values[arguments[1]]; 2200 }) 2201 } 2202 }, 2203 GetViewport:function(){ 2204 return { 2205 height:document.documentElement.clientHeight||document.body.clientHeight, 2206 width:document.documentElement.clientWidth||document.body.clientWidth 2207 } 2208 } 2209 }; 2210 2211 pi.base = function(){ 2212 this.body = {}; 2213 this.init = null; 2214 2215 this.build = function(_skipClonning){ 2216 var base = this, skipClonning = _skipClonning||false, _private = {}, 2217 fn = function(){ 2218 var _p = pi.util.Hash.clone(_private); 2219 if(!skipClonning){ 2220 for(var key in this){ 2221 if(pi.util.IsArray( this[ key ] ) ){ 2222 this[key] = pi.util.Array.clone( this[key] ); 2223 } else 2224 if( pi.util.IsHash(this[key]) ){ 2225 this[key] = pi.util.Hash.clone( 2226 this[ key ], 2227 function(_key,_object){ 2228 this[ _key ]._parent_ = this; 2229 } 2230 ); 2231 //this[key]._parent_ = this; 2232 } 2233 } 2234 }; 2235 base.createAccessors( _p, this ); 2236 if(base.init) 2237 return base.init.apply(this,arguments); 2238 return this; 2239 }; 2240 this.movePrivateMembers(this.body,_private); 2241 if(this.init){ 2242 fn["$Init"] = this.init; 2243 }; 2244 fn.prototype = this.body; 2245 return fn; 2246 }; 2247 2248 this.createAccessors = function(_p, _branch){ 2249 var getter = function(_property){ return this[_property]; }, 2250 setter = function(_property,_value){ this[_property] = _value; return _branch._parent_||_branch; }; 2251 2252 for (var name in _p) { 2253 var isPrivate = name.substring(0, 1) == "_", title = name.substring(1, 2).toUpperCase() + name.substring(2); 2254 2255 if (isPrivate) { 2256 _branch[(_branch["get" + title]?"_":"")+"get" + title] = pi.util.Curry(getter,_p,name); 2257 _branch[(_branch["set" + title]?"_":"")+"set" + title] = pi.util.Curry(setter,_p,name); 2258 } 2259 else 2260 if (pi.util.IsHash(_p[name])){ 2261 _branch[name]._parent_ = _branch; 2262 if(!_branch[name]) 2263 _branch[name] = {}; 2264 this.createAccessors(_p[name], _branch[name]); 2265 } 2266 }; 2267 }; 2268 2269 this.movePrivateMembers = function(_object, _branch){ 2270 for (var name in _object) { 2271 var isPrivate = name.substring(0, 1) == "_"; 2272 2273 if (isPrivate) { 2274 _branch[name] = _object[name]; 2275 delete _object[name]; 2276 } 2277 else 2278 if (pi.util.IsHash(_object[name])){ 2279 _branch[name] = {}; 2280 this.movePrivateMembers(_object[name], _branch[name]); 2281 } 2282 }; 2283 }; 2284 }; 2285 2286 pi.element = new pi.base; 2287 pi.element.init = function(_val){ 2288 this.environment.setElement( 2289 typeof _val=="string"||!_val? 2290 document.createElement(_val||"DIV"): 2291 _val 2292 ); 2293 return this; 2294 }; 2295 2296 pi.element.body = { 2297 "addStyle":function(){ 2298 return this.environment.addStyle.apply(this.environment,arguments); 2299 }, 2300 "clean":function(){ 2301 var childs = this.child.get(); 2302 while(childs.length){ 2303 childs[0].parentNode.removeChild(childs[0]); 2304 } 2305 }, 2306 "clone":function(_deep){ 2307 return this.environment.getElement().cloneNode(_deep); 2308 }, 2309 "insert":function(_element){ 2310 _element = _element.environment?_element.environment.getElement():_element; 2311 _element.appendChild(this.environment.getElement()); 2312 return this; 2313 }, 2314 "insertAfter":function(_referenceElement){ 2315 _referenceElement = _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement; 2316 _referenceElement.nextSibling?this.insertBefore(_referenceElement.nextSibling):this.insert(_referenceElement.parentNode); 2317 return this; 2318 }, 2319 "insertBefore":function(_referenceElement){ 2320 _referenceElement = _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement; 2321 _referenceElement.parentNode.insertBefore(this.environment.getElement(),_referenceElement); 2322 return this; 2323 }, 2324 "query":function(_expression,_resultType,namespaceResolver,_result){ 2325 return pi.xpath(_expression,_resultType||"ORDERED_NODE_SNAPSHOT_TYPE",this.environment.getElement(),_namespaceResolver,_result); 2326 }, 2327 "remove":function(){ 2328 if (this.environment.getParent()) { 2329 this.environment.getParent().removeChild(this.environment.getElement()); 2330 } 2331 }, 2332 "update":function(_value){ 2333 this.element[this.element.nodeName.toLowerCase()=="textarea"||this.element.nodeName.toLowerCase()=="input"?"value":"innerHTML"]=_value; 2334 return this; 2335 }, 2336 "attribute":{ 2337 "getAll":function(){ 2338 return this._parent_.environment.getElement().attributes; 2339 }, 2340 "clear":function(_name){ 2341 this.set(_name,""); 2342 return this._parent_; 2343 }, 2344 "get":function(_name){ 2345 return this._parent_.environment.getElement().getAttribute(_name); 2346 }, 2347 "has":function(_name){ 2348 return pi.env.ie?(this.get(_name)!=null):this._parent_.environment.getElement().hasAttribute(_name); 2349 }, 2350 "remove":function(_name){ 2351 this._parent_.environment.getElement().removeAttribute(_name); 2352 return this._parent_; 2353 }, 2354 "set":function(_name,_value){ 2355 this._parent_.environment.getElement().setAttribute(_name,_value); 2356 return this._parent_; 2357 }, 2358 "addClass":function(_classes){ 2359 for(var i=0,len=arguments.length; i<len; i++){ 2360 pi.util.Element.addClass(this._parent_.environment.getElement(),arguments[i]); 2361 }; 2362 return this._parent_; 2363 }, 2364 "clearClass":function(){ 2365 this.setClass(""); 2366 this._parent_; 2367 }, 2368 "getClass":function(){ 2369 return pi.util.Element.getClass( this._parent_.environment.getElement() ); 2370 }, 2371 "hasClass":function(_class){ 2372 return pi.util.Element.hasClass( this._parent_.environment.getElement(), _class ); 2373 }, 2374 "setClass":function(_value){ 2375 return pi.util.Element.setClass( this._parent_.environment.getElement(), _value ); 2376 }, 2377 "removeClass":function(_class){ 2378 pi.util.Element.removeClass( this._parent_.environment.getElement(), _class ); 2379 return this._parent_; 2380 }, 2381 "toggleClass":function(_class){ 2382 pi.util.Element.toggleClass( this._parent_.environment.getElement(), _class ); 2383 } 2384 }, 2385 "child":{ 2386 "get":function(){ 2387 return this._parent_.environment.getElement().childNodes; 2388 }, 2389 "add":function(_elements){ 2390 for (var i = 0; i < arguments.length; i++) { 2391 var el = arguments[i]; 2392 this._parent_.environment.getElement().appendChild( 2393 el.environment ? el.environment.getElement() : el 2394 ); 2395 } 2396 return this._parent_; 2397 }, 2398 "addAfter":function(_element,_referenceElement){ 2399 this.addBefore( 2400 _element.environment?_element.environment.getElement():_element, 2401 (_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement).nextSibling 2402 ); 2403 return this._parent_; 2404 }, 2405 "addBefore":function(_element,_referenceElement){ 2406 this._parent_.environment.getElement().insertBefore( 2407 _element.environment?_element.environment.getElement():_element, 2408 _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement 2409 ); 2410 return this._parent_; 2411 }, 2412 "remove":function(_element){ 2413 this._parent_.environment.getElement().removeChild(_element.environment?_element.environment.getElement():_element); 2414 } 2415 }, 2416 "environment":{ 2417 "_element":null, 2418 "setElement":function(_value){ 2419 this._parent_.element = _value; 2420 this._parent_.element.lib = this._parent_; 2421 this._parent_.element.firebugElement = true; 2422 this._setElement(_value); 2423 }, 2424 "getParent":function(){ 2425 return this.getElement().parentNode; 2426 }, 2427 "getPosition":function(){ 2428 return pi.util.Element.getPosition(this.getElement()); 2429 }, 2430 "getSize":function(){ 2431 return pi.util.Element.getSize( this.getElement() ); 2432 }, 2433 "addStyle":function(_styleObject){ 2434 pi.util.Element.addStyle(this.getElement(),_styleObject); 2435 return this._parent_; 2436 }, 2437 "getStyle":function(_property){ 2438 return pi.util.Element.getStyle(this.getElement(),_property); 2439 }, 2440 "getName":function(){ 2441 return this.getElement().nodeName; 2442 }, 2443 "getType":function(){ 2444 return this.getElement().nodeType; 2445 }, 2446 "getValue":function(){ 2447 return pi.util.Element.getValue(this.getElement()); 2448 }, 2449 "getView":function(_property){ 2450 return pi.util.Element.getView(this.getElement(),_property); 2451 } 2452 }, 2453 "event":{ 2454 "addListener":function(_event,_fn,_useCapture){ 2455 pi.util.AddEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture); 2456 return this._parent_; 2457 }, 2458 "removeListener":function(_event,_fn,_useCapture){ 2459 pi.util.RemoveEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture); 2460 return this._parent_; 2461 } 2462 } 2463 }; 2464 pi.element = pi.element.build(); 2465 2466 pi.xhr = new pi.base; 2467 pi.xhr.init = function(_url){ 2468 if(!window.XMLHttpRequest){ 2469 var names = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"]; 2470 for (var i = 0; i < names.length; i++) { 2471 try { 2472 this.environment.setApi(new ActiveXObject(names[i])); 2473 break; 2474 } catch (e) { continue; } 2475 } 2476 } 2477 else { 2478 this.environment.setApi(new XMLHttpRequest()); 2479 } 2480 this.environment.getApi().onreadystatechange=pi.util.Curry(this.event.readystatechange,this); 2481 this.environment.setUrl(_url); 2482 this.environment.setCallback([]); 2483 2484 return this; 2485 }; 2486 pi.xhr.body = { 2487 "addCallback": function(){ 2488 return this.environment.addCallback.apply(this.environment,arguments); 2489 }, 2490 "addData": function(){ 2491 return this.environment.addData.apply(this.environment,arguments); 2492 }, 2493 "abort":function(){ 2494 this.environment.getApi().abort(); 2495 return this; 2496 }, 2497 "send":function(){ 2498 var url = this.environment.getUrl(), data = this.environment.getData(),dataUrl = ""; 2499 2500 if(!this.environment.getCache()) 2501 data["forceCache"] = Number(new Date); 2502 2503 for (var key in data) 2504 dataUrl += pi.util.String.format("{0}={1}&",key, data[key]); 2505 2506 if (this.environment.getType()=="GET") 2507 url += (url.search("\\?")==-1?"?":"&")+pi.util.String.format("{0}",dataUrl); 2508 2509 this.api.open(this.environment.getType(),url,this.environment.getAsync()); 2510 if(this.environment.getType()=="POST"){ 2511 this.api.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 2512 }; 2513 this.api.send(this.environment.getType()=="GET"?"":dataUrl); 2514 return this; 2515 } 2516 }; 2517 pi.xhr.body.environment = { 2518 "_async":true, "_api":null, "_cache":true, "_callback":null, "_data":{}, "_type":"GET", "_url":"", 2519 "setApi":function(_value){ 2520 this._parent_.api = _value; 2521 this._setApi(_value); 2522 }, 2523 "addCallback": function(_readyState,_fn){ 2524 this.getCallback().push({ "fn":_fn, "readyState":_readyState }); 2525 return this._parent_; 2526 }, 2527 "addData": function(_key,_value){ 2528 this.getData()[_key] = _value; 2529 return this._parent_; 2530 }, 2531 "setType": function(_value){ 2532 this._setType(_value); 2533 return this._parent_; 2534 } 2535 }; 2536 pi.xhr.body.event = { 2537 "readystatechange":function(){ 2538 var readyState = this.environment.getApi().readyState, callback=this.environment.getCallback(); 2539 for (var i = 0, len=callback.length; i < len; i++) { 2540 if(pi.util.Array.indexOf(callback[i].readyState,readyState)>-1){ 2541 callback[i].fn.apply(this); 2542 } 2543 } 2544 } 2545 }; 2546 pi.xhr = pi.xhr.build(); 2547 2548 /* 2549 * xml.xhr.get 2550 */ 2551 2552 pi.xhr.get = function(_url,_returnPiObject){ 2553 var request = new pi.xhr(); 2554 request.environment.setAsync(false); 2555 request.environment.setUrl(_url); 2556 request.send(); 2557 return _returnPiObject?request:request.environment.getApi(); 2558 }; 2559 2560 /* 2561 * registering onload event for init functions 2562 */ 2563 pi.util.AddEvent( 2564 pi.env.ie?window:document, 2565 pi.env.ie?"load":"DOMContentLoaded", 2566 function(){ 2567 for(var i=0,len=pi.util.Init.length; i<len; i++){ 2568 pi.util.Init[ i ](); 2569 } 2570 } 2571 ); 2572})(firebug); 2573 2574(function(){ 2575 with(firebug){ 2576 var scriptsIncluded = document.getElementsByTagName('script'); 2577 for(var i=scriptsIncluded.length-1; i>=0; i--){ 2578 var script = scriptsIncluded[i], 2579 src = getFileName(script.src); 2580 if(src){ 2581 internal.liteFilename = src; 2582 break; 2583 } 2584 } 2585 initConsole(); 2586 lib.util.Init.push(firebug.init); 2587 } 2588})(); 2589