/usr/lib/python2.7/dist-packages/notebook/static/terminal/js/main.js is in python-notebook 5.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'jquery',
'base/js/utils',
'base/js/page',
'auth/js/loginwidget',
'services/config',
'terminal/js/terminado',
], function(
$,
utils,
page,
loginwidget,
configmod,
terminado
){
"use strict";
requirejs(['custom/custom'], function() {});
page = new page.Page('div#header', 'div#site');
var common_options = {
base_url : utils.get_body_data("baseUrl"),
};
var config = new configmod.ConfigSection('terminal', common_options);
config.load();
var common_config = new configmod.ConfigSection('common', common_options);
common_config.load();
var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
// Test size: 25x80
var termRowHeight = function(){ return 1.00 * $("#dummy-screen")[0].offsetHeight / 25;};
// 1.02 here arrived at by trial and error to make the spacing look right
var termColWidth = function() { return 1.02 * $("#dummy-screen-rows")[0].offsetWidth / 80;};
var base_url = utils.get_body_data('baseUrl').replace(/\/?$/, '/');
var ws_path = utils.get_body_data('wsPath');
var ws_url = utils.get_body_data('wsUrl');
if (!ws_url) {
// trailing 's' in https will become wss for secure web sockets
ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;
}
ws_url = ws_url + base_url + ws_path;
var header = $("#header")[0];
function calculate_size() {
var height = $(window).height() - header.offsetHeight;
var width = $('#terminado-container').width();
var rows = Math.min(1000, Math.max(20, Math.floor(height/termRowHeight())-1));
var cols = Math.min(1000, Math.max(40, Math.floor(width/termColWidth())-1));
console.log("resize to :", rows , 'rows by ', cols, 'columns');
return {rows: rows, cols: cols};
}
page.show_header();
var size = calculate_size();
var terminal = terminado.make_terminal($("#terminado-container")[0], size, ws_url);
page.show_site();
utils.load_extensions_from_config(config);
utils.load_extensions_from_config(common_config);
window.onresize = function() {
var geom = calculate_size();
terminal.term.resize(geom.cols, geom.rows);
terminal.socket.send(JSON.stringify(["set_size", geom.rows, geom.cols,
$(window).height(), $(window).width()]));
};
// Expose terminal for fiddling with in the browser
window.terminal = terminal;
});
|