瀏覽代碼

Fixes settings menu for non moderators

master
yanas 9 年之前
父節點
當前提交
a9e31a2843
共有 2 個檔案被更改,包括 39 行新增20 行删除
  1. 21
    17
      modules/UI/side_pannels/settings/SettingsMenu.js
  2. 18
    3
      modules/UI/util/UIUtil.js

+ 21
- 17
modules/UI/side_pannels/settings/SettingsMenu.js 查看文件

74
                     }
74
                     }
75
                 });
75
                 });
76
 
76
 
77
-            // Only show the subtitle if this is the only setting section.
77
+            // Only show the subtitle if this isn't the only setting section.
78
             if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
78
             if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
79
-                UIUtil.showHiddenElement("deviceOptionsTitle");
79
+                UIUtil.showElement("deviceOptionsTitle");
80
 
80
 
81
-            UIUtil.showHiddenElement("devicesOptions");
81
+            UIUtil.showElement("devicesOptions");
82
         }
82
         }
83
 
83
 
84
         if (UIUtil.isSettingEnabled('language')) {
84
         if (UIUtil.isSettingEnabled('language')) {
93
                 emitter.emit(UIEvents.LANG_CHANGED, languagesBox.val());
93
                 emitter.emit(UIEvents.LANG_CHANGED, languagesBox.val());
94
             });
94
             });
95
 
95
 
96
-            UIUtil.showHiddenElement("languages_selectbox");
96
+            UIUtil.showElement("languages_selectbox");
97
         }
97
         }
98
 
98
 
99
         if (UIUtil.isSettingEnabled('moderator')) {
99
         if (UIUtil.isSettingEnabled('moderator')) {
116
                     isFollowMeEnabled
116
                     isFollowMeEnabled
117
                 );
117
                 );
118
             });
118
             });
119
-
120
-            // Only show the subtitle if this is the only setting section.
121
-            if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
122
-                UIUtil.showHiddenElement("moderatorOptionsTitle");
123
-
124
-            UIUtil.showHiddenElement("startMutedOptions");
125
-            UIUtil.showHiddenElement("followMeOptions");
126
         }
119
         }
127
     },
120
     },
128
 
121
 
155
      * @param {boolean} show
148
      * @param {boolean} show
156
      */
149
      */
157
     showStartMutedOptions (show) {
150
     showStartMutedOptions (show) {
158
-        if (show) {
159
-            $("#startMutedOptions").css("display", "block");
151
+        console.log("------", show, UIUtil.isSettingEnabled('moderator'));
152
+        if (show && UIUtil.isSettingEnabled('moderator')) {
153
+            console.log("idva li tuuk");
154
+            // Only show the subtitle if this isn't the only setting section.
155
+            if (!$("#moderatorOptionsTitle").is(":visible")
156
+                && interfaceConfig.SETTINGS_SECTIONS.length > 1)
157
+                UIUtil.showElement("moderatorOptionsTitle");
158
+
159
+            UIUtil.showElement("startMutedOptions");
160
         } else {
160
         } else {
161
-            $("#startMutedOptions").css("display", "none");
161
+            // Only show the subtitle if this isn't the only setting section.
162
+            if ($("#moderatorOptionsTitle").is(":visible"))
163
+                UIUtil.hideElement("moderatorOptionsTitle");
164
+
165
+            UIUtil.hideElement("startMutedOptions");
162
         }
166
         }
163
     },
167
     },
164
 
168
 
173
      * @param {boolean} show {true} to show those options, {false} to hide them
177
      * @param {boolean} show {true} to show those options, {false} to hide them
174
      */
178
      */
175
     showFollowMeOptions (show) {
179
     showFollowMeOptions (show) {
176
-        if (show) {
177
-            $("#followMeOptions").css("display", "block");
180
+        if (show && UIUtil.isSettingEnabled('moderator')) {
181
+            UIUtil.showElement("followMeOptions");
178
         } else {
182
         } else {
179
-            $("#followMeOptions").css("display", "none");
183
+            UIUtil.hideElement("followMeOptions");
180
         }
184
         }
181
     },
185
     },
182
 
186
 

+ 18
- 3
modules/UI/util/UIUtil.js 查看文件

129
     /**
129
     /**
130
      * Shows the element given by id.
130
      * Shows the element given by id.
131
      *
131
      *
132
-     * @param {String} the identifier of the element
132
+     * @param {String} the identifier of the element to show
133
      */
133
      */
134
-    showHiddenElement(id) {
135
-        $("#"+id).toggleClass("hide").toggleClass("show");
134
+    showElement(id) {
135
+        if ($("#"+id).hasClass("hide"))
136
+            $("#"+id).removeClass("hide");
137
+
138
+        $("#"+id).addClass("show");
139
+    },
140
+
141
+    /**
142
+     * Hides the element given by id.
143
+     *
144
+     * @param {String} the identifier of the element to hide
145
+     */
146
+    hideElement(id) {
147
+        if ($("#"+id).hasClass("show"))
148
+            $("#"+id).removeClass("show");
149
+
150
+        $("#"+id).addClass("hide");
136
     },
151
     },
137
 
152
 
138
     hideDisabledButtons: function (mappings) {
153
     hideDisabledButtons: function (mappings) {

Loading…
取消
儲存