Commit 7b4fd893 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix title display.

parent 4a5796b9
......@@ -2092,22 +2092,24 @@ function displayUsername() {
let presentRequested = null;
/**
* @param {string} [title]
* @param {string} s
*/
function capitalise(s) {
if(s.length <= 0)
return s;
return s.charAt(0).toUpperCase() + s.slice(1);
}
/**
* @param {string} title
*/
function setTitle(title) {
function set(title) {
document.title = title;
document.getElementById('title').textContent = title;
}
if(title) {
if(title)
set(title);
return;
}
let t = group.charAt(0).toUpperCase() + group.slice(1);
if(t) {
set(t);
return;
}
set('Galène');
}
......@@ -2139,7 +2141,7 @@ async function gotJoined(kind, group, perms, status, message) {
return;
case 'join':
case 'change':
setTitle(status.displayName || group);
setTitle((status && status.displayName) || capitalise(group));
displayUsername();
setButtonsVisibility();
if(kind === 'change')
......@@ -3085,7 +3087,7 @@ async function serverConnect() {
function start() {
group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, ''));
setTitle();
setTitle(capitalise(group));
addFilters();
setMediaChoices(false).then(e => reflectSettings());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment