This commit is contained in:
Rob Garrison 2018-11-29 05:54:35 -06:00
parent ef4a0b722a
commit bd44f83121
3 changed files with 15 additions and 7 deletions

View File

@ -60,13 +60,15 @@
<label class="set-update-url">
<input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span></span>
<span class="available-message" i18n-text="installUpdateFromLabel"></span>
<span class="unavailable-message" i18n-text="installUpdateUnavailable"></span>
<p></p>
</label>
<label class="live-reload">
<input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span i18n-text="liveReloadLabel"></span>
<span class="available-message" i18n-text="liveReloadLabel"></span>
<span class="unavailable-message" i18n-text="liveReloadUnavailable"></span>
</label>
</div>
<p class="meta-description"></p>

View File

@ -246,6 +246,17 @@ h2.installed.active {
min-width: 0;
}
.unavailable-message,
.unavailable .available-message,
.live-reload.unavailable input,
.set-update-url.unavailable input {
display: none;
}
.unavailable .unavailable-message {
display: block;
}
.set-update-url {
flex-wrap: wrap;
}

View File

@ -16,8 +16,6 @@
let port;
if (params.has('direct')) {
$('.live-reload input').classList.add('hidden');
$('.live-reload span').textContent = t('liveReloadUnavailable');
$('.live-reload').classList.add('unavailable');
getCodeDirectly();
} else {
@ -311,15 +309,12 @@
// prefer the installation URL unless drag'n'dropped on the manage page
const installationUrl = (params.get('updateUrl') || '').replace(/^blob.+/, '');
const updateUrl = new URL(installationUrl || style.updateUrl || DUMMY_URL);
$('.set-update-url > span').textContent = t('installUpdateFromLabel');
if (dup && dup.updateUrl === updateUrl.href) {
checker.checked = true;
// there is no way to "unset" updateUrl, you can only overwrite it.
checker.disabled = true;
} else if (updateUrl.href === DUMMY_URL) {
// drag'n'dropped on the manage page and the style doesn't have @updateURL
$('.set-update-url input').classList.add('hidden')
$('.set-update-url span').textContent = t('installUpdateUnavailable');
$('.set-update-url').classList.add('unavailable');
return;
} else if (updateUrl.protocol !== 'file:') {