" +
"
" +
@@ -204,6 +204,7 @@ function RestoreTabs(collectionData, removeCollection = true)
chrome.runtime.sendMessage(
{
command: "restoreTabs",
+ removeCollection: removeCollection,
collectionIndex: Array.prototype.slice.call(collectionData.parentElement.children).indexOf(collectionData) - 1
},
function ()
diff --git a/js/background.js b/js/background.js
index f502723..1a4d8b6 100644
--- a/js/background.js
+++ b/js/background.js
@@ -179,8 +179,8 @@ function SaveCollection()
tabsCount: tabs.length,
titles: tabs.map(tab => tab.title ?? ""),
links: tabs.map(tab => tab.url ?? ""),
- icons: tabs.map(tab => tab.favIconUrl ?? "")//,
- //tumbnails: tabs.map(tab => chrome.tabs.captureVisibleTab)
+ icons: tabs.map(tab => tab.favIconUrl ?? ""),
+ thumbnails: tabs.map(tab => thumbnails.find(i => i.tabId == tab.id)?.url ?? "")
};
var rawData;
@@ -282,4 +282,41 @@ function RemoveTab(collectionIndex, tabIndex)
localStorage.setItem("sets", JSON.stringify(collections));
UpdateTheme();
-}
\ No newline at end of file
+}
+
+var thumbnails = [];
+
+function AppendThumbnail(tabId, cahngeInfo, tab)
+{
+ if (!tab.active || !tab.url.startsWith("http"))
+ return;
+
+ chrome.tabs.captureVisibleTab(
+ {
+ format: "jpeg",
+ quality: 1
+ },
+ function (dataUrl)
+ {
+ if(!dataUrl)
+ {
+ console.log("Failed to retrieve thumbnail");
+ return;
+ }
+
+ console.log("Thumbnail retrieved");
+ var item = thumbnails.find(i => i.tabId == tabId);
+ if (item)
+ item.url = dataUrl;
+ else
+ thumbnails.unshift(
+ {
+ tabId: tabId,
+ url: dataUrl
+ }
+ );
+ }
+ );
+}
+
+chrome.tabs.onUpdated.addListener(AppendThumbnail);
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index d2e141b..22258ec 100644
--- a/manifest.json
+++ b/manifest.json
@@ -8,7 +8,7 @@
[
"tabs",
"unlimitedStorage",
- "activeTab"
+ "
"
],
"icons":