diff --git a/module/index/js/index.js b/module/index/js/index.js index ea37e07025..b79947b6d9 100644 --- a/module/index/js/index.js +++ b/module/index/js/index.js @@ -120,7 +120,11 @@ /* Update tab state */ tab.show = true; - lastOpenedGroup = group; + if(lastOpenedGroup !== group) + { + lastOpenedGroup = group; + updateTabUrl(group); + } } /** @@ -225,6 +229,30 @@ } } + /** + * Update browser url and title for the given tab + * @param {string} group The group of target tab to update url + * @param {string|boolean} [url] The new url of the tab + * @param {string|boolean} [title] The new title of the tab + * @return {void} + */ + function updateTabUrl(group, url, title) + { + var tab = openedTabs[group]; + if(!tab) return; + + if(url) tab.pageUrl = url; + else url = tab.pageUrl; + if(title) tab.pageTitle = title; + else title = tab.pageTitle || tab.text; + + if(lastOpenedGroup === group) + { + if(location.url !== url) history.replaceState({}, title, url); + document.title = title; + } + } + /* Bind helper methods to global object "$.tabs" */ $.tabs = window.tabs = { @@ -234,6 +262,7 @@ toggle: toggleTab, close: closeTab, reload: reloadTab, + updateUrl: updateTabUrl, openedTabs: openedTabs, groupsMap: groupsMap }; diff --git a/www/js/zui/min.js b/www/js/zui/min.js index 24f7739cd5..6abf988e02 100644 --- a/www/js/zui/min.js +++ b/www/js/zui/min.js @@ -76,4 +76,4 @@ function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"= */ function(t){function e(e){if("string"==typeof e.data){var i=e.handler,n=e.data.toLowerCase().split(" ");e.handler=function(e){if(this===e.target||!/textarea|select/i.test(e.target.nodeName)&&"text"!==e.target.type){var o="keypress"!==e.type&&t.hotkeys.specialKeys[e.which],a=String.fromCharCode(e.which).toLowerCase(),s="",r={};e.altKey&&"alt"!==o&&(s+="alt+"),e.ctrlKey&&"ctrl"!==o&&(s+="ctrl+"),e.metaKey&&!e.ctrlKey&&"meta"!==o&&(s+="meta+"),e.shiftKey&&"shift"!==o&&(s+="shift+"),o?r[s+o]=!0:(r[s+a]=!0,r[s+t.hotkeys.shiftNums[a]]=!0,"shift+"===s&&(r[t.hotkeys.shiftNums[a]]=!0));for(var l=0,h=n.length;l","/":"?","\\":"|"}},t.each(["keydown","keyup","keypress"],function(){t.event.special[this]={add:e}})}(jQuery),function(t){"use strict";function e(e,i){if(e===!1)return e;if(!e)return i;e===!0?e={add:!0,"delete":!0,edit:!0,sort:!0}:"string"==typeof e&&(e=e.split(","));var n;return Array.isArray(e)&&(n={},t.each(e,function(e,i){t.isPlainObject(i)?n[i.action]=i:n[i]=!0}),e=n),t.isPlainObject(e)&&(n={},t.each(e,function(e,i){i?n[e]=t.extend({type:e},s[e],t.isPlainObject(i)?i:null):n[e]=!1}),e=n),i?t.extend(!0,{},i,e):e}function i(e,i,n){return i=i||e.type,t(n||e.template).addClass("tree-action").attr(t.extend({"data-type":i,title:e.title||""},e.attr)).data("action",e)}var n="zui.tree",o=0,a=function(e,i){this.name=n,this.$=t(e),this.getOptions(i),this._init()},s={sort:{template:''},add:{template:''},edit:{template:''},"delete":{template:''}};a.DEFAULTS={animate:null,initialState:"normal",toggleTemplate:''},a.prototype.add=function(e,i,n,o,a){var s,r=t(e),l=this.options;if(r.is("li")?(s=r.children("ul"),s.length||(s=t("