LSP: back button support
This commit is contained in:
parent
723c8b8b3b
commit
0e440231a3
2 changed files with 21 additions and 0 deletions
14
lsp/main.js
14
lsp/main.js
|
@ -1077,3 +1077,17 @@ $(function(){
|
|||
});
|
||||
});
|
||||
|
||||
$(window).on('hashchange', function(e) {
|
||||
if (ignoreHashChange) {
|
||||
ignoreHashChange = false;
|
||||
return;
|
||||
}
|
||||
var loc = location.hash.split('&')[1].split('@');
|
||||
if (loc[1]) {
|
||||
showTab(loc[0],loc[1]);
|
||||
}
|
||||
else {
|
||||
showTab(loc[0]);
|
||||
}
|
||||
ignoreHashChange = false;
|
||||
});
|
|
@ -6,6 +6,12 @@ var defaults = {
|
|||
};
|
||||
|
||||
function showTab(tabName,streamName) {
|
||||
|
||||
ignoreHashChange = true;
|
||||
location.hash = location.hash.split('&')[0]+'&'+tabName+(streamName ? '@'+streamName : '');
|
||||
|
||||
|
||||
|
||||
$('#menu .button').removeClass('current').filter(function(i){
|
||||
return $(this).text().toLowerCase() == tabName;
|
||||
}).addClass('current');
|
||||
|
@ -45,6 +51,7 @@ function showTab(tabName,streamName) {
|
|||
|
||||
if (applyInput() === false) { return; }
|
||||
|
||||
ignoreHashChange = true;
|
||||
location.hash = settings.credentials.username+'@'+settings.server;
|
||||
$('#user_and_host').text(settings.credentials.username+' @ '+settings.server);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue