From 54bc716c59a914956bafcafac89be4d719dc6c66 Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Fri, 26 Jun 2015 08:03:54 -0600 Subject: [PATCH 1/6] Added tab search. --- js/popup.js | 66 +++++++++++++++++++++++++++++++++++------------------ popup.html | 6 +++++ 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/js/popup.js b/js/popup.js index 359ebd9..49dc4c6 100644 --- a/js/popup.js +++ b/js/popup.js @@ -20,31 +20,53 @@ function getAllTabs(callback) { }); } -function displayResults(tabs){ +//search tab +function searchTab(tab, search){ + if (typeof search === 'undefined') return true; + var tabText = (tab.url + tab.title).toLowerCase(); + if (tabText.indexOf(search.toLowerCase()) > -1){ + return true; + } + return false; +} + +function createPopup(tabs){ + document.getElementById('search').addEventListener("input", (function(tabs) { + return function() { + var search = event.target.value; + displayResults(tabs, search); + } + })(tabs)); + displayResults(tabs); +} + +function displayResults(tabs, search){ getCurrentWindowTabCount(); numTabs = tabs.length; var table = document.getElementById('tabsTable'); + table.innerHTML = ""; for (var i=0; i"; - cell2.innerHTML = "X"; - cell3.innerHTML = "" + tabs[i].title + ""; + if (searchTab(tabs[i], search)){ + var row = table.insertRow(); + var cell1 = row.insertCell(0); + var cell2 = row.insertCell(1); + var cell3 = row.insertCell(2); + cell1.innerHTML = ""; + cell2.innerHTML = "X"; + cell3.innerHTML = "" + tabs[i].title + ""; + + cell2.addEventListener("click", (function(tabID) { + return function() { + closeTab(tabID); + } + })(tabs[i].id)); - cell2.addEventListener("click", (function(tabID) { - return function() { - closeTab(tabID); - } - })(tabs[i].id)); - - cell3.addEventListener("click", (function(tabID, windowID) { - return function() { - openTab(tabID, windowID); - } - })(tabs[i].id, tabs[i].windowId)); + cell3.addEventListener("click", (function(tabID, windowID) { + return function() { + openTab(tabID, windowID); + } + })(tabs[i].id, tabs[i].windowId)); + } } } @@ -64,8 +86,8 @@ function closeTab(tabID) { var tabsDisplayOption = localStorage["popupDisplayOption"]; // if extension is just installed or reloaded, tabsDisplayOption will not be set if (typeof tabsDisplayOption == "undefined" || tabsDisplayOption == "currentWindow") { - getCurrentWindowTabs(displayResults); + getCurrentWindowTabs(createPopup); } else { //getCurrentWindowTabCount(); - getAllTabs(displayResults); + getAllTabs(createPopup); } \ No newline at end of file diff --git a/popup.html b/popup.html index 4df5fbe..f0e399b 100644 --- a/popup.html +++ b/popup.html @@ -16,6 +16,11 @@ padding:10px; border:1px solid #606060; } + #search { + margin:0px 11px 10px 11px; + padding:5px 10px; + width:calc(100% - 20px); + } a.redlink { color: #FF0000; } @@ -25,6 +30,7 @@

+
From 50c1a8e2f3ff591f1feedca6a26b8c070ad4382d Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Fri, 26 Jun 2015 08:13:52 -0600 Subject: [PATCH 2/6] Style improvements to p.box --- popup.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/popup.html b/popup.html index f0e399b..efd3d7a 100644 --- a/popup.html +++ b/popup.html @@ -11,15 +11,12 @@ padding: 0 10px 0 10px; } p.box { - background-color:#F0F0F0; - margin:10px; - padding:10px; - border:1px solid #606060; + margin:15px 0px 10px 0px; } #search { - margin:0px 11px 10px 11px; + margin:0px 0px 10px 0px; padding:5px 10px; - width:calc(100% - 20px); + width:100%; } a.redlink { color: #FF0000; From 3acb379dd701d430e056babc0e13b6717d120055 Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Sat, 14 May 2016 02:27:03 -0600 Subject: [PATCH 3/6] Fixed formatting. --- popup.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/popup.html b/popup.html index efd3d7a..a58829e 100644 --- a/popup.html +++ b/popup.html @@ -11,12 +11,12 @@ padding: 0 10px 0 10px; } p.box { - margin:15px 0px 10px 0px; + margin: 15px 0px 10px 0px; } #search { - margin:0px 0px 10px 0px; - padding:5px 10px; - width:100%; + margin: 0px 0px 10px 0px; + padding: 5px 10px; + width: 100%; } a.redlink { color: #FF0000; @@ -24,11 +24,11 @@ - +

- + \ No newline at end of file From 0b9b88fb0be0f0573f1e594a1fc32cc23c31e9f5 Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Sat, 14 May 2016 02:30:06 -0600 Subject: [PATCH 4/6] Fix for input box sizing issue affecting recent versions of Chrome --- popup.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/popup.html b/popup.html index a58829e..64634a1 100644 --- a/popup.html +++ b/popup.html @@ -15,8 +15,10 @@ } #search { margin: 0px 0px 10px 0px; - padding: 5px 10px; + padding: 5px; width: 100%; + border: 1px solid #ccc; + border-radius: 4px; } a.redlink { color: #FF0000; From ecaa9c69b667a55acb8859911e389682a40e8be8 Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Sat, 14 May 2016 02:35:38 -0600 Subject: [PATCH 5/6] Added a margin to bottom of tabsTable --- popup.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/popup.html b/popup.html index 64634a1..208e4fc 100644 --- a/popup.html +++ b/popup.html @@ -20,6 +20,9 @@ border: 1px solid #ccc; border-radius: 4px; } + #tabsTable { + margin-bottom: 5px; + } a.redlink { color: #FF0000; } From da2a917af54fd6e24504ae2c5c9d24d2a61badc7 Mon Sep 17 00:00:00 2001 From: NextGenDan Date: Sat, 14 May 2016 02:57:57 -0600 Subject: [PATCH 6/6] Force the tab list to wrap at 300px to prevent clipped overflow --- popup.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/popup.html b/popup.html index 208e4fc..8562241 100644 --- a/popup.html +++ b/popup.html @@ -21,7 +21,16 @@ border-radius: 4px; } #tabsTable { + position: relative; margin-bottom: 5px; + right: 3px; + } + #tabsTable tr { + display: block; + width: 300px; + } + #tabsTable td { + padding: 0px 1px; } a.redlink { color: #FF0000;