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

58
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,9 +1167,12 @@ $(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");
window.location.pathname = "/" + val; }
if (val) {
window.location.pathname = "/" + val;
}
} }
$("#enter_room_button").click(function() $("#enter_room_button").click(function()
{ {
@ -1177,37 +1180,41 @@ $(document).ready(function () {
}); });
$("#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();
} }
}); });
var updateTimeout;
var animateTimeout;
$("#reload_roomname").click(function () {
clearTimeout(updateTimeout);
clearTimeout(animateTimeout);
update_roomname();
});
function animate(word) { if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE){
var currentVal = $("#enter_room_field").attr("placeholder"); var updateTimeout;
$("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1)); var animateTimeout;
animateTimeout = setTimeout(function() { $("#reload_roomname").click(function () {
clearTimeout(updateTimeout);
clearTimeout(animateTimeout);
update_roomname();
});
$("#reload_roomname").show();
function animate(word) {
var currentVal = $("#enter_room_field").attr("placeholder");
$("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
animateTimeout = setTimeout(function() {
animate(word.substring(1, word.length)) animate(word.substring(1, word.length))
}, 70); }, 70);
} }
function update_roomname()
{
var word = RoomNameGenerator.generateRoomWithoutSeparator();
$("#enter_room_field").attr("room_name", word);
$("#enter_room_field").attr("placeholder", "");
animate(word);
updateTimeout = setTimeout(update_roomname, 10000);
function update_roomname()
{
var word = RoomNameGenerator.generateRoomWithoutSeparator();
$("#enter_room_field").attr("room_name", word);
$("#enter_room_field").attr("placeholder", "");
clearTimeout(animateTimeout);
animate(word);
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).