diff --git a/README.md b/README.md index 2072cd7..5ee6a84 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,9 @@ 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.7 -* Fixed scroll to top -* Fixed scroll to bottom -* Improved scroll to current tab time. +# Version: 1.3.8 +* Added tab mute option +* Added to new window option ***Note: diff --git a/src/css/tabsSearch.css b/src/css/tabsSearch.css index cf12681..7e115ba 100644 --- a/src/css/tabsSearch.css +++ b/src/css/tabsSearch.css @@ -25,7 +25,7 @@ html, body { overflow-x: hidden; } #tabControls { position: fixed; z-index: 555; - height: 128px; + height: 152px; padding: 0em 0.4em 0.4em 0.4em; background-color: rgba(9,107,120, 0.85); color: rgb(255,255,255); @@ -120,7 +120,7 @@ html, body { overflow-x: hidden; } scrollbar-width: thin; } -.closeImg, .hiderImg { +.closeImg, .hiderImg, .popoutImg, .muterImg { padding: 0.2em; width: 28px; height: 28px; @@ -140,5 +140,5 @@ html, body { overflow-x: hidden; } .closeImg { float: right; } .block-focused { background-color: rgba(53, 103, 14, 0.8); } .closeImg:hover { background-color: rgba(196, 11, 11, 1); } -.hiderImg:hover { background-color: rgba(30, 129, 22, 1); } +.hiderImg:hover, .popoutImg:hover, .muterImg:hover { background-color: rgba(30, 129, 22, 1); } .hiddenBGColor { background-color: rgba(152, 152, 152, 0.8); } diff --git a/src/icons/isMuted.png b/src/icons/isMuted.png new file mode 100644 index 0000000..f523741 Binary files /dev/null and b/src/icons/isMuted.png differ diff --git a/src/icons/isNotMuted.png b/src/icons/isNotMuted.png new file mode 100644 index 0000000..902c78f Binary files /dev/null and b/src/icons/isNotMuted.png differ diff --git a/src/icons/popout-arrow.png b/src/icons/popout-arrow.png new file mode 100644 index 0000000..df25e9d Binary files /dev/null and b/src/icons/popout-arrow.png differ diff --git a/src/manifest.json b/src/manifest.json index 15a56ee..ab471ce 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Tab Search and Manage", - "version": "1.3.7", + "version": "1.3.8", "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 0eb75e9..80d55fc 100755 --- a/src/pages/tabsSearch.html +++ b/src/pages/tabsSearch.html @@ -26,8 +26,10 @@
diff --git a/src/scripts/eventListeners.js b/src/scripts/eventListeners.js index 215c63c..c275ad5 100644 --- a/src/scripts/eventListeners.js +++ b/src/scripts/eventListeners.js @@ -18,6 +18,18 @@ document.addEventListener("click", (e) => { if (hoverTarget) { closeBttnAction(hoverTarget, hoverTarget.id); } + } else if (targetID == "hideTgglBttn") { + if (hoverTarget) { + hideSelectedTabAction(hoverTarget, hoverTarget.id); + } + } else if (targetID == "popoutBttn") { + if (hoverTarget) { + popoutSelectedTabAction(hoverTarget, hoverTarget.id); + } + } else if (targetID == "muteTgglBttn") { + if (hoverTarget) { + muteSelectedTabAction(hoverTarget, hoverTarget.id); + } } else if (targetID == "iconElm") { setNewTabAction(target, targetID, parentElm, id); } else if (targetID == "goTop") { @@ -32,10 +44,6 @@ document.addEventListener("click", (e) => { createTab(); } else if (targetID == "newWin") { createWin(); - } else if (targetID == "hideTgglBttn") { - if (hoverTarget) { - hideSelectedTabAction(hoverTarget, hoverTarget.id); - } } else if (targetID == "hideAllBttn") { showHideTabsAction(0) } else if (targetID == "showAllBttn") { @@ -46,7 +54,7 @@ document.addEventListener("click", (e) => { }); function closeBttnAction(target, targetID) { - parentElm = target.parentElement; + let parentElm = target.parentElement; if (target == oldElm) { var index = Array.from(parentElm.children).indexOf(target); @@ -75,6 +83,12 @@ function setNewTabAction(target, targetID, parentElm, id) { document.getElementById("tabControls").querySelector("#hideTgglBttn").src = "../icons/eyeOpen.png"; } +function popoutSelectedTabAction(target, targetID) { + parentElm = target.parentElement; + id = parseInt(target.getAttribute("tabID")); + popoutSelectedTab(id); +} + function hideSelectedTabAction(target, targetID) { parentElm = target.parentElement; id = parseInt(target.getAttribute("tabID")); @@ -84,6 +98,7 @@ function hideSelectedTabAction(target, targetID) { if (control.src.includes("eyeClosed.png")) { target.setAttribute("class", "block"); control.src = "../icons/eyeOpen.png"; + // In generateview unhideSelectedTab(id); } else { target.setAttribute("class", "block hiddenBGColor"); @@ -93,6 +108,22 @@ function hideSelectedTabAction(target, targetID) { } } +function muteSelectedTabAction(target, targetID) { + parentElm = target.parentElement; + id = parseInt(target.getAttribute("tabID")); + control = document.getElementById("tabControls").querySelector("#muteTgglBttn"); + + if (control.src.includes("isMuted.png")) { + control.src = "../icons/isNotMuted.png"; + // In generateview + unmuteSelectedTab(id); + } else { + control.src = "../icons/isMuted.png"; + muteSelectedTab(id); + } +} + + function setSearchModeAction(target, targetID, parentElm, id) { var currentMode = target.getAttribute("searchwindowsmode"); if (currentMode == "true") { diff --git a/src/scripts/generateView.js b/src/scripts/generateView.js index 9dcaff4..c3ff3e8 100644 --- a/src/scripts/generateView.js +++ b/src/scripts/generateView.js @@ -13,6 +13,39 @@ let newWinId = undefined; let focusedWinID = undefined; let windowIndex = 0; + + + +function popoutSelectedTab(id) { + const randomWinId = Math.floor(Math.random() * 99999); + windowsAction.create({tabId: id}); +} + +function unhideSelectedTab(id) { + tabsAction.show(id).then(successMsg, errMsg); +} + +function hideSelectedTab(id) { + tabsAction.hide(id).then(successMsg, errMsg); +} + +function muteSelectedTab(id) { + tabsAction.update( + id, + {muted: true} + ) +} + +function unmuteSelectedTab(id) { + tabsAction.update( + id, + {muted: false} + ) +} + + + + function logTabs(tabs) { windowIndex = 0; @@ -79,6 +112,7 @@ function createContainer(tab) { else spanTag.className = "block hiddenBGColor"; + spanTag.style.backgroundImage = "url(" + tab.favIconUrl + ")"; icoImgTag.src = tab.favIconUrl; icoImgTag.onerror = function() { spanTag.style.backgroundImage = "url(" + tabImg + ")"; } @@ -102,9 +136,11 @@ function createWin() { windowsAction.create({}); } -function moveTabControlTo(elm) { +async function moveTabControlTo(elm) { let tabControls = document.getElementById("tabControls"); let hideTgglBttn = tabControls.querySelector("#hideTgglBttn") + let muteTgglBttn = tabControls.querySelector("#muteTgglBttn") + let rect = elm.getBoundingClientRect(); tabControls.style.left = (rect.left - 46) + "px"; tabControls.style.top = rect.top + "px"; @@ -115,6 +151,14 @@ function moveTabControlTo(elm) { else hideTgglBttn.src = "../icons/eyeOpen.png"; + + id = parseInt(hoverTarget.getAttribute("tabID")); + tab = await tabsAction.get(id); + if (tab.mutedInfo.muted == false) + muteTgglBttn.src = "../icons/isNotMuted.png"; + else + muteTgglBttn.src = "../icons/isMuted.png"; + tabControls.style.display = ""; } diff --git a/src/scripts/showHideLogic.js b/src/scripts/showHideLogic.js index e1ad770..c5aceb9 100644 --- a/src/scripts/showHideLogic.js +++ b/src/scripts/showHideLogic.js @@ -1,12 +1,3 @@ -// tabsAction.discard(id); -function unhideSelectedTab(id) { - tabsAction.show(id).then(successMsg, errMsg); -} - -function hideSelectedTab(id) { - tabsAction.hide(id).then(successMsg, errMsg); -} - function successMsg(ev) { console.log("Tab is hidden..." + ev); } function errMsg(ev) {