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

View File

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

View File

@ -10,5 +10,6 @@ var interfaceConfig = {
JITSI_WATERMARK_LINK: "http://jitsi.org",
SHOW_BRAND_WATERMARK: false,
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.
* @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
// with fewer options will have higher probability of being chosen that names from patterns with more options).