commit 74cdb2d31f67acd3203f61cc4d6d8afd53cea006
parent b14b8a9f7937ff42474b5a8fad9f66536337c3f9
Author: Sheng <webmaster0115@gmail.com>
Date: Fri, 24 Aug 2018 12:42:02 +0800
Change title when wssh connected
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js
@@ -8,6 +8,8 @@ jQuery(function($){
var status = $('#status'),
btn = $('.btn-primary'),
style = {},
+ title_text = 'WebSSH',
+ title_element = document.querySelector('title'),
DISCONNECTED = 0,
CONNECTING = 1,
CONNECTED = 2,
@@ -253,6 +255,7 @@ jQuery(function($){
term.open(terminal, true);
term.toggleFullscreen(true);
state = CONNECTED;
+ title_element.text = title_text;
};
sock.onmessage = function(msg) {
@@ -272,6 +275,8 @@ jQuery(function($){
$('.container').show();
status.text(e.reason);
state = DISCONNECTED;
+ title_text = 'WebSSH';
+ title_element.text = title_text;
};
$(window).resize(function(){
@@ -312,6 +317,7 @@ jQuery(function($){
});
state = CONNECTING;
+ title_text = username + '@' + hostname + ':' + port;
}
if (!hostname || !port || !username) {
@@ -400,6 +406,7 @@ jQuery(function($){
});
state = CONNECTING;
+ title_text = username + '@' + hostname + ':' + port;
}
wssh.connect = function(opts) {