From 1354d17270961fff662d40f90521223f8fd0d73b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Aug 2012 18:59:10 +0400 Subject: update dojo to 1.7.3 --- lib/dojo/_firebug/firebug.css | 2 +- lib/dojo/_firebug/firebug.js | 1222 +------------------------- lib/dojo/_firebug/firebug.js.uncompressed.js | 1183 +++++++++++++++++++++++++ 3 files changed, 1186 insertions(+), 1221 deletions(-) create mode 100644 lib/dojo/_firebug/firebug.js.uncompressed.js (limited to 'lib/dojo/_firebug') diff --git a/lib/dojo/_firebug/firebug.css b/lib/dojo/_firebug/firebug.css index 27657ef42..2012e0674 100644 --- a/lib/dojo/_firebug/firebug.css +++ b/lib/dojo/_firebug/firebug.css @@ -208,4 +208,4 @@ text-decoration:none; background:transparent url(tab_rgt_over.png) no-repeat right; color:#FFFFFF; -} \ No newline at end of file +} diff --git a/lib/dojo/_firebug/firebug.js b/lib/dojo/_firebug/firebug.js index c78b50fa6..cf5044e09 100644 --- a/lib/dojo/_firebug/firebug.js +++ b/lib/dojo/_firebug/firebug.js @@ -4,1223 +4,5 @@ see: http://dojotoolkit.org/license for details */ - -if(!dojo._hasResource["dojo._firebug.firebug"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojo._firebug.firebug"] = true; -dojo.provide("dojo._firebug.firebug"); - - -dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){ - // summary: - // Log a debug message to indicate that a behavior has been - // deprecated. - // extra: Text to append to the message. - // removal: - // Text to indicate when in the future the behavior will be removed. - 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){ - // summary: Marks code as experimental. - // description: - // This can be used to mark a function, file, or module as - // experimental. Experimental code is not ready to be used, and the - // APIs are subject to change without notice. Experimental code may be - // completed deleted without going through the normal deprecation - // process. - // moduleName: - // The name of a module, or the name of a module file or a specific - // function - // extra: - // some additional message for the user - // example: - // | dojo.experimental("dojo.data.Result"); - // example: - // | dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA"); - var message = "EXPERIMENTAL: " + moduleName + " -- APIs subject to change without notice."; - if(extra){ message += " " + extra; } - console.warn(message); -}; - -// FIREBUG LITE - // 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 } - - - -(function(){ - - 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"); - str = str.replace(/\t/g, "    "); - logRow([str], "dir"); - }, - - dirxml: function(node){ - // summary: - // - 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=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= 'Firebug Lite\n' + - '\n' + - '
' + - ''; - - 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; - } - - 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 = 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 '
  • '+label+'
  • '; - }; - consoleFrame.innerHTML = - '
    ' - + '
      ' - - + 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")) - - + '
    ' - + '
    ' - + '' - + '
    ' - + '' - + ''; - - - 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); // 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 = ''+getObjectAbbr(object)+''; - - 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"; - })); - } - } - - 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('', escapeHTML(objectToString(object)), ''); - } - - function appendString(object, html){ - html.push('"', escapeHTML(objectToString(object)), - '"'); - } - - function appendInteger(object, html){ - html.push('', escapeHTML(objectToString(object)), ''); - } - - function appendFloat(object, html){ - html.push('', escapeHTML(objectToString(object)), ''); - } - - function appendFunction(object, html){ - html.push('', getObjectAbbr(object), ''); - } - - 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('', m ? m[1] : text, ''); - } - - function appendSelector(object, html){ - html.push(''); - - html.push('', escapeHTML(object.nodeName.toLowerCase()), ''); - if(object.id){ - html.push('#', escapeHTML(object.id), ''); - } - if(object.className){ - html.push('.', escapeHTML(object.className), ''); - } - - html.push(''); - } - - function appendNode(node, html){ - if(node.nodeType == 1){ - html.push( - '
    ', - '<', node.nodeName.toLowerCase(), ''); - - for(var i = 0; i < node.attributes.length; ++i){ - var attr = node.attributes[i]; - if(!attr.specified){ continue; } - - html.push(' ', attr.nodeName.toLowerCase(), - '="', escapeHTML(attr.nodeValue), - '"'); - } - - if(node.firstChild){ - html.push('>
    '); - - for(var child = node.firstChild; child; child = child.nextSibling){ - appendNode(child, html); - } - - html.push('
    </', - node.nodeName.toLowerCase(), '>
    '); - }else{ - html.push('/>'); - } - }else if (node.nodeType == 3){ - html.push('
    ', escapeHTML(node.nodeValue), - '
    '); - } - } - - // *************************************************************************** - - 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 = [ - '', msg, '', - '' - ]; - - 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){ - continue; - }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, dojo.isIE || dojo.isSafari ? "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, dojo.isIE || dojo.isSafari ? "keydown" : "keypress", onKeyDown); - window.onFirebugResize = null; - window.console = null; - }); -} - -})(); - -} +//>>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");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=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="Firebug Lite\n"+"\n"+"
    "+"";_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 "
  • "+_40+"
  • ";};_9.innerHTML="
    "+"
      "+_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
    "+"
    "+""+"
    "+"
    Click on an object in the Log display
    "+"
    Hover over HTML elements in the main page. Click to hold selection.
    ";_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=""+_6b(_69)+"";_6c(str,_62);}}}}}_21(_62,_61);for(i=0;i"+_20(this.obj)+"";}));}};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("",_76(_79(_7f)),"");};function _81(_82,_83){_83.push(""",_76(_79(_82)),""");};function _70(_84,_85){_85.push("",_76(_79(_84)),"");};function _71(_86,_87){_87.push("",_76(_79(_86)),"");};function _88(_89,_8a){_8a.push("",_6b(_89),"");};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("",m?m[1]:_91,"");};function _8d(_93,_94){_94.push("");_94.push("",_76(_93.nodeName.toLowerCase()),"");if(_93.id){_94.push("#",_76(_93.id),"");}if(_93.className){_94.push(".",_76(_93.className),"");}_94.push("");};function _24(_95,_96){if(_95.nodeType==1){_96.push("
    ","<",_95.nodeName.toLowerCase(),"");for(var i=0;i<_95.attributes.length;++i){var _97=_95.attributes[i];if(!_97.specified){continue;}_96.push(" ",_97.nodeName.toLowerCase(),"="",_76(_97.nodeValue),""");}if(_95.firstChild){_96.push(">
    ");for(var _98=_95.firstChild;_98;_98=_98.nextSibling){_24(_98,_96);}_96.push("
    </",_95.nodeName.toLowerCase(),">
    ");}else{_96.push("/>");}}else{if(_95.nodeType==3){_96.push("
    ",_76(_95.nodeValue),"
    ");}}};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=["",msg,"","
    ",_a6," (line ",_a4,")
    "];_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 diff --git a/lib/dojo/_firebug/firebug.js.uncompressed.js b/lib/dojo/_firebug/firebug.js.uncompressed.js new file mode 100644 index 000000000..d908c59ed --- /dev/null +++ b/lib/dojo/_firebug/firebug.js.uncompressed.js @@ -0,0 +1,1183 @@ +define("dojo/_firebug/firebug", ["../_base/kernel", "require", "../_base/html", "../_base/sniff", "../_base/array", "../_base/lang", "../_base/event", "../_base/unload"], function(dojo, require) { + // module: + // dojo/_firebug/firebug + // summary: + +// FIREBUG LITE + // 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"); + str = str.replace(/\t/g, "    "); + logRow([str], "dir"); + }, + + dirxml: function(node){ + // summary: + // + 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=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= 'Firebug Lite\n' + + '\n' + + '
    ' + + ''; + + 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(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 '
  • '+label+'
  • '; + }; + consoleFrame.innerHTML = + '
    ' + + '
      ' + + + 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")) + + + '
    ' + + '
    ' + + '' + + '
    ' + + '' + + ''; + + + 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); // 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 = ''+getObjectAbbr(object)+''; + + 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"; + })); + } + } + + 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('', escapeHTML(objectToString(object)), ''); + } + + function appendString(object, html){ + html.push('"', escapeHTML(objectToString(object)), + '"'); + } + + function appendInteger(object, html){ + html.push('', escapeHTML(objectToString(object)), ''); + } + + function appendFloat(object, html){ + html.push('', escapeHTML(objectToString(object)), ''); + } + + function appendFunction(object, html){ + html.push('', getObjectAbbr(object), ''); + } + + 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('', m ? m[1] : text, ''); + } + + function appendSelector(object, html){ + html.push(''); + + html.push('', escapeHTML(object.nodeName.toLowerCase()), ''); + if(object.id){ + html.push('#', escapeHTML(object.id), ''); + } + if(object.className){ + html.push('.', escapeHTML(object.className), ''); + } + + html.push(''); + } + + function appendNode(node, html){ + if(node.nodeType == 1){ + html.push( + '
    ', + '<', node.nodeName.toLowerCase(), ''); + + for(var i = 0; i < node.attributes.length; ++i){ + var attr = node.attributes[i]; + if(!attr.specified){ continue; } + + html.push(' ', attr.nodeName.toLowerCase(), + '="', escapeHTML(attr.nodeValue), + '"'); + } + + if(node.firstChild){ + html.push('>
    '); + + for(var child = node.firstChild; child; child = child.nextSibling){ + appendNode(child, html); + } + + html.push('
    </', + node.nodeName.toLowerCase(), '>
    '); + }else{ + html.push('/>'); + } + }else if (node.nodeType == 3){ + html.push('
    ', escapeHTML(node.nodeValue), + '
    '); + } + } + + // *************************************************************************** + + 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 = [ + '', msg, '', + '' + ]; + + 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, dojo.isIE || dojo.isSafari ? "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, dojo.isIE || dojo.isSafari ? "keydown" : "keypress", onKeyDown); + window.onFirebugResize = null; + window.console = null; + }); + +}); -- cgit v1.2.3-54-g00ecf