Changeset 1307
- Timestamp:
- 06/08/09 00:20:53 (10 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/windmill/html/js/lib/firebug/firebug-lite.js
r1180 r1307 1 1 var firebug = { 2 version:[1.23,20090 309],2 version:[1.23,20090506], 3 3 el:{}, 4 4 env:{ 5 "cache":{}, 6 "extConsole":null, 7 "css":"/windmill-serv/css/firebug-lite.css", 5 "css":"http://getfirebug.com/releases/lite/1.2/firebug-lite.css", 8 6 "debug":true, 9 "detectFirebug": false,7 "detectFirebug":true, 10 8 "dIndex":"console", 11 "height": 195,9 "height":295, 12 10 "hideDOMFunctions":false, 13 "init":false,14 "isPopup":false,15 "liteFilename":"firebug-lite.js",16 "minimized":false,17 11 "openInPopup": false, 18 12 "override":false, 19 13 "ml":false, 20 "popupWin":null,21 14 "showIconWhenHidden":true, 22 "targetWindow":undefined,23 15 "popupTop":1, 24 16 "popupLeft":1, 25 17 "popupWidth":undefined, 26 "popupHeight":undefined 18 "popupHeight":undefined, 19 "textNodeChars":0 20 }, 21 internal:{ 22 "cache":{}, 23 "extConsole":null, 24 "init":false, 25 "isPopup":false, 26 "liteFilename":null, 27 "minimized":false, 28 "popupWin":null, 29 "targetWindow":undefined 27 30 }, 28 31 initConsole:function(){ … … 48 51 env.override=true; 49 52 try{ 50 env.extConsole=window.console;53 internal.extConsole=window.console; 51 54 } catch(e){} 52 55 initConsole(); … … 55 58 restoreConsole:function(){ 56 59 with(firebug){ 57 if( env.extConsole){60 if(internal.extConsole){ 58 61 env.override=false; 59 62 try{ 60 window.console= env.extConsole;63 window.console=internal.extConsole; 61 64 } catch(e){} 62 env.extConsole=null;65 internal.extConsole=null; 63 66 } 64 67 } 65 68 }, 66 69 init:function(_css){ 67 var 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."; 70 var i, 71 cssLoaded=false, 72 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."; 68 73 69 74 with(firebug){ … … 72 77 } 73 78 74 if( env.isPopup) {79 if(internal.isPopup) { 75 80 env.openInPopup = false; 76 env.targetWindow = window.opener;81 internal.targetWindow = window.opener; 77 82 env.popupWidth = window.opener.firebug.env.popupWidth || window.opener.firebug.lib.util.GetViewport().width; 78 83 env.popupHeight = window.opener.firebug.env.popupHeight || window.opener.firebug.lib.util.GetViewport().height; 79 84 } else { 80 env.targetWindow = window;85 internal.targetWindow = window; 81 86 env.popupWidth = env.popupWidth || lib.util.GetViewport().width; 82 87 env.popupHeight = env.popupHeight || lib.util.GetViewport().height; … … 85 90 settings.readCookie(); 86 91 87 if( env.init || (env.detectFirebug && window.console && window.console.firebug)) {92 if(internal.init || (env.detectFirebug && window.console && window.console.firebug)) { 88 93 return; 89 94 } 90 95 91 document.getElementsByTagName("head")[0].appendChild( 92 new lib.element("link").attribute.set("rel","stylesheet").attribute.set("type","text/css").attribute.set("href",env.css).element 93 ); 96 for(i=0;i<document.styleSheets.length;i++) { 97 if(/firebug-lite\.css/i.test(document.styleSheets[i].href)) { 98 cssLoaded=true; 99 break; 100 } 101 } 102 103 if(!cssLoaded){ 104 document.getElementsByTagName("head")[0].appendChild( 105 new lib.element("link").attribute.set("rel","stylesheet").attribute.set("type","text/css").attribute.set("href",env.css).element 106 ); 107 } 94 108 95 109 if(env.override){ … … 100 114 * Firebug Icon 101 115 */ 102 el.firebugIcon = new lib.element("div").attribute.set( "id","firebugIconDiv").attribute.set("title",iconTitle).attribute.set("alt",iconTitle).event.addListener("mousedown",win.iconClicked).insert(document.body);116 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); 103 117 104 118 /* … … 106 120 */ 107 121 el.content = {}; 108 el.mainiframe = new lib.element("IFRAME").attribute.set("id","FirebugIFrame"). environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body);109 el.main = new lib.element("DIV").attribute.set("id","Firebug"). environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body);110 if(! env.isPopup){122 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); 123 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); 124 if(!internal.isPopup){ 111 125 el.resizer = new lib.element("DIV").attribute.addClass("Resizer").event.addListener("mousedown",win.resizer.start).insert(el.main); 112 126 } … … 124 138 el.button.container = new lib.element("DIV").attribute.addClass("ButtonContainer").insert(el.header); 125 139 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); 126 el.button.inspect = new lib.element("A").attribute.addClass("Button").event.addListener("click", env.targetWindow.firebug.d.inspector.toggle).update("Inspect").insert(el.button.container);140 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); 127 141 el.button.dock = new lib.element("A").attribute.addClass("Button Dock").event.addListener("click", win.dock).insert(el.button.container); 128 142 el.button.newWindow = new lib.element("A").attribute.addClass("Button NewWindow").event.addListener("click", win.newWindow).insert(el.button.container); 129 143 130 if(! env.isPopup){144 if(!internal.isPopup){ 131 145 el.button.maximize = new lib.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container); 132 146 el.button.minimize = new lib.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container); … … 146 160 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); 147 161 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); 148 if(! env.isPopup){162 if(!internal.isPopup){ 149 163 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); 150 164 } 151 el.nav.dom = new lib.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",lib.util.Curry(d.navigate, env.targetWindow,"dom")).insert(el.nav.container);165 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); 152 166 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); 153 167 el.nav.optionsdiv = new lib.element("DIV").attribute.addClass("Settings").insert(el.nav.container); 154 el.nav.options = new lib.element("A").attribute.addClass("Tab ").update("Options ∨").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv);168 el.nav.options = new lib.element("A").attribute.addClass("Tab Button Options").update("Options ").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv); 155 169 156 170 /* 157 171 * inspector 158 172 */ 159 el.borderInspector = new lib.element("DIV").attribute.set("id","FirebugBorderInspector"). event.addListener("click",listen.inspector).insert(document.body);160 el.bgInspector = new lib.element("DIV").attribute.set("id","FirebugBGInspector"). insert(document.body);173 el.borderInspector = new lib.element("DIV").attribute.set("id","FirebugBorderInspector").attribute.set('firebugIgnore',true).event.addListener("click",listen.inspector).insert(document.body); 174 el.bgInspector = new lib.element("DIV").attribute.set("id","FirebugBGInspector").attribute.set('firebugIgnore',true).insert(document.body); 161 175 162 176 /* … … 260 274 el.button.dom.container = new lib.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container); 261 275 el.button.dom.label = new lib.element("LABEL").update("Object Path:").insert(el.button.dom.container); 262 el.button.dom.textbox = new lib.element("INPUT").event.addListener("keydown",listen.domTextbox).update( env.isPopup?"window.opener":"window").insert(el.button.dom.container);276 el.button.dom.textbox = new lib.element("INPUT").event.addListener("keydown",listen.domTextbox).update(internal.isPopup?"window.opener":"window").insert(el.button.dom.container); 263 277 264 278 /* … … 320 334 el.settings.cbxOpenInPopup = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 321 335 el.settings.content.child.add(document.createTextNode("Open in popup")); 336 new lib.element("BR").insert(el.settings.content); 337 el.settings.content.child.add(document.createTextNode("Trim textnode to ")); 338 el.settings.textNodeChars = new lib.element("INPUT").attribute.set("type","text").attribute.addClass("SettingsTextbox").insert(el.settings.content); 339 el.settings.content.child.add(document.createTextNode(" chars")); 322 340 el.settings.buttonDiv = new lib.element("DIV").insert(el.settings.content); 323 341 el.settings.buttonLeftDiv = new lib.element("DIV").attribute.addClass("ButtonsLeft").insert(el.settings.buttonDiv); … … 330 348 lib.util.AddEvent(document,"mousemove",listen.mouse)("mousemove",win.resizer.resize)("mouseup",win.resizer.stop)("keydown",listen.keyboard); 331 349 332 env.init = true;350 internal.init = true; 333 351 334 352 for(var i=0, len=d.console.cache.length; i<len; i++){ … … 355 373 356 374 if(env.showIconWhenHidden) { 357 if(! env.popupWin) {375 if(!internal.popupWin) { 358 376 el.firebugIcon.environment.addStyle({ "display": env.debug&&'none'||'block' }); 359 377 } … … 362 380 lib.util.AddEvent(window, "unload", win.unload); 363 381 364 if ( env.isPopup) {382 if (internal.isPopup) { 365 383 env.height=lib.util.GetViewport().height; 366 384 lib.util.AddEvent(window, "resize", win.fitToPopup); … … 372 390 win.setHeight(env.height); 373 391 374 if(env.openInPopup&&! env.isPopup) {392 if(env.openInPopup&&!internal.isPopup) { 375 393 win.newWindow(); 376 394 } else { … … 400 418 el.settings.container.environment.addStyle({ 401 419 "display": "block", 402 "left": (posXY.offsetLeft-1 25)+"px"420 "left": (posXY.offsetLeft-107)+"px" 403 421 }); 404 422 el.settings.progressDiv.environment.addStyle({ … … 439 457 fe.showIconWhenHidden=elSet.cbxShowIcon.element.checked; 440 458 fe.openInPopup=elSet.cbxOpenInPopup.element.checked; 441 442 if(fe.isPopup) { 443 ofe=window.opener.firebug.env; 444 ofe.debug=fe.debug; 445 ofe.detectFirebug=fe.detectFirebug; 446 ofe.hideDOMFunctions=fe.hideDOMFunctions; 447 ofe.override=fe.override; 448 ofe.showIconWhenHidden=fe.showIconWhenHidden; 449 ofe.openInPopup=fe.openInPopup; 450 ofe.popupTop=fe.popupTop; 451 ofe.popupLeft=fe.popupLeft; 452 ofe.popupWidth=fe.popupWidth; 453 ofe.popupHeight=fe.popupHeight; 459 460 if(isFinite(elSet.textNodeChars.element.value)&&elSet.textNodeChars.element.value>0) { 461 fe.textNodeChars=elSet.textNodeChars.element.value; 462 } else { 463 fe.textNodeChars=0; 464 } 465 466 if(firebug.internal.isPopup) { 467 window.opener.firebug.env = firebug.lib.util.Hash.clone(fe); 454 468 } 455 469 … … 458 472 settings.hide(); 459 473 win.refreshDOM(); 474 d.html.openHtmlTree(); 475 if(internal.isPopup) { 476 with(opener.firebug) { 477 win.refreshDOM(); 478 d.html.openHtmlTree(); 479 } 480 } 460 481 } 461 482 }, … … 471 492 472 493 with(firebug.env){ 473 if( targetWindow.document.cookie.length>0) {474 cookieArr= targetWindow.document.cookie.split('; ');494 if(firebug.internal.targetWindow.document.cookie.length>0) { 495 cookieArr=firebug.internal.targetWindow.document.cookie.split('; '); 475 496 476 497 for(i=0;i<cookieArr.length;i++) { … … 504 525 openInPopup=value=="true"; 505 526 break; 527 case 'textNodeChars': 528 textNodeChars=isFinite(value)?parseInt(value,10):0; 529 break; 506 530 case 'popupTop': 507 531 popupTop=parseInt(value,10); … … 535 559 values+='showIconWhenHidden:'+showIconWhenHidden+','; 536 560 values+='openInPopup:'+openInPopup+','; 537 538 if(isPopup) { 561 values+='textNodeChars:'+textNodeChars+','; 562 563 if(firebug.internal.isPopup) { 539 564 if(window.outerWidth===undefined) { 540 565 values+='popupTop:'+(window.screenTop-56)+','; … … 555 580 } 556 581 557 values+='height:'+(parseInt( targetWindow.firebug.el.main.element.style.height.replace(/px/,''),10)-38);582 values+='height:'+(parseInt(firebug.internal.targetWindow.firebug.el.main.element.style.height.replace(/px/,''),10)-38); 558 583 559 584 exdate=new Date(); 560 585 exdate.setDate(exdate.getDate()+365); 561 targetWindow.document.cookie='FBLiteSettings='+values+';expires='+exdate.toGMTString();586 firebug.internal.targetWindow.document.cookie='FBLiteSettings='+values+';expires='+exdate.toGMTString(); 562 587 } 563 588 }, … … 572 597 elSet.cbxShowIcon.element.checked=fe.showIconWhenHidden; 573 598 elSet.cbxOpenInPopup.element.checked=fe.openInPopup; 599 elSet.textNodeChars.element.value=fe.textNodeChars; 574 600 } 575 601 }, … … 617 643 minimize:function(){ 618 644 with(firebug){ 619 env.minimized=true;645 internal.minimized=true; 620 646 el.main.environment.addStyle({ "height":"35px" }); 621 647 el.mainiframe.environment.addStyle({ "height":"35px" }); … … 627 653 maximize:function(){ 628 654 with(firebug){ 629 env.minimized=false;655 internal.minimized=false; 630 656 el.button.minimize.environment.addStyle({ "display":"block" }); 631 657 el.button.maximize.environment.addStyle({ "display":"none" }); … … 634 660 }, 635 661 newWindow: function() { 636 return;637 662 var interval,scripts,script,scriptPath, 638 fe=firebug.env; 639 640 if (!fe.popupWin) { 663 fe=firebug.env, 664 fi=firebug.internal; 665 666 if (!fi.popupWin) { 641 667 scripts = document.getElementsByTagName('script'); 642 668 643 f e.popupWin = window.open("", "_firebug",669 fi.popupWin = window.open("", "_firebug", 644 670 "status=0,menubar=0,resizable=1,top="+fe.popupTop+",left="+fe.popupLeft+",width=" + fe.popupWidth + 645 671 ",height=" + fe.popupHeight + ",scrollbars=0,addressbar=0,outerWidth="+fe.popupWidth+",outerHeight="+fe.popupHeight+ 646 672 "toolbar=0,location=0,directories=0,dialog=0"); 647 673 648 if(!f e.popupWin) {674 if(!fi.popupWin) { 649 675 alert("Firebug Lite could not open a pop-up window, most likely because of a popup blocker.\nPlease enable popups for this domain"); 650 676 } else { 651 677 firebug.settings.hide(); 652 678 653 679 for (i=0,len=scripts.length; i<len; i++) { 654 if (scripts[i].src.indexOf(f e.liteFilename) > -1) {680 if (scripts[i].src.indexOf(fi.liteFilename) > -1) { 655 681 scriptPath = scripts[i].src; 656 682 break; … … 659 685 660 686 if (scriptPath) { 661 script = fe.popupWin.document.createElement('script'), done = false; 687 done = false; 688 script = fi.popupWin.document.createElement('script'); 662 689 script.type = 'text/javascript'; 663 690 script.src = scriptPath; … … 666 693 if(!done && (!firebug.lib.env.ie || this.readyState == "complete" || this.readyState=="loaded")){ 667 694 done = true; 668 if(f e.popupWin.firebug) {669 with(f e.popupWin.firebug) {670 env.isPopup = true;695 if(fi.popupWin.firebug) { 696 with(fi.popupWin.firebug) { 697 internal.isPopup = true; 671 698 env.css = fe.css; 672 699 init(); … … 679 706 680 707 if (!done && firebug.lib.env.webkit) { 681 fe.popupWin.document.write('<html><head></head><body></body></html>');682 708 interval = setInterval(function() { 683 if (f e.popupWin.firebug) {709 if (firebug.internal.popupWin.firebug) { 684 710 clearInterval(interval); 685 711 done = true; 686 with(f e.popupWin.firebug) {687 env.isPopup = true;712 with(firebug.internal.popupWin.firebug) { 713 internal.isPopup = true; 688 714 env.css = fe.css; 689 715 init(); … … 695 721 }; 696 722 723 if(!firebug.lib.env.ie) { 724 firebug.internal.popupWin.document.write('<html><head><title>Firebug Lite - '+document.location.href+'</title></head><body></body></html>'); 725 } 697 726 if (!done) { 698 f e.popupWin.document.getElementsByTagName('head')[0].appendChild(script);727 firebug.internal.popupWin.document.getElementsByTagName('head')[0].appendChild(script); 699 728 firebug.el.main.environment.addStyle({"display": "none"}); 700 729 firebug.el.mainiframe.environment.addStyle({"display": "none"}); 701 730 } 702 731 } else { 703 /*alert("Unable to detect the following script \"" + fe.liteFilename +704 "\" ... if the script has been renamed then please set the value of firebug. env.liteFilename to reflect this change");*/705 f e.popupWin.close();706 f e.popupWin=null;732 alert("Unable to detect the following script \"" + firebug.internal.liteFilename + 733 "\" ... if the script has been renamed then please set the value of firebug.internal.liteFilename to reflect this change"); 734 firebug.internal.popupWin.close(); 735 firebug.internal.popupWin=null; 707 736 } 708 737 } … … 711 740 dock: function() { 712 741 with(opener.firebug) { 713 env.popupWin = null;742 internal.popupWin = null; 714 743 el.main.environment.addStyle({ 715 744 "display": "block" … … 724 753 unload: function() { 725 754 with(firebug){ 726 if( env.isPopup) {755 if(internal.isPopup) { 727 756 win.dock(); 728 } else if( env.popupWin) {729 env.popupWin.close();757 } else if(internal.popupWin) { 758 internal.popupWin.close(); 730 759 } 731 760 } … … 747 776 start:function(_event){ 748 777 with(firebug){ 749 if( env.minimized)return;778 if(internal.minimized)return; 750 779 win.resizer.y=[el.main.element.offsetHeight,_event.clientY]; 751 780 if(lib.env.ie6){ … … 824 853 refreshSize:function(){ 825 854 with(firebug){ 826 if(! env.init)855 if(!internal.init) 827 856 return; 828 857 … … 905 934 if(_cmd==='console.firebug') { 906 935 d.console.addLine().attribute.addClass("Arrow").update(firebug.version); 907 } else { 936 } else { 908 937 result = eval.call(window,_cmd); 909 938 d.console.print(_cmd,result); … … 923 952 run:function(_command){ 924 953 with(firebug){ 925 if(! env.init){954 if(!internal.init){ 926 955 d.console.cache.push({ "command":_command, "arg":Array.prototype.slice.call(arguments,1) }); 927 956 } else { … … 1051 1080 open:function(_index){ 1052 1081 with (firebug) { 1053 var item = env.targetWindow.document.styleSheets[_index],1082 var item = internal.targetWindow.document.styleSheets[_index], 1054 1083 uri = item.href; 1055 1084 try { … … 1081 1110 with(firebug){ 1082 1111 el.button.css.selectbox.update(""); 1083 var collection = env.targetWindow.document.styleSheets;1112 var collection = internal.targetWindow.document.styleSheets; 1084 1113 for(var i=0,len=collection.length; i<len; i++){ 1085 1114 var uri = getFileName(collection[i].href); … … 1148 1177 with(firebug){ 1149 1178 var isArray = false, isHash, isElement = false, vtype=typeof _value, result=[]; 1150 1179 1151 1180 if(vtype=="object"){ 1152 1181 if(Object.prototype.toString.call(_value) === "[object Date]"){ … … 1167 1196 1168 1197 // number, string, boolean, null, function 1169 if(_value==null||vtype=="number"||vtype=="string"||vtype=="boolean"|| vtype=="function"||vtype=="regexp"||vtype=="date"){1198 if(_value==null||vtype=="number"||vtype=="string"||vtype=="boolean"||(vtype=="function"&&_value.nodeName!="OBJECT")||vtype=="regexp"||vtype=="date"){ 1170 1199 if(_value==null){ 1171 result.push("<span class='Null'>null</span>"); 1200 if(_value===undefined) { 1201 result.push("<span class='Null'>undefined</span>"); 1202 } else { 1203 result.push("<span class='Null'>null</span>"); 1204 } 1172 1205 }else if (vtype=="regexp") { 1173 1206 result.push("<span class='Maroon'>" + _value + "</span>"); … … 1269 1302 } 1270 1303 if(_clear){ 1271 env.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" });1304 internal.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" }); 1272 1305 return; 1273 1306 } … … 1279 1312 parentLayer, 1280 1313 t, 1314 link, 1281 1315 tagName, 1316 searchEl, 1282 1317 parent = _element; 1283 1318 while (parent) { 1284 1319 map.push(parent); 1285 if (parent == firebug. env.targetWindow.document.body) break;1320 if (parent == firebug.internal.targetWindow.document.body) break; 1286 1321 parent = parent.parentNode; 1287 1322 } … … 1289 1324 with(firebug) { 1290 1325 if (env.dIndex != "html") { 1291 env.targetWindow.firebug.d.navigate("html");1292 } 1293 1294 env.targetWindow.firebug.d.inspector.toggle(false);1326 internal.targetWindow.firebug.d.navigate("html"); 1327 } 1328 1329 internal.targetWindow.firebug.d.inspector.toggle(false); 1295 1330 1296 1331 for (t = 0; t < el.left.html.container.child.get().length; t++) { 1297 if (el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0]) { 1298 if (el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].innerText) { 1299 tagName = el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].innerText; 1300 } else { 1301 tagName = el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].textContent; 1302 } 1303 1304 if (/<body/i.test(tagName)) { 1305 parentLayer = el.left.html.container.child.get()[t].childNodes[1].lib; 1306 break; 1307 } 1332 searchEl=el.left.html.container.child.get()[t]; 1333 if(/<body/i.test(searchEl.innerText||searchEl.textContent)) { 1334 parentLayer = el.left.html.container.child.get()[t].childNodes[1].lib; 1335 break; 1308 1336 } 1309 1337 } … … 1315 1343 for (t = 0, len = map.length; map[t]; t++) { 1316 1344 if (t == len - 1) { 1317 varlink = parentLayer.environment.getElement().previousSibling.lib;1345 link = parentLayer.environment.getElement().previousSibling.lib; 1318 1346 link.attribute.addClass("Selected"); 1347 1348 if(link.element.scrollIntoView) { 1349 link.element.scrollIntoView(false); 1350 } 1319 1351 1320 1352 if (d.html.current) { … … 1338 1370 openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){ 1339 1371 with(firebug){ 1340 var element = _element || env.targetWindow.document.documentElement,1372 var element = _element || internal.targetWindow.document.documentElement, 1341 1373 parent = _parent || el.left.html.container, 1342 1374 returnParentEl = _returnParentElementByElement || null, … … 1344 1376 len = element.childNodes.length, 1345 1377 nodeLink; 1346 1378 1379 if (!window.Node) { 1380 window.Node = {TEXT_NODE:3,COMMENT_NODE:8}; 1381 } 1382 1347 1383 if(parent!=el.left.html.container){ 1348 1384 nodeLink = parent.environment.getParent().lib.child.get()[0].lib; … … 1356 1392 }; 1357 1393 1358 if(element.childNodes&&(len==0||(len==1&&element.childNodes[0].nodeType== 3)))return;1394 if(element.childNodes&&(len==0||(len==1&&element.childNodes[0].nodeType==Node.TEXT_NODE)))return; 1359 1395 parent.clean(); 1360 1396 … … 1383 1419 var item = element.childNodes[i]; 1384 1420 1385 if (item.nodeType != 3){1421 if (item.nodeType != Node.TEXT_NODE && !item.getAttribute('firebugIgnore')){ 1386 1422 var container = new lib.element().attribute.addClass("Block").insert(parent), 1387 link = new lib.element("A").attribute.addClass("Link").insert(container), 1388 spacer = new lib.element("SPAN").attribute.addClass("Spacer").update(" ").insert(link), 1389 html = new lib.element("SPAN").attribute.addClass("Content").update(d.highlight(item)).insert(link), 1390 subContainer = new lib.element("DIV").attribute.addClass("SubContainer").insert(container), 1423 link = new lib.element("A").attribute.addClass("Link").insert(container), 1424 spacer = new lib.element("SPAN").attribute.addClass("Spacer").update(" ").insert(link), 1425 html = new lib.element("SPAN").attribute.addClass("Content").update(d.highlight(item)).insert(link), 1426 subContainer = new lib.element("DIV").attribute.addClass("SubContainer").insert(container), 1427 view; 1428 1429 if(item.nodeType == Node.COMMENT_NODE) { 1430 continue; 1431 } 1432 1391 1433 view = lib.util.Element.getView(item); 1392 1393 1434 link.event.addListener("click", lib.util.Curry(d.html.openHtmlTree, window, item, subContainer, false)); 1394 1435 link.event.addListener("mouseover", lib.util.Curry(d.html.highlight, window, item, false)); 1395 1436 link.event.addListener("mouseout", lib.util.Curry(d.html.highlight, window, item, true)); 1396 1437 1397 1438 returnParentVal = returnParentEl == item ? subContainer : returnParentVal; 1398 1439 1399 1440 if(d.html.current==null&&item==document.body){ 1400 1441 link.attribute.addClass("Selected"); 1442 link.attribute.addClass("Parent"); 1401 1443 d.html.current = [item,link]; 1402 1444 d.html.openHtmlTree(item,subContainer); … … 1409 1451 if (item.childNodes){ 1410 1452 var childLen = item.childNodes.length; 1411 if (childLen == 1 && item.childNodes[0].nodeType == 3) { 1412 html.child.add(document.createTextNode(item.childNodes[0].nodeValue.substring(0, 50))); 1453 if (childLen == 1 && item.childNodes[0].nodeType == Node.TEXT_NODE) { 1454 if(isFinite(env.textNodeChars)&&parseInt(env.textNodeChars)>0) { 1455 html.child.add(document.createTextNode(item.childNodes[0].nodeValue.substring(0, env.textNodeChars))); 1456 } else { 1457 html.child.add(document.createTextNode(item.childNodes[0].nodeValue)); 1458 } 1413 1459 html.child.add(document.createTextNode("</")); 1414 1460 html.child.add(new lib.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement()); … … 1416 1462 continue; 1417 1463 } 1418 else 1419 if (childLen > 0) { 1420 link.attribute.addClass("Parent"); 1421 } 1464 else if (childLen > 0) { 1465 link.attribute.addClass("Parent"); 1466 } 1422 1467 } 1423 1468 } … … 1455 1500 inspect:function(_element,_bgInspector){ 1456 1501 with(firebug){ 1457 var pos = env.targetWindow.firebug.lib.util.Element.getPosition(_element);1458 1459 env.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({1502 var pos = internal.targetWindow.firebug.lib.util.Element.getPosition(_element); 1503 1504 internal.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({ 1460 1505 "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px", 1461 1506 "top":pos.offsetTop-(_bgInspector?0:2)+"px", "left":pos.offsetLeft-(_bgInspector?0:2)+"px", 1462 1507 "display":"block" 1463 1508 }); 1464 9 1509 1465 1510 if(!_bgInspector){ 1466 1511 d.inspector.el = _element; … … 1478 1523 d.inspector.el = null; 1479 1524 } else if(lib.env.dIndex!="html") { 1480 if ( env.popupWin) {1481 env.popupWin.firebug.d.navigate("html");1525 if (internal.popupWin) { 1526 internal.popupWin.firebug.d.navigate("html"); 1482 1527 } else { 1483 1528 d.navigate("html"); … … 1494 1539 d.scripts.index = _index; 1495 1540 el.left.scripts.container.update(""); 1496 var script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source;1541 var i=0,script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source; 1497 1542 try { 1498 1543 if(uri!=document.location.href){ 1499 source = env.cache[uri]||lib.xhr.get(uri).responseText;1500 env.cache[uri] = source;1544 source = internal.cache[uri]||lib.xhr.get(uri).responseText; 1545 internal.cache[uri] = source; 1501 1546 } else { 1502 1547 source = script.innerHTML; … … 1505 1550 return ({"<":"<",">":">"})[_ch]; 1506 1551 }); 1507 1508 if(!d.scripts.lineNumbers) 1509 el.left.scripts.container.child.add( 1510 new lib.element("DIV").attribute.addClass("CodeContainer").update(source) 1511 ); 1512 else { 1513 source = source.split("<br />"); 1514 for (var i = 0; i < source.length; i++) { 1515 el.left.scripts.container.child.add(new lib.element("DIV").child.add(new lib.element("DIV").attribute.addClass("LineNumber").update(i + 1), new lib.element("DIV").attribute.addClass("Code").update(" " + source[i]), new lib.element("DIV").attribute.addClass('Clear'))); 1516 }; 1517 }; 1552 1553 if(d.scripts.lineNumbers){ 1554 source = source.replace(/(^)|\n/g,function(_ch){ 1555 i++; 1556 return "\n"+i+" "; 1557 }); 1558 } 1559 1560 el.left.scripts.container.update(source); 1518 1561 } catch(e){ 1519 1562 el.left.scripts.container.child.add( … … 1533 1576 with(firebug){ 1534 1577 el.button.scripts.selectbox.clean(); 1535 var collection = env.targetWindow.document.getElementsByTagName("script");1578 var collection = internal.targetWindow.document.getElementsByTagName("script"); 1536 1579 for(var i=0,len=collection.length; i<len; i++){ 1537 1580 var item = collection[i], … … 1561 1604 try { 1562 1605 var item = arguments[i], 1563 val = env.targetWindow.eval(item);1606 val = internal.targetWindow.eval(item); 1564 1607 d.xhr.objects.push([item, val]); 1565 1608 } catch(e){ … … 1718 1761 addXhrObject:function(){ 1719 1762 with(firebug){ 1720 d.xhr.addObject.apply( env.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(","));1763 d.xhr.addObject.apply(internal.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(",")); 1721 1764 } 1722 1765 }, … … 1759 1802 inspector:function(){ 1760 1803 with(firebug){ 1761 if ( env.popupWin) {1762 env.popupWin.firebug.d.html.inspect(firebug.d.inspector.el);1804 if (internal.popupWin) { 1805 internal.popupWin.firebug.d.html.inspect(firebug.d.inspector.el); 1763 1806 } else { 1764 1807 firebug.d.html.inspect(firebug.d.inspector.el); … … 1770 1813 if(_event.keyCode==27 && d.inspector.enabled){ 1771 1814 d.inspector.toggle(); 1772 } else if(_event.keyCode === 123 && _event.ctrlKey || _event.metaKey) {1773 if( env.isPopup){1815 } else if(_event.keyCode === 123 && (_event.ctrlKey || _event.metaKey)) { 1816 if(internal.isPopup){ 1774 1817 win.dock(); 1775 1818 }else { … … 1777 1820 } 1778 1821 } else if( 1779 (_event.keyCode === 123 && !_event.ctrlKey && !_event.metaKey) ||1822 (_event.keyCode === 123 && (!_event.ctrlKey && !_event.metaKey)) || 1780 1823 (_event.keyCode === 76 && (_event.ctrlKey || _event.metaKey) && _event.shiftKey) || 1781 1824 (_event.keyCode === 13 && _event.shiftKey)) { 1782 1825 1783 if( env.isPopup){1826 if(internal.isPopup){ 1784 1827 win.dock(); 1785 1828 } else if (el.main.environment.getStyle("display") === 'none') { … … 1827 1870 var item = source[i]+"}", rule = !lib.env.ie?item:item.split(/{|}/), 1828 1871 styleSheet = document.styleSheets[0]; 1829 console.log(rule);1830 1872 if(item.match(/.+\{.+\}/)){ 1831 1873 if(lib.env.ie) … … 1845 1887 with(firebug){ 1846 1888 if(_event.keyCode==13){ 1847 d.xhr.addObject.apply( env.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(","));1889 d.xhr.addObject.apply(internal.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(",")); 1848 1890 } 1849 1891 } … … 2514 2556 })(firebug); 2515 2557 2516 with(firebug){ 2517 //initConsole(); 2518 //lib.util.Init.push(firebug.init); 2519 }; 2558 (function(){ 2559 with(firebug){ 2560 var scriptsIncluded = document.getElementsByTagName('script'); 2561 for(var i=scriptsIncluded.length-1; i>=0; i--){ 2562 var script = scriptsIncluded[i], 2563 src = getFileName(script.src); 2564 if(src){ 2565 internal.liteFilename = src; 2566 break; 2567 } 2568 } 2569 //initConsole(); 2570 //lib.util.Init.push(firebug.init); 2571 } 2572 })();
