increate body margin-bottom with visible console
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Jun 2010 14:29:49 +0000 (16:29 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Jun 2010 14:29:49 +0000 (16:29 +0200)
This allow us to see all content on page, since we extend page
so we can fit all content and console vertically

public/js/eval_console.js

index bcddf2c..4093021 100644 (file)
@@ -1,6 +1,8 @@
 $(document).ready( function(){
 
-       $('form#eval textarea').each( function() {
+       var $form = $('form#eval');
+
+       $form.find('textarea').each( function() {
                console.debug('grow',this);
 
                var rows = this.rows;
@@ -17,6 +19,10 @@ $(document).ready( function(){
                this.onkeyup = function() { grow(this) };
        });
 
+       if ( $form.is(':visible') ) {
+               $('body').css({ 'margin-bottom': $form.height() });
+       }
+
        $('input#close').click( function(){
                console.debug( 'close console' );
                $.post( document.location, { code: '' } );
@@ -33,8 +39,10 @@ $(document).ready( function(){
                var $f = $('form#eval');
                if ( $f.is(':visible') ) {
                        $f.hide();
+                       $('body').css({ 'margin-bottom': 0 });
                } else {
                        $f.show();
+                       $('body').css({ 'margin-bottom': $form.height() });
                }
                return false;
        }).show();