mirror of https://github.com/huashengdun/webssh
Updated static files
parent
d74c097471
commit
5a52b20feb
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +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});
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).fullscreen=e()}}(function(){return function i(f,l,s){function u(n,e){if(!l[n]){if(!f[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(c)return c(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var r=l[n]={exports:{}};f[n][0].call(r.exports,function(e){return u(f[n][1][e]||e)},r,r.exports,i,f,l,s)}return l[n].exports}for(var c="function"==typeof require&&require,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,n,t){"use strict";function o(e,n){(void 0===n?e.element.classList.contains("fullscreen")?e.element.classList.remove:e.element.classList.add:n?e.element.classList.add:e.element.classList.remove).bind(e.element.classList)("fullscreen")}Object.defineProperty(t,"__esModule",{value:!0}),t.toggleFullScreen=o,t.apply=function(e){e.prototype.toggleFullScreen=function(e){o(this,e)}}},{}]},{},[1])(1)});
|
|
@ -89,9 +89,23 @@ jQuery(function($){
|
|||
}
|
||||
|
||||
|
||||
function current_geometry() {
|
||||
function get_cell_size(term) {
|
||||
style.width = term._core.renderer.dimensions.actualCellWidth;
|
||||
style.height = term._core.renderer.dimensions.actualCellHeight;
|
||||
}
|
||||
|
||||
function toggle_fullscreen(term) {
|
||||
var func = term.toggleFullScreen || term.toggleFullscreen;
|
||||
func.call(term, true);
|
||||
}
|
||||
|
||||
function current_geometry(term) {
|
||||
if (!style.width || !style.height) {
|
||||
parse_xterm_style();
|
||||
try {
|
||||
get_cell_size(term);
|
||||
} catch (TypeError) {
|
||||
parse_xterm_style();
|
||||
}
|
||||
}
|
||||
|
||||
var cols = parseInt(window.innerWidth / style.width, 10) - 1;
|
||||
|
@ -216,7 +230,7 @@ jQuery(function($){
|
|||
}
|
||||
|
||||
function resize_terminal(term) {
|
||||
var geometry = current_geometry();
|
||||
var geometry = current_geometry(term);
|
||||
term.on_resize(geometry.cols, geometry.rows);
|
||||
}
|
||||
|
||||
|
@ -258,7 +272,7 @@ jQuery(function($){
|
|||
|
||||
wssh.geometry = function() {
|
||||
// for console use
|
||||
var geometry = current_geometry();
|
||||
var geometry = current_geometry(term);
|
||||
console.log('Current window geometry: ' + JSON.stringify(geometry));
|
||||
};
|
||||
|
||||
|
@ -302,7 +316,7 @@ jQuery(function($){
|
|||
var valid_args = false;
|
||||
|
||||
if (cols > 0 && rows > 0) {
|
||||
var geometry = current_geometry();
|
||||
var geometry = current_geometry(term);
|
||||
if (cols <= geometry.cols && rows <= geometry.rows) {
|
||||
valid_args = true;
|
||||
}
|
||||
|
@ -316,7 +330,7 @@ jQuery(function($){
|
|||
};
|
||||
|
||||
term.on_resize = function(cols, rows) {
|
||||
if (cols !== this.geometry[0] || rows !== this.geometry[1]) {
|
||||
if (cols !== this.cols || rows !== this.rows) {
|
||||
console.log('Resizing terminal to geometry: ' + format_geometry(cols, rows));
|
||||
this.resize(cols, rows);
|
||||
sock.send(JSON.stringify({'resize': [cols, rows]}));
|
||||
|
@ -329,9 +343,9 @@ jQuery(function($){
|
|||
});
|
||||
|
||||
sock.onopen = function() {
|
||||
// $('.container').hide();
|
||||
term.open(terminal, true);
|
||||
term.toggleFullscreen(true);
|
||||
term.open(terminal);
|
||||
toggle_fullscreen(term);
|
||||
term.focus();
|
||||
state = CONNECTED;
|
||||
title_element.text = title_text;
|
||||
};
|
||||
|
@ -350,7 +364,6 @@ jQuery(function($){
|
|||
term = undefined;
|
||||
sock = undefined;
|
||||
reset_wssh();
|
||||
// $('.container').show();
|
||||
status.text(e.reason);
|
||||
state = DISCONNECTED;
|
||||
title_text = 'WebSSH';
|
||||
|
@ -600,4 +613,8 @@ jQuery(function($){
|
|||
|
||||
window.addEventListener('message', cross_origin_connect, false);
|
||||
|
||||
if (window.Terminal.applyAddon) {
|
||||
window.Terminal.applyAddon(window.fullscreen);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue