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