Fix: handle non-configurable styles
This commit is contained in:
parent
f9c45b0dac
commit
7c46dae627
|
@ -247,6 +247,7 @@ function createStyleElement({
|
||||||
Object.assign(entry, {
|
Object.assign(entry, {
|
||||||
id: ENTRY_ID_PREFIX_RAW + style.id,
|
id: ENTRY_ID_PREFIX_RAW + style.id,
|
||||||
styleId: style.id,
|
styleId: style.id,
|
||||||
|
styleIsUsercss: Boolean(style.usercssData),
|
||||||
className: entry.className + ' ' + (style.enabled ? 'enabled' : 'disabled'),
|
className: entry.className + ' ' + (style.enabled ? 'enabled' : 'disabled'),
|
||||||
onmousedown: handleEvent.maybeEdit,
|
onmousedown: handleEvent.maybeEdit,
|
||||||
});
|
});
|
||||||
|
@ -277,6 +278,14 @@ function createStyleElement({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const config = $('.configure', entry);
|
||||||
|
if (!style.usercssData && style.updateUrl && style.updateUrl.includes('?') && style.url) {
|
||||||
|
config.href = style.url;
|
||||||
|
config.target = '_blank';
|
||||||
|
} else if (!style.usercssData || !Object.keys(style.usercssData.vars || {}).length) {
|
||||||
|
config.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
$('.enable', entry).onclick = handleEvent.toggle;
|
$('.enable', entry).onclick = handleEvent.toggle;
|
||||||
$('.disable', entry).onclick = handleEvent.toggle;
|
$('.disable', entry).onclick = handleEvent.toggle;
|
||||||
$('.delete', entry).onclick = handleEvent.delete;
|
$('.delete', entry).onclick = handleEvent.delete;
|
||||||
|
@ -351,8 +360,12 @@ Object.assign(handleEvent, {
|
||||||
},
|
},
|
||||||
|
|
||||||
configure(event) {
|
configure(event) {
|
||||||
const id = handleEvent.getClickedStyleId(event);
|
const {styleId, styleIsUsercss} = handleEvent.getClickedStyleElement(event);
|
||||||
getStylesSafe({id}).then(([style]) => style).then(configDialog);
|
if (styleIsUsercss) {
|
||||||
|
getStylesSafe({id: styleId})
|
||||||
|
.then(([style]) => style)
|
||||||
|
.then(configDialog);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
indicator(event) {
|
indicator(event) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user