diff options
author | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:24 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:26 +0400 |
commit | f0cfe83e3725f9a3928da97a6e3085e79cb25309 (patch) | |
tree | 4b0af188defaa807c7bc6ff3a101b41c9166c463 /lib/dojo/_firebug | |
parent | 9a2885da170ffd64358b99194095851a2d09c1b6 (diff) |
upgrade dojo to 1.8.3 (refs #570)
Diffstat (limited to 'lib/dojo/_firebug')
-rw-r--r-- | lib/dojo/_firebug/firebug.js | 4 | ||||
-rw-r--r-- | lib/dojo/_firebug/firebug.js.uncompressed.js | 1191 |
2 files changed, 1193 insertions, 2 deletions
diff --git a/lib/dojo/_firebug/firebug.js b/lib/dojo/_firebug/firebug.js index cf5044e09..49d47e570 100644 --- a/lib/dojo/_firebug/firebug.js +++ b/lib/dojo/_firebug/firebug.js @@ -1,8 +1,8 @@ /* - Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built -define("dojo/_firebug/firebug",["../_base/kernel","require","../_base/html","../_base/sniff","../_base/array","../_base/lang","../_base/event","../_base/unload"],function(_1,_2){var _3=(/Trident/.test(window.navigator.userAgent));if(_3){var _4=["log","info","debug","warn","error"];for(var i=0;i<_4.length;i++){var m=_4[i];if(!console[m]||console[m]._fake){continue;}var n="_"+_4[i];console[n]=console[m];console[m]=(function(){var _5=n;return function(){console[_5](Array.prototype.join.call(arguments," "));};})();}try{console.clear();}catch(e){}}if(_1.isFF||_1.isChrome||_1.isSafari||_3||window.firebug||(typeof console!="undefined"&&console.firebug)||_1.config.useCustomLogger||_1.isAIR){return;}try{if(window!=window.parent){if(window.parent["console"]){window.console=window.parent.console;}return;}}catch(e){}var _6=document;var _7=window;var _8=0;var _9=null;var _a=null;var _b=null;var _c=null;var _d=null;var _e=null;var _f=false;var _10=[];var _11=[];var _12={};var _13={};var _14=null;var _15;var _16;var _17=false;var _18=null;var _19=document.createElement("div");var _1a;var _1b;window.console={_connects:[],log:function(){_1c(arguments,"");},debug:function(){_1c(arguments,"debug");},info:function(){_1c(arguments,"info");},warn:function(){_1c(arguments,"warning");},error:function(){_1c(arguments,"error");},assert:function(_1d,_1e){if(!_1d){var _1f=[];for(var i=1;i<arguments.length;++i){_1f.push(arguments[i]);}_1c(_1f.length?_1f:["Assertion Failure"],"error");throw _1e?_1e:"Assertion Failure";}},dir:function(obj){var str=_20(obj);str=str.replace(/\n/g,"<br />");str=str.replace(/\t/g," ");_21([str],"dir");},dirxml:function(_22){var _23=[];_24(_22,_23);_21(_23,"dirxml");},group:function(){_21(arguments,"group",_25);},groupEnd:function(){_21(arguments,"",_26);},time:function(_27){_12[_27]=new Date().getTime();},timeEnd:function(_28){if(_28 in _12){var _29=(new Date()).getTime()-_12[_28];_1c([_28+":",_29+"ms"]);delete _12[_28];}},count:function(_2a){if(!_13[_2a]){_13[_2a]=0;}_13[_2a]++;_1c([_2a+": "+_13[_2a]]);},trace:function(_2b){var _2c=_2b||3;var f=console.trace.caller;for(var i=0;i<_2c;i++){var _2d=f.toString();var _2e=[];for(var a=0;a<f.arguments.length;a++){_2e.push(f.arguments[a]);}if(f.arguments.length){}else{}f=f.caller;}},profile:function(){this.warn(["profile() not supported."]);},profileEnd:function(){},clear:function(){if(_a){while(_a.childNodes.length){_1.destroy(_a.firstChild);}}_1.forEach(this._connects,_1.disconnect);},open:function(){_2f(true);},close:function(){if(_f){_2f();}},_restoreBorder:function(){if(_1a){_1a.style.border=_1b;}},openDomInspector:function(){_17=true;_a.style.display="none";_14.style.display="block";_b.style.display="none";document.body.style.cursor="pointer";_15=_1.connect(document,"mousemove",function(evt){if(!_17){return;}if(!_18){_18=setTimeout(function(){_18=null;},50);}else{return;}var _30=evt.target;if(_30&&(_1a!==_30)){var _31=true;console._restoreBorder();var _32=[];_24(_30,_32);_14.innerHTML=_32.join("");_1a=_30;_1b=_1a.style.border;_1a.style.border="#0000FF 1px solid";}});setTimeout(function(){_16=_1.connect(document,"click",function(evt){document.body.style.cursor="";_17=!_17;_1.disconnect(_16);});},30);},_closeDomInspector:function(){document.body.style.cursor="";_1.disconnect(_15);_1.disconnect(_16);_17=false;console._restoreBorder();},openConsole:function(){_a.style.display="block";_14.style.display="none";_b.style.display="none";console._closeDomInspector();},openObjectInspector:function(){_a.style.display="none";_14.style.display="none";_b.style.display="block";console._closeDomInspector();},recss:function(){var i,a,s;a=document.getElementsByTagName("link");for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf("stylesheet")>=0&&s.href){var h=s.href.replace(/(&|%5C?)forceReload=\d+/,"");s.href=h+(h.indexOf("?")>=0?"&":"?")+"forceReload="+new Date().valueOf();}}}};function _2f(_33){_f=_33||!_f;if(_9){_9.style.display=_f?"block":"none";}};function _34(){_2f(true);if(_d){_d.focus();}};function _35(x,y,w,h){var win=window.open("","_firebug","status=0,menubar=0,resizable=1,top="+y+",left="+x+",width="+w+",height="+h+",scrollbars=1,addressbar=0");if(!win){var msg="Firebug Lite could not open a pop-up window, most likely because of a blocker.\n"+"Either enable pop-ups for this domain, or change the djConfig to popup=false.";alert(msg);}_36(win);var _37=win.document;var _38="<html style=\"height:100%;\"><head><title>Firebug Lite</title></head>\n"+"<body bgColor=\"#ccc\" style=\"height:97%;\" onresize=\"opener.onFirebugResize()\">\n"+"<div id=\"fb\"></div>"+"</body></html>";_37.write(_38);_37.close();return win;};function _36(wn){var d=new Date();d.setTime(d.getTime()+(60*24*60*60*1000));d=d.toUTCString();var dc=wn.document,_39;if(wn.innerWidth){_39=function(){return {w:wn.innerWidth,h:wn.innerHeight};};}else{if(dc.documentElement&&dc.documentElement.clientWidth){_39=function(){return {w:dc.documentElement.clientWidth,h:dc.documentElement.clientHeight};};}else{if(dc.body){_39=function(){return {w:dc.body.clientWidth,h:dc.body.clientHeight};};}}}window.onFirebugResize=function(){_47(_39().h);clearInterval(wn._firebugWin_resize);wn._firebugWin_resize=setTimeout(function(){var x=wn.screenLeft,y=wn.screenTop,w=wn.outerWidth||wn.document.body.offsetWidth,h=wn.outerHeight||wn.document.body.offsetHeight;document.cookie="_firebugPosition="+[x,y,w,h].join(",")+"; expires="+d+"; path=/";},5000);};};function _3a(){if(_9){return;}_2f(true);if(_1.config.popup){var _3b="100%";var _3c=document.cookie.match(/(?:^|; )_firebugPosition=([^;]*)/);var p=_3c?_3c[1].split(","):[2,2,320,480];_7=_35(p[0],p[1],p[2],p[3]);_6=_7.document;_1.config.debugContainerId="fb";_7.console=window.console;_7.dojo=window.dojo;}else{_6=document;_3b=(_1.config.debugHeight||300)+"px";}var _3d=_6.createElement("link");_3d.href=_2.toUrl("./firebug.css");_3d.rel="stylesheet";_3d.type="text/css";var _3e=_6.getElementsByTagName("head");if(_3e){_3e=_3e[0];}if(!_3e){_3e=_6.getElementsByTagName("html")[0];}if(_1.isIE){window.setTimeout(function(){_3e.appendChild(_3d);},0);}else{_3e.appendChild(_3d);}if(_1.config.debugContainerId){_9=_6.getElementById(_1.config.debugContainerId);}if(!_9){_9=_6.createElement("div");_6.body.appendChild(_9);}_9.className+=" firebug";_9.style.height=_3b;_9.style.display=(_f?"block":"none");var _3f=function(_40,_41,_42,_43){return "<li class=\""+_43+"\"><a href=\"javascript:void(0);\" onclick=\"console."+_42+"(); return false;\" title=\""+_41+"\">"+_40+"</a></li>";};_9.innerHTML="<div id=\"firebugToolbar\">"+" <ul id=\"fireBugTabs\" class=\"tabs\">"+_3f("Clear","Remove All Console Logs","clear","")+_3f("ReCSS","Refresh CSS without reloading page","recss","")+_3f("Console","Show Console Logs","openConsole","gap")+_3f("DOM","Show DOM Inspector","openDomInspector","")+_3f("Object","Show Object Inspector","openObjectInspector","")+((_1.config.popup)?"":_3f("Close","Close the console","close","gap"))+"\t</ul>"+"</div>"+"<input type=\"text\" id=\"firebugCommandLine\" />"+"<div id=\"firebugLog\"></div>"+"<div id=\"objectLog\" style=\"display:none;\">Click on an object in the Log display</div>"+"<div id=\"domInspect\" style=\"display:none;\">Hover over HTML elements in the main page. Click to hold selection.</div>";_e=_6.getElementById("firebugToolbar");_d=_6.getElementById("firebugCommandLine");_44(_d,"keydown",_45);_44(_6,_1.isIE||_1.isSafari?"keydown":"keypress",_46);_a=_6.getElementById("firebugLog");_b=_6.getElementById("objectLog");_14=_6.getElementById("domInspect");_c=_6.getElementById("fireBugTabs");_47();_48();};_1.addOnLoad(_3a);function _49(){_6=null;if(_7.console){_7.console.clear();}_7=null;_9=null;_a=null;_b=null;_14=null;_d=null;_10=[];_11=[];_12={};};function _4a(){var _4b=_d.value;_d.value="";_21(["> ",_4b],"command");var _4c;try{_4c=eval(_4b);}catch(e){}};function _47(h){var _4d=25;var _4e=h?h-(_4d+_d.offsetHeight+25+(h*0.01))+"px":(_9.offsetHeight-_4d-_d.offsetHeight)+"px";_a.style.top=_4d+"px";_a.style.height=_4e;_b.style.height=_4e;_b.style.top=_4d+"px";_14.style.height=_4e;_14.style.top=_4d+"px";_d.style.bottom=0;_1.addOnWindowUnload(_49);};function _21(_4f,_50,_51){if(_a){_52(_4f,_50,_51);}else{_10.push([_4f,_50,_51]);}};function _48(){var _53=_10;_10=[];for(var i=0;i<_53.length;++i){_52(_53[i][0],_53[i][1],_53[i][2]);}};function _52(_54,_55,_56){var _57=_a.scrollTop+_a.offsetHeight>=_a.scrollHeight;_56=_56||_58;_56(_54,_55);if(_57){_a.scrollTop=_a.scrollHeight-_a.offsetHeight;}};function _59(row){var _5a=_11.length?_11[_11.length-1]:_a;_5a.appendChild(row);};function _58(_5b,_5c){var row=_a.ownerDocument.createElement("div");row.className="logRow"+(_5c?" logRow-"+_5c:"");row.innerHTML=_5b.join("");_59(row);};function _25(_5d,_5e){_1c(_5d,_5e);var _5f=_a.ownerDocument.createElement("div");_5f.className="logGroupBox";_59(_5f);_11.push(_5f);};function _26(){_11.pop();};function _1c(_60,_61){var _62=[];var _63=_60[0];var _64=0;if(typeof (_63)!="string"){_63="";_64=-1;}var _65=_66(_63);for(var i=0;i<_65.length;++i){var _67=_65[i];if(_67&&typeof _67=="object"){_67.appender(_60[++_64],_62);}else{_68(_67,_62);}}var ids=[];var obs=[];for(i=_64+1;i<_60.length;++i){_68(" ",_62);var _69=_60[i];if(_69===undefined||_69===null){_6a(_69,_62);}else{if(typeof (_69)=="string"){_68(_69,_62);}else{if(_69 instanceof Date){_68(_69.toString(),_62);}else{if(_69.nodeType==9){_68("[ XmlDoc ]",_62);}else{var id="_a"+_8++;ids.push(id);obs.push(_69);var str="<a id=\""+id+"\" href=\"javascript:void(0);\">"+_6b(_69)+"</a>";_6c(str,_62);}}}}}_21(_62,_61);for(i=0;i<ids.length;i++){var btn=_6.getElementById(ids[i]);if(!btn){continue;}btn.obj=obs[i];_7.console._connects.push(_1.connect(btn,"onclick",function(){console.openObjectInspector();try{_20(this.obj);}catch(e){this.obj=e;}_b.innerHTML="<pre>"+_20(this.obj)+"</pre>";}));}};function _66(_6d){var _6e=[];var reg=/((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;var _6f={s:_68,d:_70,i:_70,f:_71};for(var m=reg.exec(_6d);m;m=reg.exec(_6d)){var _72=m[8]?m[8]:m[5];var _73=_72 in _6f?_6f[_72]:_74;var _75=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);_6e.push(_6d.substr(0,m[0][0]=="%"?m.index:m.index+1));_6e.push({appender:_73,precision:_75});_6d=_6d.substr(m.index+m[0].length);}_6e.push(_6d);return _6e;};function _76(_77){function _78(ch){switch(ch){case "<":return "<";case ">":return ">";case "&":return "&";case "'":return "'";case "\"":return """;}return "?";};return String(_77).replace(/[<>&"']/g,_78);};function _79(_7a){try{return _7a+"";}catch(e){return null;}};function _6c(_7b,_7c){_7c.push(_79(_7b));};function _68(_7d,_7e){_7e.push(_76(_79(_7d)));};function _6a(_7f,_80){_80.push("<span class=\"objectBox-null\">",_76(_79(_7f)),"</span>");};function _81(_82,_83){_83.push("<span class=\"objectBox-string\">"",_76(_79(_82)),""</span>");};function _70(_84,_85){_85.push("<span class=\"objectBox-number\">",_76(_79(_84)),"</span>");};function _71(_86,_87){_87.push("<span class=\"objectBox-number\">",_76(_79(_86)),"</span>");};function _88(_89,_8a){_8a.push("<span class=\"objectBox-function\">",_6b(_89),"</span>");};function _74(_8b,_8c){try{if(_8b===undefined){_6a("undefined",_8c);}else{if(_8b===null){_6a("null",_8c);}else{if(typeof _8b=="string"){_81(_8b,_8c);}else{if(typeof _8b=="number"){_70(_8b,_8c);}else{if(typeof _8b=="function"){_88(_8b,_8c);}else{if(_8b.nodeType==1){_8d(_8b,_8c);}else{if(typeof _8b=="object"){_8e(_8b,_8c);}else{_68(_8b,_8c);}}}}}}}}catch(e){}};function _8e(_8f,_90){var _91=_79(_8f);var _92=/\[object (.*?)\]/;var m=_92.exec(_91);_90.push("<span class=\"objectBox-object\">",m?m[1]:_91,"</span>");};function _8d(_93,_94){_94.push("<span class=\"objectBox-selector\">");_94.push("<span class=\"selectorTag\">",_76(_93.nodeName.toLowerCase()),"</span>");if(_93.id){_94.push("<span class=\"selectorId\">#",_76(_93.id),"</span>");}if(_93.className){_94.push("<span class=\"selectorClass\">.",_76(_93.className),"</span>");}_94.push("</span>");};function _24(_95,_96){if(_95.nodeType==1){_96.push("<div class=\"objectBox-element\">","<<span class=\"nodeTag\">",_95.nodeName.toLowerCase(),"</span>");for(var i=0;i<_95.attributes.length;++i){var _97=_95.attributes[i];if(!_97.specified){continue;}_96.push(" <span class=\"nodeName\">",_97.nodeName.toLowerCase(),"</span>="<span class=\"nodeValue\">",_76(_97.nodeValue),"</span>"");}if(_95.firstChild){_96.push("></div><div class=\"nodeChildren\">");for(var _98=_95.firstChild;_98;_98=_98.nextSibling){_24(_98,_96);}_96.push("</div><div class=\"objectBox-element\"></<span class=\"nodeTag\">",_95.nodeName.toLowerCase(),"></span></div>");}else{_96.push("/></div>");}}else{if(_95.nodeType==3){_96.push("<div class=\"nodeText\">",_76(_95.nodeValue),"</div>");}}};function _44(_99,_9a,_9b){if(document.all){_99.attachEvent("on"+_9a,_9b);}else{_99.addEventListener(_9a,_9b,false);}};function _9c(_9d,_9e,_9f){if(document.all){_9d.detachEvent("on"+_9e,_9f);}else{_9d.removeEventListener(_9e,_9f,false);}};function _a0(_a1){if(document.all){_a1.cancelBubble=true;}else{_a1.stopPropagation();}};function _a2(msg,_a3,_a4){var _a5=_a3.lastIndexOf("/");var _a6=_a5==-1?_a3:_a3.substr(_a5+1);var _a7=["<span class=\"errorMessage\">",msg,"</span>","<div class=\"objectBox-sourceLink\">",_a6," (line ",_a4,")</div>"];_21(_a7,"error");};var _a8=new Date().getTime();function _46(_a9){var _aa=(new Date()).getTime();if(_aa>_a8+200){_a9=_1.fixEvent(_a9);var _ab=_1.keys;var ekc=_a9.keyCode;_a8=_aa;if(ekc==_ab.F12){_2f();}else{if((ekc==_ab.NUMPAD_ENTER||ekc==76)&&_a9.shiftKey&&(_a9.metaKey||_a9.ctrlKey)){_34();}else{return;}}_a0(_a9);}};function _45(e){var dk=_1.keys;if(e.keyCode==13&&_d.value){_ac(_d.value);_4a();}else{if(e.keyCode==27){_d.value="";}else{if(e.keyCode==dk.UP_ARROW||e.charCode==dk.UP_ARROW){_ad("older");}else{if(e.keyCode==dk.DOWN_ARROW||e.charCode==dk.DOWN_ARROW){_ad("newer");}else{if(e.keyCode==dk.HOME||e.charCode==dk.HOME){_ae=1;_ad("older");}else{if(e.keyCode==dk.END||e.charCode==dk.END){_ae=999999;_ad("newer");}}}}}}};var _ae=-1;var _af=null;function _ac(_b0){var _b1=_b2("firebug_history");_b1=(_b1)?_1.fromJson(_b1):[];var pos=_1.indexOf(_b1,_b0);if(pos!=-1){_b1.splice(pos,1);}_b1.push(_b0);_b2("firebug_history",_1.toJson(_b1),30);while(_b1.length&&!_b2("firebug_history")){_b1.shift();_b2("firebug_history",_1.toJson(_b1),30);}_af=null;_ae=-1;};function _ad(_b3){var _b4=_b2("firebug_history");_b4=(_b4)?_1.fromJson(_b4):[];if(!_b4.length){return;}if(_af===null){_af=_d.value;}if(_ae==-1){_ae=_b4.length;}if(_b3=="older"){--_ae;if(_ae<0){_ae=0;}}else{if(_b3=="newer"){++_ae;if(_ae>_b4.length){_ae=_b4.length;}}}if(_ae==_b4.length){_d.value=_af;_af=null;}else{_d.value=_b4[_ae];}};function _b2(_b5,_b6){var c=document.cookie;if(arguments.length==1){var _b7=c.match(new RegExp("(?:^|; )"+_b5+"=([^;]*)"));return _b7?decodeURIComponent(_b7[1]):undefined;}else{var d=new Date();d.setMonth(d.getMonth()+1);document.cookie=_b5+"="+encodeURIComponent(_b6)+((d.toUtcString)?"; expires="+d.toUTCString():"");}};function _b8(it){return it&&it instanceof Array||typeof it=="array";};function _b9(o){var cnt=0;for(var nm in o){cnt++;}return cnt;};function _20(o,i,txt,_ba){var ind=" \t";txt=txt||"";i=i||ind;_ba=_ba||[];var _bb;if(o&&o.nodeType==1){var _bc=[];_24(o,_bc);return _bc.join("");}var br=",\n",cnt=0,_bd=_b9(o);if(o instanceof Date){return i+o.toString()+br;}looking:for(var nm in o){cnt++;if(cnt==_bd){br="\n";}if(o[nm]===window||o[nm]===document){}else{if(o[nm]===null){txt+=i+nm+" : NULL"+br;}else{if(o[nm]&&o[nm].nodeType){if(o[nm].nodeType==1){}else{if(o[nm].nodeType==3){txt+=i+nm+" : [ TextNode "+o[nm].data+" ]"+br;}}}else{if(typeof o[nm]=="object"&&(o[nm] instanceof String||o[nm] instanceof Number||o[nm] instanceof Boolean)){txt+=i+nm+" : "+o[nm]+","+br;}else{if(o[nm] instanceof Date){txt+=i+nm+" : "+o[nm].toString()+br;}else{if(typeof (o[nm])=="object"&&o[nm]){for(var j=0,_be;_be=_ba[j];j++){if(o[nm]===_be){txt+=i+nm+" : RECURSION"+br;continue looking;}}_ba.push(o[nm]);_bb=(_b8(o[nm]))?["[","]"]:["{","}"];txt+=i+nm+" : "+_bb[0]+"\n";txt+=_20(o[nm],i+ind,"",_ba);txt+=i+_bb[1]+br;}else{if(typeof o[nm]=="undefined"){txt+=i+nm+" : undefined"+br;}else{if(nm=="toString"&&typeof o[nm]=="function"){var _bf=o[nm]();if(typeof _bf=="string"&&_bf.match(/function ?(.*?)\(/)){_bf=_76(_6b(o[nm]));}txt+=i+nm+" : "+_bf+br;}else{txt+=i+nm+" : "+_76(_6b(o[nm]))+br;}}}}}}}}}return txt;};function _6b(obj){var _c0=(obj instanceof Error);if(obj.nodeType==1){return _76("< "+obj.tagName.toLowerCase()+" id=\""+obj.id+"\" />");}if(obj.nodeType==3){return _76("[TextNode: \""+obj.nodeValue+"\"]");}var nm=(obj&&(obj.id||obj.name||obj.ObjectID||obj.widgetId));if(!_c0&&nm){return "{"+nm+"}";}var _c1=2;var _c2=4;var cnt=0;if(_c0){nm="[ Error: "+(obj.message||obj.description||obj)+" ]";}else{if(_b8(obj)){nm="["+obj.slice(0,_c2).join(",");if(obj.length>_c2){nm+=" ... ("+obj.length+" items)";}nm+="]";}else{if(typeof obj=="function"){nm=obj+"";var reg=/function\s*([^\(]*)(\([^\)]*\))[^\{]*\{/;var m=reg.exec(nm);if(m){if(!m[1]){m[1]="function";}nm=m[1]+m[2];}else{nm="function()";}}else{if(typeof obj!="object"||typeof obj=="string"){nm=obj+"";}else{nm="{";for(var i in obj){cnt++;if(cnt>_c1){break;}nm+=i+":"+_76(obj[i])+" ";}nm+="}";}}}}return nm;};_44(document,_1.isIE||_1.isSafari?"keydown":"keypress",_46);if((document.documentElement.getAttribute("debug")=="true")||(_1.config.isDebug)){_2f(true);}_1.addOnWindowUnload(function(){_9c(document,_1.isIE||_1.isSafari?"keydown":"keypress",_46);window.onFirebugResize=null;window.console=null;});});
\ No newline at end of file +define("dojo/_firebug/firebug",["../_base/kernel","require","../_base/html","../sniff","../_base/array","../_base/lang","../_base/event","../_base/unload"],function(_1,_2,_3,_4){var _5=(/Trident/.test(window.navigator.userAgent));if(_5){var _6=["log","info","debug","warn","error"];for(var i=0;i<_6.length;i++){var m=_6[i];if(!console[m]||console[m]._fake){continue;}var n="_"+_6[i];console[n]=console[m];console[m]=(function(){var _7=n;return function(){console[_7](Array.prototype.join.call(arguments," "));};})();}try{console.clear();}catch(e){}}if(_4("ff")||_4("chrome")||_4("safari")||_5||window.firebug||(typeof console!="undefined"&&console.firebug)||_1.config.useCustomLogger||_4("air")){return;}try{if(window!=window.parent){if(window.parent["console"]){window.console=window.parent.console;}return;}}catch(e){}var _8=document;var _9=window;var _a=0;var _b=null;var _c=null;var _d=null;var _e=null;var _f=null;var _10=null;var _11=false;var _12=[];var _13=[];var _14={};var _15={};var _16=null;var _17;var _18;var _19=false;var _1a=null;var _1b=document.createElement("div");var _1c;var _1d;window.console={_connects:[],log:function(){_1e(arguments,"");},debug:function(){_1e(arguments,"debug");},info:function(){_1e(arguments,"info");},warn:function(){_1e(arguments,"warning");},error:function(){_1e(arguments,"error");},assert:function(_1f,_20){if(!_1f){var _21=[];for(var i=1;i<arguments.length;++i){_21.push(arguments[i]);}_1e(_21.length?_21:["Assertion Failure"],"error");throw _20?_20:"Assertion Failure";}},dir:function(obj){var str=_22(obj);str=str.replace(/\n/g,"<br />");str=str.replace(/\t/g," ");_23([str],"dir");},dirxml:function(_24){var _25=[];_26(_24,_25);_23(_25,"dirxml");},group:function(){_23(arguments,"group",_27);},groupEnd:function(){_23(arguments,"",_28);},time:function(_29){_14[_29]=new Date().getTime();},timeEnd:function(_2a){if(_2a in _14){var _2b=(new Date()).getTime()-_14[_2a];_1e([_2a+":",_2b+"ms"]);delete _14[_2a];}},count:function(_2c){if(!_15[_2c]){_15[_2c]=0;}_15[_2c]++;_1e([_2c+": "+_15[_2c]]);},trace:function(_2d){var _2e=_2d||3;var f=console.trace.caller;for(var i=0;i<_2e;i++){var _2f=f.toString();var _30=[];for(var a=0;a<f.arguments.length;a++){_30.push(f.arguments[a]);}if(f.arguments.length){}else{}f=f.caller;}},profile:function(){this.warn(["profile() not supported."]);},profileEnd:function(){},clear:function(){if(_c){while(_c.childNodes.length){_1.destroy(_c.firstChild);}}_1.forEach(this._connects,_1.disconnect);},open:function(){_31(true);},close:function(){if(_11){_31();}},_restoreBorder:function(){if(_1c){_1c.style.border=_1d;}},openDomInspector:function(){_19=true;_c.style.display="none";_16.style.display="block";_d.style.display="none";document.body.style.cursor="pointer";_17=_1.connect(document,"mousemove",function(evt){if(!_19){return;}if(!_1a){_1a=setTimeout(function(){_1a=null;},50);}else{return;}var _32=evt.target;if(_32&&(_1c!==_32)){var _33=true;console._restoreBorder();var _34=[];_26(_32,_34);_16.innerHTML=_34.join("");_1c=_32;_1d=_1c.style.border;_1c.style.border="#0000FF 1px solid";}});setTimeout(function(){_18=_1.connect(document,"click",function(evt){document.body.style.cursor="";_19=!_19;_1.disconnect(_18);});},30);},_closeDomInspector:function(){document.body.style.cursor="";_1.disconnect(_17);_1.disconnect(_18);_19=false;console._restoreBorder();},openConsole:function(){_c.style.display="block";_16.style.display="none";_d.style.display="none";console._closeDomInspector();},openObjectInspector:function(){_c.style.display="none";_16.style.display="none";_d.style.display="block";console._closeDomInspector();},recss:function(){var i,a,s;a=document.getElementsByTagName("link");for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf("stylesheet")>=0&&s.href){var h=s.href.replace(/(&|%5C?)forceReload=\d+/,"");s.href=h+(h.indexOf("?")>=0?"&":"?")+"forceReload="+new Date().valueOf();}}}};function _31(_35){_11=_35||!_11;if(_b){_b.style.display=_11?"block":"none";}};function _36(){_31(true);if(_f){_f.focus();}};function _37(x,y,w,h){var win=window.open("","_firebug","status=0,menubar=0,resizable=1,top="+y+",left="+x+",width="+w+",height="+h+",scrollbars=1,addressbar=0");if(!win){var msg="Firebug Lite could not open a pop-up window, most likely because of a blocker.\n"+"Either enable pop-ups for this domain, or change the djConfig to popup=false.";alert(msg);}_38(win);var _39=win.document;var _3a="<html style=\"height:100%;\"><head><title>Firebug Lite</title></head>\n"+"<body bgColor=\"#ccc\" style=\"height:97%;\" onresize=\"opener.onFirebugResize()\">\n"+"<div id=\"fb\"></div>"+"</body></html>";_39.write(_3a);_39.close();return win;};function _38(wn){var d=new Date();d.setTime(d.getTime()+(60*24*60*60*1000));d=d.toUTCString();var dc=wn.document,_3b;if(wn.innerWidth){_3b=function(){return {w:wn.innerWidth,h:wn.innerHeight};};}else{if(dc.documentElement&&dc.documentElement.clientWidth){_3b=function(){return {w:dc.documentElement.clientWidth,h:dc.documentElement.clientHeight};};}else{if(dc.body){_3b=function(){return {w:dc.body.clientWidth,h:dc.body.clientHeight};};}}}window.onFirebugResize=function(){_49(_3b().h);clearInterval(wn._firebugWin_resize);wn._firebugWin_resize=setTimeout(function(){var x=wn.screenLeft,y=wn.screenTop,w=wn.outerWidth||wn.document.body.offsetWidth,h=wn.outerHeight||wn.document.body.offsetHeight;document.cookie="_firebugPosition="+[x,y,w,h].join(",")+"; expires="+d+"; path=/";},5000);};};function _3c(){if(_b){return;}_31(true);if(_1.config.popup){var _3d="100%";var _3e=document.cookie.match(/(?:^|; )_firebugPosition=([^;]*)/);var p=_3e?_3e[1].split(","):[2,2,320,480];_9=_37(p[0],p[1],p[2],p[3]);_8=_9.document;_1.config.debugContainerId="fb";_9.console=window.console;_9.dojo=window.dojo;}else{_8=document;_3d=(_1.config.debugHeight||300)+"px";}var _3f=_8.createElement("link");_3f.href=_2.toUrl("./firebug.css");_3f.rel="stylesheet";_3f.type="text/css";var _40=_8.getElementsByTagName("head");if(_40){_40=_40[0];}if(!_40){_40=_8.getElementsByTagName("html")[0];}if(_4("ie")){window.setTimeout(function(){_40.appendChild(_3f);},0);}else{_40.appendChild(_3f);}if(_1.config.debugContainerId){_b=_8.getElementById(_1.config.debugContainerId);}if(!_b){_b=_8.createElement("div");_8.body.appendChild(_b);}_b.className+=" firebug";_b.id="firebug";_b.style.height=_3d;_b.style.display=(_11?"block":"none");var _41=function(_42,_43,_44,_45){return "<li class=\""+_45+"\"><a href=\"javascript:void(0);\" onclick=\"console."+_44+"(); return false;\" title=\""+_43+"\">"+_42+"</a></li>";};_b.innerHTML="<div id=\"firebugToolbar\">"+" <ul id=\"fireBugTabs\" class=\"tabs\">"+_41("Clear","Remove All Console Logs","clear","")+_41("ReCSS","Refresh CSS without reloading page","recss","")+_41("Console","Show Console Logs","openConsole","gap")+_41("DOM","Show DOM Inspector","openDomInspector","")+_41("Object","Show Object Inspector","openObjectInspector","")+((_1.config.popup)?"":_41("Close","Close the console","close","gap"))+"\t</ul>"+"</div>"+"<input type=\"text\" id=\"firebugCommandLine\" />"+"<div id=\"firebugLog\"></div>"+"<div id=\"objectLog\" style=\"display:none;\">Click on an object in the Log display</div>"+"<div id=\"domInspect\" style=\"display:none;\">Hover over HTML elements in the main page. Click to hold selection.</div>";_10=_8.getElementById("firebugToolbar");_f=_8.getElementById("firebugCommandLine");_46(_f,"keydown",_47);_46(_8,_4("ie")||_4("safari")?"keydown":"keypress",_48);_c=_8.getElementById("firebugLog");_d=_8.getElementById("objectLog");_16=_8.getElementById("domInspect");_e=_8.getElementById("fireBugTabs");_49();_4a();};_1.addOnLoad(_3c);function _4b(){_8=null;if(_9.console){_9.console.clear();}_9=null;_b=null;_c=null;_d=null;_16=null;_f=null;_12=[];_13=[];_14={};};function _4c(){var _4d=_f.value;_f.value="";_23(["> ",_4d],"command");var _4e;try{_4e=eval(_4d);}catch(e){}};function _49(h){var _4f=25;var _50=h?h-(_4f+_f.offsetHeight+25+(h*0.01))+"px":(_b.offsetHeight-_4f-_f.offsetHeight)+"px";_c.style.top=_4f+"px";_c.style.height=_50;_d.style.height=_50;_d.style.top=_4f+"px";_16.style.height=_50;_16.style.top=_4f+"px";_f.style.bottom=0;_1.addOnWindowUnload(_4b);};function _23(_51,_52,_53){if(_c){_54(_51,_52,_53);}else{_12.push([_51,_52,_53]);}};function _4a(){var _55=_12;_12=[];for(var i=0;i<_55.length;++i){_54(_55[i][0],_55[i][1],_55[i][2]);}};function _54(_56,_57,_58){var _59=_c.scrollTop+_c.offsetHeight>=_c.scrollHeight;_58=_58||_5a;_58(_56,_57);if(_59){_c.scrollTop=_c.scrollHeight-_c.offsetHeight;}};function _5b(row){var _5c=_13.length?_13[_13.length-1]:_c;_5c.appendChild(row);};function _5a(_5d,_5e){var row=_c.ownerDocument.createElement("div");row.className="logRow"+(_5e?" logRow-"+_5e:"");row.innerHTML=_5d.join("");_5b(row);};function _27(_5f,_60){_1e(_5f,_60);var _61=_c.ownerDocument.createElement("div");_61.className="logGroupBox";_5b(_61);_13.push(_61);};function _28(){_13.pop();};function _1e(_62,_63){var _64=[];var _65=_62[0];var _66=0;if(typeof (_65)!="string"){_65="";_66=-1;}var _67=_68(_65);for(var i=0;i<_67.length;++i){var _69=_67[i];if(_69&&typeof _69=="object"){_69.appender(_62[++_66],_64);}else{_6a(_69,_64);}}var ids=[];var obs=[];for(i=_66+1;i<_62.length;++i){_6a(" ",_64);var _6b=_62[i];if(_6b===undefined||_6b===null){_6c(_6b,_64);}else{if(typeof (_6b)=="string"){_6a(_6b,_64);}else{if(_6b instanceof Date){_6a(_6b.toString(),_64);}else{if(_6b.nodeType==9){_6a("[ XmlDoc ]",_64);}else{var id="_a"+_a++;ids.push(id);obs.push(_6b);var str="<a id=\""+id+"\" href=\"javascript:void(0);\">"+_6d(_6b)+"</a>";_6e(str,_64);}}}}}_23(_64,_63);for(i=0;i<ids.length;i++){var btn=_8.getElementById(ids[i]);if(!btn){continue;}btn.obj=obs[i];_9.console._connects.push(_1.connect(btn,"onclick",function(){console.openObjectInspector();try{_22(this.obj);}catch(e){this.obj=e;}_d.innerHTML="<pre>"+_22(this.obj)+"</pre>";}));}};function _68(_6f){var _70=[];var reg=/((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;var _71={s:_6a,d:_72,i:_72,f:_73};for(var m=reg.exec(_6f);m;m=reg.exec(_6f)){var _74=m[8]?m[8]:m[5];var _75=_74 in _71?_71[_74]:_76;var _77=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);_70.push(_6f.substr(0,m[0][0]=="%"?m.index:m.index+1));_70.push({appender:_75,precision:_77});_6f=_6f.substr(m.index+m[0].length);}_70.push(_6f);return _70;};function _78(_79){function _7a(ch){switch(ch){case "<":return "<";case ">":return ">";case "&":return "&";case "'":return "'";case "\"":return """;}return "?";};return String(_79).replace(/[<>&"']/g,_7a);};function _7b(_7c){try{return _7c+"";}catch(e){return null;}};function _6e(_7d,_7e){_7e.push(_7b(_7d));};function _6a(_7f,_80){_80.push(_78(_7b(_7f)));};function _6c(_81,_82){_82.push("<span class=\"objectBox-null\">",_78(_7b(_81)),"</span>");};function _83(_84,_85){_85.push("<span class=\"objectBox-string\">"",_78(_7b(_84)),""</span>");};function _72(_86,_87){_87.push("<span class=\"objectBox-number\">",_78(_7b(_86)),"</span>");};function _73(_88,_89){_89.push("<span class=\"objectBox-number\">",_78(_7b(_88)),"</span>");};function _8a(_8b,_8c){_8c.push("<span class=\"objectBox-function\">",_6d(_8b),"</span>");};function _76(_8d,_8e){try{if(_8d===undefined){_6c("undefined",_8e);}else{if(_8d===null){_6c("null",_8e);}else{if(typeof _8d=="string"){_83(_8d,_8e);}else{if(typeof _8d=="number"){_72(_8d,_8e);}else{if(typeof _8d=="function"){_8a(_8d,_8e);}else{if(_8d.nodeType==1){_8f(_8d,_8e);}else{if(typeof _8d=="object"){_90(_8d,_8e);}else{_6a(_8d,_8e);}}}}}}}}catch(e){}};function _90(_91,_92){var _93=_7b(_91);var _94=/\[object (.*?)\]/;var m=_94.exec(_93);_92.push("<span class=\"objectBox-object\">",m?m[1]:_93,"</span>");};function _8f(_95,_96){_96.push("<span class=\"objectBox-selector\">");_96.push("<span class=\"selectorTag\">",_78(_95.nodeName.toLowerCase()),"</span>");if(_95.id){_96.push("<span class=\"selectorId\">#",_78(_95.id),"</span>");}if(_95.className){_96.push("<span class=\"selectorClass\">.",_78(_95.className),"</span>");}_96.push("</span>");};function _26(_97,_98){if(_97.nodeType==1){_98.push("<div class=\"objectBox-element\">","<<span class=\"nodeTag\">",_97.nodeName.toLowerCase(),"</span>");for(var i=0;i<_97.attributes.length;++i){var _99=_97.attributes[i];if(!_99.specified){continue;}_98.push(" <span class=\"nodeName\">",_99.nodeName.toLowerCase(),"</span>="<span class=\"nodeValue\">",_78(_99.nodeValue),"</span>"");}if(_97.firstChild){_98.push("></div><div class=\"nodeChildren\">");for(var _9a=_97.firstChild;_9a;_9a=_9a.nextSibling){_26(_9a,_98);}_98.push("</div><div class=\"objectBox-element\"></<span class=\"nodeTag\">",_97.nodeName.toLowerCase(),"></span></div>");}else{_98.push("/></div>");}}else{if(_97.nodeType==3){_98.push("<div class=\"nodeText\">",_78(_97.nodeValue),"</div>");}}};function _46(_9b,_9c,_9d){if(document.all){_9b.attachEvent("on"+_9c,_9d);}else{_9b.addEventListener(_9c,_9d,false);}};function _9e(_9f,_a0,_a1){if(document.all){_9f.detachEvent("on"+_a0,_a1);}else{_9f.removeEventListener(_a0,_a1,false);}};function _a2(_a3){if(document.all){_a3.cancelBubble=true;}else{_a3.stopPropagation();}};function _a4(msg,_a5,_a6){var _a7=_a5.lastIndexOf("/");var _a8=_a7==-1?_a5:_a5.substr(_a7+1);var _a9=["<span class=\"errorMessage\">",msg,"</span>","<div class=\"objectBox-sourceLink\">",_a8," (line ",_a6,")</div>"];_23(_a9,"error");};var _aa=new Date().getTime();function _48(_ab){var _ac=(new Date()).getTime();if(_ac>_aa+200){_ab=_1.fixEvent(_ab);var _ad=_1.keys;var ekc=_ab.keyCode;_aa=_ac;if(ekc==_ad.F12){_31();}else{if((ekc==_ad.NUMPAD_ENTER||ekc==76)&&_ab.shiftKey&&(_ab.metaKey||_ab.ctrlKey)){_36();}else{return;}}_a2(_ab);}};function _47(e){var dk=_1.keys;if(e.keyCode==13&&_f.value){_ae(_f.value);_4c();}else{if(e.keyCode==27){_f.value="";}else{if(e.keyCode==dk.UP_ARROW||e.charCode==dk.UP_ARROW){_af("older");}else{if(e.keyCode==dk.DOWN_ARROW||e.charCode==dk.DOWN_ARROW){_af("newer");}else{if(e.keyCode==dk.HOME||e.charCode==dk.HOME){_b0=1;_af("older");}else{if(e.keyCode==dk.END||e.charCode==dk.END){_b0=999999;_af("newer");}}}}}}};var _b0=-1;var _b1=null;function _ae(_b2){var _b3=_b4("firebug_history");_b3=(_b3)?_1.fromJson(_b3):[];var pos=_1.indexOf(_b3,_b2);if(pos!=-1){_b3.splice(pos,1);}_b3.push(_b2);_b4("firebug_history",_1.toJson(_b3),30);while(_b3.length&&!_b4("firebug_history")){_b3.shift();_b4("firebug_history",_1.toJson(_b3),30);}_b1=null;_b0=-1;};function _af(_b5){var _b6=_b4("firebug_history");_b6=(_b6)?_1.fromJson(_b6):[];if(!_b6.length){return;}if(_b1===null){_b1=_f.value;}if(_b0==-1){_b0=_b6.length;}if(_b5=="older"){--_b0;if(_b0<0){_b0=0;}}else{if(_b5=="newer"){++_b0;if(_b0>_b6.length){_b0=_b6.length;}}}if(_b0==_b6.length){_f.value=_b1;_b1=null;}else{_f.value=_b6[_b0];}};function _b4(_b7,_b8){var c=document.cookie;if(arguments.length==1){var _b9=c.match(new RegExp("(?:^|; )"+_b7+"=([^;]*)"));return _b9?decodeURIComponent(_b9[1]):undefined;}else{var d=new Date();d.setMonth(d.getMonth()+1);document.cookie=_b7+"="+encodeURIComponent(_b8)+((d.toUtcString)?"; expires="+d.toUTCString():"");}};function _ba(it){return it&&it instanceof Array||typeof it=="array";};function _bb(o){var cnt=0;for(var nm in o){cnt++;}return cnt;};function _22(o,i,txt,_bc){var ind=" \t";txt=txt||"";i=i||ind;_bc=_bc||[];var _bd;if(o&&o.nodeType==1){var _be=[];_26(o,_be);return _be.join("");}var br=",\n",cnt=0,_bf=_bb(o);if(o instanceof Date){return i+o.toString()+br;}looking:for(var nm in o){cnt++;if(cnt==_bf){br="\n";}if(o[nm]===window||o[nm]===document){}else{if(o[nm]===null){txt+=i+nm+" : NULL"+br;}else{if(o[nm]&&o[nm].nodeType){if(o[nm].nodeType==1){}else{if(o[nm].nodeType==3){txt+=i+nm+" : [ TextNode "+o[nm].data+" ]"+br;}}}else{if(typeof o[nm]=="object"&&(o[nm] instanceof String||o[nm] instanceof Number||o[nm] instanceof Boolean)){txt+=i+nm+" : "+o[nm]+","+br;}else{if(o[nm] instanceof Date){txt+=i+nm+" : "+o[nm].toString()+br;}else{if(typeof (o[nm])=="object"&&o[nm]){for(var j=0,_c0;_c0=_bc[j];j++){if(o[nm]===_c0){txt+=i+nm+" : RECURSION"+br;continue looking;}}_bc.push(o[nm]);_bd=(_ba(o[nm]))?["[","]"]:["{","}"];txt+=i+nm+" : "+_bd[0]+"\n";txt+=_22(o[nm],i+ind,"",_bc);txt+=i+_bd[1]+br;}else{if(typeof o[nm]=="undefined"){txt+=i+nm+" : undefined"+br;}else{if(nm=="toString"&&typeof o[nm]=="function"){var _c1=o[nm]();if(typeof _c1=="string"&&_c1.match(/function ?(.*?)\(/)){_c1=_78(_6d(o[nm]));}txt+=i+nm+" : "+_c1+br;}else{txt+=i+nm+" : "+_78(_6d(o[nm]))+br;}}}}}}}}}return txt;};function _6d(obj){var _c2=(obj instanceof Error);if(obj.nodeType==1){return _78("< "+obj.tagName.toLowerCase()+" id=\""+obj.id+"\" />");}if(obj.nodeType==3){return _78("[TextNode: \""+obj.nodeValue+"\"]");}var nm=(obj&&(obj.id||obj.name||obj.ObjectID||obj.widgetId));if(!_c2&&nm){return "{"+nm+"}";}var _c3=2;var _c4=4;var cnt=0;if(_c2){nm="[ Error: "+(obj.message||obj.description||obj)+" ]";}else{if(_ba(obj)){nm="["+obj.slice(0,_c4).join(",");if(obj.length>_c4){nm+=" ... ("+obj.length+" items)";}nm+="]";}else{if(typeof obj=="function"){nm=obj+"";var reg=/function\s*([^\(]*)(\([^\)]*\))[^\{]*\{/;var m=reg.exec(nm);if(m){if(!m[1]){m[1]="function";}nm=m[1]+m[2];}else{nm="function()";}}else{if(typeof obj!="object"||typeof obj=="string"){nm=obj+"";}else{nm="{";for(var i in obj){cnt++;if(cnt>_c3){break;}nm+=i+":"+_78(obj[i])+" ";}nm+="}";}}}}return nm;};_46(document,_4("ie")||_4("safari")?"keydown":"keypress",_48);if((document.documentElement.getAttribute("debug")=="true")||(_1.config.isDebug)){_31(true);}_1.addOnWindowUnload(function(){_9e(document,_4("ie")||_4("safari")?"keydown":"keypress",_48);window.onFirebugResize=null;window.console=null;});});
\ No newline at end of file diff --git a/lib/dojo/_firebug/firebug.js.uncompressed.js b/lib/dojo/_firebug/firebug.js.uncompressed.js new file mode 100644 index 000000000..908e5f7b2 --- /dev/null +++ b/lib/dojo/_firebug/firebug.js.uncompressed.js @@ -0,0 +1,1191 @@ +define("dojo/_firebug/firebug", [ + "../_base/kernel", + "require", + "../_base/html", + "../sniff", + "../_base/array", + "../_base/lang", + "../_base/event", + "../_base/unload"], function(dojo, require, html, has){ + + // module: + // dojo/_firebug/firebug + // summary: + // Firebug Lite, the baby brother to Joe Hewitt's Firebug for Mozilla Firefox + // description: + // Opens a console for logging, debugging, and error messages. + // Contains partial functionality to Firebug. See function list below. + // + // NOTE: + // Firebug is a Firefox extension created by Joe Hewitt (see license). You do not need Dojo to run Firebug. + // Firebug Lite is included in Dojo by permission from Joe Hewitt + // If you are new to Firebug, or used to the Dojo 0.4 dojo.debug, you can learn Firebug + // functionality by reading the function comments below or visiting http://www.getfirebug.com/docs.html + // + // NOTE: + // To test Firebug Lite in Firefox: + // + // - FF2: set "console = null" before loading dojo and set djConfig.isDebug=true + // - FF3: disable Firebug and set djConfig.isDebug=true + // + // example: + // Supports inline objects in object inspector window (only simple trace of dom nodes, however) + // | console.log("my object", {foo:"bar"}) + // example: + // Option for console to open in popup window + // | var djConfig = {isDebug: true, popup:true }; + // example: + // Option for console height (ignored for popup) + // | var djConfig = {isDebug: true, debugHeight:100 } + + + var isNewIE = (/Trident/.test(window.navigator.userAgent)); + if(isNewIE){ + // Fixing IE's console + // IE doesn't insert space between arguments. How annoying. + var calls = ["log", "info", "debug", "warn", "error"]; + for(var i=0;i<calls.length;i++){ + var m = calls[i]; + if(!console[m] ||console[m]._fake){ + // IE9 doesn't have console.debug method, a fake one is added later + continue; + } + var n = "_"+calls[i]; + console[n] = console[m]; + console[m] = (function(){ + var type = n; + return function(){ + console[type](Array.prototype.join.call(arguments, " ")); + }; + })(); + } + // clear the console on load. This is more than a convenience - too many logs crashes it. + // If closed it throws an error + try{ console.clear(); }catch(e){} + } + + if( + has("ff") || // Firefox has Firebug + has("chrome") || // Chrome 3+ has a console + has("safari") || // Safari 4 has a console + isNewIE || // Has the new IE console + window.firebug || // Testing for mozilla firebug lite + (typeof console != "undefined" && console.firebug) || //The firebug console + dojo.config.useCustomLogger || // Allow custom loggers + has("air") // isDebug triggers AIRInsector, not Firebug + ){ + return; + } + + // don't build firebug in iframes + try{ + if(window != window.parent){ + // but if we've got a parent logger, connect to it + if(window.parent["console"]){ + window.console = window.parent.console; + } + return; + } + }catch(e){/*squelch*/} + + // *************************************************************************** + // Placing these variables before the functions that use them to avoid a + // shrinksafe bug where variable renaming does not happen correctly otherwise. + + // most of the objects in this script are run anonomously + var _firebugDoc = document; + var _firebugWin = window; + var __consoleAnchorId__ = 0; + + var consoleFrame = null; + var consoleBody = null; + var consoleObjectInspector = null; + var fireBugTabs = null; + var commandLine = null; + var consoleToolbar = null; + + var frameVisible = false; + var messageQueue = []; + var groupStack = []; + var timeMap = {}; + var countMap = {}; + + var consoleDomInspector = null; + var _inspectionMoveConnection; + var _inspectionClickConnection; + var _inspectionEnabled = false; + var _inspectionTimer = null; + var _inspectTempNode = document.createElement("div"); + + + var _inspectCurrentNode; + var _restoreBorderStyle; + + // *************************************************************************** + + window.console = { + _connects: [], + log: function(){ + // summary: + // Sends arguments to console. + logFormatted(arguments, ""); + }, + + debug: function(){ + // summary: + // Sends arguments to console. Missing finctionality to show script line of trace. + logFormatted(arguments, "debug"); + }, + + info: function(){ + // summary: + // Sends arguments to console, highlighted with (I) icon. + logFormatted(arguments, "info"); + }, + + warn: function(){ + // summary: + // Sends warning arguments to console, highlighted with (!) icon and blue style. + logFormatted(arguments, "warning"); + }, + + error: function(){ + // summary: + // Sends error arguments (object) to console, highlighted with (X) icon and yellow style + // NEW: error object now displays in object inspector + logFormatted(arguments, "error"); + }, + + assert: function(truth, message){ + // summary: + // Tests for true. Throws exception if false. + if(!truth){ + var args = []; + for(var i = 1; i < arguments.length; ++i){ + args.push(arguments[i]); + } + + logFormatted(args.length ? args : ["Assertion Failure"], "error"); + throw message ? message : "Assertion Failure"; + } + }, + + dir: function(obj){ + var str = printObject( obj ); + str = str.replace(/\n/g, "<br />"); + str = str.replace(/\t/g, " "); + logRow([str], "dir"); + }, + + dirxml: function(node){ + var html = []; + appendNode(node, html); + logRow(html, "dirxml"); + }, + + group: function(){ + // summary: + // collects log messages into a group, starting with this call and ending with + // groupEnd(). Missing collapse functionality + logRow(arguments, "group", pushGroup); + }, + + groupEnd: function(){ + // summary: + // Closes group. See above + logRow(arguments, "", popGroup); + }, + + time: function(name){ + // summary: + // Starts timers assigned to name given in argument. Timer stops and displays on timeEnd(title); + // example: + // | console.time("load"); + // | console.time("myFunction"); + // | console.timeEnd("load"); + // | console.timeEnd("myFunction"); + timeMap[name] = new Date().getTime(); + }, + + timeEnd: function(name){ + // summary: + // See above. + if(name in timeMap){ + var delta = (new Date()).getTime() - timeMap[name]; + logFormatted([name+ ":", delta+"ms"]); + delete timeMap[name]; + } + }, + + count: function(name){ + // summary: + // Not supported + if(!countMap[name]) countMap[name] = 0; + countMap[name]++; + logFormatted([name+": "+countMap[name]]); + }, + + trace: function(_value){ + var stackAmt = _value || 3; + var f = console.trace.caller; //function that called trace + console.log(">>> console.trace(stack)"); + for(var i=0;i<stackAmt;i++){ + var func = f.toString(); + var args=[]; + for (var a = 0; a < f.arguments.length; a++){ + args.push(f.arguments[a]); + } + if(f.arguments.length){ + console.dir({"function":func, "arguments":args}); + }else{ + console.dir({"function":func}); + } + + f = f.caller; + } + }, + + profile: function(){ + // summary: + // Not supported + this.warn(["profile() not supported."]); + }, + + profileEnd: function(){ }, + + clear: function(){ + // summary: + // Clears message console. Do not call this directly + if(consoleBody){ + while(consoleBody.childNodes.length){ + dojo.destroy(consoleBody.firstChild); + } + } + dojo.forEach(this._connects,dojo.disconnect); + }, + + open: function(){ + // summary: + // Opens message console. Do not call this directly + toggleConsole(true); + }, + + close: function(){ + // summary: + // Closes message console. Do not call this directly + if(frameVisible){ + toggleConsole(); + } + }, + _restoreBorder: function(){ + if(_inspectCurrentNode){ + _inspectCurrentNode.style.border = _restoreBorderStyle; + } + }, + openDomInspector: function(){ + _inspectionEnabled = true; + consoleBody.style.display = "none"; + consoleDomInspector.style.display = "block"; + consoleObjectInspector.style.display = "none"; + document.body.style.cursor = "pointer"; + _inspectionMoveConnection = dojo.connect(document, "mousemove", function(evt){ + if(!_inspectionEnabled){ return; } + if(!_inspectionTimer){ + _inspectionTimer = setTimeout(function(){ _inspectionTimer = null; }, 50); + }else{ + return; + } + var node = evt.target; + if(node && (_inspectCurrentNode !== node)){ + var parent = true; + + console._restoreBorder(); + var html = []; + appendNode(node, html); + consoleDomInspector.innerHTML = html.join(""); + + _inspectCurrentNode = node; + _restoreBorderStyle = _inspectCurrentNode.style.border; + _inspectCurrentNode.style.border = "#0000FF 1px solid"; + } + }); + setTimeout(function(){ + _inspectionClickConnection = dojo.connect(document, "click", function(evt){ + document.body.style.cursor = ""; + _inspectionEnabled = !_inspectionEnabled; + dojo.disconnect(_inspectionClickConnection); + // console._restoreBorder(); + }); + }, 30); + }, + _closeDomInspector: function(){ + document.body.style.cursor = ""; + dojo.disconnect(_inspectionMoveConnection); + dojo.disconnect(_inspectionClickConnection); + _inspectionEnabled = false; + console._restoreBorder(); + }, + openConsole:function(){ + // summary: + // Closes object inspector and opens message console. Do not call this directly + consoleBody.style.display = "block"; + consoleDomInspector.style.display = "none"; + consoleObjectInspector.style.display = "none"; + console._closeDomInspector(); + }, + openObjectInspector:function(){ + consoleBody.style.display = "none"; + consoleDomInspector.style.display = "none"; + consoleObjectInspector.style.display = "block"; + console._closeDomInspector(); + }, + recss: function(){ + // this is placed in dojo since the console is most likely + // in another window and dojo is easilly accessible + var i,a,s;a=document.getElementsByTagName('link'); + for(i=0;i<a.length;i++){ + s=a[i]; + if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href){ + var h=s.href.replace(/(&|%5C?)forceReload=\d+/,''); + s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+new Date().valueOf(); + } + } + } + }; + + // *************************************************************************** + + function toggleConsole(forceOpen){ + frameVisible = forceOpen || !frameVisible; + if(consoleFrame){ + consoleFrame.style.display = frameVisible ? "block" : "none"; + } + } + + function focusCommandLine(){ + toggleConsole(true); + if(commandLine){ + commandLine.focus(); + } + } + + function openWin(x,y,w,h){ + var win = window.open("","_firebug","status=0,menubar=0,resizable=1,top="+y+",left="+x+",width="+w+",height="+h+",scrollbars=1,addressbar=0"); + if(!win){ + var msg = "Firebug Lite could not open a pop-up window, most likely because of a blocker.\n" + + "Either enable pop-ups for this domain, or change the djConfig to popup=false."; + alert(msg); + } + createResizeHandler(win); + var newDoc=win.document; + //Safari needs an HTML height + var HTMLstring= '<html style="height:100%;"><head><title>Firebug Lite</title></head>\n' + + '<body bgColor="#ccc" style="height:97%;" onresize="opener.onFirebugResize()">\n' + + '<div id="fb"></div>' + + '</body></html>'; + + newDoc.write(HTMLstring); + newDoc.close(); + return win; + } + + function createResizeHandler(wn){ + // summary: + // Creates handle for onresize window. Called from script in popup's body tag (so that it will work with IE). + // + + var d = new Date(); + d.setTime(d.getTime()+(60*24*60*60*1000)); // 60 days + d = d.toUTCString(); + + var dc = wn.document, + getViewport; + + if (wn.innerWidth){ + getViewport = function(){ + return{w:wn.innerWidth, h:wn.innerHeight}; + }; + }else if (dc.documentElement && dc.documentElement.clientWidth){ + getViewport = function(){ + return{w:dc.documentElement.clientWidth, h:dc.documentElement.clientHeight}; + }; + }else if (dc.body){ + getViewport = function(){ + return{w:dc.body.clientWidth, h:dc.body.clientHeight}; + }; + } + + + window.onFirebugResize = function(){ + + //resize the height of the console log body + layout(getViewport().h); + + clearInterval(wn._firebugWin_resize); + wn._firebugWin_resize = setTimeout(function(){ + var x = wn.screenLeft, + y = wn.screenTop, + w = wn.outerWidth || wn.document.body.offsetWidth, + h = wn.outerHeight || wn.document.body.offsetHeight; + + document.cookie = "_firebugPosition=" + [x,y,w,h].join(",") + "; expires="+d+"; path=/"; + + }, 5000); //can't capture window.onMove - long timeout gives better chance of capturing a resize, then the move + + }; + } + + + /*****************************************************************************/ + + + function createFrame(){ + if(consoleFrame){ + return; + } + toggleConsole(true); + if(dojo.config.popup){ + var containerHeight = "100%"; + var cookieMatch = document.cookie.match(/(?:^|; )_firebugPosition=([^;]*)/); + var p = cookieMatch ? cookieMatch[1].split(",") : [2,2,320,480]; + + _firebugWin = openWin(p[0],p[1],p[2],p[3]); // global + _firebugDoc = _firebugWin.document; // global + + dojo.config.debugContainerId = 'fb'; + + // connecting popup + _firebugWin.console = window.console; + _firebugWin.dojo = window.dojo; + }else{ + _firebugDoc = document; + containerHeight = (dojo.config.debugHeight || 300) + "px"; + } + + var styleElement = _firebugDoc.createElement("link"); + styleElement.href = require.toUrl("./firebug.css"); + styleElement.rel = "stylesheet"; + styleElement.type = "text/css"; + var styleParent = _firebugDoc.getElementsByTagName("head"); + if(styleParent){ + styleParent = styleParent[0]; + } + if(!styleParent){ + styleParent = _firebugDoc.getElementsByTagName("html")[0]; + } + if(has("ie")){ + window.setTimeout(function(){ styleParent.appendChild(styleElement); }, 0); + }else{ + styleParent.appendChild(styleElement); + } + + if(dojo.config.debugContainerId){ + consoleFrame = _firebugDoc.getElementById(dojo.config.debugContainerId); + } + if(!consoleFrame){ + consoleFrame = _firebugDoc.createElement("div"); + _firebugDoc.body.appendChild(consoleFrame); + } + consoleFrame.className += " firebug"; + consoleFrame.id = "firebug"; + consoleFrame.style.height = containerHeight; + consoleFrame.style.display = (frameVisible ? "block" : "none"); + + var buildLink = function(label, title, method, _class){ + return '<li class="'+_class+'"><a href="javascript:void(0);" onclick="console.'+ method +'(); return false;" title="'+title+'">'+label+'</a></li>'; + }; + consoleFrame.innerHTML = + '<div id="firebugToolbar">' + + ' <ul id="fireBugTabs" class="tabs">' + + + buildLink("Clear", "Remove All Console Logs", "clear", "") + + buildLink("ReCSS", "Refresh CSS without reloading page", "recss", "") + + + buildLink("Console", "Show Console Logs", "openConsole", "gap") + + buildLink("DOM", "Show DOM Inspector", "openDomInspector", "") + + buildLink("Object", "Show Object Inspector", "openObjectInspector", "") + + ((dojo.config.popup) ? "" : buildLink("Close", "Close the console", "close", "gap")) + + + ' </ul>' + + '</div>' + + '<input type="text" id="firebugCommandLine" />' + + '<div id="firebugLog"></div>' + + '<div id="objectLog" style="display:none;">Click on an object in the Log display</div>' + + '<div id="domInspect" style="display:none;">Hover over HTML elements in the main page. Click to hold selection.</div>'; + + + consoleToolbar = _firebugDoc.getElementById("firebugToolbar"); + + commandLine = _firebugDoc.getElementById("firebugCommandLine"); + addEvent(commandLine, "keydown", onCommandLineKeyDown); + + addEvent(_firebugDoc, has("ie") || has("safari") ? "keydown" : "keypress", onKeyDown); + + consoleBody = _firebugDoc.getElementById("firebugLog"); + consoleObjectInspector = _firebugDoc.getElementById("objectLog"); + consoleDomInspector = _firebugDoc.getElementById("domInspect"); + fireBugTabs = _firebugDoc.getElementById("fireBugTabs"); + layout(); + flush(); + } + + dojo.addOnLoad(createFrame); + + function clearFrame(){ + _firebugDoc = null; + + if(_firebugWin.console){ + _firebugWin.console.clear(); + } + _firebugWin = null; + consoleFrame = null; + consoleBody = null; + consoleObjectInspector = null; + consoleDomInspector = null; + commandLine = null; + messageQueue = []; + groupStack = []; + timeMap = {}; + } + + + function evalCommandLine(){ + var text = commandLine.value; + commandLine.value = ""; + + logRow(["> ", text], "command"); + + var value; + try{ + value = eval(text); + }catch(e){ + console.debug(e); // put exception on the console + } + + console.log(value); + } + + function layout(h){ + var tHeight = 25; //consoleToolbar.offsetHeight; // tab style not ready on load - throws off layout + var height = h ? + h - (tHeight + commandLine.offsetHeight +25 + (h*.01)) + "px" : + (consoleFrame.offsetHeight - tHeight - commandLine.offsetHeight) + "px"; + + consoleBody.style.top = tHeight + "px"; + consoleBody.style.height = height; + consoleObjectInspector.style.height = height; + consoleObjectInspector.style.top = tHeight + "px"; + consoleDomInspector.style.height = height; + consoleDomInspector.style.top = tHeight + "px"; + commandLine.style.bottom = 0; + + dojo.addOnWindowUnload(clearFrame); + } + + function logRow(message, className, handler){ + if(consoleBody){ + writeMessage(message, className, handler); + }else{ + messageQueue.push([message, className, handler]); + } + } + + function flush(){ + var queue = messageQueue; + messageQueue = []; + + for(var i = 0; i < queue.length; ++i){ + writeMessage(queue[i][0], queue[i][1], queue[i][2]); + } + } + + function writeMessage(message, className, handler){ + var isScrolledToBottom = + consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight; + + handler = handler||writeRow; + + handler(message, className); + + if(isScrolledToBottom){ + consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight; + } + } + + function appendRow(row){ + var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody; + container.appendChild(row); + } + + function writeRow(message, className){ + var row = consoleBody.ownerDocument.createElement("div"); + row.className = "logRow" + (className ? " logRow-"+className : ""); + row.innerHTML = message.join(""); + appendRow(row); + } + + function pushGroup(message, className){ + logFormatted(message, className); + + //var groupRow = consoleBody.ownerDocument.createElement("div"); + //groupRow.className = "logGroup"; + var groupRowBox = consoleBody.ownerDocument.createElement("div"); + groupRowBox.className = "logGroupBox"; + //groupRow.appendChild(groupRowBox); + appendRow(groupRowBox); + groupStack.push(groupRowBox); + } + + function popGroup(){ + groupStack.pop(); + } + + // *************************************************************************** + + function logFormatted(objects, className){ + var html = []; + + var format = objects[0]; + var objIndex = 0; + + if(typeof(format) != "string"){ + format = ""; + objIndex = -1; + } + + var parts = parseFormat(format); + + for(var i = 0; i < parts.length; ++i){ + var part = parts[i]; + if(part && typeof part == "object"){ + part.appender(objects[++objIndex], html); + }else{ + appendText(part, html); + } + } + + + var ids = []; + var obs = []; + for(i = objIndex+1; i < objects.length; ++i){ + appendText(" ", html); + + var object = objects[i]; + if(object === undefined || object === null ){ + appendNull(object, html); + + }else if(typeof(object) == "string"){ + appendText(object, html); + + }else if(object instanceof Date){ + appendText(object.toString(), html); + + }else if(object.nodeType == 9){ + appendText("[ XmlDoc ]", html); + + }else{ + // Create link for object inspector + // need to create an ID for this link, since it is currently text + var id = "_a" + __consoleAnchorId__++; + ids.push(id); + // need to save the object, so the arrays line up + obs.push(object); + var str = '<a id="'+id+'" href="javascript:void(0);">'+getObjectAbbr(object)+'</a>'; + + appendLink( str , html); + } + } + + logRow(html, className); + + // Now that the row is inserted in the DOM, loop through all of the links that were just created + for(i=0; i<ids.length; i++){ + var btn = _firebugDoc.getElementById(ids[i]); + if(!btn){ continue; } + + // store the object in the dom btn for reference later + // avoid parsing these objects unless necessary + btn.obj = obs[i]; + + _firebugWin.console._connects.push(dojo.connect(btn, "onclick", function(){ + + console.openObjectInspector(); + + try{ + printObject(this.obj); + }catch(e){ + this.obj = e; + } + consoleObjectInspector.innerHTML = "<pre>" + printObject( this.obj ) + "</pre>"; + })); + } + } + + function parseFormat(format){ + var parts = []; + + var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/; + var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat}; + + for(var m = reg.exec(format); m; m = reg.exec(format)){ + var type = m[8] ? m[8] : m[5]; + var appender = type in appenderMap ? appenderMap[type] : appendObject; + var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0); + + parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1)); + parts.push({appender: appender, precision: precision}); + + format = format.substr(m.index+m[0].length); + } + + parts.push(format); + + return parts; + } + + function escapeHTML(value){ + function replaceChars(ch){ + switch(ch){ + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case "'": + return "'"; + case '"': + return """; + } + return "?"; + } + return String(value).replace(/[<>&"']/g, replaceChars); + } + + function objectToString(object){ + try{ + return object+""; + }catch(e){ + return null; + } + } + + // *************************************************************************** + function appendLink(object, html){ + // needed for object links - no HTML escaping + html.push( objectToString(object) ); + } + + function appendText(object, html){ + html.push(escapeHTML(objectToString(object))); + } + + function appendNull(object, html){ + html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>'); + } + + function appendString(object, html){ + html.push('<span class="objectBox-string">"', escapeHTML(objectToString(object)), + '"</span>'); + } + + function appendInteger(object, html){ + html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>'); + } + + function appendFloat(object, html){ + html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>'); + } + + function appendFunction(object, html){ + html.push('<span class="objectBox-function">', getObjectAbbr(object), '</span>'); + } + + function appendObject(object, html){ + try{ + if(object === undefined){ + appendNull("undefined", html); + }else if(object === null){ + appendNull("null", html); + }else if(typeof object == "string"){ + appendString(object, html); + }else if(typeof object == "number"){ + appendInteger(object, html); + }else if(typeof object == "function"){ + appendFunction(object, html); + }else if(object.nodeType == 1){ + appendSelector(object, html); + }else if(typeof object == "object"){ + appendObjectFormatted(object, html); + }else{ + appendText(object, html); + } + }catch(e){ + /* squelch */ + } + } + + function appendObjectFormatted(object, html){ + var text = objectToString(object); + var reObject = /\[object (.*?)\]/; + + var m = reObject.exec(text); + html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>'); + } + + function appendSelector(object, html){ + html.push('<span class="objectBox-selector">'); + + html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>'); + if(object.id){ + html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>'); + } + if(object.className){ + html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>'); + } + + html.push('</span>'); + } + + function appendNode(node, html){ + if(node.nodeType == 1){ + html.push( + '<div class="objectBox-element">', + '<<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>'); + + for(var i = 0; i < node.attributes.length; ++i){ + var attr = node.attributes[i]; + if(!attr.specified){ continue; } + + html.push(' <span class="nodeName">', attr.nodeName.toLowerCase(), + '</span>="<span class="nodeValue">', escapeHTML(attr.nodeValue), + '</span>"'); + } + + if(node.firstChild){ + html.push('></div><div class="nodeChildren">'); + + for(var child = node.firstChild; child; child = child.nextSibling){ + appendNode(child, html); + } + + html.push('</div><div class="objectBox-element"></<span class="nodeTag">', + node.nodeName.toLowerCase(), '></span></div>'); + }else{ + html.push('/></div>'); + } + }else if (node.nodeType == 3){ + html.push('<div class="nodeText">', escapeHTML(node.nodeValue), + '</div>'); + } + } + + // *************************************************************************** + + function addEvent(object, name, handler){ + if(document.all){ + object.attachEvent("on"+name, handler); + }else{ + object.addEventListener(name, handler, false); + } + } + + function removeEvent(object, name, handler){ + if(document.all){ + object.detachEvent("on"+name, handler); + }else{ + object.removeEventListener(name, handler, false); + } + } + + function cancelEvent(event){ + if(document.all){ + event.cancelBubble = true; + }else{ + event.stopPropagation(); + } + } + + function onError(msg, href, lineNo){ + var lastSlash = href.lastIndexOf("/"); + var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1); + + var html = [ + '<span class="errorMessage">', msg, '</span>', + '<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>' + ]; + + logRow(html, "error"); + } + + + //After converting to div instead of iframe, now getting two keydowns right away in IE 6. + //Make sure there is a little bit of delay. + var onKeyDownTime = new Date().getTime(); + + function onKeyDown(event){ + var timestamp = (new Date()).getTime(); + if(timestamp > onKeyDownTime + 200){ + event = dojo.fixEvent(event); + var keys = dojo.keys; + var ekc = event.keyCode; + onKeyDownTime = timestamp; + if(ekc == keys.F12){ + toggleConsole(); + }else if( + (ekc == keys.NUMPAD_ENTER || ekc == 76) && + event.shiftKey && + (event.metaKey || event.ctrlKey) + ){ + focusCommandLine(); + }else{ + return; + } + cancelEvent(event); + } + } + + function onCommandLineKeyDown(e){ + var dk = dojo.keys; + if(e.keyCode == 13 && commandLine.value){ + addToHistory(commandLine.value); + evalCommandLine(); + }else if(e.keyCode == 27){ + commandLine.value = ""; + }else if(e.keyCode == dk.UP_ARROW || e.charCode == dk.UP_ARROW){ + navigateHistory("older"); + }else if(e.keyCode == dk.DOWN_ARROW || e.charCode == dk.DOWN_ARROW){ + navigateHistory("newer"); + }else if(e.keyCode == dk.HOME || e.charCode == dk.HOME){ + historyPosition = 1; + navigateHistory("older"); + }else if(e.keyCode == dk.END || e.charCode == dk.END){ + historyPosition = 999999; + navigateHistory("newer"); + } + } + + var historyPosition = -1; + var historyCommandLine = null; + + function addToHistory(value){ + var history = cookie("firebug_history"); + history = (history) ? dojo.fromJson(history) : []; + var pos = dojo.indexOf(history, value); + if (pos != -1){ + history.splice(pos, 1); + } + history.push(value); + cookie("firebug_history", dojo.toJson(history), 30); + while(history.length && !cookie("firebug_history")){ + history.shift(); + cookie("firebug_history", dojo.toJson(history), 30); + } + historyCommandLine = null; + historyPosition = -1; + } + + function navigateHistory(direction){ + var history = cookie("firebug_history"); + history = (history) ? dojo.fromJson(history) : []; + if(!history.length){ + return; + } + + if(historyCommandLine === null){ + historyCommandLine = commandLine.value; + } + + if(historyPosition == -1){ + historyPosition = history.length; + } + + if(direction == "older"){ + --historyPosition; + if(historyPosition < 0){ + historyPosition = 0; + } + }else if(direction == "newer"){ + ++historyPosition; + if(historyPosition > history.length){ + historyPosition = history.length; + } + } + + if(historyPosition == history.length){ + commandLine.value = historyCommandLine; + historyCommandLine = null; + }else{ + commandLine.value = history[historyPosition]; + } + } + + function cookie(name, value){ + var c = document.cookie; + if(arguments.length == 1){ + var matches = c.match(new RegExp("(?:^|; )" + name + "=([^;]*)")); + return matches ? decodeURIComponent(matches[1]) : undefined; // String or undefined + }else{ + var d = new Date(); + d.setMonth(d.getMonth()+1); + document.cookie = name + "=" + encodeURIComponent(value) + ((d.toUtcString) ? "; expires=" + d.toUTCString() : ""); + } + } + + function isArray(it){ + return it && it instanceof Array || typeof it == "array"; + } + + //*************************************************************************************************** + // Print Object Helpers + function objectLength(o){ + var cnt = 0; + for(var nm in o){ + cnt++; + } + return cnt; + } + + function printObject(o, i, txt, used){ + // Recursively trace object, indenting to represent depth for display in object inspector + var ind = " \t"; + txt = txt || ""; + i = i || ind; + used = used || []; + var opnCls; + + if(o && o.nodeType == 1){ + var html = []; + appendNode(o, html); + return html.join(""); + } + + var br=",\n", cnt = 0, length = objectLength(o); + + if(o instanceof Date){ + return i + o.toString() + br; + } + looking: + for(var nm in o){ + cnt++; + if(cnt==length){br = "\n";} + if(o[nm] === window || o[nm] === document){ + // do nothing + }else if(o[nm] === null){ + txt += i+nm + " : NULL" + br; + }else if(o[nm] && o[nm].nodeType){ + if(o[nm].nodeType == 1){ + //txt += i+nm + " : < "+o[nm].tagName+" id=\""+ o[nm].id+"\" />" + br; + }else if(o[nm].nodeType == 3){ + txt += i+nm + " : [ TextNode "+o[nm].data + " ]" + br; + } + + }else if(typeof o[nm] == "object" && (o[nm] instanceof String || o[nm] instanceof Number || o[nm] instanceof Boolean)){ + txt += i+nm + " : " + o[nm] + "," + br; + + }else if(o[nm] instanceof Date){ + txt += i+nm + " : " + o[nm].toString() + br; + + }else if(typeof(o[nm]) == "object" && o[nm]){ + for(var j = 0, seen; seen = used[j]; j++){ + if(o[nm] === seen){ + txt += i+nm + " : RECURSION" + br; + continue looking; + } + } + used.push(o[nm]); + + opnCls = (isArray(o[nm]))?["[","]"]:["{","}"]; + txt += i+nm +" : " + opnCls[0] + "\n";//non-standard break, (no comma) + txt += printObject(o[nm], i+ind, "", used); + txt += i + opnCls[1] + br; + + }else if(typeof o[nm] == "undefined"){ + txt += i+nm + " : undefined" + br; + }else if(nm == "toString" && typeof o[nm] == "function"){ + var toString = o[nm](); + if(typeof toString == "string" && toString.match(/function ?(.*?)\(/)){ + toString = escapeHTML(getObjectAbbr(o[nm])); + } + txt += i+nm +" : " + toString + br; + }else{ + txt += i+nm +" : "+ escapeHTML(getObjectAbbr(o[nm])) + br; + } + } + return txt; + } + + function getObjectAbbr(obj){ + // Gets an abbreviation of an object for display in log + // X items in object, including id + // X items in an array + // TODO: Firebug Sr. actually goes by char count + var isError = (obj instanceof Error); + if(obj.nodeType == 1){ + return escapeHTML('< '+obj.tagName.toLowerCase()+' id=\"'+ obj.id+ '\" />'); + } + if(obj.nodeType == 3){ + return escapeHTML('[TextNode: "'+obj.nodeValue+'"]'); + } + var nm = (obj && (obj.id || obj.name || obj.ObjectID || obj.widgetId)); + if(!isError && nm){ return "{"+nm+"}"; } + + var obCnt = 2; + var arCnt = 4; + var cnt = 0; + + if(isError){ + nm = "[ Error: "+(obj.message || obj.description || obj)+" ]"; + }else if(isArray(obj)){ + nm = "[" + obj.slice(0,arCnt).join(","); + if(obj.length > arCnt){ + nm += " ... ("+obj.length+" items)"; + } + nm += "]"; + }else if(typeof obj == "function"){ + nm = obj + ""; + var reg = /function\s*([^\(]*)(\([^\)]*\))[^\{]*\{/; + var m = reg.exec(nm); + if(m){ + if(!m[1]){ + m[1] = "function"; + } + nm = m[1] + m[2]; + }else{ + nm = "function()"; + } + }else if(typeof obj != "object" || typeof obj == "string"){ + nm = obj + ""; + }else{ + nm = "{"; + for(var i in obj){ + cnt++; + if(cnt > obCnt){ break; } + nm += i+":"+escapeHTML(obj[i])+" "; + } + nm+="}"; + } + + return nm; + } + + //************************************************************************************* + + //window.onerror = onError; + + addEvent(document, has("ie") || has("safari") ? "keydown" : "keypress", onKeyDown); + + if( (document.documentElement.getAttribute("debug") == "true")|| + (dojo.config.isDebug) + ){ + toggleConsole(true); + } + + dojo.addOnWindowUnload(function(){ + // Erase the globals and event handlers I created, to prevent spurious leak warnings + removeEvent(document, has("ie") || has("safari") ? "keydown" : "keypress", onKeyDown); + window.onFirebugResize = null; + window.console = null; + }); + +}); |