firebug.js
来自「这是一个ajax的例子大家好好的看看就是一个鱼眼的效果」· JavaScript 代码 · 共 1,104 行 · 第 1/3 页
JS
1,104 行
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, set console = null; // // 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 }; if((!("console" in window) || !("firebug" in console)) && dojo.config.noFirebugLite !== true){(function(){ // don't build a firebug frame 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*/} 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(object){ // summary: // Traces object. Only partially implemented. var pairs = []; for(var prop in object){ try{ pairs.push([prop, object[prop]]); }catch(e){ /* squelch */ } } pairs.sort(function(a, b){ return a[0] < b[0] ? -1 : 1; }); var html = ['<table>']; for(var i = 0; i < pairs.length; ++i){ var name = pairs[i][0], value = pairs[i][1]; html.push('<tr>', '<td class="propertyNameCell"><span class="propertyName">', escapeHTML(name), '</span></td>', '<td><span class="propertyValue">'); appendObject(value, html); html.push('</span></td></tr>'); } html.push('</table>'); logRow(html, "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(){ // summary: // Not supported this.warn(["count() not supported."]); }, trace: function(){ // summary: // Not supported this.warn(["trace() not supported."]); }, profile: function(){ // summary: // Not supported this.warn(["profile() not supported."]); }, profileEnd: function(){ }, clear: function(){ // summary: // Clears message console. Do not call this directly while(consoleBody.childNodes.length){ dojo._destroyElement(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(); } }, closeObjectInspector:function(){ // summary: // Closes object inspector and opens message console. Do not call this directly consoleObjectInspector.innerHTML = ""; consoleObjectInspector.style.display = "none"; consoleBody.style.display = "block"; } }; // *************************************************************************** // using global objects so they can be accessed // 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 commandLine = null; var consoleToolbar = null; var frameVisible = false; var messageQueue = []; var groupStack = []; var timeMap = {}; var clPrefix = ">>> "; // *************************************************************************** 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 HTMLstring= '<html style="height:100%;"><head><title>Firebug Lite</title></head>\n' + '<body bgColor="#ccc" style="height:98%;" onresize="opener.onFirebugResize()">\n' + '<div id="fb"></div>' + '</body></html>'; newDoc.write(HTMLstring); newDoc.close(); return win; } function createResizeHandler(wn){ // summary // Creates handle for onresize window. Called from script in popup's body tag (so that it will work with IE). // var d = new Date(); d.setTime(d.getTime()+(60*24*60*60*1000)); // 60 days d = d.toUTCString(); var dc = wn.document, getViewport; if (wn.innerWidth){ getViewport = function(){ return{w:wn.innerWidth, h:wn.innerHeight}; } }else if (dc.documentElement && dc.documentElement.clientWidth){ getViewport = function(){ return{w:dc.documentElement.clientWidth, h:dc.documentElement.clientHeight}; } }else if (dc.body){ getViewport = function(){ return{w:dc.body.clientWidth, h:dc.body.clientHeight}; } } window.onFirebugResize = function(){ //resize the height of the console log body layout(getViewport().h); clearInterval(wn._firebugWin_resize); wn._firebugWin_resize = setTimeout(function(){ var x = wn.screenLeft, y = wn.screenTop, w = wn.outerWidth || wn.document.body.offsetWidth, h = wn.outerHeight || wn.document.body.offsetHeight; document.cookie = "_firebugPosition=" + [x,y,w,h].join(",") + "; expires="+d+"; path=/"; }, 5000); //can't capture window.onMove - long timeout gives better chance of capturing a resize, then the move } } /*****************************************************************************/ function createFrame(){ if(consoleFrame){ return; } 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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?