12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226 |
- if(!dojo._hasResource["dojo._firebug.firebug"]){
- dojo._hasResource["dojo._firebug.firebug"] = true;
- dojo.provide("dojo._firebug.firebug");
-
- dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){
-
-
-
-
-
-
- var message = "DEPRECATED: " + behaviour;
- if(extra){ message += " " + extra; }
- if(removal){ message += " -- will be removed in version: " + removal; }
- console.warn(message);
- };
- dojo.experimental = function(/* String */ moduleName, /* String? */ extra){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var message = "EXPERIMENTAL: " + moduleName + " -- APIs subject to change without notice.";
- if(extra){ message += " " + extra; }
- console.warn(message);
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (function(){
- var isNewIE = (/Trident/.test(window.navigator.userAgent));
- if(isNewIE){
-
-
- var calls = ["log", "info", "debug", "warn", "error"];
- for(var i=0;i<calls.length;i++){
- var m = calls[i];
- var n = "_"+calls[i];
- console[n] = console[m];
- console[m] = (function(){
- var type = n;
- return function(){
- console[type](Array.prototype.slice.call(arguments).join(" "));
- };
- })();
- }
-
-
- try{ console.clear(); }catch(e){}
- }
-
- if(
- !dojo.isFF &&
- !dojo.isChrome &&
- !dojo.isSafari &&
- !isNewIE &&
- !window.firebug &&
- (typeof console != "undefined" && !console.firebug) &&
- !dojo.config.useCustomLogger &&
- !dojo.isAIR
- ){
-
-
-
- try{
- if(window != window.parent){
-
- if(window.parent["console"]){
- window.console = window.parent.console;
- }
- return;
- }
- }catch(e){}
-
-
-
-
-
- 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(){
-
-
- logFormatted(arguments, "");
- },
-
- debug: function(){
-
-
- logFormatted(arguments, "debug");
- },
-
- info: function(){
-
-
- logFormatted(arguments, "info");
- },
-
- warn: function(){
-
-
- logFormatted(arguments, "warning");
- },
-
- error: function(){
-
-
-
- logFormatted(arguments, "error");
- },
-
- assert: function(truth, message){
-
-
- 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(){
-
-
-
- logRow(arguments, "group", pushGroup);
- },
-
- groupEnd: function(){
-
-
- logRow(arguments, "", popGroup);
- },
-
- time: function(name){
-
-
-
-
-
-
-
- timeMap[name] = new Date().getTime();
- },
-
- timeEnd: function(name){
-
-
- if(name in timeMap){
- var delta = (new Date()).getTime() - timeMap[name];
- logFormatted([name+ ":", delta+"ms"]);
- delete timeMap[name];
- }
- },
-
- count: function(name){
-
-
- if(!countMap[name]) countMap[name] = 0;
- countMap[name]++;
- logFormatted([name+": "+countMap[name]]);
- },
-
- trace: function(_value){
- var stackAmt = _value || 3;
- var f = console.trace.caller;
- 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(){
-
-
- this.warn(["profile() not supported."]);
- },
-
- profileEnd: function(){ },
- clear: function(){
-
-
- if(consoleBody){
- while(consoleBody.childNodes.length){
- dojo.destroy(consoleBody.firstChild);
- }
- }
- dojo.forEach(this._connects,dojo.disconnect);
- },
- open: function(){
-
-
- toggleConsole(true);
- },
-
- close: function(){
-
-
- 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);
-
- });
- }, 30);
- },
- _closeDomInspector: function(){
- document.body.style.cursor = "";
- dojo.disconnect(_inspectionMoveConnection);
- dojo.disconnect(_inspectionClickConnection);
- _inspectionEnabled = false;
- console._restoreBorder();
- },
- openConsole:function(){
-
-
- 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(){
-
-
-
- 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;
-
- 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){
-
-
-
-
- var d = new Date();
- d.setTime(d.getTime()+(60*24*60*60*1000));
- 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(){
-
-
- 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);
-
- };
- }
-
-
-
-
-
- function createFrame(){
- if(consoleFrame){
- return;
- }
-
- 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]);
- _firebugDoc = _firebugWin.document;
- dojo.config.debugContainerId = 'fb';
-
-
- _firebugWin.console = window.console;
- _firebugWin.dojo = window.dojo;
- }else{
- _firebugDoc = document;
- containerHeight = (dojo.config.debugHeight || 300) + "px";
- }
-
- var styleElement = _firebugDoc.createElement("link");
- styleElement.href = dojo.moduleUrl("dojo._firebug", "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(dojo.isIE){
- 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.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, dojo.isIE || dojo.isSafari ? "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);
- }
- console.log(value);
- }
-
- function layout(h){
- var tHeight = 25;
- 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 groupRowBox = consoleBody.ownerDocument.createElement("div");
- groupRowBox.className = "logGroupBox";
-
- 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{
-
-
- var id = "_a" + __consoleAnchorId__++;
- ids.push(id);
-
- obs.push(object);
- var str = '<a id="'+id+'" href="javascript:void(0);">'+getObjectAbbr(object)+'</a>';
-
- appendLink( str , html);
- }
- }
-
- logRow(html, className);
-
-
- for(i=0; i<ids.length; i++){
- var btn = _firebugDoc.getElementById(ids[i]);
- if(!btn){ continue; }
-
-
-
- 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){
-
- 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){
-
- }
- }
-
- 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");
- }
-
-
- 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;
- }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";
- }
-
-
- function objectLength(o){
- var cnt = 0;
- for(var nm in o){
- cnt++;
- }
- return cnt;
- }
-
- function printObject(o, i, txt, used){
-
- 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){
- continue;
- }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, 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";
- 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){
-
-
-
-
- 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;
- }
-
-
-
-
-
- addEvent(document, dojo.isIE || dojo.isSafari ? "keydown" : "keypress", onKeyDown);
-
- if( (document.documentElement.getAttribute("debug") == "true")||
- (dojo.config.isDebug)
- ){
- toggleConsole(true);
- }
- dojo.addOnWindowUnload(function(){
-
- removeEvent(document, dojo.isIE || dojo.isSafari ? "keydown" : "keypress", onKeyDown);
- window.onFirebugResize = null;
- window.console = null;
- });
- }
- })();
- }
|