OpenLayers OpenLayers

Ticket #507: debug.3.patch

File debug.3.patch, 55.4 kB (added by tschaub, 1 year ago)

Adds OpenLayers.Console - and Firebug like debugging cross-browser

  • examples/debug.html

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     2         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     3<html xmlns="http://www.w3.org/1999/xhtml"> 
     4  <head> 
     5    <script src="../lib/OpenLayers.js"></script> 
     6    <script src="../lib/Firebug/DebugOpenLayers.js"></script> 
     7    <script type="text/javascript"> 
     8        <!-- 
     9        function consoleLog() { 
     10            OpenLayers.Console.log("This is the result of an OpenLayers.Console.log() call"); 
     11        } 
     12        function consoleWarn() { 
     13            OpenLayers.Console.warn("This is the result of an OpenLayers.Console.warn() call"); 
     14        } 
     15        function consoleError() { 
     16            OpenLayers.Console.error("This is the result of an OpenLayers.Console.error() call"); 
     17        } 
     18        function consoleDir() { 
     19            OpenLayers.Console.dir(OpenLayers); 
     20        } 
     21        function consoleDirxml() { 
     22            OpenLayers.Console.dirxml(document.getElementsByTagName('body')[0]); 
     23        } 
     24        // --> 
     25    </script> 
     26  </head> 
     27  <body> 
     28    <h1>OpenLayers Debug Example</h1> 
     29    <p>To run OpenLayers in debug mode, include the following script 
     30    tag <b>after</b> the tag that loads OpenLayers: 
     31    <pre> 
     32    &lt;script src="../lib/Firebug/DebugOpenLayers.js"&gt;&lt;/script&gt; 
     33    </pre> 
     34    The path to DebugOpenLayers.js must be relative to your 
     35    html file.  With this script included calls to OpenLayers.Console 
     36    will be displayed in the Firebug console.  For browsers without 
     37    the Firebug extension, the script creates a Firebug Lite console. 
     38    This console can be opened by hitting <b>F12</b> or <b>Ctrl+Shift+L</b> 
     39    (<b>?+Shift+L</b> on a Mac).  If you want the Firebug Lite console 
     40    to be open when the page loads, add <b>debug="true"</b> to the opening 
     41    html tag of your page.  Open the console and click on the links below 
     42    to see console calls.</p> 
     43    <ul> 
     44        <li> 
     45            <a href="javascript: void(consoleLog());">OpenLayers.Console.log()</a> 
     46        </li> 
     47        <li> 
     48            <a href="javascript: void(consoleWarn());">OpenLayers.Console.warn()</a> 
     49        </li> 
     50        <li> 
     51            <a href="javascript: void(consoleError());">OpenLayers.Console.error()</a> 
     52        </li> 
     53        <li> 
     54            <a href="javascript: void(consoleDir());">OpenLayers.Console.dir()</a> 
     55        </li> 
     56        <li> 
     57            <a href="javascript: void(consoleDirxml());">OpenLayers.Console.dirxml()</a> 
     58        </li> 
     59    </ul> 
     60    <p>The Firebug website has a complete list of 
     61    <a href="http://www.getfirebug.com/console.html">console calls</a>. 
     62    Note that not all are supported with Firebug Lite.</p> 
     63  </body> 
     64</html> 
  • lib/Firebug/DebugOpenLayers.js

    old new  
     1/** 
     2 * Include this script in your OpenLayers application after the OpenLayers.js 
     3 * script tag to get Firebug debugging in any browser.  With this script 
     4 * included, if a browser has the Firebug extension installed, calls to 
     5 * OpenLayers.Console will get rerouted to console.  If a browser does not 
     6 * have the Firebug extension installed, this script mimics the behavior 
     7 * of that extension.  With this script included, the Firebug console can 
     8 * be opened with F12 or Ctrl+Shift+L (or ?+Shift+L on a Mac). 
     9 * 
     10 * This script is based on the firebug.js script from 
     11 * http://www.getfirebug.com/lite.html 
     12 * Modifications include putting the console object in the OpenLayers 
     13 * namespace, modifying getFirebugURL, and re-routing OpenLayers.Console calls 
     14 * to console if the Firebug extension is installed. 
     15 */ 
     16 
     17 
     18if (("console" in window) && ("firebug" in console)) { 
     19    /** 
     20     * If the Firebug extension is installed, re-route all OpenLayers.Console 
     21     * calls to the console object. 
     22     */ 
     23    OpenLayers.Util.extend(OpenLayers.Console, console); 
     24} else { 
     25    /** 
     26     * An anonymous function is called here so that variables are not 
     27     * global in scope. 
     28     */ 
     29    (function() 
     30    { 
     31        OpenLayers.Console =  
     32        { 
     33            log: function() 
     34            { 
     35                logFormatted(arguments, ""); 
     36            }, 
     37             
     38            debug: function() 
     39            { 
     40                logFormatted(arguments, "debug"); 
     41            }, 
     42             
     43            info: function() 
     44            { 
     45                logFormatted(arguments, "info"); 
     46            }, 
     47             
     48            warn: function() 
     49            { 
     50                logFormatted(arguments, "warning"); 
     51            }, 
     52             
     53            error: function() 
     54            { 
     55                logFormatted(arguments, "error"); 
     56            }, 
     57             
     58            assert: function(truth, message) 
     59            { 
     60                if (!truth) 
     61                { 
     62                    var args = []; 
     63                    for (var i = 1; i < arguments.length; ++i) 
     64                        args.push(arguments[i]); 
     65                     
     66                    logFormatted(args.length ? args : ["Assertion Failure"], "error"); 
     67                    throw message ? message : "Assertion Failure"; 
     68                } 
     69            }, 
     70             
     71            dir: function(object) 
     72            { 
     73                var html = []; 
     74                             
     75                var pairs = []; 
     76                for (var name in object) 
     77                { 
     78                    try 
     79                    { 
     80                        pairs.push([name, object[name]]); 
     81                    } 
     82                    catch (exc) 
     83                    { 
     84                    } 
     85                } 
     86                 
     87                pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; }); 
     88                 
     89                html.push('<table>'); 
     90                for (var i = 0; i < pairs.length; ++i) 
     91                { 
     92                    var name = pairs[i][0], value = pairs[i][1]; 
     93                     
     94                    html.push('<tr>',  
     95                    '<td class="propertyNameCell"><span class="propertyName">', 
     96                        escapeHTML(name), '</span></td>', '<td><span class="propertyValue">'); 
     97                    appendObject(value, html); 
     98                    html.push('</span></td></tr>'); 
     99                } 
     100                html.push('</table>'); 
     101                 
     102                logRow(html, "dir"); 
     103            }, 
     104             
     105            dirxml: function(node) 
     106            { 
     107                var html = []; 
     108                 
     109                appendNode(node, html); 
     110                logRow(html, "dirxml"); 
     111            }, 
     112             
     113            group: function() 
     114            { 
     115                logRow(arguments, "group", pushGroup); 
     116            }, 
     117             
     118            groupEnd: function() 
     119            { 
     120                logRow(arguments, "", popGroup); 
     121            }, 
     122             
     123            time: function(name) 
     124            { 
     125                timeMap[name] = (new Date()).getTime(); 
     126            }, 
     127             
     128            timeEnd: function(name) 
     129            { 
     130                if (name in timeMap) 
     131                { 
     132                    var delta = (new Date()).getTime() - timeMap[name]; 
     133                    logFormatted([name+ ":", delta+"ms"]); 
     134                    delete timeMap[name]; 
     135                } 
     136            }, 
     137             
     138            count: function() 
     139            { 
     140                this.warn(["count() not supported."]); 
     141            }, 
     142             
     143            trace: function() 
     144            { 
     145                this.warn(["trace() not supported."]); 
     146            }, 
     147             
     148            profile: function() 
     149            { 
     150                this.warn(["profile() not supported."]); 
     151            }, 
     152             
     153            profileEnd: function() 
     154            { 
     155            }, 
     156             
     157            clear: function() 
     158            { 
     159                consoleBody.innerHTML = ""; 
     160            }, 
     161     
     162            open: function() 
     163            { 
     164                toggleConsole(true); 
     165            }, 
     166             
     167            close: function() 
     168            { 
     169                if (frameVisible) 
     170                    toggleConsole(); 
     171            } 
     172        }; 
     173      
     174        // ******************************************************************************************** 
     175            
     176        var consoleFrame = null; 
     177        var consoleBody = null; 
     178        var commandLine = null; 
     179         
     180        var frameVisible = false; 
     181        var messageQueue = []; 
     182        var groupStack = []; 
     183        var timeMap = {}; 
     184         
     185        var clPrefix = ">>> "; 
     186         
     187        var isFirefox = navigator.userAgent.indexOf("Firefox") != -1; 
     188        var isIE = navigator.userAgent.indexOf("MSIE") != -1; 
     189        var isOpera = navigator.userAgent.indexOf("Opera") != -1; 
     190        var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1; 
     191     
     192        // ******************************************************************************************** 
     193     
     194        function toggleConsole(forceOpen) 
     195        { 
     196            frameVisible = forceOpen || !frameVisible; 
     197            if (consoleFrame) 
     198                consoleFrame.style.visibility = frameVisible ? "visible" : "hidden"; 
     199            else 
     200                waitForBody(); 
     201        } 
     202     
     203        function focusCommandLine() 
     204        { 
     205            toggleConsole(true); 
     206            if (commandLine) 
     207                commandLine.focus(); 
     208        } 
     209     
     210        function waitForBody() 
     211        { 
     212            if (document.body) 
     213                createFrame(); 
     214            else 
     215                setTimeout(waitForBody, 200); 
     216        }     
     217     
     218        function createFrame() 
     219        { 
     220            if (consoleFrame) 
     221                return; 
     222             
     223            window.onFirebugReady = function(doc) 
     224            { 
     225                window.onFirebugReady = null; 
     226     
     227                var toolbar = doc.getElementById("toolbar"); 
     228                toolbar.onmousedown = onSplitterMouseDown; 
     229     
     230                commandLine = doc.getElementById("commandLine"); 
     231                addEvent(commandLine, "keydown", onCommandLineKeyDown); 
     232     
     233                addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown); 
     234                 
     235                consoleBody = doc.getElementById("log"); 
     236                layout(); 
     237                flush(); 
     238            } 
     239     
     240            var baseURL = getFirebugURL(); 
     241     
     242            consoleFrame = document.createElement("iframe"); 
     243            consoleFrame.setAttribute("src", baseURL+"/firebug.html"); 
     244            consoleFrame.setAttribute("frameBorder", "0"); 
     245            consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");     
     246            consoleFrame.style.zIndex = "2147483647"; 
     247            consoleFrame.style.position = "fixed"; 
     248            consoleFrame.style.width = "100%"; 
     249            consoleFrame.style.left = "0"; 
     250            consoleFrame.style.bottom = "0"; 
     251            consoleFrame.style.height = "200px"; 
     252            document.body.appendChild(consoleFrame); 
     253        } 
     254         
     255        function getFirebugURL() 
     256        { 
     257            var scripts = document.getElementsByTagName("script"); 
     258            for (var i = 0; i < scripts.length; ++i) 
     259            { 
     260                if (scripts[i].src.indexOf("DebugOpenLayers.js") != -1) 
     261                { 
     262                    var lastSlash = scripts[i].src.lastIndexOf("/"); 
     263                    return scripts[i].src.substr(0, lastSlash); 
     264                } 
     265            } 
     266        } 
     267         
     268        function evalCommandLine() 
     269        { 
     270            var text = commandLine.value; 
     271            commandLine.value = ""; 
     272     
     273            logRow([clPrefix, text], "command"); 
     274             
     275            var value; 
     276            try 
     277            { 
     278                value = eval(text); 
     279            } 
     280            catch (exc) 
     281            { 
     282            } 
     283     
     284            OpenLayers.Console.log(value); 
     285        } 
     286         
     287        function layout() 
     288        { 
     289            var toolbar = consoleBody.ownerDocument.getElementById("toolbar"); 
     290            var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight); 
     291            height = Math.max(height, 0); 
     292            consoleBody.style.top = toolbar.offsetHeight + "px"; 
     293            consoleBody.style.height = height + "px"; 
     294            commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px"; 
     295        } 
     296         
     297        function logRow(message, className, handler) 
     298        { 
     299            if (consoleBody) 
     300                writeMessage(message, className, handler); 
     301            else 
     302            { 
     303                messageQueue.push([message, className, handler]); 
     304                waitForBody(); 
     305            } 
     306        } 
     307         
     308        function flush() 
     309        { 
     310            var queue = messageQueue; 
     311            messageQueue = []; 
     312             
     313            for (var i = 0; i < queue.length; ++i) 
     314                writeMessage(queue[i][0], queue[i][1], queue[i][2]); 
     315        } 
     316     
     317        function writeMessage(message, className, handler) 
     318        { 
     319            var isScrolledToBottom = 
     320                consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight; 
     321     
     322            if (!handler) 
     323                handler = writeRow; 
     324             
     325            handler(message, className); 
     326             
     327            if (isScrolledToBottom) 
     328                consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight; 
     329        } 
     330         
     331        function appendRow(row) 
     332        { 
     333            var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody; 
     334            container.appendChild(row); 
     335        } 
     336     
     337        function writeRow(message, className) 
     338        { 
     339            var row = consoleBody.ownerDocument.createElement("div"); 
     340            row.className = "logRow" + (className ? " logRow-"+className : ""); 
     341            row.innerHTML = message.join(""); 
     342            appendRow(row); 
     343        } 
     344     
     345        function pushGroup(message, className) 
     346        { 
     347            logFormatted(message, className); 
     348     
     349            var groupRow = consoleBody.ownerDocument.createElement("div"); 
     350            groupRow.className = "logGroup"; 
     351            var groupRowBox = consoleBody.ownerDocument.createElement("div"); 
     352            groupRowBox.className = "logGroupBox"; 
     353            groupRow.appendChild(groupRowBox); 
     354            appendRow(groupRowBox); 
     355            groupStack.push(groupRowBox); 
     356        } 
     357     
     358        function popGroup() 
     359        { 
     360            groupStack.pop(); 
     361        } 
     362         
     363        // ******************************************************************************************** 
     364     
     365        function logFormatted(objects, className) 
     366        { 
     367            var html = []; 
     368     
     369            var format = objects[0]; 
     370            var objIndex = 0; 
     371     
     372            if (typeof(format) != "string") 
     373            { 
     374                format = ""; 
     375                objIndex = -1; 
     376            } 
     377     
     378            var parts = parseFormat(format); 
     379            for (var i = 0; i < parts.length; ++i) 
     380            { 
     381                var part = parts[i]; 
     382                if (part && typeof(part) == "object") 
     383                { 
     384                    var object = objects[++objIndex]; 
     385                    part.appender(object, html); 
     386                } 
     387                else 
     388                    appendText(part, html); 
     389            } 
     390     
     391            for (var i = objIndex+1; i < objects.length; ++i) 
     392            { 
     393                appendText(" ", html); 
     394                 
     395                var object = objects[i]; 
     396                if (typeof(object) == "string") 
     397                    appendText(object, html); 
     398                else 
     399                    appendObject(object, html); 
     400            } 
     401             
     402            logRow(html, className); 
     403        } 
     404     
     405        function parseFormat(format) 
     406        { 
     407            var parts = []; 
     408     
     409            var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;     
     410            var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat}; 
     411     
     412            for (var m = reg.exec(format); m; m = reg.exec(format)) 
     413            { 
     414                var type = m[8] ? m[8] : m[5]; 
     415                var appender = type in appenderMap ? appenderMap[type] : appendObject; 
     416                var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0); 
     417     
     418                parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1)); 
     419                parts.push({appender: appender, precision: precision}); 
     420     
     421                format = format.substr(m.index+m[0].length); 
     422            } 
     423     
     424            parts.push(format); 
     425     
     426            return parts; 
     427        } 
     428     
     429        function escapeHTML(value) 
     430        { 
     431            function replaceChars(ch) 
     432            { 
     433                switch (ch) 
     434                { 
     435                    case "<": 
     436                        return "&lt;"; 
     437                    case ">": 
     438                        return "&gt;"; 
     439                    case "&": 
     440                        return "&amp;"; 
     441                    case "'": 
     442                        return "&#39;"; 
     443                    case '"': 
     444                        return "&quot;"; 
     445                } 
     446                return "?"; 
     447            }; 
     448            return String(value).replace(/[<>&"']/g, replaceChars); 
     449        } 
     450     
     451        function objectToString(object) 
     452        { 
     453            try 
     454            { 
     455                return object+""; 
     456            } 
     457            catch (exc) 
     458            { 
     459                return null; 
     460            } 
     461        } 
     462     
     463        // ******************************************************************************************** 
     464     
     465        function appendText(object, html) 
     466        { 
     467            html.push(escapeHTML(objectToString(object))); 
     468        } 
     469     
     470        function appendNull(object, html) 
     471        { 
     472            html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>'); 
     473        } 
     474     
     475        function appendString(object, html) 
     476        { 
     477            html.push('<span class="objectBox-string">&quot;', escapeHTML(objectToString(object)), 
     478                '&quot;</span>'); 
     479        } 
     480     
     481        function appendInteger(object, html) 
     482        { 
     483            html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>'); 
     484        } 
     485     
     486        function appendFloat(object, html) 
     487        { 
     488            html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>'); 
     489        } 
     490     
     491        function appendFunction(object, html) 
     492        { 
     493            var reName = /function ?(.*?)\(/; 
     494            var m = reName.exec(objectToString(object)); 
     495            var name = m ? m[1] : "function"; 
     496            html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>'); 
     497        } 
     498         
     499        function appendObject(object, html) 
     500        { 
     501            try 
     502            { 
     503                if (object == undefined) 
     504                    appendNull("undefined", html); 
     505                else if (object == null) 
     506                    appendNull("null", html); 
     507                else if (typeof object == "string") 
     508                    appendString(object, html); 
     509                else if (typeof object == "number") 
     510                    appendInteger(object, html); 
     511                else if (typeof object == "function") 
     512                    appendFunction(object, html); 
     513                else if (object.nodeType == 1) 
     514                    appendSelector(object, html); 
     515                else if (typeof object == "object") 
     516                    appendObjectFormatted(object, html); 
     517                else 
     518                    appendText(object, html); 
     519            } 
     520            catch (exc) 
     521            { 
     522            } 
     523        } 
     524             
     525        function appendObjectFormatted(object, html) 
     526        { 
     527            var text = objectToString(object); 
     528            var reObject = /\[object (.*?)\]/; 
     529     
     530            var m = reObject.exec(text); 
     531            html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>') 
     532        } 
     533         
     534        function appendSelector(object, html) 
     535        { 
     536            html.push('<span class="objectBox-selector">'); 
     537     
     538            html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>'); 
     539            if (object.id) 
     540                html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>'); 
     541            if (object.className) 
     542                html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>'); 
     543     
     544            html.push('</span>'); 
     545        } 
     546     
     547        function appendNode(node, html) 
     548        { 
     549            if (node.nodeType == 1) 
     550            { 
     551                html.push( 
     552                    '<div class="objectBox-element">', 
     553                        '&lt;<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>'); 
     554     
     555                for (var i = 0; i < node.attributes.length; ++i) 
     556                { 
     557                    var attr = node.attributes[i]; 
     558                    if (!attr.specified) 
     559                        continue; 
     560                     
     561                    html.push('&nbsp;<span class="nodeName">', attr.nodeName.toLowerCase(), 
     562                        '</span>=&quot;<span class="nodeValue">', escapeHTML(attr.nodeValue), 
     563                        '</span>&quot;') 
     564                } 
     565     
     566                if (node.firstChild) 
     567                { 
     568                    html.push('&gt;</div><div class="nodeChildren">'); 
     569     
     570                    for (var child = node.firstChild; child; child = child.nextSibling) 
     571                        appendNode(child, html); 
     572                         
     573                    html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">',  
     574                        node.nodeName.toLowerCase(), '&gt;</span></div>'); 
     575                } 
     576                else 
     577                    html.push('/&gt;</div>'); 
     578            } 
     579            else if (node.nodeType == 3) 
     580            { 
     581                html.push('<div class="nodeText">', escapeHTML(node.nodeValue), 
     582                    '</div>'); 
     583            } 
     584        } 
     585     
     586        // ******************************************************************************************** 
     587         
     588        function addEvent(object, name, handler) 
     589        { 
     590            if (document.all) 
     591                object.attachEvent("on"+name, handler); 
     592            else 
     593                object.addEventListener(name, handler, false); 
     594        } 
     595         
     596        function removeEvent(object, name, handler) 
     597        { 
     598            if (document.all) 
     599                object.detachEvent("on"+name, handler); 
     600            else 
     601                object.removeEventListener(name, handler, false); 
     602        } 
     603         
     604        function cancelEvent(event) 
     605        { 
     606            if (document.all) 
     607                event.cancelBubble = true; 
     608            else 
     609                event.stopPropagation();         
     610        } 
     611     
     612        function onError(msg, href, lineNo) 
     613        { 
     614            var html = []; 
     615             
     616            var lastSlash = href.lastIndexOf("/"); 
     617            var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1); 
     618             
     619            html.push( 
     620                '<span class="errorMessage">', msg, '</span>',  
     621                '<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>' 
     622            ); 
     623             
     624            logRow(html, "error"); 
     625        }; 
     626     
     627        function onKeyDown(event) 
     628        { 
     629            if (event.keyCode == 123) 
     630                toggleConsole(); 
     631            else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey 
     632                     && (event.metaKey || event.ctrlKey)) 
     633                focusCommandLine(); 
     634            else 
     635                return; 
     636             
     637            cancelEvent(event); 
     638        } 
     639     
     640        function onSplitterMouseDown(event) 
     641        { 
     642            if (isSafari || isOpera) 
     643                return; 
     644             
     645            addEvent(document, "mousemove", onSplitterMouseMove); 
     646            addEvent(document, "mouseup", onSplitterMouseUp); 
     647     
     648            for (var i = 0; i < frames.length; ++i) 
     649            { 
     650                addEvent(frames[i].document, "mousemove", onSplitterMouseMove); 
     651                addEvent(frames[i].document, "mouseup", onSplitterMouseUp); 
     652            } 
     653        } 
     654         
     655        function onSplitterMouseMove(event) 
     656        { 
     657            var win = document.all 
     658                ? event.srcElement.ownerDocument.parentWindow 
     659                : event.target.ownerDocument.defaultView; 
     660     
     661            var clientY = event.clientY; 
     662            if (win != win.parent) 
     663                clientY += win.frameElement ? win.frameElement.offsetTop : 0; 
     664             
     665            var height = consoleFrame.offsetTop + consoleFrame.clientHeight; 
     666            var toolbar = consoleBody.ownerDocument.getElementById("toolbar"); 
     667            var y = Math.max(height - clientY, 
     668                             toolbar.offsetHeight + commandLine.offsetHeight); 
     669            consoleFrame.style.height = y + "px"; 
     670            layout(); 
     671        } 
     672         
     673        function onSplitterMouseUp(event) 
     674        { 
     675            removeEvent(document, "mousemove", onSplitterMouseMove); 
     676            removeEvent(document, "mouseup", onSplitterMouseUp); 
     677     
     678            for (var i = 0; i < frames.length; ++i) 
     679            { 
     680                removeEvent(frames[i].document, "mousemove", onSplitterMouseMove); 
     681                removeEvent(frames[i].document, "mouseup", onSplitterMouseUp); 
     682            } 
     683        } 
     684         
     685        function onCommandLineKeyDown(event) 
     686        { 
     687            if (event.keyCode == 13) 
     688                evalCommandLine(); 
     689            else if (event.keyCode == 27) 
     690                commandLine.value = ""; 
     691        } 
     692         
     693        window.onerror = onError; 
     694        addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown); 
     695         
     696        if (document.documentElement.getAttribute("debug") == "true") 
     697            toggleConsole(true); 
     698    })(); 
     699} 
  • lib/Firebug/firebug.css

    old new  
     1 
     2html, body { 
     3    margin: 0; 
     4    background: #FFFFFF; 
     5    font-family: Lucida Grande, Tahoma, sans-serif; 
     6    font-size: 11px; 
     7    overflow: hidden; 
     8} 
     9 
     10a { 
     11    text-decoration: none; 
     12} 
     13 
     14a:hover { 
     15    text-decoration: underline; 
     16} 
     17 
     18.toolbar { 
     19    height: 14px; 
     20    border-top: 1px solid ThreeDHighlight; 
     21    border-bottom: 1px solid ThreeDShadow; 
     22    padding: 2px 6px; 
     23    background: ThreeDFace; 
     24} 
     25 
     26.toolbarRight { 
     27    position: absolute; 
     28    top: 4px; 
     29    right: 6px; 
     30} 
     31 
     32#log { 
     33    overflow: auto; 
     34    position: absolute; 
     35    left: 0; 
     36    width: 100%; 
     37} 
     38 
     39#commandLine { 
     40    position: absolute; 
     41    bottom: 0; 
     42    left: 0; 
     43    width: 100%; 
     44    height: 18px; 
     45    border: none; 
     46    border-top: 1px solid ThreeDShadow; 
     47} 
     48 
     49/************************************************************************************************/ 
     50 
     51.logRow { 
     52    position: relative; 
     53    border-bottom: 1px solid #D7D7D7; 
     54    padding: 2px 4px 1px 6px; 
     55    background-color: #FFFFFF; 
     56} 
     57 
     58.logRow-command { 
     59    font-family: Monaco, monospace; 
     60    color: blue; 
     61} 
     62 
     63.objectBox-null { 
     64    padding: 0 2px; 
     65    border: 1px solid #666666; 
     66    background-color: #888888; 
     67    color: #FFFFFF; 
     68} 
     69 
     70.objectBox-string { 
     71    font-family: Monaco, monospace; 
     72    color: red; 
     73    white-space: pre; 
     74} 
     75 
     76.objectBox-number { 
     77    color: #000088; 
     78} 
     79 
     80.objectBox-function { 
     81    font-family: Monaco, monospace; 
     82    color: DarkGreen; 
     83} 
     84 
     85.objectBox-object { 
     86    color: DarkGreen; 
     87    font-weight: bold; 
     88} 
     89 
     90/************************************************************************************************/ 
     91 
     92.logRow-info, 
     93.logRow-error, 
     94.logRow-warning { 
     95    background: #FFFFFF no-repeat 2px 2px; 
     96    padding-left: 20px; 
     97    padding-bottom: 3px; 
     98} 
     99 
     100.logRow-info { 
     101    background-image: url(infoIcon.png); 
     102} 
     103 
     104.logRow-warning { 
     105    background-color: cyan; 
     106    background-image: url(warningIcon.png); 
     107} 
     108 
     109.logRow-error { 
     110    background-color: LightYellow; 
     111    background-image: url(errorIcon.png); 
     112} 
     113 
     114.errorMessage { 
     115    vertical-align: top; 
     116    color: #FF0000; 
     117} 
     118 
     119.objectBox-sourceLink { 
     120    position: absolute; 
     121    right: 4px; 
     122    top: 2px; 
     123    padding-left: 8px; 
     124    font-family: Lucida Grande, sans-serif; 
     125    font-weight: bold; 
     126    color: #0000FF; 
     127} 
     128 
     129/************************************************************************************************/ 
     130 
     131.logRow-group { 
     132    background: #EEEEEE; 
     133    border-bottom: none; 
     134} 
     135 
     136.logGroup { 
     137    background: #EEEEEE; 
     138} 
     139 
     140.logGroupBox { 
     141    margin-left: 24px; 
     142    border-top: 1px solid #D7D7D7; 
     143    border-left: 1px solid #D7D7D7; 
     144} 
     145 
     146/************************************************************************************************/ 
     147 
     148.selectorTag, 
     149.selectorId, 
     150.selectorClass { 
     151    font-family: Monaco, monospace; 
     152    font-weight: normal; 
     153} 
     154 
     155.selectorTag { 
     156    color: #0000FF; 
     157} 
     158 
     159.selectorId { 
     160    color: DarkBlue; 
     161} 
     162 
     163.selectorClass { 
     164    color: red; 
     165} 
     166 
     167/************************************************************************************************/ 
     168 
     169.objectBox-element { 
     170    font-family: Monaco, monospace; 
     171    color: #000088; 
     172} 
     173 
     174.nodeChildren { 
     175    margin-left: 16px; 
     176} 
     177 
     178.nodeTag { 
     179    color: blue; 
     180} 
     181 
     182.nodeValue { 
     183    color: #FF0000; 
     184    font-weight: normal; 
     185} 
     186 
     187.nodeText, 
     188.nodeComment { 
     189    margin: 0 2px; 
     190    vertical-align: top; 
     191} 
     192 
     193.nodeText { 
     194    color: #333333; 
     195} 
     196 
     197.nodeComment { 
     198    color: DarkGreen; 
     199} 
     200 
     201/************************************************************************************************/ 
     202 
     203.propertyNameCell { 
     204    vertical-align: top; 
     205} 
     206 
     207.propertyName { 
     208    font-weight: bold; 
     209} 
  • lib/Firebug/firebug.html

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     2         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     3 
     4<html xmlns="http://www.w3.org/1999/xhtml"> 
     5 
     6<head> 
     7    <title>Firebug</title> 
     8    <link rel="stylesheet" type="text/css" href="firebug.css"> 
     9</head> 
     10 
     11<body> 
     12    <div id="toolbar" class="toolbar"> 
     13        <a href="#" onclick="parent.OpenLayers.Console.clear()">Clear</a> 
     14        <span class="toolbarRight"> 
     15            <a href="#" onclick="parent.OpenLayers.Console.close()">Close</a> 
     16        </span> 
     17    </div> 
     18    <div id="log"></div> 
     19    <input type="text" id="commandLine"> 
     20     
     21    <script>parent.onFirebugReady(document);</script> 
     22</body> 
     23</html> 
  • lib/Firebug/firebug.js

    old new  
     1 
     2if (!("console" in window) || !("firebug" in console)) { 
     3(function() 
     4{ 
     5    window.console =  
     6    { 
     7        log: function() 
     8