Change: drop excludeStyleByUrlRedundant plus menu height
This commit is contained in:
parent
5686e93328
commit
29908feb1e
|
@ -26,6 +26,10 @@ body {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
.firefox, .firefox body:not(.search-results-shown) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.firefox body {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
|
@ -327,8 +331,7 @@ a.configure[target="_blank"] .svg-icon.config {
|
|||
opacity: 0;
|
||||
}
|
||||
.entry.menu-active .menu {
|
||||
/* FIXME: avoid hard coded height */
|
||||
height: 72px;
|
||||
height: var(--menu-height, 0px);
|
||||
opacity: 1;
|
||||
}
|
||||
/* accessibility */
|
||||
|
@ -336,12 +339,12 @@ a.configure[target="_blank"] .svg-icon.config {
|
|||
display: none;
|
||||
border: none;
|
||||
align-items: center;
|
||||
padding: 0 0 0 20px;
|
||||
height: 24px;
|
||||
padding: 3px 0 3px 20px;
|
||||
background: none;
|
||||
text-decoration: none;
|
||||
flex: none;
|
||||
}
|
||||
.entry.menu-active.accessible-items .menu-item {
|
||||
.entry.menu-active .menu-item {
|
||||
display: flex;
|
||||
}
|
||||
.entry .menu-item.delete {
|
||||
|
@ -360,6 +363,7 @@ a.configure[target="_blank"] .svg-icon.config {
|
|||
}
|
||||
.entry .menu-icon {
|
||||
width: 26px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.entry .menu-icon > * {
|
||||
display: block;
|
||||
|
|
|
@ -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, {
|
||||
|
@ -397,11 +394,11 @@ Object.assign(handleEvent, {
|
|||
},
|
||||
|
||||
toggleMenu(event) {
|
||||
document.documentElement.classList.toggle('menu-shown')
|
||||
const entry = handleEvent.getClickedStyleElement(event);
|
||||
entry.classList.toggle('menu-active');
|
||||
setTimeout(() => {
|
||||
entry.classList.toggle('accessible-items');
|
||||
}, 250);
|
||||
const menu = entry.querySelector('.menu');
|
||||
menu.style.setProperty('--menu-height', menu.scrollHeight + 'px');
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user