Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50654 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2011 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
// Layout
10
//============================================================================
11
12
var IPython = (function (IPython) {
13
"use strict";
14
15
var LayoutManager = function () {
16
this.bind_events();
17
};
18
19
LayoutManager.prototype.bind_events = function () {
20
$(window).resize($.proxy(this.do_resize,this));
21
};
22
23
LayoutManager.prototype.app_height = function() {
24
var win = $(window);
25
var w = win.width();
26
var h = win.height();
27
var header_height;
28
if ($('div#header').css('display') === 'none') {
29
header_height = 0;
30
} else {
31
header_height = $('div#header').outerHeight(true);
32
}
33
var menubar_height;
34
if ($('div#menubar-container').css('display') === 'none') {
35
menubar_height = 0;
36
} else {
37
menubar_height = $('div#menubar-container').outerHeight(true);
38
}
39
return h-header_height-menubar_height; // content height
40
};
41
42
LayoutManager.prototype.do_resize = function () {
43
var app_height = this.app_height(); // content height
44
45
$('#ipython-main-app').height(app_height); // content+padding+border height
46
47
var pager_height = IPython.pager.percentage_height*app_height;
48
var pager_splitter_height = $('div#pager_splitter').outerHeight(true);
49
$('div#pager').outerHeight(pager_height);
50
if (IPython.pager.expanded) {
51
$('div#notebook').outerHeight(app_height-pager_height-pager_splitter_height);
52
} else {
53
$('div#notebook').outerHeight(app_height-pager_splitter_height);
54
}
55
};
56
57
IPython.LayoutManager = LayoutManager;
58
59
return IPython;
60
61
}(IPython));
62
63