From f6b89286dcbd5fc74caf8b7f80704cef676bb378 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 17 Aug 2016 16:10:24 -0400 Subject: [PATCH] fix showtab --- dashboard-ui/scripts/librarybrowser.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 04ba851466..5f650d56bc 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -164,13 +164,18 @@ } ownerpage.addEventListener('viewbeforeshow', function () { - if (tabs.triggerBeforeTabChange) { + if (tabs.triggerBeforeTabChange && this.firstTabIndex == null) { tabs.triggerBeforeTabChange(); } }); ownerpage.addEventListener('viewshow', function () { - tabs.triggerTabChange(); + if (this.firstTabIndex) { + tabs.selectedIndex(this.firstTabIndex); + this.firstTabIndex = null; + } else { + tabs.triggerTabChange(); + } }); tabs.addEventListener('beforetabchange', function (e) { @@ -195,10 +200,8 @@ var afterNavigate = function () { - document.removeEventListener('pagebeforeshow', afterNavigate); - + document.removeEventListener('pageinit', afterNavigate); if (window.location.href.toLowerCase().indexOf(url.toLowerCase()) != -1) { - this.firstTabIndex = index; } }; @@ -208,7 +211,7 @@ afterNavigate.call(viewManager.currentView()); } else { - pageClassOn('pagebeforeshow', 'page', afterNavigate); + pageClassOn('pageinit', 'page', afterNavigate); Dashboard.navigate(url); } },