Skip to content

Commit

Permalink
handle startups
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanb10 committed Jun 23, 2021
1 parent 1764dee commit 7934815
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
As you can see below, I am just sending the choice and time you selected. Nothing else.
No geographic, language, diagnostic data is collected in any way, simply the choice that you have selected in the popup
Lets say you snooze a tab to wakeup on monday morning at 9:30am, this string will be sent to the server 'monday.0930'. Thats it
Lets say you snooze a tab to wakeup on monday morning at 9:30am, this string will be sent to the server 'monday.0930'. Thats it.
All data collected using this code is fully public and can be seen at https://snoozz.me/stats.html
The source code for the server is also available publicly at https://github.com/rohanb10/snoozz-stats
Expand Down
7 changes: 3 additions & 4 deletions scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ async function modify(time, choice) {
if (parent && parent.deleteTabFromDiv) parent.deleteTabFromDiv(getUrlParam('tabId'))
var response = await editSnoozeTime(getUrlParam('tabId'), time);
if (!response || !response.edited) return;
await displayPreviewAnimation(choice, time.format('HHmm'), 'Going back to sleep');
await displayPreviewAnimation(choice, time.format ? time.format('.HHmm') : '', 'Going back to sleep');
if (parent && parent.closeEditModal) setTimeout(_ => parent.closeEditModal(), closeDelay);
}

Expand All @@ -323,7 +323,6 @@ async function snooze(time, choice) {
if (isInEditMode) return modify(time, choice);
var target = document.querySelector('.target.active');
if (!['tab', 'window', 'selection', 'group'].includes(target.id)) return;
debugger;
var response;
if (target.id === 'tab') {
response = await snoozeTab(time);
Expand All @@ -334,11 +333,11 @@ async function snooze(time, choice) {
}
if (response && !(response.tabId || response.windowId)) return;
await chrome.runtime.sendMessage(Object.assign(response, {close: true, delay: closeDelay}));
await displayPreviewAnimation(choice, time.format('HHmm'), `Snoozing ${target.id}`)
await displayPreviewAnimation(choice, time.format ? time.format('.HHmm') : '', `Snoozing ${target.id}`)
}

async function displayPreviewAnimation(choice, time, text = 'Snoozing') {
await chrome.runtime.sendMessage({poll: `${choice.id}.${time}`});
await chrome.runtime.sendMessage({poll: `${choice.id}${time}`});
document.body.style.pointerEvents = 'none';
choice.classList.add('focused');
var preview = document.getElementById('preview');
Expand Down

0 comments on commit 7934815

Please sign in to comment.