Changed scroll logic and timings

This commit is contained in:
Maxim Stewart 2020-03-27 14:34:04 -05:00
parent 3edbf0ab70
commit 640b9acdb4
4 changed files with 17 additions and 10 deletions

View File

@ -4,8 +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.6
* Added create new window button
# Version: 1.3.7
* Fixed scroll to top
* Fixed scroll to bottom
* Improved scroll to current tab time.
***Note:

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Tab Search and Manage",
"version": "1.3.6",
"version": "1.3.7",
"description": "This plugin can search, drag-n-drop ordering, and (un)hide all or some tabs.",
"applications": {

View File

@ -2,6 +2,11 @@ document.getElementById("searchBar").onkeyup = function () {
searchTabs();
}
window.onload = async () => {
getTabs();
}
// Set click events for tab blocks
document.addEventListener("click", (e) => {
var target = (!e.target.className.includes("pTagTitleText")) ? e.target : e.target.parentElement;
@ -16,11 +21,13 @@ document.addEventListener("click", (e) => {
} else if (targetID == "iconElm") {
setNewTabAction(target, targetID, parentElm, id);
} else if (targetID == "goTop") {
window.scrollTo(0,0);
const elm = document.getElementById("listZone");
elm.scrollTo(0,0);
} else if (targetID == "goBottom") {
window.scrollTo(0, document.body.scrollHeight);
const elm = document.getElementById("listZone");
elm.scrollTo(0,elm.scrollHeight);
} else if (targetID == "goToTab") {
scrollToView(200);
scrollToView();
} else if (targetID == "newTab") {
createTab();
} else if (targetID == "newWin") {
@ -103,7 +110,7 @@ function setOldElm(target) {
target.setAttribute("class", "block block-focused");
}
function scrollToView(time) {
function scrollToView(time = 200) {
setTimeout(function () {
// Go to selected and 100px up
oldElm.scrollIntoView();

View File

@ -44,7 +44,7 @@ function logTabs(tabs) {
});
newWinId = undefined;
scrollToView(800);
scrollToView();
}
function createContainer(tab) {
@ -170,5 +170,3 @@ function clearNodes(targetNode) {
function resetWinIndex() {
windowIndex = 0;
}
getTabs();