Fossil SCM
/chat restored accidentally-removed configurable notification sounds. More layout tweaks on chat buttons.
Commit
cf81ddf97a4cad9ab81747a1036ece2c4159567b6f82c647c75c3770869c0238
Parent
03f33cd3c290116…
2 files changed
+26
-12
+6
-2
+26
-12
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -1080,23 +1080,37 @@ | ||
| 1080 | 1080 | } |
| 1081 | 1081 | }]; |
| 1082 | 1082 | |
| 1083 | 1083 | /** Set up selection list of notification sounds. */ |
| 1084 | 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 | - } | |
| 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 | 1094 | }); |
| 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); | |
| 1098 | 1112 | }/*audio notification config*/ |
| 1099 | 1113 | /** |
| 1100 | 1114 | Build list of options... |
| 1101 | 1115 | */ |
| 1102 | 1116 | settingsOps.forEach(function f(op){ |
| 1103 | 1117 |
| --- 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 |
+6
-2
| --- src/style.chat.css | ||
| +++ src/style.chat.css | ||
| @@ -234,13 +234,17 @@ | ||
| 234 | 234 | body.chat #chat-input-line.single-line #chat-edit-buttons { |
| 235 | 235 | flex-direction: row; |
| 236 | 236 | } |
| 237 | 237 | body.chat #chat-edit-buttons > * { |
| 238 | 238 | 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; | |
| 240 | 243 | } |
| 241 | 244 | body.chat #chat-input-line.single-line #chat-edit-buttons > * { |
| 245 | + margin: 0 0.25em; | |
| 242 | 246 | } |
| 243 | 247 | |
| 244 | 248 | body.chat #chat-input-line > button { |
| 245 | 249 | max-width: 4em; |
| 246 | 250 | } |
| @@ -248,11 +252,11 @@ | ||
| 248 | 252 | margin: 0 0 0 0.25em; |
| 249 | 253 | max-width: 2em; |
| 250 | 254 | } |
| 251 | 255 | body.chat #chat-input-line > input[type=text], |
| 252 | 256 | body.chat #chat-input-line > textarea { |
| 253 | - flex: 10 1 auto; | |
| 257 | + flex: 20 1 auto; | |
| 254 | 258 | max-width: revert; |
| 255 | 259 | min-width: 20em; |
| 256 | 260 | } |
| 257 | 261 | body.chat #chat-input-line.single-line > input[type=text] { |
| 258 | 262 | margin: 0 0 0.25em 0/* gap for if/when buttons wrap*/; |
| 259 | 263 |
| --- 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 |