Initialize
This commit is contained in:
Vendored
+7
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("../../xterm")):"function"==typeof define?define(["../../xterm"],e):e(window.Terminal)}(function(e){var t={};return t.toggleFullScreen=function(e,t){var n;n=void 0===t?e.element.classList.contains("fullscreen")?"remove":"add":t?"add":"remove",e.element.classList[n]("fullscreen")},e.prototype.toggleFullscreen=function(e){t.toggleFullScreen(this,e)},t});
|
||||
Vendored
+4
File diff suppressed because one or more lines are too long
@@ -0,0 +1,63 @@
|
||||
jQuery(function($){
|
||||
$('form#connect').submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var form = $(this),
|
||||
url = form.attr('action'),
|
||||
type = form.attr('type'),
|
||||
data = new FormData(this);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: type,
|
||||
data: data,
|
||||
success: callback,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function callback(msg) {
|
||||
// console.log(msg);
|
||||
if (msg.status) {
|
||||
$('#status').text(msg.status);
|
||||
return;
|
||||
}
|
||||
|
||||
var ws_url = window.location.href.replace('http', 'ws'),
|
||||
join = (ws_url[ws_url.length-1] == '/' ? '' : '/'),
|
||||
url = ws_url + join + 'ws?id=' + msg.id;
|
||||
socket = new WebSocket(url),
|
||||
terminal = document.getElementById('#terminal'),
|
||||
term = new Terminal({cursorBlink: true});
|
||||
|
||||
console.log(url);
|
||||
term.on('data', function(data) {
|
||||
// console.log(data);
|
||||
socket.send(data);
|
||||
});
|
||||
|
||||
socket.onopen = function(e) {
|
||||
$('.container').hide();
|
||||
term.open(terminal, true);
|
||||
};
|
||||
|
||||
socket.onmessage = function(msg) {
|
||||
// console.log(msg);
|
||||
term.write(msg.data);
|
||||
};
|
||||
|
||||
socket.onerror = function(e) {
|
||||
console.log(e);
|
||||
};
|
||||
|
||||
socket.onclose = function(e) {
|
||||
console.log(e);
|
||||
term.destroy();
|
||||
$('.container').show();
|
||||
$('#status').text(e.reason);
|
||||
};
|
||||
}
|
||||
});
|
||||
Vendored
+4
File diff suppressed because one or more lines are too long
+5132
File diff suppressed because it is too large
Load Diff
Vendored
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user