Fossil SCM

chat: reconnected the audible-alert persistent toggle to the new way of storing the sound file config.

stephan 2021-01-06 05:40 trunk
Commit 2f0bf9dabd4f4c6fd3016104f8aa4727c25e16fb14ee85b06f690c7555441cba
1 file changed +5 -2
+5 -2
--- src/chat.js
+++ src/chat.js
@@ -375,11 +375,11 @@
375375
setting is true, else this is a no-op. Returns this.
376376
*/
377377
playNewMessageSound: function f(){
378378
if(f.uri){
379379
try{
380
- if(!f.audio) f.audio = new Audio(window.fossil.config.chat.alertSound);
380
+ if(!f.audio) f.audio = new Audio(f.uri);
381381
f.audio.currentTime = 0;
382382
f.audio.play();
383383
}catch(e){
384384
console.error("Audio playblack failed.",e);
385385
}
@@ -967,15 +967,18 @@
967967
settingsOps.push({
968968
label: "Audible alerts",
969969
boolValue: ()=>Chat.settings.getBool('audible-alert'),
970970
callback: function(){
971971
const v = Chat.settings.toggle('audible-alert');
972
- Chat.setNewMessageSound(v ? 'builtin/alerts/plunk.wav' : false);
972
+ Chat.setNewMessageSound(v ? F.config.chat.alertSound : false);
973973
if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
974974
F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
975975
}
976976
});
977
+ Chat.setNewMessageSound(
978
+ Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false
979
+ );
977980
}else{
978981
/* Disabled per chatroom discussion: selection list of audio files for
979982
chat notification. */
980983
const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry');
981984
D.disable(D.option(selectSound, "0", "Audible alert..."));
982985
--- src/chat.js
+++ src/chat.js
@@ -375,11 +375,11 @@
375 setting is true, else this is a no-op. Returns this.
376 */
377 playNewMessageSound: function f(){
378 if(f.uri){
379 try{
380 if(!f.audio) f.audio = new Audio(window.fossil.config.chat.alertSound);
381 f.audio.currentTime = 0;
382 f.audio.play();
383 }catch(e){
384 console.error("Audio playblack failed.",e);
385 }
@@ -967,15 +967,18 @@
967 settingsOps.push({
968 label: "Audible alerts",
969 boolValue: ()=>Chat.settings.getBool('audible-alert'),
970 callback: function(){
971 const v = Chat.settings.toggle('audible-alert');
972 Chat.setNewMessageSound(v ? 'builtin/alerts/plunk.wav' : false);
973 if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
974 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
975 }
976 });
 
 
 
977 }else{
978 /* Disabled per chatroom discussion: selection list of audio files for
979 chat notification. */
980 const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry');
981 D.disable(D.option(selectSound, "0", "Audible alert..."));
982
--- src/chat.js
+++ src/chat.js
@@ -375,11 +375,11 @@
375 setting is true, else this is a no-op. Returns this.
376 */
377 playNewMessageSound: function f(){
378 if(f.uri){
379 try{
380 if(!f.audio) f.audio = new Audio(f.uri);
381 f.audio.currentTime = 0;
382 f.audio.play();
383 }catch(e){
384 console.error("Audio playblack failed.",e);
385 }
@@ -967,15 +967,18 @@
967 settingsOps.push({
968 label: "Audible alerts",
969 boolValue: ()=>Chat.settings.getBool('audible-alert'),
970 callback: function(){
971 const v = Chat.settings.toggle('audible-alert');
972 Chat.setNewMessageSound(v ? F.config.chat.alertSound : false);
973 if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
974 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
975 }
976 });
977 Chat.setNewMessageSound(
978 Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false
979 );
980 }else{
981 /* Disabled per chatroom discussion: selection list of audio files for
982 chat notification. */
983 const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry');
984 D.disable(D.option(selectSound, "0", "Audible alert..."));
985

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button