Changeset 1307

Show
Ignore:
Timestamp:
06/08/09 00:20:53 (10 months ago)
Author:
admc
Message:

Upgrade of firebug-lite version

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/windmill/html/js/lib/firebug/firebug-lite.js

    r1180 r1307  
    11var firebug = { 
    2   version:[1.23,20090309], 
     2  version:[1.23,20090506], 
    33  el:{},  
    44  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",  
    86    "debug":true, 
    9     "detectFirebug":false, 
     7    "detectFirebug":true, 
    108    "dIndex":"console",  
    11     "height":195, 
     9    "height":295, 
    1210    "hideDOMFunctions":false, 
    13     "init":false,  
    14     "isPopup":false, 
    15     "liteFilename":"firebug-lite.js", 
    16     "minimized":false, 
    1711    "openInPopup": false, 
    1812    "override":false, 
    1913    "ml":false, 
    20     "popupWin":null, 
    2114    "showIconWhenHidden":true, 
    22     "targetWindow":undefined, 
    2315    "popupTop":1, 
    2416    "popupLeft":1, 
    2517    "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 
    2730  }, 
    2831  initConsole:function(){ 
     
    4851      env.override=true; 
    4952      try{ 
    50         env.extConsole=window.console; 
     53        internal.extConsole=window.console; 
    5154      } catch(e){} 
    5255      initConsole(); 
     
    5558  restoreConsole:function(){ 
    5659    with(firebug){ 
    57       if(env.extConsole){ 
     60      if(internal.extConsole){ 
    5861        env.override=false; 
    5962        try{ 
    60           window.console=env.extConsole; 
     63          window.console=internal.extConsole; 
    6164        } catch(e){} 
    62         env.extConsole=null; 
     65        internal.extConsole=null; 
    6366      } 
    6467    } 
    6568  }, 
    6669  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."; 
    6873   
    6974    with(firebug){ 
     
    7277      } 
    7378             
    74       if(env.isPopup) { 
     79      if(internal.isPopup) { 
    7580        env.openInPopup = false; 
    76         env.targetWindow = window.opener; 
     81        internal.targetWindow = window.opener; 
    7782        env.popupWidth = window.opener.firebug.env.popupWidth || window.opener.firebug.lib.util.GetViewport().width; 
    7883        env.popupHeight = window.opener.firebug.env.popupHeight || window.opener.firebug.lib.util.GetViewport().height; 
    7984      } else { 
    80         env.targetWindow = window; 
     85        internal.targetWindow = window; 
    8186        env.popupWidth = env.popupWidth || lib.util.GetViewport().width; 
    8287        env.popupHeight = env.popupHeight || lib.util.GetViewport().height; 
     
    8590      settings.readCookie(); 
    8691       
    87       if(env.init || (env.detectFirebug && window.console && window.console.firebug)) { 
     92      if(internal.init || (env.detectFirebug && window.console && window.console.firebug)) { 
    8893        return; 
    8994      } 
    9095 
    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      } 
    94108 
    95109      if(env.override){ 
     
    100114       * Firebug Icon 
    101115       */ 
    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); 
    103117       
    104118      /*  
     
    106120       */ 
    107121      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){ 
    111125        el.resizer = new lib.element("DIV").attribute.addClass("Resizer").event.addListener("mousedown",win.resizer.start).insert(el.main); 
    112126      } 
     
    124138      el.button.container = new lib.element("DIV").attribute.addClass("ButtonContainer").insert(el.header); 
    125139      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("&nbsp;").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); 
    127141      el.button.dock = new lib.element("A").attribute.addClass("Button Dock").event.addListener("click", win.dock).insert(el.button.container); 
    128142      el.button.newWindow = new lib.element("A").attribute.addClass("Button NewWindow").event.addListener("click", win.newWindow).insert(el.button.container); 
    129143 
    130       if(!env.isPopup){ 
     144      if(!internal.isPopup){ 
    131145        el.button.maximize = new lib.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container); 
    132146        el.button.minimize = new lib.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container); 
     
    146160      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); 
    147161      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){ 
    149163        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); 
    150164      } 
    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); 
    152166      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); 
    153167      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&nbsp;&or;").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv); 
     168      el.nav.options = new lib.element("A").attribute.addClass("Tab Button Options").update("Options&nbsp;&nbsp;&nbsp;&nbsp;").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv); 
    155169       
    156170      /* 
    157171       * inspector 
    158172       */ 
    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); 
    161175 
    162176      /* 
     
    260274      el.button.dom.container = new lib.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container); 
    261275      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); 
    263277 
    264278      /* 
     
    320334      el.settings.cbxOpenInPopup = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content); 
    321335      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")); 
    322340      el.settings.buttonDiv = new lib.element("DIV").insert(el.settings.content); 
    323341      el.settings.buttonLeftDiv = new lib.element("DIV").attribute.addClass("ButtonsLeft").insert(el.settings.buttonDiv); 
     
    330348      lib.util.AddEvent(document,"mousemove",listen.mouse)("mousemove",win.resizer.resize)("mouseup",win.resizer.stop)("keydown",listen.keyboard); 
    331349 
    332       env.init = true; 
     350      internal.init = true; 
    333351 
    334352      for(var i=0, len=d.console.cache.length; i<len; i++){ 
     
    355373      
    356374      if(env.showIconWhenHidden) { 
    357         if(!env.popupWin) { 
     375        if(!internal.popupWin) { 
    358376          el.firebugIcon.environment.addStyle({ "display": env.debug&&'none'||'block' }); 
    359377        } 
     
    362380      lib.util.AddEvent(window, "unload", win.unload); 
    363381 
    364       if (env.isPopup) { 
     382      if (internal.isPopup) { 
    365383        env.height=lib.util.GetViewport().height; 
    366384        lib.util.AddEvent(window, "resize", win.fitToPopup); 
     
    372390      win.setHeight(env.height); 
    373391 
    374       if(env.openInPopup&&!env.isPopup) { 
     392      if(env.openInPopup&&!internal.isPopup) { 
    375393        win.newWindow(); 
    376394      } else { 
     
    400418        el.settings.container.environment.addStyle({ 
    401419          "display": "block", 
    402           "left": (posXY.offsetLeft-125)+"px" 
     420          "left": (posXY.offsetLeft-107)+"px" 
    403421        }); 
    404422        el.settings.progressDiv.environment.addStyle({ 
     
    439457      fe.showIconWhenHidden=elSet.cbxShowIcon.element.checked; 
    440458      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); 
    454468      } 
    455469 
     
    458472        settings.hide(); 
    459473        win.refreshDOM(); 
     474        d.html.openHtmlTree(); 
     475        if(internal.isPopup) { 
     476          with(opener.firebug) { 
     477            win.refreshDOM(); 
     478            d.html.openHtmlTree(); 
     479          } 
     480        } 
    460481      } 
    461482    }, 
     
    471492 
    472493      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('; '); 
    475496           
    476497          for(i=0;i<cookieArr.length;i++) { 
     
    504525                  openInPopup=value=="true"; 
    505526                  break; 
     527                case 'textNodeChars': 
     528                  textNodeChars=isFinite(value)?parseInt(value,10):0; 
     529                  break; 
    506530                case 'popupTop': 
    507531                  popupTop=parseInt(value,10); 
     
    535559        values+='showIconWhenHidden:'+showIconWhenHidden+','; 
    536560        values+='openInPopup:'+openInPopup+','; 
    537  
    538         if(isPopup) { 
     561        values+='textNodeChars:'+textNodeChars+','; 
     562 
     563        if(firebug.internal.isPopup) { 
    539564          if(window.outerWidth===undefined) { 
    540565            values+='popupTop:'+(window.screenTop-56)+','; 
     
    555580        } 
    556581         
    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); 
    558583 
    559584        exdate=new Date(); 
    560585        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(); 
    562587      } 
    563588    }, 
     
    572597      elSet.cbxShowIcon.element.checked=fe.showIconWhenHidden; 
    573598      elSet.cbxOpenInPopup.element.checked=fe.openInPopup; 
     599      elSet.textNodeChars.element.value=fe.textNodeChars; 
    574600    } 
    575601  }, 
     
    617643    minimize:function(){ 
    618644      with(firebug){ 
    619         env.minimized=true; 
     645        internal.minimized=true; 
    620646        el.main.environment.addStyle({ "height":"35px" }); 
    621647        el.mainiframe.environment.addStyle({ "height":"35px" }); 
     
    627653    maximize:function(){ 
    628654      with(firebug){ 
    629         env.minimized=false; 
     655        internal.minimized=false; 
    630656        el.button.minimize.environment.addStyle({ "display":"block" }); 
    631657        el.button.maximize.environment.addStyle({ "display":"none" }); 
     
    634660    }, 
    635661    newWindow: function() { 
    636       return; 
    637662      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) { 
    641667        scripts = document.getElementsByTagName('script'); 
    642668         
    643         fe.popupWin = window.open("", "_firebug",  
     669        fi.popupWin = window.open("", "_firebug",  
    644670          "status=0,menubar=0,resizable=1,top="+fe.popupTop+",left="+fe.popupLeft+",width=" + fe.popupWidth +  
    645671          ",height=" + fe.popupHeight + ",scrollbars=0,addressbar=0,outerWidth="+fe.popupWidth+",outerHeight="+fe.popupHeight+ 
    646672          "toolbar=0,location=0,directories=0,dialog=0"); 
    647673         
    648         if(!fe.popupWin) { 
     674        if(!fi.popupWin) { 
    649675          alert("Firebug Lite could not open a pop-up window, most likely because of a popup blocker.\nPlease enable popups for this domain"); 
    650676        } else { 
    651677          firebug.settings.hide(); 
    652          
     678 
    653679          for (i=0,len=scripts.length; i<len; i++) { 
    654             if (scripts[i].src.indexOf(fe.liteFilename) > -1) { 
     680            if (scripts[i].src.indexOf(fi.liteFilename) > -1) { 
    655681              scriptPath = scripts[i].src; 
    656682              break; 
     
    659685 
    660686          if (scriptPath) { 
    661             script = fe.popupWin.document.createElement('script'), done = false; 
     687            done = false; 
     688            script = fi.popupWin.document.createElement('script'); 
    662689            script.type = 'text/javascript'; 
    663690            script.src = scriptPath; 
     
    666693              if(!done && (!firebug.lib.env.ie || this.readyState == "complete" || this.readyState=="loaded")){ 
    667694                done = true; 
    668                 if(fe.popupWin.firebug) { 
    669                   with(fe.popupWin.firebug) { 
    670                     env.isPopup = true; 
     695                if(fi.popupWin.firebug) { 
     696                  with(fi.popupWin.firebug) { 
     697                    internal.isPopup = true; 
    671698                    env.css = fe.css; 
    672699                    init(); 
     
    679706 
    680707            if (!done && firebug.lib.env.webkit) { 
    681               fe.popupWin.document.write('<html><head></head><body></body></html>'); 
    682708              interval = setInterval(function() { 
    683                 if (fe.popupWin.firebug) { 
     709                if (firebug.internal.popupWin.firebug) { 
    684710                  clearInterval(interval); 
    685711                  done = true; 
    686                   with(fe.popupWin.firebug) { 
    687                     env.isPopup = true; 
     712                  with(firebug.internal.popupWin.firebug) { 
     713                    internal.isPopup = true; 
    688714                    env.css = fe.css; 
    689715                    init(); 
     
    695721            }; 
    696722 
     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            } 
    697726            if (!done) { 
    698               fe.popupWin.document.getElementsByTagName('head')[0].appendChild(script); 
     727              firebug.internal.popupWin.document.getElementsByTagName('head')[0].appendChild(script); 
    699728              firebug.el.main.environment.addStyle({"display": "none"}); 
    700729              firebug.el.mainiframe.environment.addStyle({"display": "none"}); 
    701730            } 
    702731          } 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             fe.popupWin.close(); 
    706             fe.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; 
    707736          } 
    708737        } 
     
    711740    dock: function() { 
    712741      with(opener.firebug) { 
    713         env.popupWin = null; 
     742        internal.popupWin = null; 
    714743        el.main.environment.addStyle({ 
    715744          "display": "block" 
     
    724753    unload: function() { 
    725754      with(firebug){ 
    726         if(env.isPopup) { 
     755        if(internal.isPopup) { 
    727756          win.dock(); 
    728         } else if(env.popupWin) { 
    729           env.popupWin.close(); 
     757        } else if(internal.popupWin) { 
     758          internal.popupWin.close(); 
    730759        } 
    731760      } 
     
    747776      start:function(_event){ 
    748777        with(firebug){ 
    749           if(env.minimized)return; 
     778          if(internal.minimized)return; 
    750779          win.resizer.y=[el.main.element.offsetHeight,_event.clientY]; 
    751780          if(lib.env.ie6){ 
     
    824853    refreshSize:function(){ 
    825854      with(firebug){ 
    826         if(!env.init) 
     855        if(!internal.init) 
    827856          return; 
    828857 
     
    905934            if(_cmd==='console.firebug') { 
    906935              d.console.addLine().attribute.addClass("Arrow").update(firebug.version); 
    907             } else {   
     936            } else { 
    908937              result = eval.call(window,_cmd); 
    909938              d.console.print(_cmd,result); 
     
    923952      run:function(_command){ 
    924953        with(firebug){ 
    925           if(!env.init){ 
     954          if(!internal.init){ 
    926955            d.console.cache.push({ "command":_command, "arg":Array.prototype.slice.call(arguments,1) }); 
    927956          } else { 
     
    10511080      open:function(_index){ 
    10521081        with (firebug) { 
    1053           var item = env.targetWindow.document.styleSheets[_index], 
     1082          var item = internal.targetWindow.document.styleSheets[_index], 
    10541083          uri = item.href; 
    10551084          try { 
     
    10811110        with(firebug){ 
    10821111          el.button.css.selectbox.update(""); 
    1083           var collection = env.targetWindow.document.styleSheets; 
     1112          var collection = internal.targetWindow.document.styleSheets; 
    10841113          for(var i=0,len=collection.length; i<len; i++){ 
    10851114            var uri = getFileName(collection[i].href); 
     
    11481177      with(firebug){ 
    11491178        var isArray = false, isHash, isElement = false, vtype=typeof _value, result=[]; 
    1150          
     1179 
    11511180        if(vtype=="object"){ 
    11521181          if(Object.prototype.toString.call(_value) === "[object Date]"){ 
     
    11671196 
    11681197          // 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"){ 
    11701199            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              } 
    11721205            }else if (vtype=="regexp") { 
    11731206              result.push("<span class='Maroon'>" + _value + "</span>"); 
     
    12691302          } 
    12701303          if(_clear){ 
    1271             env.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" }); 
     1304            internal.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" }); 
    12721305            return; 
    12731306          } 
     
    12791312        parentLayer, 
    12801313        t, 
     1314        link, 
    12811315        tagName, 
     1316        searchEl, 
    12821317        parent = _element; 
    12831318        while (parent) { 
    12841319          map.push(parent); 
    1285           if (parent == firebug.env.targetWindow.document.body) break; 
     1320          if (parent == firebug.internal.targetWindow.document.body) break; 
    12861321          parent = parent.parentNode; 
    12871322        } 
     
    12891324        with(firebug) { 
    12901325          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); 
    12951330 
    12961331          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; 
    13081336            } 
    13091337          } 
     
    13151343          for (t = 0, len = map.length; map[t]; t++) { 
    13161344            if (t == len - 1) { 
    1317               var link = parentLayer.environment.getElement().previousSibling.lib; 
     1345              link = parentLayer.environment.getElement().previousSibling.lib; 
    13181346              link.attribute.addClass("Selected"); 
     1347               
     1348              if(link.element.scrollIntoView) { 
     1349                link.element.scrollIntoView(false); 
     1350              } 
    13191351 
    13201352              if (d.html.current) { 
     
    13381370      openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){ 
    13391371        with(firebug){ 
    1340           var element = _element || env.targetWindow.document.documentElement,  
     1372          var element = _element || internal.targetWindow.document.documentElement,  
    13411373              parent = _parent || el.left.html.container,  
    13421374              returnParentEl = _returnParentElementByElement || null,  
     
    13441376              len = element.childNodes.length, 
    13451377              nodeLink; 
    1346  
     1378           
     1379          if (!window.Node) { 
     1380            window.Node = {TEXT_NODE:3,COMMENT_NODE:8}; 
     1381          } 
     1382               
    13471383          if(parent!=el.left.html.container){ 
    13481384            nodeLink = parent.environment.getParent().lib.child.get()[0].lib; 
     
    13561392          }; 
    13571393 
    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; 
    13591395          parent.clean(); 
    13601396 
     
    13831419            var item = element.childNodes[i]; 
    13841420 
    1385             if (item.nodeType != 3){ 
     1421            if (item.nodeType != Node.TEXT_NODE && !item.getAttribute('firebugIgnore')){ 
    13861422              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("&nbsp;").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("&nbsp;").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               
    13911433              view = lib.util.Element.getView(item); 
    1392  
    13931434              link.event.addListener("click", lib.util.Curry(d.html.openHtmlTree, window, item, subContainer, false)); 
    13941435              link.event.addListener("mouseover", lib.util.Curry(d.html.highlight, window, item, false)); 
    13951436              link.event.addListener("mouseout", lib.util.Curry(d.html.highlight, window, item, true)); 
    1396  
     1437                             
    13971438              returnParentVal = returnParentEl == item ? subContainer : returnParentVal; 
    1398  
     1439     
    13991440              if(d.html.current==null&&item==document.body){ 
    14001441                link.attribute.addClass("Selected"); 
     1442                link.attribute.addClass("Parent"); 
    14011443                d.html.current = [item,link]; 
    14021444                d.html.openHtmlTree(item,subContainer); 
     
    14091451              if (item.childNodes){ 
    14101452                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                  } 
    14131459                  html.child.add(document.createTextNode("</")); 
    14141460                  html.child.add(new lib.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement()); 
     
    14161462                  continue; 
    14171463                } 
    1418                 else  
    1419                   if (childLen > 0) { 
    1420                     link.attribute.addClass("Parent"); 
    1421                   } 
     1464                else if (childLen > 0) { 
     1465                  link.attribute.addClass("Parent"); 
     1466                } 
    14221467              } 
    14231468            } 
     
    14551500      inspect:function(_element,_bgInspector){ 
    14561501        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({  
    14601505            "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px", 
    14611506            "top":pos.offsetTop-(_bgInspector?0:2)+"px", "left":pos.offsetLeft-(_bgInspector?0:2)+"px", 
    14621507            "display":"block" 
    14631508          }); 
    1464 9 
     1509 
    14651510          if(!_bgInspector){ 
    14661511            d.inspector.el = _element; 
     
    14781523            d.inspector.el = null; 
    14791524          } 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"); 
    14821527            } else { 
    14831528              d.navigate("html"); 
     
    14941539          d.scripts.index = _index; 
    14951540          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; 
    14971542          try { 
    14981543            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; 
    15011546            } else { 
    15021547              source = script.innerHTML; 
     
    15051550              return ({"<":"&#60;",">":"&#62;"})[_ch]; 
    15061551            }); 
    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("&nbsp;" + 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); 
    15181561          } catch(e){ 
    15191562            el.left.scripts.container.child.add( 
     
    15331576        with(firebug){ 
    15341577          el.button.scripts.selectbox.clean(); 
    1535           var collection = env.targetWindow.document.getElementsByTagName("script"); 
     1578          var collection = internal.targetWindow.document.getElementsByTagName("script"); 
    15361579          for(var i=0,len=collection.length; i<len; i++){ 
    15371580            var item = collection[i], 
     
    15611604            try { 
    15621605              var item = arguments[i], 
    1563                   val = env.targetWindow.eval(item); 
     1606                  val = internal.targetWindow.eval(item); 
    15641607              d.xhr.objects.push([item, val]); 
    15651608            } catch(e){ 
     
    17181761    addXhrObject:function(){ 
    17191762      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(",")); 
    17211764      } 
    17221765    }, 
     
    17591802    inspector:function(){ 
    17601803      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); 
    17631806        } else { 
    17641807          firebug.d.html.inspect(firebug.d.inspector.el); 
     
    17701813        if(_event.keyCode==27 && d.inspector.enabled){ 
    17711814          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){ 
    17741817            win.dock(); 
    17751818          }else { 
     
    17771820          } 
    17781821        } else if( 
    1779             (_event.keyCode === 123 && !_event.ctrlKey && !_event.metaKey) ||  
     1822            (_event.keyCode === 123 && (!_event.ctrlKey && !_event.metaKey)) || 
    17801823            (_event.keyCode === 76 && (_event.ctrlKey || _event.metaKey) && _event.shiftKey) || 
    17811824            (_event.keyCode === 13 && _event.shiftKey)) { 
    17821825 
    1783           if(env.isPopup){ 
     1826          if(internal.isPopup){ 
    17841827            win.dock(); 
    17851828          } else if (el.main.environment.getStyle("display") === 'none') { 
     
    18271870          var item = source[i]+"}", rule = !lib.env.ie?item:item.split(/{|}/), 
    18281871              styleSheet = document.styleSheets[0]; 
    1829           console.log(rule); 
    18301872          if(item.match(/.+\{.+\}/)){ 
    18311873            if(lib.env.ie) 
     
    18451887      with(firebug){ 
    18461888        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(",")); 
    18481890        } 
    18491891      } 
     
    25142556})(firebug); 
    25152557 
    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})();