Disable input & hide icon

This commit is contained in:
Rob Garrison 2018-11-29 06:35:05 -06:00
parent bd44f83121
commit b1034114d7
2 changed files with 11 additions and 2 deletions

View File

@ -248,6 +248,7 @@ h2.installed.active {
.unavailable-message,
.unavailable .available-message,
.unavailable .svg-icon,
.live-reload.unavailable input,
.set-update-url.unavailable input {
display: none;

View File

@ -16,7 +16,7 @@
let port;
if (params.has('direct')) {
$('.live-reload').classList.add('unavailable');
setUnavailable('.live-reload');
getCodeDirectly();
} else {
port = chrome.tabs.connect(tabId);
@ -315,7 +315,7 @@
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').classList.add('unavailable');
setUnavailable('.set-update-url');
return;
} else if (updateUrl.protocol !== 'file:') {
checker.checked = true;
@ -354,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 *_gen() {
for (const section of style.sections) {