* Fix usercss install error. Closes #589 * Cleanup * Disable input & hide icon
This commit is contained in:
parent
a4c08084bf
commit
6aaff7aa12
|
@ -60,13 +60,15 @@
|
||||||
<label class="set-update-url">
|
<label class="set-update-url">
|
||||||
<input type="checkbox">
|
<input type="checkbox">
|
||||||
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
|
<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>
|
<p></p>
|
||||||
</label>
|
</label>
|
||||||
<label class="live-reload">
|
<label class="live-reload">
|
||||||
<input type="checkbox">
|
<input type="checkbox">
|
||||||
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
|
<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>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<p class="meta-description"></p>
|
<p class="meta-description"></p>
|
||||||
|
|
|
@ -246,6 +246,18 @@ h2.installed.active {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unavailable-message,
|
||||||
|
.unavailable .available-message,
|
||||||
|
.unavailable .svg-icon,
|
||||||
|
.live-reload.unavailable input,
|
||||||
|
.set-update-url.unavailable input {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unavailable .unavailable-message {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.set-update-url {
|
.set-update-url {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
let port;
|
let port;
|
||||||
|
|
||||||
if (params.has('direct')) {
|
if (params.has('direct')) {
|
||||||
$('.live-reload').textContent = t('liveReloadUnavailable');
|
setUnavailable('.live-reload');
|
||||||
$('.live-reload').classList.add('unavailable');
|
|
||||||
getCodeDirectly();
|
getCodeDirectly();
|
||||||
} else {
|
} else {
|
||||||
port = chrome.tabs.connect(tabId);
|
port = chrome.tabs.connect(tabId);
|
||||||
|
@ -310,15 +309,13 @@
|
||||||
// prefer the installation URL unless drag'n'dropped on the manage page
|
// prefer the installation URL unless drag'n'dropped on the manage page
|
||||||
const installationUrl = (params.get('updateUrl') || '').replace(/^blob.+/, '');
|
const installationUrl = (params.get('updateUrl') || '').replace(/^blob.+/, '');
|
||||||
const updateUrl = new URL(installationUrl || style.updateUrl || DUMMY_URL);
|
const updateUrl = new URL(installationUrl || style.updateUrl || DUMMY_URL);
|
||||||
$('.set-update-url > span').textContent = t('installUpdateFromLabel');
|
|
||||||
if (dup && dup.updateUrl === updateUrl.href) {
|
if (dup && dup.updateUrl === updateUrl.href) {
|
||||||
checker.checked = true;
|
checker.checked = true;
|
||||||
// there is no way to "unset" updateUrl, you can only overwrite it.
|
// there is no way to "unset" updateUrl, you can only overwrite it.
|
||||||
checker.disabled = true;
|
checker.disabled = true;
|
||||||
} else if (updateUrl.href === DUMMY_URL) {
|
} else if (updateUrl.href === DUMMY_URL) {
|
||||||
// drag'n'dropped on the manage page and the style doesn't have @updateURL
|
// drag'n'dropped on the manage page and the style doesn't have @updateURL
|
||||||
$('.set-update-url').textContent = t('installUpdateUnavailable');
|
setUnavailable('.set-update-url');
|
||||||
$('.set-update-url').classList.add('unavailable');
|
|
||||||
return;
|
return;
|
||||||
} else if (updateUrl.protocol !== 'file:') {
|
} else if (updateUrl.protocol !== 'file:') {
|
||||||
checker.checked = true;
|
checker.checked = true;
|
||||||
|
@ -357,6 +354,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUnavailable(label) {
|
||||||
|
const el = $(label);
|
||||||
|
el.classList.add('unavailable');
|
||||||
|
const input = $('input', el);
|
||||||
|
input.disabled = true;
|
||||||
|
input.checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
function getAppliesTo(style) {
|
function getAppliesTo(style) {
|
||||||
function *_gen() {
|
function *_gen() {
|
||||||
for (const section of style.sections) {
|
for (const section of style.sections) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user