diff --git a/contentScripts/index.js b/contentScripts/index.js index c901fe4..34ffcaf 100644 --- a/contentScripts/index.js +++ b/contentScripts/index.js @@ -38,7 +38,13 @@ export const executeUpdateScroll = (tabId, scrollId) => { executeScript(tabId, 'contentScripts/update.js'); }; -export const showToast = (content, color) => { +export const showToast = async (content, color) => { + const shouldShowToast = (await getItemFromStorage('show-toast-notification'))['show-toast-notification']; + + if (!shouldShowToast) { + return; + } + const svgIcon = ``; document.body.innerHTML += `
${svgIcon} ${content}
`; diff --git a/popup/App.svelte b/popup/App.svelte index 63d9464..0b69e86 100644 --- a/popup/App.svelte +++ b/popup/App.svelte @@ -18,6 +18,8 @@ let savedScrolls = []; + let showToastNotifications = false; + $: controlImage = doesCurrentTabHasSavedScroll ? "icon-32.png" : "icon-32-inactive.png"; @@ -37,6 +39,10 @@ } }); + chrome.storage.local.get("show-toast-notification", (data) => { + showToastNotifications = !!data["show-toast-notification"]; + }); + // Check whether the current tab has a saved scrroll or not chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { const fullUrl = tabs[0].url; @@ -106,6 +112,10 @@ window.close(); } + function handleShowToastNotificationClick() { + showToastNotifications = !showToastNotifications; + chrome.storage.local.set({ "show-toast-notification": showToastNotifications }); + }
@@ -172,6 +182,11 @@
+
+ + +
+ {#if doesCurrentTabHasSavedScroll}

Your saved scrrolls -

@@ -332,4 +347,16 @@ color: #4e80ff; } + .checkbox-container { + display: flex; + align-items: flex-start; + margin: 12px 0px; + } + + .checkbox-container label { + color: white; + font-family: "Roboto", sans-serif; + font-size: 13px; + margin-left: 8px; + }