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

Fix title display.

parent 4a5796b9
...@@ -2092,22 +2092,24 @@ function displayUsername() { ...@@ -2092,22 +2092,24 @@ function displayUsername() {
let presentRequested = null; 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 setTitle(title) {
function set(title) { function set(title) {
document.title = title; document.title = title;
document.getElementById('title').textContent = title; document.getElementById('title').textContent = title;
} }
if(title) { if(title)
set(title); set(title);
return;
}
let t = group.charAt(0).toUpperCase() + group.slice(1);
if(t) {
set(t);
return;
}
set('Galène'); set('Galène');
} }
...@@ -2139,7 +2141,7 @@ async function gotJoined(kind, group, perms, status, message) { ...@@ -2139,7 +2141,7 @@ async function gotJoined(kind, group, perms, status, message) {
return; return;
case 'join': case 'join':
case 'change': case 'change':
setTitle(status.displayName || group); setTitle((status && status.displayName) || capitalise(group));
displayUsername(); displayUsername();
setButtonsVisibility(); setButtonsVisibility();
if(kind === 'change') if(kind === 'change')
...@@ -3085,7 +3087,7 @@ async function serverConnect() { ...@@ -3085,7 +3087,7 @@ async function serverConnect() {
function start() { function start() {
group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, '')); group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, ''));
setTitle(); setTitle(capitalise(group));
addFilters(); addFilters();
setMediaChoices(false).then(e => reflectSettings()); 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