Bläddra i källkod

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

master
Boris Grozev 10 år sedan
förälder
incheckning
c53cc032a0
4 ändrade filer med 37 tillägg och 30 borttagningar
  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 Visa fil

209
         if (path.length > 1) {
209
         if (path.length > 1) {
210
             roomnode = path.substr(1).toLowerCase();
210
             roomnode = path.substr(1).toLowerCase();
211
         } else {
211
         } else {
212
-            var word = RoomNameGenerator.generateRoomWithoutSeparator(3);
212
+            var word = RoomNameGenerator.generateRoomWithoutSeparator();
213
             roomnode = word.toLowerCase();
213
             roomnode = word.toLowerCase();
214
 
214
 
215
             window.history.pushState('VideoChat',
215
             window.history.pushState('VideoChat',
1167
         function enter_room()
1167
         function enter_room()
1168
         {
1168
         {
1169
             var val = $("#enter_room_field").val();
1169
             var val = $("#enter_room_field").val();
1170
-            if(!val)
1170
+            if(!val) {
1171
                 val = $("#enter_room_field").attr("room_name");
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
         $("#enter_room_button").click(function()
1177
         $("#enter_room_button").click(function()
1175
         {
1178
         {
1177
         });
1180
         });
1178
 
1181
 
1179
         $("#enter_room_field").keydown(function (event) {
1182
         $("#enter_room_field").keydown(function (event) {
1180
-            if (event.keyCode === 13) {
1183
+            if (event.keyCode === 13 /* enter */) {
1181
                 enter_room();
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
                     animate(word.substring(1, word.length))
1203
                     animate(word.substring(1, word.length))
1198
                 }, 70);
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
         $("#disable_welcome").click(function () {
1219
         $("#disable_welcome").click(function () {
1213
             window.localStorage.welcomePageDisabled
1220
             window.localStorage.welcomePageDisabled
1544
     disposeConference();
1551
     disposeConference();
1545
     sessionTerminated = true;
1552
     sessionTerminated = true;
1546
     connection.emuc.doLeave();
1553
     connection.emuc.doLeave();
1547
-    var buttons = {};
1548
     if(config.enableWelcomePage)
1554
     if(config.enableWelcomePage)
1549
     {
1555
     {
1550
         setTimeout(function()
1556
         setTimeout(function()

+ 2
- 1
css/welcome_page.css Visa fil

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

+ 2
- 1
interface_config.js Visa fil

10
     JITSI_WATERMARK_LINK: "http://jitsi.org",
10
     JITSI_WATERMARK_LINK: "http://jitsi.org",
11
     SHOW_BRAND_WATERMARK: false,
11
     SHOW_BRAND_WATERMARK: false,
12
     BRAND_WATERMARK_LINK: "",
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 Visa fil

166
 
166
 
167
     /**
167
     /**
168
      * Generates new room name.
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
         // Note that if more than one pattern is available, the choice of 'name' won't be random (names from patterns
172
         // Note that if more than one pattern is available, the choice of 'name' won't be random (names from patterns
174
         // with fewer options will have higher probability of being chosen that names from patterns with more options).
173
         // with fewer options will have higher probability of being chosen that names from patterns with more options).

Laddar…
Avbryt
Spara