* Fix & cleanup config in popup. Closes #602 * Hide icon for USO with no config
This commit is contained in:
parent
8b8a3d60ab
commit
7f3013f477
|
@ -276,15 +276,24 @@ function createStyleElement({
|
|||
});
|
||||
styleName.checkbox = checkbox;
|
||||
styleName.appendChild(document.createTextNode(' '));
|
||||
|
||||
const config = $('.configure', entry);
|
||||
if (!style.usercssData && style.updateUrl && style.updateUrl.includes('?') && style.url) {
|
||||
config.target = '_blank';
|
||||
config.title = t('configureStyleOnHomepage');
|
||||
config.dataset.sendMessage = JSON.stringify({method: 'openSettings'});
|
||||
$('use', config).attributes['xlink:href'].nodeValue = '#svg-icon-config-uso';
|
||||
config.onclick = handleEvent.configure;
|
||||
if (!style.usercssData) {
|
||||
if (style.updateUrl && style.updateUrl.includes('?') && style.url) {
|
||||
config.href = style.url;
|
||||
config.target = '_blank';
|
||||
config.title = t('configureStyleOnHomepage');
|
||||
config.dataset.sendMessage = JSON.stringify({method: 'openSettings'});
|
||||
$('use', config).attributes['xlink:href'].nodeValue = '#svg-icon-config-uso';
|
||||
} else {
|
||||
config.classList.add('hidden');
|
||||
}
|
||||
} else if (Object.keys(style.usercssData.vars || {}).length === 0) {
|
||||
config.classList.add('hidden');
|
||||
}
|
||||
|
||||
$('.delete', entry).onclick = handleEvent.delete;
|
||||
$('.configure', entry).onclick = handleEvent.configure;
|
||||
|
||||
const indicator = template.regexpProblemIndicator.cloneNode(true);
|
||||
indicator.appendChild(document.createTextNode('!'));
|
||||
|
@ -307,15 +316,6 @@ function createStyleElement({
|
|||
styleName.textContent : '';
|
||||
});
|
||||
|
||||
const config = $('.configure', entry);
|
||||
if (!style.usercssData && style.updateUrl && style.updateUrl.includes('?') && style.url) {
|
||||
config.href = style.url;
|
||||
}
|
||||
config.style.display =
|
||||
!style.usercssData && config.href ||
|
||||
style.usercssData && Object.keys(style.usercssData.vars || {}).length ?
|
||||
'' : 'none';
|
||||
|
||||
entry.classList.toggle('not-applied', style.excluded || style.sloppy);
|
||||
entry.classList.toggle('regexp-partial', style.sloppy);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user