Change: drop excludeStyleByUrlRedundant
This commit is contained in:
parent
629d017d94
commit
76129e125c
|
@ -321,9 +321,6 @@
|
|||
"excludeStyleByUrlLabel": {
|
||||
"message": "Exclude the current URL"
|
||||
},
|
||||
"excludeStyleByUrlRedundant": {
|
||||
"message": "The current URL is the domain page"
|
||||
},
|
||||
"exportLabel": {
|
||||
"message": "Export",
|
||||
"description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)"
|
||||
|
|
|
@ -335,16 +335,7 @@ function createStyleElement(style) {
|
|||
entry.classList.toggle('regexp-partial', style.sloppy);
|
||||
|
||||
$('.exclude-by-domain-checkbox', entry).checked = styleExcluded(style, 'domain');
|
||||
|
||||
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') : '';
|
||||
$('.exclude-by-url-checkbox', entry).checked = styleExcluded(style, 'url');
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
@ -358,10 +349,16 @@ function styleExcluded({exclusions}, type) {
|
|||
}
|
||||
|
||||
function getExcludeRule(type) {
|
||||
const u = new URL(tabURL);
|
||||
if (type === 'domain') {
|
||||
return new URL(tabURL).origin + '/*';
|
||||
return u.origin + '/*';
|
||||
}
|
||||
return tabURL + '*';
|
||||
// current page
|
||||
return escapeGlob(u.origin + u.pathname);
|
||||
}
|
||||
|
||||
function escapeGlob(text) {
|
||||
return text.replace(/\*/g, '\\*');
|
||||
}
|
||||
|
||||
Object.assign(handleEvent, {
|
||||
|
|
Loading…
Reference in New Issue
Block a user