Skip to content

Conversation

mjsir911
Copy link

This allows wildcarding excluded all domains for a stylesheet (like global dark mode enable), & then opting in per-domain when I need it.

Related: #1892

Basically just prioritize matching includes over excludes. I don't think it's backwards compatible.

API.styles.toggleOverride(menu.styleId, rule, false, input.checked);
};
}
for (const el of $$('[data-include]')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, but could you combine the two loops using $$('[data-exclude], [data-include]') ?

if ((ovr = style.inclusions) && ovr.some(urlMatchExclusion, query)) {
return 'included';
}
if ((ovr = style.exclusions) && ovr.some(urlMatchExclusion, query)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good thing to drastically change the priority of matching. I guess it may be a user configurable option in the style exposed in style settings in the editor and in the popup's three-dot menu.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I agree with you and that's what my comment about backwards compatibility was.

I can't really imagine a situation where an excluded glob is superceding an included line, because then surely your included line just isn't useful?

But yeah I'de agree that user configurable is a possibility

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, the problem is that now the conditions like style.enabled are checked prior to inclusion/exclusion, which messes up matching.


export function urlMatchStyle(query, style) {
let ovr;
if ((ovr = style.exclusions) && ovr.some(urlMatchExclusion, query)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment about priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants