Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdh1995 committed Feb 14, 2024
1 parent 93dd58c commit e6ee811
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions background/normalize_urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export const createSearch_ = function (query: string[], url: string, blank: stri
} else {
arr = localQuery === query && q2 ? q2 : localQuery.map(encodeAsciiComponent_)
localQuery === query && !q2 && (q2 = arr)
s1 = isJSUrl_(url) || url.startsWith("vimium://run")
s1 = isJSUrl_(url) || url.startsWith("vimium://run") || url.startsWith("data:")
|| !(<RegExpOne> /\?|#.*=/).test(url.slice(0, ind)) ? "%20" : "+"
}
s2 && s2.includes("\\") && (s2 = s2.replace(<RegExpG> /\\([\\<>|])/g, "$1"))
Expand Down Expand Up @@ -450,7 +450,7 @@ export const decodeFileURL_ = (url: string, rawUrl?: string): string => {
return url
}

const normalizeSVG_mv2 = (svg_outer_html: string): string => {
const _normalizeSVG_mv2 = (svg_outer_html: string): string => {
let svg = new DOMParser().parseFromString(svg_outer_html, "image/svg+xml").firstElementChild as SVGSVGElement | null
for (const el of svg ? ([] as Element[]).slice.call(svg.querySelectorAll("script,use")) : []) { el.remove() }
if (!svg || !svg.lastElementChild) { return "" }
Expand Down Expand Up @@ -485,7 +485,7 @@ export const normalizeSVG_ = (svg_outer_html: string): string => {
out = svg_outer_html.replace(<RegExpG & RegExpSearchable<0>> /<(?!\/)[^>]+>/g,
attributes => attributes.replace(<RegExpG> /\b(id|class|aria-[\w-]+)(\="[^"]+")? ?/g, ""))
} else {
out = normalizeSVG_mv2(svg_outer_html)
out = _normalizeSVG_mv2(svg_outer_html)
}
out = out.replace(<RegExpG & RegExpSearchable<0>> /<\/?[A-Z:]+(?=\s|>)/g, s => s.toLowerCase())
out = out.replace(<RegExpG & RegExpSearchable<0>> /(?:[%?#]|[^\S ])+/g, encodeURIComponent)
Expand Down
2 changes: 1 addition & 1 deletion lib/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ export const view_ = (el: SafeElement, allowSmooth?: BOOL | boolean, oldY?: numb
if (style) { style.setProperty(kBh, "auto", "important") }
OnEdge || OnChrome && Build.MinCVer < BrowserVer.MinScrollIntoViewOptions
? scrollIntoView_(el, !allowSmooth, delta < 0) : scrollIntoView_(el, !allowSmooth)
if (style) { style.cssText = oldCss as string }
if (f) {
secondScroll = elHeight < ih ? oldY! - scrollY : 0
// required range of wanted: delta > 0 ? [-limit, 0] : [0, limit]
f = delta * secondScroll <= 0 && delta * secondScroll >= elHeight - ih
}
isNotInViewport(el) || // in case of `scroll-behavior: smooth`
(delta || f) && scrollWndBy_(0, f ? secondScroll! * secondScroll! < 4 ? 0 : secondScroll! : delta * ih / 5)
if (style) { style.cssText = oldCss as string }
}
return ty
}
Expand Down
2 changes: 1 addition & 1 deletion pages/options_permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ OnEdge || registerClass_("OptionalPermissions", OptionalPermissionsOption_)

const initOptionalPermissions = (): void => {
const fragment = document.createDocumentFragment()
let is_important = true
let is_important = shownItems.some(i => i.name_ === "bookmarks")
for (const shownItem of shownItems) {
const name = shownItem.name_
const node = document.importNode(template, true) as EnsuredMountedHTMLElement
Expand Down

0 comments on commit e6ee811

Please sign in to comment.