Fossil SCM

chat: switched back to binary notification sound on/off, without sound file selection, per chatroom discussion. The the file selection bits are simply if'd out. Removed alerts/g-minor-triad.wav per request.

stephan 2021-01-05 12:49 trunk
Commit 1469c150c478ccf739ac99e89b5f0826f98deff39801f64b069394276ad922a4
D src/alerts/g-minor-triad.wav

Binary file

+45 -26
--- src/chat.js
+++ src/chat.js
@@ -393,11 +393,11 @@
393393
this. This setting is persistent.
394394
*/
395395
setNewMessageSound: function f(uri){
396396
delete this.playNewMessageSound.audio;
397397
this.playNewMessageSound.uri = uri;
398
- this.settings.set('audible-alert', uri || '');
398
+ this.settings.set('audible-alert', !!uri);
399399
return this;
400400
}
401401
};
402402
cs.e.inputCurrent = cs.e.inputSingle;
403403
/* Install default settings... */
@@ -961,34 +961,49 @@
961961
boolValue: ()=>!Chat.e.btnMsgHome.classList.contains('hidden'),
962962
callback: ()=>Chat.toggleNavButtons()
963963
}];
964964
965965
/** Set up selection list of notification sounds. */
966
- const selectSound = D.addClass(D.select(), 'menu-entry');
967
- D.disable(D.option(selectSound, "0", "Audible alert..."));
968
- D.option(selectSound, "", "(no audio)");
969
- F.config.chat.alerts.forEach(function(a){
970
- D.option(selectSound, a);
971
- });
972
- if(true===Chat.settings.getBool('audible-alert')){
973
- selectSound.selectedIndex = 2/*first audio file in the list*/;
966
+ if(true/*flip this to false to enable selection of audio files*/){
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
+ });
974977
}else{
975
- selectSound.value = Chat.settings.get('audible-alert','');
976
- if(selectSound.selectedIndex<0){
977
- /*Missing file - removed after this setting was applied. Fall back
978
- to the first sound in the list. */
979
- selectSound.selectedIndex = 2;
980
- }
981
- }
982
- selectSound.addEventListener('change',function(){
983
- const v = this.selectedIndex>1 ? this.value : '';
984
- Chat.setNewMessageSound(v);
985
- F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
986
- if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
987
- settingsPopup.hide();
988
- }, false);
989
- Chat.setNewMessageSound(selectSound.value);
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
+ D.option(selectSound, "", "(no audio)");
983
+ F.config.chat.alerts.forEach(function(a){
984
+ D.option(selectSound, a);
985
+ });
986
+ if(true===Chat.settings.getBool('audible-alert')){
987
+ selectSound.selectedIndex = 2/*first audio file in the list*/;
988
+ }else{
989
+ selectSound.value = Chat.settings.get('audible-alert','');
990
+ if(selectSound.selectedIndex<0){
991
+ /*Missing file - removed after this setting was applied. Fall back
992
+ to the first sound in the list. */
993
+ selectSound.selectedIndex = 2;
994
+ }
995
+ }
996
+ selectSound.addEventListener('change',function(){
997
+ const v = this.selectedIndex>1 ? this.value : '';
998
+ Chat.setNewMessageSound(v);
999
+ F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1000
+ if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
1001
+ settingsPopup.hide();
1002
+ }, false);
1003
+ Chat.setNewMessageSound(selectSound.value);
1004
+ }/*audio notification config*/
9901005
/**
9911006
Rebuild the menu each time it's shown so that the toggles can
9921007
show their current values.
9931008
*/
9941009
settingsPopup.options.refresh = function(){
@@ -1010,13 +1025,17 @@
10101025
D.append(line, check);
10111026
}
10121027
D.append(settingsPopup.e, line);
10131028
line.addEventListener('click', callback);
10141029
});
1015
- D.append(settingsPopup.e, selectSound);
1030
+ if(settingsOps.selectSound){
1031
+ D.append(settingsPopup.e, settingsOps.selectSound);
1032
+ }
10161033
};
1017
- settingsPopup.installHideHandlers(false, false, true)
1034
+ settingsPopup.installHideHandlers(
1035
+ false, settingsOps.selectSound ? false : true,
1036
+ true)
10181037
/** Reminder: click-to-hide interferes with "?" embedded within
10191038
the popup, so cannot be used together with those. Enabling
10201039
this means, however, that tapping the menu button to toggle
10211040
the menu cannot work because tapping the menu button while the
10221041
menu is opened will, because of the click-to-hide handler,
10231042
--- src/chat.js
+++ src/chat.js
@@ -393,11 +393,11 @@
393 this. This setting is persistent.
394 */
395 setNewMessageSound: function f(uri){
396 delete this.playNewMessageSound.audio;
397 this.playNewMessageSound.uri = uri;
398 this.settings.set('audible-alert', uri || '');
399 return this;
400 }
401 };
402 cs.e.inputCurrent = cs.e.inputSingle;
403 /* Install default settings... */
@@ -961,34 +961,49 @@
961 boolValue: ()=>!Chat.e.btnMsgHome.classList.contains('hidden'),
962 callback: ()=>Chat.toggleNavButtons()
963 }];
964
965 /** Set up selection list of notification sounds. */
966 const selectSound = D.addClass(D.select(), 'menu-entry');
967 D.disable(D.option(selectSound, "0", "Audible alert..."));
968 D.option(selectSound, "", "(no audio)");
969 F.config.chat.alerts.forEach(function(a){
970 D.option(selectSound, a);
971 });
972 if(true===Chat.settings.getBool('audible-alert')){
973 selectSound.selectedIndex = 2/*first audio file in the list*/;
 
 
 
974 }else{
975 selectSound.value = Chat.settings.get('audible-alert','');
976 if(selectSound.selectedIndex<0){
977 /*Missing file - removed after this setting was applied. Fall back
978 to the first sound in the list. */
979 selectSound.selectedIndex = 2;
980 }
981 }
982 selectSound.addEventListener('change',function(){
983 const v = this.selectedIndex>1 ? this.value : '';
984 Chat.setNewMessageSound(v);
985 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
986 if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
987 settingsPopup.hide();
988 }, false);
989 Chat.setNewMessageSound(selectSound.value);
 
 
 
 
 
 
 
 
 
 
 
 
990 /**
991 Rebuild the menu each time it's shown so that the toggles can
992 show their current values.
993 */
994 settingsPopup.options.refresh = function(){
@@ -1010,13 +1025,17 @@
1010 D.append(line, check);
1011 }
1012 D.append(settingsPopup.e, line);
1013 line.addEventListener('click', callback);
1014 });
1015 D.append(settingsPopup.e, selectSound);
 
 
1016 };
1017 settingsPopup.installHideHandlers(false, false, true)
 
 
1018 /** Reminder: click-to-hide interferes with "?" embedded within
1019 the popup, so cannot be used together with those. Enabling
1020 this means, however, that tapping the menu button to toggle
1021 the menu cannot work because tapping the menu button while the
1022 menu is opened will, because of the click-to-hide handler,
1023
--- src/chat.js
+++ src/chat.js
@@ -393,11 +393,11 @@
393 this. This setting is persistent.
394 */
395 setNewMessageSound: function f(uri){
396 delete this.playNewMessageSound.audio;
397 this.playNewMessageSound.uri = uri;
398 this.settings.set('audible-alert', !!uri);
399 return this;
400 }
401 };
402 cs.e.inputCurrent = cs.e.inputSingle;
403 /* Install default settings... */
@@ -961,34 +961,49 @@
961 boolValue: ()=>!Chat.e.btnMsgHome.classList.contains('hidden'),
962 callback: ()=>Chat.toggleNavButtons()
963 }];
964
965 /** Set up selection list of notification sounds. */
966 if(true/*flip this to false to enable selection of audio files*/){
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 D.option(selectSound, "", "(no audio)");
983 F.config.chat.alerts.forEach(function(a){
984 D.option(selectSound, a);
985 });
986 if(true===Chat.settings.getBool('audible-alert')){
987 selectSound.selectedIndex = 2/*first audio file in the list*/;
988 }else{
989 selectSound.value = Chat.settings.get('audible-alert','');
990 if(selectSound.selectedIndex<0){
991 /*Missing file - removed after this setting was applied. Fall back
992 to the first sound in the list. */
993 selectSound.selectedIndex = 2;
994 }
995 }
996 selectSound.addEventListener('change',function(){
997 const v = this.selectedIndex>1 ? this.value : '';
998 Chat.setNewMessageSound(v);
999 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1000 if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
1001 settingsPopup.hide();
1002 }, false);
1003 Chat.setNewMessageSound(selectSound.value);
1004 }/*audio notification config*/
1005 /**
1006 Rebuild the menu each time it's shown so that the toggles can
1007 show their current values.
1008 */
1009 settingsPopup.options.refresh = function(){
@@ -1010,13 +1025,17 @@
1025 D.append(line, check);
1026 }
1027 D.append(settingsPopup.e, line);
1028 line.addEventListener('click', callback);
1029 });
1030 if(settingsOps.selectSound){
1031 D.append(settingsPopup.e, settingsOps.selectSound);
1032 }
1033 };
1034 settingsPopup.installHideHandlers(
1035 false, settingsOps.selectSound ? false : true,
1036 true)
1037 /** Reminder: click-to-hide interferes with "?" embedded within
1038 the popup, so cannot be used together with those. Enabling
1039 this means, however, that tapping the menu button to toggle
1040 the menu cannot work because tapping the menu button while the
1041 menu is opened will, because of the click-to-hide handler,
1042
--- src/main.mk
+++ src/main.mk
@@ -221,11 +221,10 @@
221221
$(SRCDIR)/../skins/xekri/details.txt \
222222
$(SRCDIR)/../skins/xekri/footer.txt \
223223
$(SRCDIR)/../skins/xekri/header.txt \
224224
$(SRCDIR)/accordion.js \
225225
$(SRCDIR)/alerts/b-flat.wav \
226
- $(SRCDIR)/alerts/g-minor-triad.wav \
227226
$(SRCDIR)/alerts/plunk.wav \
228227
$(SRCDIR)/chat.js \
229228
$(SRCDIR)/ci_edit.js \
230229
$(SRCDIR)/copybtn.js \
231230
$(SRCDIR)/default.css \
232231
--- src/main.mk
+++ src/main.mk
@@ -221,11 +221,10 @@
221 $(SRCDIR)/../skins/xekri/details.txt \
222 $(SRCDIR)/../skins/xekri/footer.txt \
223 $(SRCDIR)/../skins/xekri/header.txt \
224 $(SRCDIR)/accordion.js \
225 $(SRCDIR)/alerts/b-flat.wav \
226 $(SRCDIR)/alerts/g-minor-triad.wav \
227 $(SRCDIR)/alerts/plunk.wav \
228 $(SRCDIR)/chat.js \
229 $(SRCDIR)/ci_edit.js \
230 $(SRCDIR)/copybtn.js \
231 $(SRCDIR)/default.css \
232
--- src/main.mk
+++ src/main.mk
@@ -221,11 +221,10 @@
221 $(SRCDIR)/../skins/xekri/details.txt \
222 $(SRCDIR)/../skins/xekri/footer.txt \
223 $(SRCDIR)/../skins/xekri/header.txt \
224 $(SRCDIR)/accordion.js \
225 $(SRCDIR)/alerts/b-flat.wav \
 
226 $(SRCDIR)/alerts/plunk.wav \
227 $(SRCDIR)/chat.js \
228 $(SRCDIR)/ci_edit.js \
229 $(SRCDIR)/copybtn.js \
230 $(SRCDIR)/default.css \
231
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -633,11 +633,10 @@
633633
$(SRCDIR)/../skins/xekri/details.txt \
634634
$(SRCDIR)/../skins/xekri/footer.txt \
635635
$(SRCDIR)/../skins/xekri/header.txt \
636636
$(SRCDIR)/accordion.js \
637637
$(SRCDIR)/alerts/b-flat.wav \
638
- $(SRCDIR)/alerts/g-minor-triad.wav \
639638
$(SRCDIR)/alerts/plunk.wav \
640639
$(SRCDIR)/chat.js \
641640
$(SRCDIR)/ci_edit.js \
642641
$(SRCDIR)/copybtn.js \
643642
$(SRCDIR)/default.css \
644643
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -633,11 +633,10 @@
633 $(SRCDIR)/../skins/xekri/details.txt \
634 $(SRCDIR)/../skins/xekri/footer.txt \
635 $(SRCDIR)/../skins/xekri/header.txt \
636 $(SRCDIR)/accordion.js \
637 $(SRCDIR)/alerts/b-flat.wav \
638 $(SRCDIR)/alerts/g-minor-triad.wav \
639 $(SRCDIR)/alerts/plunk.wav \
640 $(SRCDIR)/chat.js \
641 $(SRCDIR)/ci_edit.js \
642 $(SRCDIR)/copybtn.js \
643 $(SRCDIR)/default.css \
644
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -633,11 +633,10 @@
633 $(SRCDIR)/../skins/xekri/details.txt \
634 $(SRCDIR)/../skins/xekri/footer.txt \
635 $(SRCDIR)/../skins/xekri/header.txt \
636 $(SRCDIR)/accordion.js \
637 $(SRCDIR)/alerts/b-flat.wav \
 
638 $(SRCDIR)/alerts/plunk.wav \
639 $(SRCDIR)/chat.js \
640 $(SRCDIR)/ci_edit.js \
641 $(SRCDIR)/copybtn.js \
642 $(SRCDIR)/default.css \
643
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -554,11 +554,10 @@
554554
"$(SRCDIR)\..\skins\xekri\details.txt" \
555555
"$(SRCDIR)\..\skins\xekri\footer.txt" \
556556
"$(SRCDIR)\..\skins\xekri\header.txt" \
557557
"$(SRCDIR)\accordion.js" \
558558
"$(SRCDIR)\alerts\b-flat.wav" \
559
- "$(SRCDIR)\alerts\g-minor-triad.wav" \
560559
"$(SRCDIR)\alerts\plunk.wav" \
561560
"$(SRCDIR)\chat.js" \
562561
"$(SRCDIR)\ci_edit.js" \
563562
"$(SRCDIR)\copybtn.js" \
564563
"$(SRCDIR)\default.css" \
@@ -1166,11 +1165,10 @@
11661165
echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
11671166
echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
11681167
echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
11691168
echo "$(SRCDIR)\accordion.js" >> $@
11701169
echo "$(SRCDIR)\alerts/b-flat.wav" >> $@
1171
- echo "$(SRCDIR)\alerts/g-minor-triad.wav" >> $@
11721170
echo "$(SRCDIR)\alerts/plunk.wav" >> $@
11731171
echo "$(SRCDIR)\chat.js" >> $@
11741172
echo "$(SRCDIR)\ci_edit.js" >> $@
11751173
echo "$(SRCDIR)\copybtn.js" >> $@
11761174
echo "$(SRCDIR)\default.css" >> $@
11771175
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -554,11 +554,10 @@
554 "$(SRCDIR)\..\skins\xekri\details.txt" \
555 "$(SRCDIR)\..\skins\xekri\footer.txt" \
556 "$(SRCDIR)\..\skins\xekri\header.txt" \
557 "$(SRCDIR)\accordion.js" \
558 "$(SRCDIR)\alerts\b-flat.wav" \
559 "$(SRCDIR)\alerts\g-minor-triad.wav" \
560 "$(SRCDIR)\alerts\plunk.wav" \
561 "$(SRCDIR)\chat.js" \
562 "$(SRCDIR)\ci_edit.js" \
563 "$(SRCDIR)\copybtn.js" \
564 "$(SRCDIR)\default.css" \
@@ -1166,11 +1165,10 @@
1166 echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
1167 echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
1168 echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
1169 echo "$(SRCDIR)\accordion.js" >> $@
1170 echo "$(SRCDIR)\alerts/b-flat.wav" >> $@
1171 echo "$(SRCDIR)\alerts/g-minor-triad.wav" >> $@
1172 echo "$(SRCDIR)\alerts/plunk.wav" >> $@
1173 echo "$(SRCDIR)\chat.js" >> $@
1174 echo "$(SRCDIR)\ci_edit.js" >> $@
1175 echo "$(SRCDIR)\copybtn.js" >> $@
1176 echo "$(SRCDIR)\default.css" >> $@
1177
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -554,11 +554,10 @@
554 "$(SRCDIR)\..\skins\xekri\details.txt" \
555 "$(SRCDIR)\..\skins\xekri\footer.txt" \
556 "$(SRCDIR)\..\skins\xekri\header.txt" \
557 "$(SRCDIR)\accordion.js" \
558 "$(SRCDIR)\alerts\b-flat.wav" \
 
559 "$(SRCDIR)\alerts\plunk.wav" \
560 "$(SRCDIR)\chat.js" \
561 "$(SRCDIR)\ci_edit.js" \
562 "$(SRCDIR)\copybtn.js" \
563 "$(SRCDIR)\default.css" \
@@ -1166,11 +1165,10 @@
1165 echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
1166 echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
1167 echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
1168 echo "$(SRCDIR)\accordion.js" >> $@
1169 echo "$(SRCDIR)\alerts/b-flat.wav" >> $@
 
1170 echo "$(SRCDIR)\alerts/plunk.wav" >> $@
1171 echo "$(SRCDIR)\chat.js" >> $@
1172 echo "$(SRCDIR)\ci_edit.js" >> $@
1173 echo "$(SRCDIR)\copybtn.js" >> $@
1174 echo "$(SRCDIR)\default.css" >> $@
1175

Keyboard Shortcuts

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