2016-02-25 13:52:15 +00:00
|
|
|
/* global $, interfaceConfig, APP */
|
2015-01-07 14:54:03 +00:00
|
|
|
var animateTimeout, updateTimeout;
|
|
|
|
|
2015-11-06 22:08:20 +00:00
|
|
|
var RoomnameGenerator = require("../../util/RoomnameGenerator");
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
function enter_room() {
|
2015-01-07 14:54:03 +00:00
|
|
|
var val = $("#enter_room_field").val();
|
|
|
|
if(!val) {
|
|
|
|
val = $("#enter_room_field").attr("room_name");
|
|
|
|
}
|
|
|
|
if (val) {
|
|
|
|
window.location.pathname = "/" + val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function animate(word) {
|
|
|
|
var currentVal = $("#enter_room_field").attr("placeholder");
|
|
|
|
$("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
|
|
|
|
animateTimeout = setTimeout(function() {
|
2015-09-11 03:05:53 +00:00
|
|
|
animate(word.substring(1, word.length));
|
2015-01-07 14:54:03 +00:00
|
|
|
}, 70);
|
|
|
|
}
|
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
function update_roomname() {
|
2015-11-06 22:08:20 +00:00
|
|
|
var word = RoomnameGenerator.generateRoomWithoutSeparator();
|
2015-01-07 14:54:03 +00:00
|
|
|
$("#enter_room_field").attr("room_name", word);
|
|
|
|
$("#enter_room_field").attr("placeholder", "");
|
|
|
|
clearTimeout(animateTimeout);
|
|
|
|
animate(word);
|
|
|
|
updateTimeout = setTimeout(update_roomname, 10000);
|
|
|
|
}
|
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
function setupWelcomePage() {
|
2015-01-07 14:54:03 +00:00
|
|
|
$("#videoconference_page").hide();
|
|
|
|
$("#domain_name").text(
|
|
|
|
window.location.protocol + "//" + window.location.host + "/");
|
|
|
|
if (interfaceConfig.SHOW_JITSI_WATERMARK) {
|
2015-07-28 21:52:32 +00:00
|
|
|
var leftWatermarkDiv =
|
|
|
|
$("#welcome_page_header div[class='watermark leftwatermark']");
|
|
|
|
if(leftWatermarkDiv && leftWatermarkDiv.length > 0) {
|
2015-01-07 14:54:03 +00:00
|
|
|
leftWatermarkDiv.css({display: 'block'});
|
2015-07-28 21:52:32 +00:00
|
|
|
leftWatermarkDiv.parent().get(0).href =
|
|
|
|
interfaceConfig.JITSI_WATERMARK_LINK;
|
2015-01-07 14:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_BRAND_WATERMARK) {
|
2015-07-28 21:52:32 +00:00
|
|
|
var rightWatermarkDiv =
|
|
|
|
$("#welcome_page_header div[class='watermark rightwatermark']");
|
2015-01-07 14:54:03 +00:00
|
|
|
if(rightWatermarkDiv && rightWatermarkDiv.length > 0) {
|
|
|
|
rightWatermarkDiv.css({display: 'block'});
|
2015-07-28 21:52:32 +00:00
|
|
|
rightWatermarkDiv.parent().get(0).href =
|
|
|
|
interfaceConfig.BRAND_WATERMARK_LINK;
|
|
|
|
rightWatermarkDiv.get(0).style.backgroundImage =
|
|
|
|
"url(images/rightwatermark.png)";
|
2015-01-07 14:54:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_POWERED_BY) {
|
|
|
|
$("#welcome_page_header>a[class='poweredby']")
|
|
|
|
.css({display: 'block'});
|
|
|
|
}
|
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
$("#enter_room_button").click(function() {
|
2015-01-07 14:54:03 +00:00
|
|
|
enter_room();
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#enter_room_field").keydown(function (event) {
|
|
|
|
if (event.keyCode === 13 /* enter */) {
|
|
|
|
enter_room();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE !== false) {
|
2015-01-07 14:54:03 +00:00
|
|
|
var updateTimeout;
|
|
|
|
var animateTimeout;
|
2015-07-28 21:52:32 +00:00
|
|
|
var selector = $("#reload_roomname");
|
|
|
|
selector.click(function () {
|
2015-01-07 14:54:03 +00:00
|
|
|
clearTimeout(updateTimeout);
|
|
|
|
clearTimeout(animateTimeout);
|
|
|
|
update_roomname();
|
|
|
|
});
|
2015-07-28 21:52:32 +00:00
|
|
|
selector.show();
|
2015-01-07 14:54:03 +00:00
|
|
|
|
|
|
|
update_roomname();
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#disable_welcome").click(function () {
|
2016-02-25 13:52:15 +00:00
|
|
|
APP.settings.setWelcomePageEnabled(
|
|
|
|
!$("#disable_welcome").is(":checked")
|
|
|
|
);
|
2015-01-07 14:54:03 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-25 13:52:15 +00:00
|
|
|
module.exports = setupWelcomePage;
|