~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/console/console.js

  • Committer: drtomc
  • Date: 2008-02-28 04:10:59 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:599
console: improve end of line handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
    if (res.hasOwnProperty('okay'))
256
256
    {
257
257
        // Success!
258
 
        // print out the output (res.okay[0])
259
 
        var pre = document.createElement("pre");
260
 
        pre.setAttribute("class", "outputMsg");
261
 
        pre.appendChild(document.createTextNode(res.okay[0]));
262
 
        output.appendChild(pre);
263
 
        // print out the return value (res.okay[1])
264
 
        if (res.okay[1])
 
258
        if (res.okay)
265
259
        {
266
260
            var pre = document.createElement("pre");
267
261
            pre.setAttribute("class", "outputMsg");
268
 
            pre.appendChild(document.createTextNode(res.okay[1] + "\n"));
 
262
            pre.appendChild(document.createTextNode(res.okay + "\n"));
269
263
            output.appendChild(pre);
270
264
        }
271
265
        // set the prompt to >>>
275
269
    else if (res.hasOwnProperty('exc'))
276
270
    {
277
271
        // Failure!
278
 
        // print out any output that came before the error
279
 
        if (res.exc[0].length > 0)
280
 
        {
281
 
            var pre = document.createElement("pre");
282
 
            pre.setAttribute("class", "outputMsg");
283
 
            pre.appendChild(document.createTextNode(res.exc[0]));
284
 
            output.appendChild(pre);
285
 
        }
286
 
 
287
272
        // print out the error message (res.exc)
288
273
        var pre = document.createElement("pre");
289
274
        pre.setAttribute("class", "errorMsg");
290
 
        pre.appendChild(document.createTextNode(res.exc[1]));
 
275
        pre.appendChild(document.createTextNode(res.exc));
291
276
        output.appendChild(pre);
292
277
    }
293
278
    else if (res.hasOwnProperty('more'))
298
283
    }
299
284
    else if (res.hasOwnProperty('output'))
300
285
    {
301
 
        lines = res.output
302
 
        for (var i = 0; i < lines.length; i++)
 
286
        if (res.output.length > 0)
303
287
        {
304
288
            var pre = document.createElement("pre");
305
289
            pre.setAttribute("class", "outputMsg");
306
 
            pre.appendChild(document.createTextNode(lines[i] + "\n"));
 
290
            pre.appendChild(document.createTextNode(res.output));
307
291
            output.appendChild(pre);
308
292
        }
309
293
        var callback = function(xhr)