Initialize

This commit is contained in:
Sheng
2017-11-08 22:33:05 +08:00
commit 30d38865a2
19 changed files with 7906 additions and 0 deletions
+7
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -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});
+4
View File
File diff suppressed because one or more lines are too long
+63
View File
@@ -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);
};
}
});
+4
View File
File diff suppressed because one or more lines are too long
+5132
View File
File diff suppressed because it is too large Load Diff
+1
View File
File diff suppressed because one or more lines are too long