Fixed auto-scroll into view of currently selected tab.
This commit is contained in:
parent
7feec057a5
commit
5afaf1d6a0
|
@ -4,9 +4,9 @@ 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-and-manage/
|
https://addons.mozilla.org/en-US/firefox/addon/tab-search-and-manage/
|
||||||
|
|
||||||
# Version: 1.2.9
|
# Version: 1.3.0
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed window selection issue.</li>
|
<li>Fixed auto-scroll into view of currently selected tab.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
***Note:
|
***Note:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Tab Search and Manage",
|
"name": "Tab Search and Manage",
|
||||||
"version": "1.2.9",
|
"version": "1.3.0",
|
||||||
"description": "This plugin can search, drag-n-drop ordering, and (un)hide all or some tabs.",
|
"description": "This plugin can search, drag-n-drop ordering, and (un)hide all or some tabs.",
|
||||||
|
|
||||||
"applications": {
|
"applications": {
|
||||||
|
|
|
@ -18,9 +18,7 @@ document.addEventListener("click", (e) => {
|
||||||
} else if (targetID == "goBottom") {
|
} else if (targetID == "goBottom") {
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
} else if (targetID == "goToTab") {
|
} else if (targetID == "goToTab") {
|
||||||
// Go to selected and 100px up
|
scrollToView(200);
|
||||||
oldElm.scrollIntoView();
|
|
||||||
window.scrollBy(0, -100);
|
|
||||||
} else if (targetID == "newTab") {
|
} else if (targetID == "newTab") {
|
||||||
createTab();
|
createTab();
|
||||||
} else if (targetID == "hideTgglBttn") {
|
} else if (targetID == "hideTgglBttn") {
|
||||||
|
@ -34,7 +32,7 @@ document.addEventListener("click", (e) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function closeBttnAction(var target, var targetID, var parentElm, var id) {
|
function closeBttnAction(target, targetID, parentElm, id) {
|
||||||
if (parentElm == oldElm) {
|
if (parentElm == oldElm) {
|
||||||
var index = Array.from(parentElm.parentElement.children).indexOf(parentElm);
|
var index = Array.from(parentElm.parentElement.children).indexOf(parentElm);
|
||||||
(index - 1 < 0) ? index++ : index-- ; // Check what index to chose
|
(index - 1 < 0) ? index++ : index-- ; // Check what index to chose
|
||||||
|
@ -51,7 +49,7 @@ function closeBttnAction(var target, var targetID, var parentElm, var id) {
|
||||||
parentElm.parentElement.removeChild(parentElm);
|
parentElm.parentElement.removeChild(parentElm);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNewTabAction(var target, var targetID, var parentElm, var id) {
|
function setNewTabAction(target, targetID, parentElm, id) {
|
||||||
id = parseInt(target.getAttribute("tabID"));
|
id = parseInt(target.getAttribute("tabID"));
|
||||||
tabsAction.get(id).then((tab) => {
|
tabsAction.get(id).then((tab) => {
|
||||||
browser.windows.update(tab.windowId, {focused: true});
|
browser.windows.update(tab.windowId, {focused: true});
|
||||||
|
@ -61,7 +59,7 @@ function setNewTabAction(var target, var targetID, var parentElm, var id) {
|
||||||
setOldElm(target);
|
setOldElm(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSelectedTabAction(var target, var targetID, var parentElm, var id) {
|
function hideSelectedTabAction(target, targetID, parentElm, id) {
|
||||||
id = parseInt(parentElm.getAttribute("tabID"));
|
id = parseInt(parentElm.getAttribute("tabID"));
|
||||||
|
|
||||||
if (id != oldElm.getAttribute("tabID")) {
|
if (id != oldElm.getAttribute("tabID")) {
|
||||||
|
@ -77,7 +75,7 @@ function hideSelectedTabAction(var target, var targetID, var parentElm, var id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSearchModeAction(var target, var targetID, var parentElm, var id) {
|
function setSearchModeAction(target, targetID, parentElm, id) {
|
||||||
var currentMode = target.getAttribute("searchwindowsmode");
|
var currentMode = target.getAttribute("searchwindowsmode");
|
||||||
if (currentMode == "true") {
|
if (currentMode == "true") {
|
||||||
// In generateview
|
// In generateview
|
||||||
|
@ -94,3 +92,11 @@ function setOldElm(target) {
|
||||||
oldElm = target;
|
oldElm = target;
|
||||||
target.setAttribute("class", "block block-focused");
|
target.setAttribute("class", "block block-focused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollToView(time) {
|
||||||
|
setTimeout(function () {
|
||||||
|
// Go to selected and 100px up
|
||||||
|
oldElm.scrollIntoView();
|
||||||
|
window.scrollBy(0, -100);
|
||||||
|
}, time);
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ function logTabs(tabs) {
|
||||||
windowIndex = 0;
|
windowIndex = 0;
|
||||||
|
|
||||||
tabsAction.query({currentWindow: true, active: true}).then((tab) => {
|
tabsAction.query({currentWindow: true, active: true}).then((tab) => {
|
||||||
console.log(tab);
|
|
||||||
focusedWinID = tab[0].windowId;
|
focusedWinID = tab[0].windowId;
|
||||||
}, focusedWinID).then(() => {
|
}, focusedWinID).then(() => {
|
||||||
for (let tab of tabs) {
|
for (let tab of tabs) {
|
||||||
|
@ -44,9 +43,7 @@ function logTabs(tabs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
newWinId = undefined;
|
newWinId = undefined;
|
||||||
// Set poped-out-window position and 100px up from selected elm
|
scrollToView(800);
|
||||||
oldElm.scrollIntoView();
|
|
||||||
window.scrollBy(0, -100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createContainer(tab) {
|
function createContainer(tab) {
|
||||||
|
|
Loading…
Reference in New Issue