@ -15,30 +15,51 @@ var IPython = (function (IPython) {
var Pager = function ( pager _selector , pager _splitter _selector ) {
this . pager _element = $ ( pager _selector ) ;
this . pager _splitter _element = $ ( pager _splitter _selector ) ;
this . expanded = false ;
var that = this ;
this . percentage _height = 0.40 ;
this . pager _splitter _element = $ ( pager _splitter _selector )
. draggable ( {
containment : 'window' ,
axis : 'y' ,
helper : null ,
drag : function ( event , ui ) {
// recalculate the amount of space the pager should take
var pheight = ( document . height - event . clientY - 4 ) ;
var downprct = pheight / IPython . layout _manager . app _height ( ) ;
downprct = Math . min ( 0.9 , downprct ) ;
if ( downprct < 0.1 ) {
that . percentage _height = 0.1 ;
that . collapse ( { 'duration' : 0 } ) ;
} else if ( downprct > 0.2 ) {
that . percentage _height = downprct ;
that . expand ( { 'duration' : 0 } ) ;
}
IPython . layout _manager . do _resize ( ) ;
}
} ) ;
this . expanded = false ;
this . style ( ) ;
this . bind _events ( ) ;
} ;
Pager . prototype . style = function ( ) {
this . pager _splitter _element . addClass ( 'border-box-sizing ui-widget ui-state-default' ) ;
this . pager _element . addClass ( 'border-box-sizing ui-widget' ) ;
this . pager _splitter _element . attr ( 'title' , 'Click to Show/Hide pager area' ) ;
this . pager _splitter _element . attr ( 'title' , 'Click to Show/Hide pager area , drag to Resize ') ;
} ;
Pager . prototype . bind _events = function ( ) {
var that = this ;
this . pager _element . bind ( 'collapse_pager' , function ( ) {
that . pager _element . hide ( 'fast' ) ;
this . pager _element . bind ( 'collapse_pager' , function ( event , extrap ) {
time = ( extrap != undefined ) ? ( ( extrap . duration != undefined ) ? extrap . duration : 'fast' ) : 'fast' ;
that . pager _element . hide ( time ) ;
} ) ;
this . pager _element . bind ( 'expand_pager' , function ( ) {
that . pager _element . show ( 'fast' ) ;
this . pager _element . bind ( 'expand_pager' , function ( event , extrap ) {
time = ( extrap != undefined ) ? ( ( extrap . duration != undefined ) ? extrap . duration : 'fast' ) : 'fast' ;
that . pager _element . show ( time ) ;
} ) ;
this . pager _splitter _element . hover (
@ -57,18 +78,18 @@ var IPython = (function (IPython) {
} ;
Pager . prototype . collapse = function ( ) {
Pager . prototype . collapse = function ( extrap ) {
if ( this . expanded === true ) {
this . pager _element . add ( $ ( 'div#notebook' ) ) . trigger ( 'collapse_pager' ) ;
this . expanded = false ;
this . pager _element . add ( $ ( 'div#notebook' ) ) . trigger ( 'collapse_pager' , extrap ) ;
} ;
} ;
Pager . prototype . expand = function ( ) {
Pager . prototype . expand = function ( extrap ) {
if ( this . expanded !== true ) {
this . pager _element . add ( $ ( 'div#notebook' ) ) . trigger ( 'expand_pager' ) ;
this . expanded = true ;
this . pager _element . add ( $ ( 'div#notebook' ) ) . trigger ( 'expand_pager' , extrap ) ;
} ;
} ;
@ -91,7 +112,7 @@ var IPython = (function (IPython) {
var toinsert = $ ( "<div/>" ) . addClass ( "output_area output_stream" ) ;
toinsert . append ( $ ( '<pre/>' ) . html ( utils . fixConsole ( text ) ) ) ;
this . pager _element . append ( toinsert ) ;
} ;
} ;
IPython . Pager = Pager ;