Changed new tab workings.

This commit is contained in:
Maxim Stewart 2018-05-13 17:27:16 -05:00
parent e71466a258
commit b3ed754fc4
13 changed files with 21 additions and 31 deletions

View File

@ -4,11 +4,8 @@ Search Firefox tabs and get a list or automatic direct to the searched tab.
# Download # Download
https://addons.mozilla.org/en-US/firefox/addon/tab-search-smarter/ https://addons.mozilla.org/en-US/firefox/addon/tab-search-smarter/
# Version: 1.1.8 # Version: 1.2.0
Added To Top, To Tab, and To Bottom buttons. Changed how new-tab works in the plugin...
Added New Tab button in tab list
Added visual indicator of currently selected tab
Set initial scroll to go to selected tab
# Images # Images

BIN
src/icons/down-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/icons/go2-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
src/icons/tabsGroups_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

BIN
src/icons/tabsGroups_96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

BIN
src/icons/up-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Tab Search", "name": "Tab Search",
"version": "1.1.8", "version": "1.2.0",
"description": "Search Tabs and switch to them quickly.", "description": "Search Tabs and switch to them quickly.",
"applications": { "applications": {

View File

@ -15,9 +15,18 @@
<div id="errorZone" style="display: none;"></div> <div id="errorZone" style="display: none;"></div>
<div id="udArrows"> <div id="udArrows">
<button id="goTop" type="button" title="To Top">&Wedge;</button> <button id="goTop" type="button" title="To Top">
<button id="goToTab" type="button" title="Scroll Current Tab To View">&mdash;</button> <img style="width:1em; height:1em;" src="../icons/up-arrow.png"/>
<button id="goBottom" type="button" title="To Bottom">&Vee;</button> </button>
<button id="goToTab" type="button" title="Scroll Current Tab To View">
<img style="width:1em; height:1em;" src="../icons/go2-arrow.png"/>
</button>
<button id="newTab" type="button" title="New Tab">
<img style="width:1em; height:1em;" src="../icons/plus.png"/>
</button>
<button id="goBottom" type="button" title="To Bottom">
<img style="width:1em; height:1em;" src="../icons/down-arrow.png"/>
</button>
</div> </div>

View File

@ -1,4 +1,4 @@
// Set click events // Set click events for tab blocks
document.addEventListener("click", (e) => { document.addEventListener("click", (e) => {
var target = e.target; var target = e.target;
var targetID = target.id; var targetID = target.id;
@ -15,12 +15,12 @@ document.addEventListener("click", (e) => {
if (targetID == "faveIcon") if (targetID == "faveIcon")
target = parentElm.parentElement; target = parentElm.parentElement;
id = parseInt(target.getAttribute("tabID"));
browser.tabs.update(id, { active: true });
oldElm.setAttribute("class", "block"); oldElm.setAttribute("class", "block");
oldElm = target; oldElm = target;
target.setAttribute("class", "block block-focused"); target.setAttribute("class", "block block-focused");
id = parseInt(target.getAttribute("tabID"));
browser.tabs.update(id, { active: true });
} else if (targetID == "goTop") { } else if (targetID == "goTop") {
window.scrollTo(0,0); window.scrollTo(0,0);
} else if (targetID == "goBottom") { } else if (targetID == "goBottom") {
@ -29,6 +29,8 @@ document.addEventListener("click", (e) => {
// Go to selected and 100px up // Go to selected and 100px up
oldElm.scrollIntoView(); oldElm.scrollIntoView();
window.scrollBy(0, -100); window.scrollBy(0, -100);
} else if (targetID == "newTab") {
createTab();
} }
}); });

View File

@ -11,7 +11,6 @@ function logTabs(tabs) {
for (let tab of tabs) { for (let tab of tabs) {
createContainer(tab); createContainer(tab);
} }
addPlusContainer();
// Set poped-out-window position and 100px up from selected elm // Set poped-out-window position and 100px up from selected elm
oldElm.scrollIntoView(); oldElm.scrollIntoView();
window.scrollBy(0, -100); window.scrollBy(0, -100);
@ -53,23 +52,6 @@ function createContainer(tab) {
} }
} }
function addPlusContainer() {
var spanTag = document.createElement("SPAN");
var centerTag = document.createElement("CENTER");
var icoImgTag = document.createElement("IMG");
spanTag .addEventListener("click", createTab);
spanTag.title = "Open a new tab...";
spanTag.className = "block";
icoImgTag.style = "width: 100%; height:auto";
icoImgTag.src = "../icons/plus.png";
centerTag.appendChild(icoImgTag);
spanTag.appendChild(centerTag);
listZone.appendChild(spanTag);
plusTag = spanTag;
}
function createTab() { function createTab() {
tabsAction.create({}) tabsAction.create({})
.then(function (tab) { .then(function (tab) {