Skip to content

Fixes Multiple TODO's in Code #4673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions background_scripts/exclusions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const ExclusionRegexpCache = {
}
},
};

// Make RegexpCache, which is required on the page popup, accessible via the Exclusions object.
const RegexpCache = ExclusionRegexpCache;

Expand All @@ -37,15 +36,17 @@ function getRule(url, rules) {
if (rules == null) {
rules = Settings.get("exclusionRules");
}
const matchingRules = rules.filter((r) =>
r.pattern && (url.search(ExclusionRegexpCache.get(r.pattern)) >= 0)
const matchingRules = rules.filter(
(r) => r.pattern && url.search(ExclusionRegexpCache.get(r.pattern)) >= 0,
);
// An absolute exclusion rule (one with no passKeys) takes priority.
for (const rule of matchingRules) {
if (!rule.passKeys) return rule;
}
// Strip whitespace from all matching passKeys strings, and join them together.
const passKeys = matchingRules.map((r) => r.passKeys.split(/\s+/).join("")).join("");
const passKeys = matchingRules
.map((r) => r.passKeys.split(/\s+/).join(""))
.join("");
// TODO(philc): Remove this commented out code.
// passKeys = (rule.passKeys.split(/\s+/).join "" for rule in matchingRules).join ""
if (matchingRules.length > 0) {
Expand All @@ -58,7 +59,7 @@ function getRule(url, rules) {
export function isEnabledForUrl(url) {
const rule = getRule(url);
return {
isEnabledForUrl: !rule || (rule.passKeys.length > 0),
isEnabledForUrl: !rule || rule.passKeys.length > 0,
passKeys: rule ? rule.passKeys : "",
};
}
Expand All @@ -74,5 +75,4 @@ function onSettingsUpdated() {
// popup is closed. Do NOT store it/use it asynchronously.
ExclusionRegexpCache.clear();
}

Settings.addEventListener("change", () => onSettingsUpdated());
12 changes: 1 addition & 11 deletions content_scripts/link_hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,7 @@ class LinkHintsMode {
if (hasPopoverSupport) {
this.containerEl.popover = "manual";
this.containerEl.showPopover();
Object.assign(this.containerEl.style, {
top: 0,
left: 0,
position: "absolute",
// This display: block is required to override Github Enterprise's CSS circa 2024-04-01. See
// #4446.
display: "block",
width: "100%",
height: "100%",
overflow: "visible",
});
this.containerEl.classList.add("vimiumPopover");
}

this.setIndicator();
Expand Down
Loading