mirror of https://github.com/huashengdun/webssh
Support passing user defined title by url
parent
23adce57d8
commit
1a2067e38a
|
@ -39,7 +39,8 @@ jQuery(function($){
|
||||||
var status = $('#status'),
|
var status = $('#status'),
|
||||||
btn = $('.btn-primary'),
|
btn = $('.btn-primary'),
|
||||||
style = {},
|
style = {},
|
||||||
title_text = 'WebSSH',
|
default_title = 'WebSSH',
|
||||||
|
user_title = '',
|
||||||
title_element = document.querySelector('title'),
|
title_element = document.querySelector('title'),
|
||||||
form_id = '#connect',
|
form_id = '#connect',
|
||||||
debug = document.querySelector(form_id).noValidate,
|
debug = document.querySelector(form_id).noValidate,
|
||||||
|
@ -384,7 +385,7 @@ jQuery(function($){
|
||||||
toggle_fullscreen(term);
|
toggle_fullscreen(term);
|
||||||
term.focus();
|
term.focus();
|
||||||
state = CONNECTED;
|
state = CONNECTED;
|
||||||
title_element.text = title_text;
|
title_element.text = user_title || default_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
sock.onmessage = function(msg) {
|
sock.onmessage = function(msg) {
|
||||||
|
@ -403,8 +404,8 @@ jQuery(function($){
|
||||||
reset_wssh();
|
reset_wssh();
|
||||||
status.text(e.reason);
|
status.text(e.reason);
|
||||||
state = DISCONNECTED;
|
state = DISCONNECTED;
|
||||||
title_text = 'WebSSH';
|
default_title = 'WebSSH';
|
||||||
title_element.text = title_text;
|
title_element.text = default_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
|
@ -612,7 +613,7 @@ jQuery(function($){
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
state = CONNECTING;
|
state = CONNECTING;
|
||||||
title_text = result;
|
default_title = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,13 +658,19 @@ jQuery(function($){
|
||||||
|
|
||||||
url_data = parse_url_data(
|
url_data = parse_url_data(
|
||||||
window.location.search.substring(1) + '&' + window.location.hash.substring(1),
|
window.location.search.substring(1) + '&' + window.location.hash.substring(1),
|
||||||
fields.concat(['password', 'bgcolor'])
|
fields.concat(['password', 'bgcolor', 'title'])
|
||||||
);
|
);
|
||||||
console.log(url_data);
|
console.log(url_data);
|
||||||
|
|
||||||
if (url_data.bgcolor) {
|
if (url_data.bgcolor) {
|
||||||
bgcolor = url_data.bgcolor;
|
bgcolor = url_data.bgcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url_data.title) {
|
||||||
|
user_title = url_data.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete url_data.title;
|
||||||
delete url_data.bgcolor;
|
delete url_data.bgcolor;
|
||||||
|
|
||||||
if (url_data.hostname && url_data.username) {
|
if (url_data.hostname && url_data.username) {
|
||||||
|
|
Loading…
Reference in New Issue