From f0c2a518878b066d12b3c208f804c660a59b6a2b Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Mon, 1 Apr 2019 03:18:14 -0500 Subject: [PATCH] Fixed buttons and improved load times of list. --- README.md | 5 +++-- src/css/tabsSearch.css | 7 +++++-- src/manifest.json | 2 +- src/pages/tabsSearch.html | 36 ++++++++++++++------------------ src/scripts/generateView.js | 41 ++++++++++++++----------------------- 5 files changed, 39 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 5e18d8c..147f1d0 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ Search Firefox tabs and get a list or automatic direct to the searched tab. # Download https://addons.mozilla.org/en-US/firefox/addon/tab-search-and-manage/ -# Version: 1.3.0 +# Version: 1.3.2 ***Note: diff --git a/src/css/tabsSearch.css b/src/css/tabsSearch.css index ccbc321..81a6e4b 100644 --- a/src/css/tabsSearch.css +++ b/src/css/tabsSearch.css @@ -24,13 +24,16 @@ html, body { overflow-x: hidden; } margin-left: 25%; } -#udArrows button { +#udArrows input { font-size: 2em; background-color: rgba(79, 186, 70, 1); color: rgba(255,255,255,1); + width: 1em; + height: 1em; + padding: 0.1em; } -#udArrows button:hover { +#udArrows input:hover { background-color: rgba(152, 152, 152, 1); color: rgba(0,0,0,1); cursor: pointer; diff --git a/src/manifest.json b/src/manifest.json index bca96e9..2a5f58a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Tab Search and Manage", - "version": "1.3.0", + "version": "1.3.2", "description": "This plugin can search, drag-n-drop ordering, and (un)hide all or some tabs.", "applications": { diff --git a/src/pages/tabsSearch.html b/src/pages/tabsSearch.html index 61358b8..60bd0bc 100755 --- a/src/pages/tabsSearch.html +++ b/src/pages/tabsSearch.html @@ -15,30 +15,24 @@
- - - - - - - + + + + + + +
+ + diff --git a/src/scripts/generateView.js b/src/scripts/generateView.js index e9781b9..17f1e3d 100644 --- a/src/scripts/generateView.js +++ b/src/scripts/generateView.js @@ -6,7 +6,6 @@ const listZone = document.getElementById("listZone"); const notFoundText = document.createTextNode("Search not found..."); const tabImg = browser.extension.getURL("icons/tab.png"); var oldElm = ""; -var plusTag = "" var currentWinId = undefined; var newWinId = undefined; var focusedWinID = undefined; @@ -47,13 +46,15 @@ function logTabs(tabs) { } function createContainer(tab) { - var id = tab.id; - var spanTag = document.createElement("DIV"); - var pTag = document.createElement("P"); - var iconText = document.createTextNode(tab.title); - var closeImgTag = document.createElement("IMG"); - var hidnStImgTag = document.createElement("IMG"); - var icoImgTag = document.createElement("IMG"); // Used to properly set bg + var template = document.querySelector('#tabContainerTemplate'); + var clone = document.importNode(template.content, true); + var spanTag = clone.querySelector("#iconElm"); + var closeImgTag = clone.querySelector("#closeBttn"); + var hidnStImgTag = clone.querySelector("#hideTgglBttn"); + var pTag = clone.querySelector(".pTagTitleText"); + var icoImgTag = document.createElement("IMG"); // Used to detect image load failure + var iconText = document.createTextNode(tab.title); + var id = tab.id; // Set oldElm so eventListeners.js has starting ref if (tab.active == true) { @@ -70,13 +71,7 @@ function createContainer(tab) { spanTag.setAttribute("tabID", tab.id); spanTag.title = tab.title; - spanTag.id = "iconElm"; - closeImgTag.id = "closeBttn"; - closeImgTag.className = "closeImg"; closeImgTag.src = "../icons/x.png"; - hidnStImgTag.id = "hideTgglBttn" - hidnStImgTag.className= "hiderImg"; - pTag.className = "pTagTitleText"; if (!tab.hidden) { spanTag.className = "block"; @@ -89,21 +84,15 @@ function createContainer(tab) { spanTag.style.backgroundImage = "url(" + tab.favIconUrl + ")"; icoImgTag.src = tab.favIconUrl; icoImgTag.onerror = function() { spanTag.style.backgroundImage = "url(" + tabImg + ")"; } - - spanTag.appendChild(closeImgTag); - spanTag.appendChild(hidnStImgTag); pTag.appendChild(iconText); - spanTag.appendChild(pTag); - listZone.appendChild(spanTag); + listZone.appendChild(clone); } function createTab() { tabsAction.create({}) .then(function (tab) { createContainer(tab); - }).then(function () { - listZone.appendChild(plusTag); - }); + }) } function onError(error) { console.log(`Error: ${error}`); } @@ -120,14 +109,14 @@ function getTabs() { if (key) { target.title = "Searching curent windows..."; - target.children[0].src = "../icons/windows.png"; + target.src = "../icons/windows.png"; target.setAttribute("searchwindowsmode", true); tabsAction.query({}).then(logTabs, onError) .then(resetWinIndex, onError); } else { target.title = "Searching curent window..."; - target.children[0].src = "../icons/window.png"; + target.src = "../icons/window.png"; target.setAttribute("searchwindowsmode", false); tabsAction.query({currentWindow: true}) @@ -141,8 +130,8 @@ function getTabs() { } async function setSearchMode(target, text, img, state) { - target.title = "Searching " + text + "..."; - target.children[0].src = "../icons/" + img + ".png"; + target.title = "Searching " + text + "..."; + target.src = "../icons/" + img + ".png"; target.setAttribute("searchwindowsmode", state); await storageArea.set({"searchMode": state });