define("dojo/_firebug/firebug", ["dojo"], function(dojo) {
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
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(" "));
};
})();
}
// clear the console on load. This is more than a convenience - too many logs crashes it.
// If closed it throws an error
try{ console.clear(); }catch(e){}
}
if(
!dojo.isFF && // Firefox has Firebug
!dojo.isChrome && // Chrome 3+ has a console
!dojo.isSafari && // Safari 4 has a console
!isNewIE && // Has the new IE console
!window.firebug && // Testing for mozilla firebug lite
(typeof console != "undefined" && !console.firebug) && //A console that is not firebug's
!dojo.config.useCustomLogger && // Allow custom loggers
!dojo.isAIR // isDebug triggers AIRInsector, not Firebug
){
// don't build firebug in iframes
try{
if(window != window.parent){
// but if we've got a parent logger, connect to it
if(window.parent["console"]){
window.console = window.parent.console;
}
return;
}
}catch(e){/*squelch*/}
// ***************************************************************************
// Placing these variables before the functions that use them to avoid a
// shrinksafe bug where variable renaming does not happen correctly otherwise.
// most of the objects in this script are run anonomously
var _firebugDoc = document;
var _firebugWin = window;
var __consoleAnchorId__ = 0;
var consoleFrame = null;
var consoleBody = null;
var consoleObjectInspector = null;
var fireBugTabs = null;
var commandLine = null;
var consoleToolbar = null;
var frameVisible = false;
var messageQueue = [];
var groupStack = [];
var timeMap = {};
var countMap = {};
var consoleDomInspector = null;
var _inspectionMoveConnection;
var _inspectionClickConnection;
var _inspectionEnabled = false;
var _inspectionTimer = null;
var _inspectTempNode = document.createElement("div");
var _inspectCurrentNode;
var _restoreBorderStyle;
// ***************************************************************************
window.console = {
_connects: [],
log: function(){
// summary:
// Sends arguments to console.
logFormatted(arguments, "");
},
debug: function(){
// summary:
// Sends arguments to console. Missing finctionality to show script line of trace.
logFormatted(arguments, "debug");
},
info: function(){
// summary:
// Sends arguments to console, highlighted with (I) icon.
logFormatted(arguments, "info");
},
warn: function(){
// summary:
// Sends warning arguments to console, highlighted with (!) icon and blue style.
logFormatted(arguments, "warning");
},
error: function(){
// summary:
// Sends error arguments (object) to console, highlighted with (X) icon and yellow style
// NEW: error object now displays in object inspector
logFormatted(arguments, "error");
},
assert: function(truth, message){
// summary:
// Tests for true. Throws exception if false.
if(!truth){
var args = [];
for(var i = 1; i < arguments.length; ++i){
args.push(arguments[i]);
}
logFormatted(args.length ? args : ["Assertion Failure"], "error");
throw message ? message : "Assertion Failure";
}
},
dir: function(obj){
var str = printObject( obj );
str = str.replace(/\n/g, "
");
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 var func = f.toString();
var args=[];
for (var a = 0; a < f.arguments.length; a++) {
args.push(f.arguments[a]);
}
if(f.arguments.length){
console.dir({"function":func, "arguments":args});
}else{
console.dir({"function":func});
}
f = f.caller;
}
},
profile: function(){
// summary:
// Not supported
this.warn(["profile() not supported."]);
},
profileEnd: function(){ },
clear: function(){
// summary:
// Clears message console. Do not call this directly
if(consoleBody){
while(consoleBody.childNodes.length){
dojo.destroy(consoleBody.firstChild);
}
}
dojo.forEach(this._connects,dojo.disconnect);
},
open: function(){
// summary:
// Opens message console. Do not call this directly
toggleConsole(true);
},
close: function(){
// summary:
// Closes message console. Do not call this directly
if(frameVisible){
toggleConsole();
}
},
_restoreBorder: function(){
if(_inspectCurrentNode){
_inspectCurrentNode.style.border = _restoreBorderStyle;
}
},
openDomInspector: function(){
_inspectionEnabled = true;
consoleBody.style.display = "none";
consoleDomInspector.style.display = "block";
consoleObjectInspector.style.display = "none";
document.body.style.cursor = "pointer";
_inspectionMoveConnection = dojo.connect(document, "mousemove", function(evt){
if(!_inspectionEnabled){ return; }
if(!_inspectionTimer){
_inspectionTimer = setTimeout(function(){ _inspectionTimer = null; }, 50);
}else{
return;
}
var node = evt.target;
if(node && (_inspectCurrentNode !== node)){
var parent = true;
console._restoreBorder();
var html = [];
appendNode(node, html);
consoleDomInspector.innerHTML = html.join("");
_inspectCurrentNode = node;
_restoreBorderStyle = _inspectCurrentNode.style.border;
_inspectCurrentNode.style.border = "#0000FF 1px solid";
}
});
setTimeout(function(){
_inspectionClickConnection = dojo.connect(document, "click", function(evt){
document.body.style.cursor = "";
_inspectionEnabled = !_inspectionEnabled;
dojo.disconnect(_inspectionClickConnection);
// console._restoreBorder();
});
}, 30);
},
_closeDomInspector: function(){
document.body.style.cursor = "";
dojo.disconnect(_inspectionMoveConnection);
dojo.disconnect(_inspectionClickConnection);
_inspectionEnabled = false;
console._restoreBorder();
},
openConsole:function(){
// summary:
// Closes object inspector and opens message console. Do not call this directly
consoleBody.style.display = "block";
consoleDomInspector.style.display = "none";
consoleObjectInspector.style.display = "none";
console._closeDomInspector();
},
openObjectInspector:function(){
consoleBody.style.display = "none";
consoleDomInspector.style.display = "none";
consoleObjectInspector.style.display = "block";
console._closeDomInspector();
},
recss: function(){
// http://turtle.dojotoolkit.org/~david/recss.html
// this is placed in dojo since the console is most likely
// in another window and dojo is easilly accessible
var i,a,s;a=document.getElementsByTagName('link');
for(i=0;i s=a[i];
if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {
var h=s.href.replace(/(&|%5C?)forceReload=\d+/,'');
s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+new Date().valueOf();
}
}
}
};
// ***************************************************************************
function toggleConsole(forceOpen){
frameVisible = forceOpen || !frameVisible;
if(consoleFrame){
consoleFrame.style.display = frameVisible ? "block" : "none";
}
}
function focusCommandLine(){
toggleConsole(true);
if(commandLine){
commandLine.focus();
}
}
function openWin(x,y,w,h){
var win = window.open("","_firebug","status=0,menubar=0,resizable=1,top="+y+",left="+x+",width="+w+",height="+h+",scrollbars=1,addressbar=0");
if(!win){
var msg = "Firebug Lite could not open a pop-up window, most likely because of a blocker.\n" +
"Either enable pop-ups for this domain, or change the djConfig to popup=false.";
alert(msg);
}
createResizeHandler(win);
var newDoc=win.document;
//Safari needs an HTML height
var HTMLstring= '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