Skip to content

Commit

Permalink
Fixes notification sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
flakas committed Dec 26, 2016
1 parent 1d8936f commit 6ab3ba0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Break Helper
[Break Helper on Chrome Webstore](https://chrome.google.com/webstore/detail/dllmmaniogaffdnagcenlnnlbahmlmld)
This is a Chrome extension that periodically reminds you to take a break.

Notification sound credits: _VTK Productions (vtkproductions.com)_
Notification sound credits: _Notification Sounds (notificationsounds.com)_
Binary file modified break-helper.zip
Binary file not shown.
9 changes: 8 additions & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if (typeof localStorage.statistics === "undefined") {
} else {
statistics = $.parseJSON(localStorage["statistics"]);
}
var notification, breakTime, workTime, rule, enableSound, iCloseNotification = 0, timer, nextBreak, breakTimeLeft;
var notification, breakTime, workTime, rule, iCloseNotification = 0, timer, nextBreak, breakTimeLeft;
resetTimes();
$(document).ready(function () {
chrome.notifications.onButtonClicked.addListener(handleNotificationInteraction);
Expand Down Expand Up @@ -111,6 +111,7 @@ function displayNotification() {
],
requireInteraction: true,
});
doSoundNotification();
log("Displaying notification");
}

Expand Down Expand Up @@ -300,6 +301,12 @@ function playSound ( url ) {
(new Audio(url)).play();
}

function doSoundNotification() {
if (settings.playSound) {
playSound('notification.mp3');
}
}

function secondsToClock(leftSeconds) {
var h, m, s, tempLeft;
h = Math.floor(leftSeconds / 3600);
Expand Down
Binary file added notification.mp3
Binary file not shown.
Binary file removed notification.wav
Binary file not shown.

0 comments on commit 6ab3ba0

Please sign in to comment.