From 93b40e216868662fe831ab5d769f6cd1ac10ee47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Gromnica?= Date: Mon, 3 Feb 2020 20:49:54 +0100 Subject: [PATCH] 2.3.1: * fixed screenshot not working if option for file/clipboard not set * removed unneeded clipboardRead permission --- extension/manifest.json | 5 ++--- extension/page.js | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/extension/manifest.json b/extension/manifest.json index 90bc636..80baf63 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Screenshot YouTube", - "version": "2.3.0", + "version": "2.3.1", "description": "Take a screenshot of any YouTube video with one click.", "icons": { @@ -29,7 +29,6 @@ "https://www.youtube.com/*", "webNavigation", "storage", - "clipboardWrite", - "clipboardRead" + "clipboardWrite" ] } diff --git a/extension/page.js b/extension/page.js index 5cfd3d2..3b8332d 100644 --- a/extension/page.js +++ b/extension/page.js @@ -58,13 +58,13 @@ function CaptureScreenshot() { downloadLink.download = title; canvas.toBlob(async function (blob) { - if (screenshotFunctionality == 0 || screenshotFunctionality == 2) { + if (screenshotFunctionality === 0 || screenshotFunctionality === 2) { // download downloadLink.href = URL.createObjectURL(blob); downloadLink.click(); } - if (screenshotFunctionality == 1 || screenshotFunctionality == 2) { + if (screenshotFunctionality === 1 || screenshotFunctionality === 2) { // clipboard const clipboardItemInput = new ClipboardItem({ "image/png": blob }); await navigator.clipboard.write([clipboardItemInput]); @@ -171,7 +171,10 @@ activePBRButton = speed1xButton; chrome.storage.sync.get(['screenshotKey', 'playbackSpeedButtons', 'screenshotFunctionality'], function(result) { screenshotKey = result.screenshotKey; playbackSpeedButtons = result.playbackSpeedButtons; - screenshotFunctionality = result.screenshotFunctionality; + if (result.screenshotFunctionality === undefined) + screenshotFunctionality = 0; + else + screenshotFunctionality = result.screenshotFunctionality; }); document.addEventListener('keydown', function(e) {