1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-26 18:45:57 +01:00

Fix title display.

This commit is contained in:
Juliusz Chroboczek 2021-07-16 23:03:36 +02:00
parent 4a5796b925
commit 7b4fd8932c

View file

@ -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) {
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() {
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());