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

This commit is contained in:
Boris Grozev 2014-10-01 21:21:57 +02:00
parent 292a080c48
commit c53cc032a0
4 changed files with 37 additions and 30 deletions

16
app.js
View File

@ -209,7 +209,7 @@ function doJoin() {
if (path.length > 1) { if (path.length > 1) {
roomnode = path.substr(1).toLowerCase(); roomnode = path.substr(1).toLowerCase();
} else { } else {
var word = RoomNameGenerator.generateRoomWithoutSeparator(3); var word = RoomNameGenerator.generateRoomWithoutSeparator();
roomnode = word.toLowerCase(); roomnode = word.toLowerCase();
window.history.pushState('VideoChat', window.history.pushState('VideoChat',
@ -1167,21 +1167,26 @@ $(document).ready(function () {
function enter_room() function enter_room()
{ {
var val = $("#enter_room_field").val(); var val = $("#enter_room_field").val();
if(!val) if(!val) {
val = $("#enter_room_field").attr("room_name"); val = $("#enter_room_field").attr("room_name");
}
if (val) {
window.location.pathname = "/" + val; window.location.pathname = "/" + val;
} }
}
$("#enter_room_button").click(function() $("#enter_room_button").click(function()
{ {
enter_room(); enter_room();
}); });
$("#enter_room_field").keydown(function (event) { $("#enter_room_field").keydown(function (event) {
if (event.keyCode === 13) { if (event.keyCode === 13 /* enter */) {
enter_room(); enter_room();
} }
}); });
if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE){
var updateTimeout; var updateTimeout;
var animateTimeout; var animateTimeout;
$("#reload_roomname").click(function () { $("#reload_roomname").click(function () {
@ -1189,6 +1194,7 @@ $(document).ready(function () {
clearTimeout(animateTimeout); clearTimeout(animateTimeout);
update_roomname(); update_roomname();
}); });
$("#reload_roomname").show();
function animate(word) { function animate(word) {
var currentVal = $("#enter_room_field").attr("placeholder"); var currentVal = $("#enter_room_field").attr("placeholder");
@ -1203,11 +1209,12 @@ $(document).ready(function () {
var word = RoomNameGenerator.generateRoomWithoutSeparator(); var word = RoomNameGenerator.generateRoomWithoutSeparator();
$("#enter_room_field").attr("room_name", word); $("#enter_room_field").attr("room_name", word);
$("#enter_room_field").attr("placeholder", ""); $("#enter_room_field").attr("placeholder", "");
clearTimeout(animateTimeout);
animate(word); animate(word);
updateTimeout = setTimeout(update_roomname, 10000); updateTimeout = setTimeout(update_roomname, 10000);
} }
update_roomname(); update_roomname();
}
$("#disable_welcome").click(function () { $("#disable_welcome").click(function () {
window.localStorage.welcomePageDisabled window.localStorage.welcomePageDisabled
@ -1544,7 +1551,6 @@ function hangup() {
disposeConference(); disposeConference();
sessionTerminated = true; sessionTerminated = true;
connection.emuc.doLeave(); connection.emuc.doLeave();
var buttons = {};
if(config.enableWelcomePage) if(config.enableWelcomePage)
{ {
setTimeout(function() setTimeout(function()

View File

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

View File

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

View File

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