Revert "Change: drop excludeStyleByUrlRedundant"
This reverts commit 76129e125c
.
This commit is contained in:
parent
76129e125c
commit
7ad3e45513
|
@ -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)"
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -349,16 +358,10 @@ function styleExcluded({exclusions}, type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExcludeRule(type) {
|
function getExcludeRule(type) {
|
||||||
const u = new URL(tabURL);
|
|
||||||
if (type === 'domain') {
|
if (type === 'domain') {
|
||||||
return u.origin + '/*';
|
return new URL(tabURL).origin + '/*';
|
||||||
}
|
}
|
||||||
// current page
|
return tabURL + '*';
|
||||||
return escapeGlob(u.origin + u.pathname);
|
|
||||||
}
|
|
||||||
|
|
||||||
function escapeGlob(text) {
|
|
||||||
return text.replace(/\*/g, '\\*');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(handleEvent, {
|
Object.assign(handleEvent, {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user