Conditionally show custom server bit

This commit is contained in:
David Baker 2018-09-04 10:08:52 +01:00
parent 9c8ef4240c
commit e23195fd86
2 changed files with 8 additions and 4 deletions

View file

@ -341,7 +341,7 @@ body {
</div>
</div>
</div>
<div class="mx_HomePage_col mx_HomePage_toprow">
<div id="step2_container" class="mx_HomePage_col mx_HomePage_toprow" style="display: none; ">
<div class="mx_HomePage_row">
<div>
<h2>Step 2: Use a custom server</h2>
@ -373,7 +373,7 @@ body {
<div class="mx_HomePage_col mx_HomePage_toprow">
<div class="mx_HomePage_row">
<div>
<h2>Step 3: Register or Log in</h2>
<h2 id="step_login_header">Step 2: Register or Log in</h2>
<p>Create a new account if you don&apos;t have one, or log in to your existing account.</p>
</div>
</div>

View file

@ -9,11 +9,15 @@ async function initPage() {
document.getElementById('back_to_riot_button').onclick = onBackToRiotClick;
const config = await getVectorConfig('..');
let hsUrl = 'https://matrix.org/';
let hsUrl;
if (config && config['default_hs_url']) {
hsUrl = config['default_hs_url'];
}
document.getElementById('hs_url').innerHTML = hsUrl;
if (hsUrl && hsUrl !== 'https://matrix.org/') {
document.getElementById('step2_container').style.display = 'block';
document.getElementById('hs_url').innerHTML = hsUrl;
document.getElementById('step_login_header').innerHTML= 'Step 3: Register or Log in';
}
}
initPage();