Fossil SCM

/chat restored accidentally-removed configurable notification sounds. More layout tweaks on chat buttons.

stephan 2021-09-21 14:34 trunk
Commit cf81ddf97a4cad9ab81747a1036ece2c4159567b6f82c647c75c3770869c0238
2 files changed +26 -12 +6 -2
+26 -12
--- src/chat.js
+++ src/chat.js
@@ -1080,23 +1080,37 @@
10801080
}
10811081
}];
10821082
10831083
/** Set up selection list of notification sounds. */
10841084
if(1){
1085
- settingsOps.push({
1086
- label: "Audible alerts",
1087
- boolValue: ()=>Chat.settings.getBool('audible-alert'),
1088
- callback: function(){
1089
- const v = Chat.settings.toggle('audible-alert');
1090
- Chat.setNewMessageSound(v ? F.config.chat.alertSound : false);
1091
- if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
1092
- F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1093
- }
1085
+ settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
1086
+ const selectSound = D.select();
1087
+ D.append(settingsOps.selectSound,
1088
+ D.append(D.span(),"Audio alert"),
1089
+ selectSound);
1090
+ D.option(selectSound, "", "(no audio)");
1091
+ const firstSoundIndex = selectSound.options.length;
1092
+ F.config.chat.alerts.forEach(function(a){
1093
+ D.option(selectSound, a);
10941094
});
1095
- Chat.setNewMessageSound(
1096
- Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false
1097
- );
1095
+ if(true===Chat.settings.getBool('audible-alert')){
1096
+ selectSound.selectedIndex = firstSoundIndex;
1097
+ }else{
1098
+ selectSound.value = Chat.settings.get('audible-alert','');
1099
+ if(selectSound.selectedIndex<0){
1100
+ /*Missing file - removed after this setting was applied. Fall back
1101
+ to the first sound in the list. */
1102
+ selectSound.selectedIndex = firstSoundIndex;
1103
+ }
1104
+ }
1105
+ selectSound.addEventListener('change',function(){
1106
+ const v = this.value;
1107
+ Chat.setNewMessageSound(v);
1108
+ F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1109
+ if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
1110
+ }, false);
1111
+ Chat.setNewMessageSound(selectSound.value);
10981112
}/*audio notification config*/
10991113
/**
11001114
Build list of options...
11011115
*/
11021116
settingsOps.forEach(function f(op){
11031117
--- src/chat.js
+++ src/chat.js
@@ -1080,23 +1080,37 @@
1080 }
1081 }];
1082
1083 /** Set up selection list of notification sounds. */
1084 if(1){
1085 settingsOps.push({
1086 label: "Audible alerts",
1087 boolValue: ()=>Chat.settings.getBool('audible-alert'),
1088 callback: function(){
1089 const v = Chat.settings.toggle('audible-alert');
1090 Chat.setNewMessageSound(v ? F.config.chat.alertSound : false);
1091 if(v) setTimeout(()=>Chat.playNewMessageSound(), 50);
1092 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1093 }
1094 });
1095 Chat.setNewMessageSound(
1096 Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false
1097 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1098 }/*audio notification config*/
1099 /**
1100 Build list of options...
1101 */
1102 settingsOps.forEach(function f(op){
1103
--- src/chat.js
+++ src/chat.js
@@ -1080,23 +1080,37 @@
1080 }
1081 }];
1082
1083 /** Set up selection list of notification sounds. */
1084 if(1){
1085 settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
1086 const selectSound = D.select();
1087 D.append(settingsOps.selectSound,
1088 D.append(D.span(),"Audio alert"),
1089 selectSound);
1090 D.option(selectSound, "", "(no audio)");
1091 const firstSoundIndex = selectSound.options.length;
1092 F.config.chat.alerts.forEach(function(a){
1093 D.option(selectSound, a);
1094 });
1095 if(true===Chat.settings.getBool('audible-alert')){
1096 selectSound.selectedIndex = firstSoundIndex;
1097 }else{
1098 selectSound.value = Chat.settings.get('audible-alert','');
1099 if(selectSound.selectedIndex<0){
1100 /*Missing file - removed after this setting was applied. Fall back
1101 to the first sound in the list. */
1102 selectSound.selectedIndex = firstSoundIndex;
1103 }
1104 }
1105 selectSound.addEventListener('change',function(){
1106 const v = this.value;
1107 Chat.setNewMessageSound(v);
1108 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1109 if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
1110 }, false);
1111 Chat.setNewMessageSound(selectSound.value);
1112 }/*audio notification config*/
1113 /**
1114 Build list of options...
1115 */
1116 settingsOps.forEach(function f(op){
1117
--- src/style.chat.css
+++ src/style.chat.css
@@ -234,13 +234,17 @@
234234
body.chat #chat-input-line.single-line #chat-edit-buttons {
235235
flex-direction: row;
236236
}
237237
body.chat #chat-edit-buttons > * {
238238
flex: 1 1 auto;
239
- margin: 0 0.25em;
239
+}
240
+body.chat #chat-input-line:not(.single-line) #chat-edit-buttons > * {
241
+ max-width: 4em;
242
+ margin: 0.25em;
240243
}
241244
body.chat #chat-input-line.single-line #chat-edit-buttons > * {
245
+ margin: 0 0.25em;
242246
}
243247
244248
body.chat #chat-input-line > button {
245249
max-width: 4em;
246250
}
@@ -248,11 +252,11 @@
248252
margin: 0 0 0 0.25em;
249253
max-width: 2em;
250254
}
251255
body.chat #chat-input-line > input[type=text],
252256
body.chat #chat-input-line > textarea {
253
- flex: 10 1 auto;
257
+ flex: 20 1 auto;
254258
max-width: revert;
255259
min-width: 20em;
256260
}
257261
body.chat #chat-input-line.single-line > input[type=text] {
258262
margin: 0 0 0.25em 0/* gap for if/when buttons wrap*/;
259263
--- src/style.chat.css
+++ src/style.chat.css
@@ -234,13 +234,17 @@
234 body.chat #chat-input-line.single-line #chat-edit-buttons {
235 flex-direction: row;
236 }
237 body.chat #chat-edit-buttons > * {
238 flex: 1 1 auto;
239 margin: 0 0.25em;
 
 
 
