diff --git a/html/nap-room.html b/html/nap-room.html index 0c660ce..bd40580 100644 --- a/html/nap-room.html +++ b/html/nap-room.html @@ -17,7 +17,8 @@
-
+
+

Snoozz has been updated  ðŸŽ‰

This version is a huge update that brings in one of the most requested features.

diff --git a/html/rise-and-shine.html b/html/rise-and-shine.html index 07ad26c..8bd6ac6 100644 --- a/html/rise-and-shine.html +++ b/html/rise-and-shine.html @@ -32,6 +32,7 @@
+ diff --git a/html/settings.html b/html/settings.html index 1553c3e..98f800c 100644 --- a/html/settings.html +++ b/html/settings.html @@ -233,7 +233,7 @@

Custom Keyboard Shortcuts

Instructions -
Firefox shortcuts can only be configured on a different page, outside of this extension. To configure your custom shortcuts:
+
Firefox shortcuts can only be configured on a different page, outside of this extension. To configure your custom shortcuts:
  1. Open the Firefox Add-Ons page in a new tab: about:addons (Click URL to copy).
  2. Click on the gear icon in the top right and select Manage Extension Shortcuts.
  3. diff --git a/manifest.json b/manifest.json index 6aa80d6..c6dafa5 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Snoozz - Snooze Tabs & Windows for later", "short_name": "Snoozz", "description": "Declutter your browser by snoozing tabs and windows until you actually need them.", - "version": "2.4.4.3", + "version": "2.5.0", "icons": { "128": "icons/ext-icon-128.png", diff --git a/scripts/background.js b/scripts/background.js index 1053688..a1cb42d 100644 --- a/scripts/background.js +++ b/scripts/background.js @@ -58,8 +58,10 @@ async function wakeUpTask(cachedTabs) { var debounce; async function setNextAlarm(tabs) { - var next = sleeping(tabs).filter(t => t.wakeUpTime && !t.paused).reduce((t1,t2) => t1.wakeUpTime < t2.wakeUpTime ? t1 : t2); - if (next && next.wakeUpTime <= dayjs().valueOf()) { + var next = sleeping(tabs).filter(t => t.wakeUpTime && !t.paused); + next = next.length ? next.reduce((t1,t2) => t1.wakeUpTime < t2.wakeUpTime ? t1 : t2) : undefined; + if (!next) return; + if (next.wakeUpTime <= dayjs().valueOf()) { clearTimeout(debounce) debounce = setTimeout(_ => wakeMeUp(tabs), 3000) } else { diff --git a/scripts/common.js b/scripts/common.js index dc089ed..0623b9b 100644 --- a/scripts/common.js +++ b/scripts/common.js @@ -224,7 +224,7 @@ async function snoozeTab(snoozeTime, overrideTab) { if (!activeTab || !activeTab.url) return {}; var sleepyTab = { id: getRandomId(), - title: activeTab.title ?? getBetterUrl(activeTab.url), + title: activeTab.title || getBetterUrl(activeTab.url), url: activeTab.url, ...activeTab.pinned ? {pinned: true} : {}, wakeUpTime: snoozeTime === 'startup' ? dayjs().add(20, 'y').valueOf() : dayjs(snoozeTime).valueOf(), @@ -297,7 +297,7 @@ async function snoozeRecurring(target, data) { var activeTab = validTabs && validTabs.length ? validTabs[0] : await getTabsInWindow(true); if (!activeTab || !activeTab.url) return {}; Object.assign(sleepyObj, { - title: activeTab.title ?? getBetterUrl(activeTab.url), + title: activeTab.title || getBetterUrl(activeTab.url), url: activeTab.url, ...activeTab.pinned ? {pinned: true} : {}, }); @@ -325,7 +325,7 @@ async function getTimeWithModifier(choice) { var options = await getOptions(['morning', 'evening', 'popup']); var modifier = options.popup ? options.popup[choice] : ''; options = upgradeSettings(options); - var m = options[modifier] ?? [dayjs().hour(), dayjs().minute()]; + var m = options[modifier] || [dayjs().hour(), dayjs().minute()]; return dayjs(c.time).add(m[0], 'h').add(m[1], 'm'); } @@ -445,7 +445,6 @@ async function getChoices(which) { } async function calculateNextSnoozeTime(data) { - console.log(data); var NOW = dayjs(), TYPE = data.type, [HOUR, MINUTE] = data.time; if (TYPE === 'hourly') { var isNextHour = NOW.minute() >= MINUTE ? 1 : 0; @@ -650,7 +649,7 @@ var bgLog = (logs, colors, timestampColor = 'grey') => { colors.unshift(timestampColor); colors = colors.flatMap((v,i,a)=>i !== a.length ? [v, ''] : v).map(c => { var colors = {green:'limegreen', red:'crimson', blue:'dodgerblue', yellow:'gold', pink:'violet', grey:'slategrey', white: 'navajowhite'} - return 'color:' + (colors[c] ?? 'unset') + return 'color:' + (colors[c] || 'unset') }) console.log(timestamp + logs, ...colors) } diff --git a/scripts/popup.js b/scripts/popup.js index 5a90aa5..8533880 100644 --- a/scripts/popup.js +++ b/scripts/popup.js @@ -480,7 +480,6 @@ async function modify(time, choice) { async function snooze(time, choice) { time = ['weekend', 'monday', 'week', 'month'].includes(choice.id) ? await getTimeWithModifier(choice.id) : time; - if (isInEditMode || isInDupeMode) return modify(time, choice); var response, target = document.querySelector('.target.active'); if (!['tab', 'window', 'selection', 'group'].includes(target.id)) return; @@ -502,16 +501,17 @@ async function snooze(time, choice) { data.monthly = document.getElementById('monthly')._flatpickr.selectedDates.map(d => dayjs(d).date()).sort(desc); } } - response = await snoozeRecurring(target.id, data); + return response = await snoozeRecurring(target.id, data); // response = await snoozeRecurring(target.id, time, repeat, data); - } else { - if (target.id === 'tab') { - response = await snoozeTab(time); - } else if (target.id === 'window') { - response = await snoozeWindow(time); - } else if (target.id === 'selection') { - response = await snoozeWindow(time, true); - } + } + if (isInEditMode || isInDupeMode) { + return modify(time, choice); + } else if (target.id === 'tab') { + response = await snoozeTab(time); + } else if (target.id === 'window') { + response = await snoozeWindow(time); + } else if (target.id === 'selection') { + response = await snoozeWindow(time, true); } if (!response || (!response.tabId && !response.windowId)) return; await chrome.runtime.sendMessage(Object.assign(response, {close: true, delay: closeDelay}));