diff --git a/lsp/main.js b/lsp/main.js index 776d2176..82cdd0e7 100755 --- a/lsp/main.js +++ b/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; +}); \ No newline at end of file diff --git a/lsp/pages.js b/lsp/pages.js index a3da11f7..8e87797d 100755 --- a/lsp/pages.js +++ b/lsp/pages.js @@ -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);