Diff
Not logged in

Differences From Artifact [20f7b4e82f]:

To Artifact [ce6efe75d9]:


1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095

1096
1097
1098


1099
1100
1101
1102
1103
1104


1105
1106
1107



1108
1109
1110
1111
1112
1113








1114
1115
1116
1117

1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130




1131
1132
1133
1134
1135
1136
1137
1138
1139
1140

1141
1142
1143
1144


1145
1146
1147

1148
1149
1150
1151
1152
1153
1154
1081
1082
1083
1084
1085
1086
1087

1088



1089
1090

1091


1092
1093
1094
1095
1096
1097
1098


1099
1100
1101
1102
1103
1104
1105
1106






1107
1108
1109
1110
1111
1112
1113
1114

1115
1116

1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129

1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146


1147
1148
1149
1150

1151
1152
1153
1154
1155
1156
1157
1158







-

-
-
-


-
+
-
-

+
+




-
-
+
+



+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-


-
+












-
+
+
+
+










+


-
-
+
+


-
+







      callback: function(){
        Chat.toggleChatOnlyMode();
      }
    }];

    /** Set up selection list of notification sounds. */
    if(1){
      settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
      const selectSound = D.select();
      D.append(settingsOps.selectSound,
               D.append(D.span(),"Audio alert"),
               selectSound);
      D.option(selectSound, "", "(no audio)");
      const firstSoundIndex = selectSound.options.length;
      F.config.chat.alerts.forEach(function(a){
      F.config.chat.alerts.forEach((a)=>D.option(selectSound, a));
        D.option(selectSound, a);
      });
      if(true===Chat.settings.getBool('audible-alert')){
        /* This setting used to be a plain bool. If we encounter
           such a setting, take the first sound in the list. */
        selectSound.selectedIndex = firstSoundIndex;
      }else{
        selectSound.value = Chat.settings.get('audible-alert','');
        if(selectSound.selectedIndex<0){
          /*Missing file - removed after this setting was applied. Fall back
            to the first sound in the list. */
          /* Missing file - removed after this setting was
            applied. Fall back to the first sound in the list. */
          selectSound.selectedIndex = firstSoundIndex;
        }
      }
      Chat.setNewMessageSound(selectSound.value);
      settingsOps.push({
        label: "Audio alert",
      selectSound.addEventListener('change',function(){
        const v = this.value;
        Chat.setNewMessageSound(v);
        F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
        if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
      }, false);
        select: selectSound,
        callback: function(ev){
          const v = ev.target.value;
          Chat.setNewMessageSound(v);
          F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
          if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
        }
      });
      Chat.setNewMessageSound(selectSound.value);
    }/*audio notification config*/
    /**
       Build list of options...
       Build UI for config options...
    */
    settingsOps.forEach(function f(op){
      const line = D.addClass(D.div(), 'menu-entry');
      const btn = D.append(
        D.addClass(D.label(), 'cbutton'/*bootstrap skin hijacks 'button'*/),
        op.label);
      const callback = function(ev){
        op.callback(ev);
        if(op.persistentSetting){
          Chat.settings.set(op.persistentSetting, op.boolValue());
        }
      };
      if(op.hasOwnProperty('boolValue')){
      if(op.hasOwnProperty('select')){
        D.append(line, btn, op.select);
        op.select.addEventListener('change', callback, false);
      }else if(op.hasOwnProperty('boolValue')){
        if(undefined === f.$id) f.$id = 0;
        ++f.$id;
        const check = D.attr(D.checkbox(1, op.boolValue()),
                             'aria-label', op.label);
        const id = 'cfgopt'+f.$id;
        if(op.boolValue()) check.checked = true;
        D.attr(check, 'id', id);
        D.attr(btn, 'for', id);
        D.append(line, check);
        check.addEventListener('change', callback);
        D.append(line, btn);
      }else{
        line.addEventListener('click', callback);
      }
      D.append(line, btn);
        D.append(line, btn);
      }
      D.append(optionsMenu, line);
    });
    if(settingsOps.selectSound){
    if(0 && settingsOps.selectSound){
      D.append(optionsMenu, settingsOps.selectSound);
    }
    //settingsButton.click()/*for for development*/;
  })()/*#chat-settings-button setup*/;

  (function(){/*set up message preview*/
    const btnPreview = Chat.e.btnPreview;