@@ -29,13 +29,9 @@ requirejs([
29
29
var common_config = new configmod . ConfigSection ( 'common' , common_options ) ;
30
30
common_config . load ( ) ;
31
31
32
+ // This makes the 'logout' button in the top right work.
32
33
var login_widget = new loginwidget . LoginWidget ( 'span#login_widget' , common_options ) ;
33
34
34
- // Test size: 25x80
35
- var termRowHeight = function ( ) { return 1.00 * $ ( "#dummy-screen" ) [ 0 ] . offsetHeight / 25 ; } ;
36
- // 1.02 here arrived at by trial and error to make the spacing look right
37
- var termColWidth = function ( ) { return 1.02 * $ ( "#dummy-screen-rows" ) [ 0 ] . offsetWidth / 80 ; } ;
38
-
39
35
var base_url = utils . get_body_data ( 'baseUrl' ) . replace ( / \/ ? $ / , '/' ) ;
40
36
var ws_path = utils . get_body_data ( 'wsPath' ) ;
41
37
var ws_url = utils . get_body_data ( 'wsUrl' ) ;
@@ -45,31 +41,19 @@ requirejs([
45
41
}
46
42
ws_url = ws_url + base_url + ws_path ;
47
43
48
- var header = $ ( "#header" ) [ 0 ] ;
49
-
50
- function calculate_size ( ) {
51
- var height = $ ( window ) . height ( ) - header . offsetHeight ;
52
- var width = $ ( '#terminado-container' ) . width ( ) ;
53
- var rows = Math . min ( 1000 , Math . max ( 20 , Math . floor ( height / termRowHeight ( ) ) - 1 ) ) ;
54
- var cols = Math . min ( 1000 , Math . max ( 40 , Math . floor ( width / termColWidth ( ) ) - 1 ) ) ;
55
- console . log ( "resize to :" , rows , 'rows by ' , cols , 'columns' ) ;
56
- return { rows : rows , cols : cols } ;
57
- }
58
-
59
44
page . show_header ( ) ;
60
45
61
- var size = calculate_size ( ) ;
62
- var terminal = terminado . make_terminal ( $ ( "#terminado-container" ) [ 0 ] , size , ws_url ) ;
46
+ var terminal = terminado . make_terminal ( $ ( "#terminado-container" ) [ 0 ] , ws_url ) ;
63
47
64
48
page . show_site ( ) ;
65
49
66
50
utils . load_extensions_from_config ( config ) ;
67
51
utils . load_extensions_from_config ( common_config ) ;
68
52
69
- window . onresize = function ( ) {
70
- var geom = calculate_size ( ) ;
71
- terminal . term . resize ( geom . cols , geom . rows ) ;
72
- terminal . socket . send ( JSON . stringify ( [ "set_size" , geom . rows , geom . cols ,
53
+ window . onresize = function ( ) {
54
+ terminal . term . fit ( ) ;
55
+ // send the new size to the server so that it can trigger a resize in the running process.
56
+ terminal . socket . send ( JSON . stringify ( [ "set_size" , terminal . term . rows , terminal . term . cols ,
73
57
$ ( window ) . height ( ) , $ ( window ) . width ( ) ] ) ) ;
74
58
} ;
75
59
0 commit comments