Просмотр исходного кода

Makes the generation of roomnames on the welcome page configurable and fixes some minor issues.

j8
Boris Grozev 10 лет назад
Родитель
Сommit
c53cc032a0
4 измененных файлов: 37 добавлений и 30 удалений
  1. 32
    26
      app.js
  2. 2
    1
      css/welcome_page.css
  3. 2
    1
      interface_config.js
  4. 1
    2
      roomname_generator.js

+ 32
- 26
app.js Просмотреть файл

@@ -209,7 +209,7 @@ function doJoin() {
209 209
         if (path.length > 1) {
210 210
             roomnode = path.substr(1).toLowerCase();
211 211
         } else {
212
-            var word = RoomNameGenerator.generateRoomWithoutSeparator(3);
212
+            var word = RoomNameGenerator.generateRoomWithoutSeparator();
213 213
             roomnode = word.toLowerCase();
214 214
 
215 215
             window.history.pushState('VideoChat',
@@ -1167,9 +1167,12 @@ $(document).ready(function () {
1167 1167
         function enter_room()
1168 1168
         {
1169 1169
             var val = $("#enter_room_field").val();
1170
-            if(!val)
1170
+            if(!val) {
1171 1171
                 val = $("#enter_room_field").attr("room_name");
1172
-            window.location.pathname = "/" + val;
1172
+            }
1173
+            if (val) {
1174
+                window.location.pathname = "/" + val;
1175
+            }
1173 1176
         }
1174 1177
         $("#enter_room_button").click(function()
1175 1178
         {
@@ -1177,37 +1180,41 @@ $(document).ready(function () {
1177 1180
         });
1178 1181
 
1179 1182
         $("#enter_room_field").keydown(function (event) {
1180
-            if (event.keyCode === 13) {
1183
+            if (event.keyCode === 13 /* enter */) {
1181 1184
                 enter_room();
1182 1185
             }
1183 1186
         });
1184 1187
 
1185
-        var updateTimeout;
1186
-        var animateTimeout;
1187
-        $("#reload_roomname").click(function () {
1188
-            clearTimeout(updateTimeout);
1189
-            clearTimeout(animateTimeout);
1190
-            update_roomname();
1191
-        });
1192 1188
 
1193
-        function animate(word) {
1194
-            var currentVal = $("#enter_room_field").attr("placeholder");
1195
-            $("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
1196
-            animateTimeout = setTimeout(function() {
1189
+        if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE){
1190
+            var updateTimeout;
1191
+            var animateTimeout;
1192
+            $("#reload_roomname").click(function () {
1193
+                clearTimeout(updateTimeout);
1194
+                clearTimeout(animateTimeout);
1195
+                update_roomname();
1196
+            });
1197
+            $("#reload_roomname").show();
1198
+
1199
+            function animate(word) {
1200
+                var currentVal = $("#enter_room_field").attr("placeholder");
1201
+                $("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
1202
+                animateTimeout = setTimeout(function() {
1197 1203
                     animate(word.substring(1, word.length))
1198 1204
                 }, 70);
1199
-        }
1200
-
1201
-        function update_roomname()
1202
-        {
1203
-            var word = RoomNameGenerator.generateRoomWithoutSeparator();
1204
-            $("#enter_room_field").attr("room_name", word);
1205
-            $("#enter_room_field").attr("placeholder", "");
1206
-            animate(word);
1207
-            updateTimeout = setTimeout(update_roomname, 10000);
1205
+            }
1208 1206
 
1207
+            function update_roomname()
1208
+            {
1209
+                var word = RoomNameGenerator.generateRoomWithoutSeparator();
1210
+                $("#enter_room_field").attr("room_name", word);
1211
+                $("#enter_room_field").attr("placeholder", "");
1212
+                clearTimeout(animateTimeout);
1213
+                animate(word);
1214
+                updateTimeout = setTimeout(update_roomname, 10000);
1215
+            }
1216
+            update_roomname();
1209 1217
         }
1210
-        update_roomname();
1211 1218
 
1212 1219
         $("#disable_welcome").click(function () {
1213 1220
             window.localStorage.welcomePageDisabled
@@ -1544,7 +1551,6 @@ function hangup() {
1544 1551
     disposeConference();
1545 1552
     sessionTerminated = true;
1546 1553
     connection.emuc.doLeave();
1547
-    var buttons = {};
1548 1554
     if(config.enableWelcomePage)
1549 1555
     {
1550 1556
         setTimeout(function()

+ 2
- 1
css/welcome_page.css Просмотреть файл

@@ -201,4 +201,5 @@
201 201
     float:  left;
202 202
     cursor: pointer;
203 203
     text-align: center;
204
-}
204
+    display: none;
205
+}

+ 2
- 1
interface_config.js Просмотреть файл

@@ -10,5 +10,6 @@ var interfaceConfig = {
10 10
     JITSI_WATERMARK_LINK: "http://jitsi.org",
11 11
     SHOW_BRAND_WATERMARK: false,
12 12
     BRAND_WATERMARK_LINK: "",
13
-    SHOW_POWERED_BY: false
13
+    SHOW_POWERED_BY: false,
14
+    GENERATE_ROOMNAMES_ON_WELCOME_PAGE: true
14 15
 };

+ 1
- 2
roomname_generator.js Просмотреть файл

@@ -166,9 +166,8 @@ var RoomNameGenerator = function(my) {
166 166
 
167 167
     /**
168 168
      * Generates new room name.
169
-     * @param number_of_words ignored
170 169
      */
171
-    RoomNameGeneratorProto.generateRoomWithoutSeparator = function(number_of_words)
170
+    RoomNameGeneratorProto.generateRoomWithoutSeparator = function()
172 171
     {
173 172
         // Note that if more than one pattern is available, the choice of 'name' won't be random (names from patterns
174 173
         // with fewer options will have higher probability of being chosen that names from patterns with more options).

Загрузка…
Отмена
Сохранить