use correct active tab URL

This commit is contained in:
zadam 2020-10-09 23:08:57 +02:00
parent 097d319fca
commit 89984a7d96

View File

@ -1,16 +1,16 @@
// Keyboard shortcuts // Keyboard shortcuts
chrome.commands.onCommand.addListener(async function (command) { chrome.commands.onCommand.addListener(async function (command) {
if(command=="saveSelection") { if (command == "saveSelection") {
await saveSelection(); await saveSelection();
} else if (command == "saveWholePage") { } else if (command == "saveWholePage") {
await saveWholePage(); await saveWholePage();
} else if (command == "saveScreenshot") { } else if (command == "saveScreenshot") {
const activeTab = await getActiveTab(); const activeTab = await getActiveTab();
await saveScreenshot(activeTab);
await saveScreenshot(activeTab.url);
} else { } else {
console.log("Unrecognized command", command); console.log("Unrecognized command", command);
} }
}); });
function cropImage(newArea, dataUrl) { function cropImage(newArea, dataUrl) {
@ -323,7 +323,9 @@ browser.runtime.onMessage.addListener(async request => {
return await browser.tabs.executeScript({file: request.file}); return await browser.tabs.executeScript({file: request.file});
} }
else if (request.name === 'save-screenshot') { else if (request.name === 'save-screenshot') {
return await saveScreenshot(); const activeTab = await getActiveTab();
return await saveScreenshot(activeTab.url);
} }
else if (request.name === 'save-whole-page') { else if (request.name === 'save-whole-page') {
return await saveWholePage(); return await saveWholePage();