[feature] add open all links in new tab

This commit is contained in:
zombieFox 2020-02-23 18:30:01 +00:00
parent ec83292655
commit 5416d6393d
8 changed files with 32 additions and 13 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "4.43.0", "version": "4.44.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "4.43.0", "version": "4.44.0",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
<div id="menu-content-groups-openall" class="menu-content-item"> <div id="menu-content-groups-openall" class="menu-content-item">
<div class="menu-item-header"> <div class="menu-item-header">
<h1 class="menu-item-header-text">Open all Bookmarks</h1> <h1 class="menu-item-header-text">Open all</h1>
</div> </div>
<div class="menu-item-form"> <div class="menu-item-form">
<div class="form-wrap"> <div class="form-wrap">

View File

@ -3555,7 +3555,7 @@ var control = (function() {
} }
}, { }, {
element: ".control-link-newtab", element: ".control-link-newtab",
path: "link.newTab", path: "link.item.newTab",
type: "checkbox", type: "checkbox",
func: function() { func: function() {
link.groupAndItems(); link.groupAndItems();

View File

@ -464,12 +464,7 @@ var link = (function() {
}; };
groupOpenallItem.addEventListener("click", function() { groupOpenallItem.addEventListener("click", function() {
console.log(copyStagedGroup.group.items); render.group.openall.all(copyStagedGroup);
copyStagedGroup.group.items.forEach(function(arrayItem, index) {
chrome.tabs.create({
url: arrayItem.url
});
})
}); });
groupHeaderItemOpenall.appendChild(groupOpenall); groupHeaderItemOpenall.appendChild(groupOpenall);
@ -576,6 +571,23 @@ var link = (function() {
} }
}, },
openall: { openall: {
all: function(copyStagedGroup) {
if (state.get.current().link.item.newTab) {
copyStagedGroup.group.items.forEach(function(arrayItem, index) {
chrome.tabs.create({
url: arrayItem.url
});
});
} else {
var first = copyStagedGroup.group.items.shift();
copyStagedGroup.group.items.forEach(function(arrayItem, index) {
chrome.tabs.create({
url: arrayItem.url
});
});
window.location.href = first.url;
};
},
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--group-openall-size", state.get.current().group.openAll.size + "em"); html.style.setProperty("--group-openall-size", state.get.current().group.openAll.size + "em");
@ -644,7 +656,7 @@ var link = (function() {
value: 1 value: 1
}] }]
}; };
if (state.get.current().link.newTab) { if (state.get.current().link.item.newTab) {
linkPanelFrontOptions.attr.push({ linkPanelFrontOptions.attr.push({
key: "target", key: "target",
value: "_blank" value: "_blank"

View File

@ -873,6 +873,13 @@ var update = (function() {
style: "box" style: "box"
}; };
return data; return data;
},
"4.44.0": function(data) {
if (!"newTab" in state.get.current().link.item && "newTab" in state.get.current().link) {
state.get.current().link.item.newTab = state.get.current().link.newTab;
delete state.get.current().link.newTab;
};
return data;
} }
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "4.43.0"; var current = "4.44.0";
var name = "Naughty Goose"; var name = "Naughty Goose";

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_name": "nightTab", "short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "4.43.0", "version": "4.44.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"