From f3aa8e96b2d3a7a944e53e9f575563925ecbb4fb Mon Sep 17 00:00:00 2001 From: teramako Date: Sat, 29 Oct 2011 13:06:44 +0900 Subject: Fix: 同じタブが履歴上で連続してしまう 1. tab[1], tab[2], tab[1], tab[2] とタブを選択する 2. tab[2] を閉じると、 tab[1], tab[1] という履歴になる --- tab-history.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tab-history.js') diff --git a/tab-history.js b/tab-history.js index 1659e08..ff5b33b 100644 --- a/tab-history.js +++ b/tab-history.js @@ -66,6 +66,17 @@ var tabHistory = (function(){ if (i <= index) --index; } + + for (let i = 1; i < history.length; ++i) { + let prevTab = history[i - 1], + currentTab = history[i]; + + if (prevTab === currentTab) { + history.splice(i, 1); + if (i <= index) + --index; + } + } } function addHistory (aTab) { -- cgit v1.2.3