Skip to content

Commit

Permalink
Update audio cue settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ion201 committed Feb 7, 2021
1 parent 609b6a8 commit 32fd26d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions main-webext.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ var notified_dls = []
// Note: This only stores a hash, not any details
var RECENT_DOWNLOADS_MAX_SIZE = 32


var SOUND_NAME_TO_FILE = {
bell: 'bell.ogg',
ding: 'ding.oga',
pop: 'pop.oga'
}


function loadPrefs(callback)
{
var prefs = Object();
Expand Down Expand Up @@ -77,10 +85,11 @@ function checkConfigVer(prefs)

function playSoundAsset(target)
{
if (target.toLowerCase() != 'none')
target = target.toLowerCase();
if (SOUND_NAME_TO_FILE.hasOwnProperty(target))
{
var audioElem = document.createElement('audio');
audioElem.src = browser.extension.getURL('assets/' + target);
audioElem.src = browser.extension.getURL('assets/' + SOUND_NAME_TO_FILE[target]);
audioElem.play();
}
}
Expand Down
2 changes: 1 addition & 1 deletion pref/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{
"type": "select",
"defaultValue": "None",
"options": ["None", "bell.ogg", "ding.oga", "pop.oga"],
"options": ["None", "bell", "ding", "pop"],
"name": "Audio Notifications",
"description": "Play an audio cue with every notification"
}
Expand Down

0 comments on commit 32fd26d

Please sign in to comment.