Changed new tab workings.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Set click events
|
||||
// Set click events for tab blocks
|
||||
document.addEventListener("click", (e) => {
|
||||
var target = e.target;
|
||||
var targetID = target.id;
|
||||
@@ -15,12 +15,12 @@ document.addEventListener("click", (e) => {
|
||||
if (targetID == "faveIcon")
|
||||
target = parentElm.parentElement;
|
||||
|
||||
id = parseInt(target.getAttribute("tabID"));
|
||||
browser.tabs.update(id, { active: true });
|
||||
|
||||
oldElm.setAttribute("class", "block");
|
||||
oldElm = target;
|
||||
target.setAttribute("class", "block block-focused");
|
||||
|
||||
id = parseInt(target.getAttribute("tabID"));
|
||||
browser.tabs.update(id, { active: true });
|
||||
} else if (targetID == "goTop") {
|
||||
window.scrollTo(0,0);
|
||||
} else if (targetID == "goBottom") {
|
||||
@@ -29,6 +29,8 @@ document.addEventListener("click", (e) => {
|
||||
// Go to selected and 100px up
|
||||
oldElm.scrollIntoView();
|
||||
window.scrollBy(0, -100);
|
||||
} else if (targetID == "newTab") {
|
||||
createTab();
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -11,7 +11,6 @@ function logTabs(tabs) {
|
||||
for (let tab of tabs) {
|
||||
createContainer(tab);
|
||||
}
|
||||
addPlusContainer();
|
||||
// Set poped-out-window position and 100px up from selected elm
|
||||
oldElm.scrollIntoView();
|
||||
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() {
|
||||
tabsAction.create({})
|
||||
.then(function (tab) {
|
||||
|
Reference in New Issue
Block a user