From 939ad42dacfeff566497f3c2f8e9c64d59b8168d Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sat, 25 Jan 2020 19:00:36 +0200 Subject: add global clipboard monitor that spawns popups TODO: refactor the search page clipboard monitor and popup clipboard monitor to use a common ClipboardMonitor class --- ext/bg/js/settings/main.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/bg/js/settings/main.js') diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 4492cd42..ad3459f0 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -28,6 +28,7 @@ function getOptionsFullMutable() { async function formRead(options) { options.general.enable = $('#enable').prop('checked'); + options.general.enableClipboardPopups = $('#enable-clipboard-popups').prop('checked'); options.general.showGuide = $('#show-usage-guide').prop('checked'); options.general.compactTags = $('#compact-tags').prop('checked'); options.general.compactGlossaries = $('#compact-glossaries').prop('checked'); -- cgit v1.2.3 From 37a922adc0721520dac2f376b85ed2c8b5e42e69 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 26 Jan 2020 02:13:01 +0200 Subject: fix settings page checkbox --- ext/bg/js/settings/main.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/bg/js/settings/main.js') diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index ad3459f0..55472a7b 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -105,6 +105,7 @@ async function formRead(options) { async function formWrite(options) { $('#enable').prop('checked', options.general.enable); + $('#enable-clipboard-popups').prop('checked', options.general.enableClipboardPopups); $('#show-usage-guide').prop('checked', options.general.showGuide); $('#compact-tags').prop('checked', options.general.compactTags); $('#compact-glossaries').prop('checked', options.general.compactGlossaries); -- cgit v1.2.3 From 91682dd63334da7acf458a320fbd48bbf7dff766 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 26 Jan 2020 04:16:02 +0200 Subject: add permission check to formRead --- ext/bg/js/settings/main.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'ext/bg/js/settings/main.js') diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 55472a7b..cf0f08db 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -28,7 +28,22 @@ function getOptionsFullMutable() { async function formRead(options) { options.general.enable = $('#enable').prop('checked'); - options.general.enableClipboardPopups = $('#enable-clipboard-popups').prop('checked'); + const enableClipboardPopups = $('#enable-clipboard-popups').prop('checked'); + if (enableClipboardPopups) { + options.general.enableClipboardPopups = await new Promise((resolve, _reject) => { + chrome.permissions.request( + {permissions: ['clipboardRead']}, + (granted) => { + if (!granted) { + $('#enable-clipboard-popups').prop('checked', false); + } + resolve(granted); + } + ); + }); + } else { + options.general.enableClipboardPopups = false; + } options.general.showGuide = $('#show-usage-guide').prop('checked'); options.general.compactTags = $('#compact-tags').prop('checked'); options.general.compactGlossaries = $('#compact-glossaries').prop('checked'); -- cgit v1.2.3