Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
63
venv/Lib/site-packages/notebook/static/terminal/js/main.js
Normal file
63
venv/Lib/site-packages/notebook/static/terminal/js/main.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright (c) Jupyter Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
requirejs([
|
||||
'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();
|
||||
|
||||
// This makes the 'logout' button in the top right work.
|
||||
var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
|
||||
|
||||
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;
|
||||
|
||||
page.show_header();
|
||||
|
||||
var terminal = terminado.make_terminal($("#terminado-container")[0], ws_url);
|
||||
|
||||
page.show_site();
|
||||
|
||||
utils.load_extensions_from_config(config);
|
||||
utils.load_extensions_from_config(common_config);
|
||||
|
||||
window.onresize = function() {
|
||||
terminal.term.fit();
|
||||
// send the new size to the server so that it can trigger a resize in the running process.
|
||||
terminal.socket.send(JSON.stringify(["set_size", terminal.term.rows, terminal.term.cols,
|
||||
$(window).height(), $(window).width()]));
|
||||
};
|
||||
|
||||
// Expose terminal for fiddling with in the browser
|
||||
window.terminal = terminal;
|
||||
|
||||
});
|
32410
venv/Lib/site-packages/notebook/static/terminal/js/main.min.js
vendored
Normal file
32410
venv/Lib/site-packages/notebook/static/terminal/js/main.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,38 @@
|
|||
define (["xterm", "xtermjs-fit"], function(Terminal, fit) {
|
||||
"use strict";
|
||||
function make_terminal(element, ws_url) {
|
||||
var ws = new WebSocket(ws_url);
|
||||
Terminal.applyAddon(fit);
|
||||
var term = new Terminal();
|
||||
ws.onopen = function(event) {
|
||||
term.on('data', function(data) {
|
||||
ws.send(JSON.stringify(['stdin', data]));
|
||||
});
|
||||
|
||||
term.on('title', function(title) {
|
||||
document.title = title;
|
||||
});
|
||||
|
||||
term.open(element);
|
||||
term.fit();
|
||||
// send the terminal size to the server.
|
||||
ws.send(JSON.stringify(["set_size", term.rows, term.cols,
|
||||
window.innerHeight, window.innerWidth]));
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
var json_msg = JSON.parse(event.data);
|
||||
switch(json_msg[0]) {
|
||||
case "stdout":
|
||||
term.write(json_msg[1]);
|
||||
break;
|
||||
case "disconnect":
|
||||
term.write("\r\n\r\n[CLOSED]\r\n");
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
return {socket: ws, term: term};
|
||||
}
|
||||
|
||||
return {make_terminal: make_terminal};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue