Skip to content

Commit 9e1de7b

Browse files
committed
Don't save an extra snapshot from the context menu.
1 parent f08eaa9 commit 9e1de7b

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

background.js

+4-20
Original file line numberDiff line numberDiff line change
@@ -238,28 +238,12 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
238238
});
239239

240240

241-
chrome.contextMenus.onClicked.addListener(onClickContextMenuSave);
242-
243-
// A generic onclick callback function.
244-
async function onClickContextMenuSave(item, tab) {
245-
const snapshot = new Snapshot(
246-
tab.url,
247-
[],
248-
tab.title,
249-
tab.favIconUrl,
250-
);
251-
252-
// Save the snapshot first
253-
const { snapshots = [] } = await chrome.storage.local.get('snapshots');
254-
snapshots.push(snapshot);
255-
await chrome.storage.local.set({ snapshots });
256-
257-
// Inject scripts - CSS now handled in popup.js
258-
await chrome.scripting.executeScript({
241+
chrome.contextMenus.onClicked.addListener((item, tab) =>
242+
chrome.scripting.executeScript({
259243
target: { tabId: tab.id },
260244
files: ['popup.js']
261-
});
262-
}
245+
})
246+
);
263247

264248
chrome.runtime.onInstalled.addListener(function () {
265249
chrome.contextMenus.removeAll();

0 commit comments

Comments
 (0)