# HG changeset patch # User Atul Varma # Date 1238487175 25200 # Node ID 54c74d62bb5e1c179def6b1557cae919366c9faf # Parent 9a759b8be515007ce3ff8bfdf016fa2e363aa334 Prevented a horribly annoying alert box from being displayed by firebug lite. diff -r 9a759b8be515 -r 54c74d62bb5e firebug-lite.js --- a/firebug-lite.js Tue Mar 31 00:30:20 2009 -0700 +++ b/firebug-lite.js Tue Mar 31 01:12:55 2009 -0700 @@ -1,16 +1,16 @@ var firebug = { version:[1.23,20090309], - el:{}, - env:{ + el:{}, + env:{ "cache":{}, "extConsole":null, - "css":"http://getfirebug.com/releases/lite/1.2/firebug-lite.css", + "css":"http://getfirebug.com/releases/lite/1.2/firebug-lite.css", "debug":true, "detectFirebug":false, - "dIndex":"console", + "dIndex":"console", "height":295, "hideDOMFunctions":false, - "init":false, + "init":false, "isPopup":false, "liteFilename":"firebug-lite.js", "minimized":false, @@ -26,7 +26,7 @@ "popupHeight":undefined }, initConsole:function(){ - /* + /* * initialize the console - user defined values are not available within this method because FBLite is not yet initialized */ var command; @@ -65,12 +65,12 @@ }, init:function(_css){ 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."; - + with(firebug){ if(document.getElementsByTagName('html')[0].attributes.getNamedItem('debug')){ env.debug = document.getElementsByTagName('html')[0].attributes.getNamedItem('debug').nodeValue !== "false"; } - + if(env.isPopup) { env.openInPopup = false; env.targetWindow = window.opener; @@ -83,7 +83,7 @@ } settings.readCookie(); - + if(env.init || (env.detectFirebug && window.console && window.console.firebug)) { return; } @@ -95,13 +95,13 @@ if(env.override){ overrideConsole(); } - - /* + + /* * Firebug Icon */ 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); - - /* + + /* * main interface */ el.content = {}; @@ -152,7 +152,7 @@ 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); el.nav.optionsdiv = new lib.element("DIV").attribute.addClass("Settings").insert(el.nav.container); el.nav.options = new lib.element("A").attribute.addClass("Tab").update("Options ∨").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv); - + /* * inspector */ @@ -352,7 +352,7 @@ buttons[i].attribute.set("href","#"); win.refreshSize(); } - + if(env.showIconWhenHidden) { if(!env.popupWin) { el.firebugIcon.environment.addStyle({ "display": env.debug&&'none'||'block' }); @@ -377,7 +377,7 @@ el.main.environment.addStyle({ "display":env.debug&&'block'||'none' }); el.mainiframe.environment.addStyle({ "display":env.debug&&'block'||'none' }); } - } + } }, inspect:function(){ return firebug.d.html.inspect.apply(window,arguments); @@ -472,7 +472,7 @@ with(firebug.env){ if(targetWindow.document.cookie.length>0) { cookieArr=targetWindow.document.cookie.split('; '); - + for(i=0;i -1) { scriptPath = scripts[i].src; @@ -699,8 +699,8 @@ firebug.el.mainiframe.environment.addStyle({"display": "none"}); } } else { - alert("Unable to detect the following script \"" + fe.liteFilename + - "\" ... if the script has been renamed then please set the value of firebug.env.liteFilename to reflect this change"); + //alert("Unable to detect the following script \"" + fe.liteFilename + + // "\" ... if the script has been renamed then please set the value of firebug.env.liteFilename to reflect this change"); fe.popupWin.close(); fe.popupWin=null; } @@ -903,7 +903,7 @@ try { if(_cmd==='console.firebug') { d.console.addLine().attribute.addClass("Arrow").update(firebug.version); - } else { + } else { result = eval.call(window,_cmd); d.console.print(_cmd,result); } @@ -1146,7 +1146,7 @@ highlight:function(_value,_inObject,_inArray,_link){ with(firebug){ var isArray = false, isHash, isElement = false, vtype=typeof _value, result=[]; - + if(vtype=="object"){ if(Object.prototype.toString.call(_value) === "[object Date]"){ vtype = "date"; @@ -1158,7 +1158,7 @@ vtype = "regexp"; } } - + try { isArray = lib.util.IsArray(_value); isHash = lib.util.IsHash(_value); @@ -1214,7 +1214,7 @@ result.push(">"); } } - } + } // array, hash else if(isArray||isHash){ if(isArray){ @@ -1235,7 +1235,7 @@ } } else if(_inObject){ result.push("Object"); - } else { + } else { result.push("Object"); var i=0; for(var key in _value){ @@ -1248,12 +1248,12 @@ i++; } result.push(""); - } + } } else { result.push([""+_value+""]); } } catch(e){ - result.push(".."); + result.push(".."); } return result.join(""); } @@ -1336,9 +1336,9 @@ }, openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){ with(firebug){ - var element = _element || env.targetWindow.document.documentElement, - parent = _parent || el.left.html.container, - returnParentEl = _returnParentElementByElement || null, + var element = _element || env.targetWindow.document.documentElement, + parent = _parent || el.left.html.container, + returnParentEl = _returnParentElementByElement || null, returnParentVal = null, len = element.childNodes.length, nodeLink; @@ -1378,12 +1378,12 @@ if(i==len){ new lib.element("A").attribute.addClass("Block").update("</"+element.nodeName.toLowerCase()+">").insert(container); break; - } + } var item = element.childNodes[i]; if (item.nodeType != 3){ - var container = new lib.element().attribute.addClass("Block").insert(parent), - link = new lib.element("A").attribute.addClass("Link").insert(container), + var container = new lib.element().attribute.addClass("Block").insert(parent), + link = new lib.element("A").attribute.addClass("Link").insert(container), spacer = new lib.element("SPAN").attribute.addClass("Spacer").update(" ").insert(link), html = new lib.element("SPAN").attribute.addClass("Content").update(d.highlight(item)).insert(link), subContainer = new lib.element("DIV").attribute.addClass("SubContainer").insert(container), @@ -1414,7 +1414,7 @@ html.child.add(document.createTextNode(">")); continue; } - else + else if (childLen > 0) { link.attribute.addClass("Parent"); } @@ -1455,7 +1455,7 @@ with(firebug){ var pos = env.targetWindow.firebug.lib.util.Element.getPosition(_element); - env.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({ + env.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({ "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px", "top":pos.offsetTop-(_bgInspector?0:2)+"px", "left":pos.offsetLeft-(_bgInspector?0:2)+"px", "display":"block" @@ -1503,8 +1503,8 @@ source = source.replace(/<|>/g,function(_ch){ return ({"<":"<",">":">"})[_ch]; }); - - if(!d.scripts.lineNumbers) + + if(!d.scripts.lineNumbers) el.left.scripts.container.child.add( new lib.element("DIV").attribute.addClass("CodeContainer").update(source) ); @@ -1702,7 +1702,7 @@ var position = firebug.getSelection(_el); _el.value = _el.value.substring(0,position.start) + String.fromCharCode(9) + _el.value.substring(position.start+position.length,_el.value.length); _el.setSelectionRange(position.start+1,position.start+1); - } else if(document.selection) { + } else if(document.selection) { var range = document.selection.createRange(), isCollapsed = range.text == ''; range.text = String.fromCharCode(9); range.moveStart('character', -1); @@ -1775,7 +1775,7 @@ win.newWindow(); } } else if( - (_event.keyCode === 123 && !_event.ctrlKey && !_event.metaKey) || + (_event.keyCode === 123 && !_event.ctrlKey && !_event.metaKey) || (_event.keyCode === 76 && (_event.ctrlKey || _event.metaKey) && _event.shiftKey) || (_event.keyCode === 13 && _event.shiftKey)) { @@ -1792,7 +1792,7 @@ mouse:function(_event){ with(firebug){ var target; - + if(document.elementFromPoint) { target = document.elementFromPoint(_event.clientX, _event.clientY); } else { @@ -1802,7 +1802,7 @@ target = _event.explicitOriginalTarget || _event.target; } } - + if( d.inspector.enabled&& target!=document.body&& target!=document.firstChild&& @@ -1895,7 +1895,7 @@ if(_array.forEach) return _array.forEach(_function); for(var i=0,len=_array.length; i