mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-07-02 19:52:47 +03:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb45f1a7b3 | |||
| 2b83f3bd60 |
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
[](https://twitter.com/xfox111)
|
[](https://twitter.com/xfox111)
|
||||||
[](https://github.com/xfox111)
|
[](https://github.com/xfox111)
|
||||||
|
[](https://buymeacoffee.com/xfox111)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -31,11 +31,16 @@
|
|||||||
<button title="Options"></button>
|
<button title="Options"></button>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
|
<p>
|
||||||
|
<input type="checkbox" id="loadOnRestore"/>
|
||||||
|
<label for="loadOnRestore">Load tabs on restore</label>
|
||||||
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<button value="https://github.com/xfox111/ChromiumTabsAside">Visit GitHub page</button>
|
<button value="https://github.com/xfox111/ChromiumTabsAside">Visit GitHub page</button>
|
||||||
|
<button value="https://github.com/XFox111/ChromiumTabsAside/graphs/contributors">Project contributors</button>
|
||||||
<button value="https://chrome.google.com/webstore/detail/tabs-aside/mgmjbodjgijnebfgohlnjkegdpbdjgin">Leave feedback</button>
|
<button value="https://chrome.google.com/webstore/detail/tabs-aside/mgmjbodjgijnebfgohlnjkegdpbdjgin">Leave feedback</button>
|
||||||
<button value="https://buymeacoffee.com/xfox111">Buy me a coffee!</button>
|
<button value="https://buymeacoffee.com/xfox111">Buy me a coffee!</button>
|
||||||
<button hidden>Backup saved tabs</button>
|
<!-- <button hidden>Backup saved tabs</button> -->
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<small>v1.0</small><br />
|
<small>v1.0</small><br />
|
||||||
|
|||||||
@@ -6,8 +6,13 @@
|
|||||||
<button title="Options"></button>
|
<button title="Options"></button>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
|
<p>
|
||||||
|
<input type="checkbox" id="loadOnRestore"/>
|
||||||
|
<label for="loadOnRestore">Load tabs on restore</label>
|
||||||
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<button value="https://github.com/xfox111/ChromiumTabsAside">Visit GitHub page</button>
|
<button value="https://github.com/xfox111/ChromiumTabsAside">Visit GitHub page</button>
|
||||||
|
<button value="https://github.com/XFox111/ChromiumTabsAside/graphs/contributors">Project contributors</button>
|
||||||
<button value="https://chrome.google.com/webstore/detail/tabs-aside/mgmjbodjgijnebfgohlnjkegdpbdjgin">Leave feedback</button>
|
<button value="https://chrome.google.com/webstore/detail/tabs-aside/mgmjbodjgijnebfgohlnjkegdpbdjgin">Leave feedback</button>
|
||||||
<button value="https://buymeacoffee.com/xfox111">Buy me a coffee!</button>
|
<button value="https://buymeacoffee.com/xfox111">Buy me a coffee!</button>
|
||||||
<!--<button hidden>Backup saved tabs</button>-->
|
<!--<button hidden>Backup saved tabs</button>-->
|
||||||
|
|||||||
+49
-3
@@ -37,6 +37,28 @@ else
|
|||||||
|
|
||||||
document.querySelector(".tabsAside .saveTabs").onclick = SetTabsAside;
|
document.querySelector(".tabsAside .saveTabs").onclick = SetTabsAside;
|
||||||
|
|
||||||
|
document.querySelector("nav > p > small").textContent = chrome.runtime.getManifest()["version"];
|
||||||
|
|
||||||
|
var loadOnRestoreCheckbox = document.querySelector("nav > p > input[type=checkbox]");
|
||||||
|
chrome.storage.sync.get({ "loadOnRestore": false },
|
||||||
|
values => loadOnRestoreCheckbox.checked = values.loadOnRestore
|
||||||
|
);
|
||||||
|
chrome.storage.onChanged.addListener(function (changes, namespace) {
|
||||||
|
if (namespace == 'sync'){
|
||||||
|
for (key in changes) {
|
||||||
|
if (key === 'loadOnRestore') {
|
||||||
|
loadOnRestoreCheckbox.checked = changes[key].newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
loadOnRestoreCheckbox.addEventListener("click", function ()
|
||||||
|
{
|
||||||
|
chrome.storage.sync.set(
|
||||||
|
{
|
||||||
|
"loadOnRestore": loadOnRestoreCheckbox.checked
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll(".tabsAside.pane > header nav button").forEach(i =>
|
document.querySelectorAll(".tabsAside.pane > header nav button").forEach(i =>
|
||||||
{
|
{
|
||||||
@@ -98,6 +120,29 @@ function InitializeStandalone()
|
|||||||
|
|
||||||
document.querySelector(".tabsAside .saveTabs").onclick = SetTabsAside;
|
document.querySelector(".tabsAside .saveTabs").onclick = SetTabsAside;
|
||||||
|
|
||||||
|
document.querySelector("nav > p > small").textContent = chrome.runtime.getManifest()["version"];
|
||||||
|
|
||||||
|
var loadOnRestoreCheckbox = document.querySelector("nav > p > input[type=checkbox]");
|
||||||
|
chrome.storage.sync.get({ "loadOnRestore": false },
|
||||||
|
values => loadOnRestoreCheckbox.checked = values.loadOnRestore
|
||||||
|
);
|
||||||
|
chrome.storage.onChanged.addListener(function (changes, namespace) {
|
||||||
|
if (namespace == 'sync'){
|
||||||
|
for (key in changes) {
|
||||||
|
if (key === 'loadOnRestore') {
|
||||||
|
loadOnRestoreCheckbox.checked = changes[key].newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
loadOnRestoreCheckbox.addEventListener("click", function ()
|
||||||
|
{
|
||||||
|
chrome.storage.sync.set(
|
||||||
|
{
|
||||||
|
"loadOnRestore": loadOnRestoreCheckbox.checked
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll(".tabsAside.pane > header nav button").forEach(i =>
|
document.querySelectorAll(".tabsAside.pane > header nav button").forEach(i =>
|
||||||
{
|
{
|
||||||
i.onclick = function () { window.open(i.value, '_blank'); };
|
i.onclick = function () { window.open(i.value, '_blank'); };
|
||||||
@@ -142,8 +187,8 @@ function AddCollection(collection)
|
|||||||
"<button title='More...'></button>" +
|
"<button title='More...'></button>" +
|
||||||
"<nav>" +
|
"<nav>" +
|
||||||
"<button>Restore without removing</button>" +
|
"<button>Restore without removing</button>" +
|
||||||
"<button hidden>Add tabs to favorites</button>" +
|
// "<button hidden>Add tabs to favorites</button>" +
|
||||||
"<button hidden>Share tabs</button>" +
|
// "<button hidden>Share tabs</button>" +
|
||||||
"</nav>" +
|
"</nav>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"<button title='Remove collection'></button>" +
|
"<button title='Remove collection'></button>" +
|
||||||
@@ -164,7 +209,8 @@ function AddCollection(collection)
|
|||||||
|
|
||||||
list.querySelectorAll("div > div:last-child > div > span").forEach(i =>
|
list.querySelectorAll("div > div:last-child > div > span").forEach(i =>
|
||||||
{
|
{
|
||||||
i.onclick = function () {
|
i.onclick = function ()
|
||||||
|
{
|
||||||
chrome.runtime.sendMessage(
|
chrome.runtime.sendMessage(
|
||||||
{
|
{
|
||||||
command: "openTab",
|
command: "openTab",
|
||||||
|
|||||||
+36
-36
@@ -1,8 +1,8 @@
|
|||||||
chrome.browserAction.onClicked.addListener(function (tab)
|
chrome.browserAction.onClicked.addListener(function (tab)
|
||||||
{
|
{
|
||||||
if (tab.url.startsWith("http")
|
if (tab.url.startsWith("http")
|
||||||
&& !tab.url.includes("chrome.google.com")
|
&& !tab.url.includes("chrome.google.com")
|
||||||
&& !tab.url.includes("microsoftedge.microsoft.com"))
|
&& !tab.url.includes("microsoftedge.microsoft.com"))
|
||||||
{
|
{
|
||||||
chrome.tabs.insertCSS(
|
chrome.tabs.insertCSS(
|
||||||
{
|
{
|
||||||
@@ -37,25 +37,22 @@ chrome.browserAction.onClicked.addListener(function (tab)
|
|||||||
chrome.tabs.create({
|
chrome.tabs.create({
|
||||||
url: chrome.extension.getURL("TabsAside.html"),
|
url: chrome.extension.getURL("TabsAside.html"),
|
||||||
active: true
|
active: true
|
||||||
});
|
},
|
||||||
|
chrome.tabs.onActivated.addListener(function TabsAsideCloser(activeInfo) {
|
||||||
|
chrome.tabs.query({ url: chrome.extension.getURL("TabsAside.html") }, function (result) {
|
||||||
|
if (result.length)
|
||||||
|
setTimeout(function () {
|
||||||
|
result.forEach(i => {
|
||||||
|
if (activeInfo.tabId != i.id)
|
||||||
|
chrome.tabs.remove(i.id);
|
||||||
|
});
|
||||||
|
}, 200);
|
||||||
|
else chrome.tabs.onActivated.removeListener(TabsAsideCloser);
|
||||||
|
});
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.tabs.onActivated.addListener(function (activeInfo)
|
|
||||||
{
|
|
||||||
chrome.tabs.query({ url: chrome.extension.getURL("TabsAside.html") }, function (result)
|
|
||||||
{
|
|
||||||
if (result.length)
|
|
||||||
setTimeout(function ()
|
|
||||||
{
|
|
||||||
result.forEach(i =>
|
|
||||||
{
|
|
||||||
if (activeInfo.tabId != i.id)
|
|
||||||
chrome.tabs.remove(i.id);
|
|
||||||
});
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function UpdateTheme()
|
function UpdateTheme()
|
||||||
{
|
{
|
||||||
@@ -150,22 +147,10 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse)
|
|||||||
});
|
});
|
||||||
|
|
||||||
UpdateTheme();
|
UpdateTheme();
|
||||||
chrome.windows.onCreated.addListener(UpdateTheme);
|
|
||||||
chrome.windows.onRemoved.addListener(UpdateTheme);
|
|
||||||
chrome.windows.onFocusChanged.addListener(UpdateTheme);
|
chrome.windows.onFocusChanged.addListener(UpdateTheme);
|
||||||
|
|
||||||
chrome.tabs.onUpdated.addListener(UpdateTheme);
|
chrome.tabs.onUpdated.addListener(UpdateTheme);
|
||||||
chrome.tabs.onCreated.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onMoved.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onSelectionChanged.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onActiveChanged.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onActivated.addListener(UpdateTheme);
|
chrome.tabs.onActivated.addListener(UpdateTheme);
|
||||||
chrome.tabs.onHighlightChanged.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onHighlighted.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onDetached.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onAttached.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onRemoved.addListener(UpdateTheme);
|
|
||||||
chrome.tabs.onReplaced.addListener(UpdateTheme);
|
|
||||||
|
|
||||||
function SaveCollection()
|
function SaveCollection()
|
||||||
{
|
{
|
||||||
@@ -202,11 +187,13 @@ function SaveCollection()
|
|||||||
|
|
||||||
collections = JSON.parse(localStorage.getItem("sets"));
|
collections = JSON.parse(localStorage.getItem("sets"));
|
||||||
|
|
||||||
chrome.tabs.remove(rawTabs.filter(i => !i.url.startsWith("chrome-extension") && !i.url.endsWith("TabsAside.html") && !i.pinned).map(tab => tab.id));
|
var newTabId;
|
||||||
chrome.tabs.create({});
|
chrome.tabs.create({}, function(tab) { newTabId = tab.id; });
|
||||||
});
|
|
||||||
|
chrome.tabs.remove(rawTabs.filter(i => !i.url.startsWith("chrome-extension") && !i.url.endsWith("TabsAside.html") && !i.pinned && i.id != newTabId).map(tab => tab.id));
|
||||||
|
|
||||||
UpdateTheme();
|
UpdateTheme();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteCollection(collectionIndex)
|
function DeleteCollection(collectionIndex)
|
||||||
@@ -225,7 +212,20 @@ function RestoreCollection(collectionIndex, removeCollection)
|
|||||||
{
|
{
|
||||||
url: i,
|
url: i,
|
||||||
active: false
|
active: false
|
||||||
|
} , function (createdTab)
|
||||||
|
{
|
||||||
|
chrome.storage.sync.get({ "loadOnRestore" : false }, values => {
|
||||||
|
if (!values.loadOnRestore)
|
||||||
|
chrome.tabs.onUpdated.addListener(function discarder(updatedTabId, changeInfo, updatedTab) {
|
||||||
|
if (updatedTabId === createdTab.id) {
|
||||||
|
chrome.tabs.onUpdated.removeListener(discarder);
|
||||||
|
if (!updatedTab.active) {
|
||||||
|
chrome.tabs.discard(updatedTabId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!removeCollection)
|
if (!removeCollection)
|
||||||
@@ -304,7 +304,7 @@ function AppendThumbnail(tabId, cahngeInfo, tab)
|
|||||||
},
|
},
|
||||||
function (dataUrl)
|
function (dataUrl)
|
||||||
{
|
{
|
||||||
if(!dataUrl)
|
if (!dataUrl)
|
||||||
{
|
{
|
||||||
console.log("Failed to retrieve thumbnail");
|
console.log("Failed to retrieve thumbnail");
|
||||||
return;
|
return;
|
||||||
@@ -325,4 +325,4 @@ function AppendThumbnail(tabId, cahngeInfo, tab)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.tabs.onUpdated.addListener(AppendThumbnail);
|
chrome.tabs.onUpdated.addListener(AppendThumbnail);
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Tabs Aside",
|
"name": "Tabs Aside",
|
||||||
"version": "1.3",
|
"version": "1.4",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Classic Microsoft Edge \"Tabs Aside\" feature for Chromium browsers",
|
"description": "Classic Microsoft Edge \"Tabs Aside\" feature for Chromium browsers",
|
||||||
"author": "Michael \"XFox\" Gordeev",
|
"author": "Michael \"XFox\" Gordeev",
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
[
|
[
|
||||||
"tabs",
|
"tabs",
|
||||||
"unlimitedStorage",
|
"unlimitedStorage",
|
||||||
|
"storage",
|
||||||
"<all_urls>"
|
"<all_urls>"
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -24,6 +25,6 @@
|
|||||||
"background":
|
"background":
|
||||||
{
|
{
|
||||||
"scripts": [ "js/background.js" ],
|
"scripts": [ "js/background.js" ],
|
||||||
"persistent": true
|
"persistent": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user