Fix: disable redundant exclude-by-url checkbox
This commit is contained in:
parent
9101ee9219
commit
f7d0853f84
|
@ -321,6 +321,9 @@
|
||||||
"excludeStyleByUrlLabel": {
|
"excludeStyleByUrlLabel": {
|
||||||
"message": "Exclude the current URL"
|
"message": "Exclude the current URL"
|
||||||
},
|
},
|
||||||
|
"excludeStyleByUrlRedundant": {
|
||||||
|
"message": "The current URL is the domain page"
|
||||||
|
},
|
||||||
"exportLabel": {
|
"exportLabel": {
|
||||||
"message": "Export",
|
"message": "Export",
|
||||||
"description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)"
|
"description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)"
|
||||||
|
|
|
@ -367,6 +367,10 @@ a.configure[target="_blank"] .svg-icon.config {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
.entry .menu-item.disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
/* checkbox */
|
/* checkbox */
|
||||||
.checkbox-container {
|
.checkbox-container {
|
||||||
|
|
|
@ -335,7 +335,16 @@ function createStyleElement(style) {
|
||||||
entry.classList.toggle('regexp-partial', style.sloppy);
|
entry.classList.toggle('regexp-partial', style.sloppy);
|
||||||
|
|
||||||
$('.exclude-by-domain-checkbox', entry).checked = styleExcluded(style, 'domain');
|
$('.exclude-by-domain-checkbox', entry).checked = styleExcluded(style, 'domain');
|
||||||
$('.exclude-by-url-checkbox', entry).checked = styleExcluded(style, 'url');
|
|
||||||
|
const excludeByUrlCheckbox = $('.exclude-by-url-checkbox', entry);
|
||||||
|
const isRedundant = getExcludeRule('domain') === getExcludeRule('url');
|
||||||
|
excludeByUrlCheckbox.checked = !isRedundant && styleExcluded(style, 'url');
|
||||||
|
excludeByUrlCheckbox.disabled = isRedundant;
|
||||||
|
|
||||||
|
const excludeByUrlLabel = $('.exclude-by-url', entry);
|
||||||
|
excludeByUrlLabel.classList.toggle('disabled', isRedundant);
|
||||||
|
excludeByUrlLabel.title = isRedundant ?
|
||||||
|
chrome.i18n.getMessage('excludeStyleByUrlRedundant') : '';
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user