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

« back to all changes in this revision

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

  • Committer: agdimech
  • Date: 2008-02-29 00:14:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:616
/console/console.js: Added dynamic scrolling for the console.

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
 
317
317
    /* Open up the console so we can see the output */
318
318
    console_maximize();
 
319
    /* Auto-scrolling */
 
320
    divScroll.activeScroll();
319
321
}
320
322
 
321
323
function catch_input(key)
373
375
        break;
374
376
    }
375
377
}
 
378
 
 
379
/**** Following Code modified from ******************************************/
 
380
/**** http://radio.javaranch.com/pascarello/2006/08/17/1155837038219.html ***/
 
381
/****************************************************************************/
 
382
var chatscroll = new Object();
 
383
 
 
384
chatscroll.Pane = function(scrollContainerId)
 
385
{
 
386
    this.scrollContainerId = scrollContainerId;
 
387
}
 
388
 
 
389
chatscroll.Pane.prototype.activeScroll = function()
 
390
{
 
391
    var scrollDiv = document.getElementById(this.scrollContainerId);
 
392
    var currentHeight = 0;
 
393
        
 
394
    if (scrollDiv.scrollHeight > 0)
 
395
        currentHeight = scrollDiv.scrollHeight;
 
396
    else 
 
397
        if (objDiv.offsetHeight > 0)
 
398
            currentHeight = scrollDiv.offsetHeight;
 
399
 
 
400
    scrollDiv.scrollTop = currentHeight;
 
401
 
 
402
    scrollDiv = null;
 
403
}
 
404
 
 
405
var divScroll = new chatscroll.Pane('console_output');