240 }
241 body.chat #chat-input-line.single-line #chat-edit-buttons > * {
 
242 }
243
244 body.chat #chat-input-line > button {
245 max-width: 4em;
246 }
@@ -248,11 +252,11 @@
248 margin: 0 0 0 0.25em;
249 max-width: 2em;
250 }
251 body.chat #chat-input-line > input[type=text],
252 body.chat #chat-input-line > textarea {
253 flex: 10 1 auto;
254 max-width: revert;
255 min-width: 20em;
256 }
257 body.chat #chat-input-line.single-line > input[type=text] {
258 margin: 0 0 0.25em 0/* gap for if/when buttons wrap*/;
259
--- src/style.chat.css
+++ src/style.chat.css
@@ -234,13 +234,17 @@
234 body.chat #chat-input-line.single-line #chat-edit-buttons {
235 flex-direction: row;
236 }
237 body.chat #chat-edit-buttons > * {
238 flex: 1 1 auto;
239 }
240 body.chat #chat-input-line:not(.single-line) #chat-edit-buttons > * {
241 max-width: 4em;
242 margin: 0.25em;
243 }
244 body.chat #chat-input-line.single-line #chat-edit-buttons > * {
245 margin: 0 0.25em;
246 }
247
248 body.chat #chat-input-line > button {
249 max-width: 4em;
250 }
@@ -248,11 +252,11 @@
252 margin: 0 0 0 0.25em;
253 max-width: 2em;
254 }
255 body.chat #chat-input-line > input[type=text],
256 body.chat #chat-input-line > textarea {
257 flex: 20 1 auto;
258 max-width: revert;
259 min-width: 20em;
260 }
261 body.chat #chat-input-line.single-line > input[type=text] {
262 margin: 0 0 0.25em 0/* gap for if/when buttons wrap*/;
263

Keyboard Shortcuts

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