From 9e4ef02fa84e7d5b4d6b7a7c643513aa373b52d8 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Wed, 3 May 2023 17:22:55 +0800 Subject: [PATCH] Rename `uri` to `href` --- view.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/view.js b/view.js index a85d07c..6656fc3 100644 --- a/view.js +++ b/view.js @@ -109,14 +109,14 @@ export class View { for (const a of doc.querySelectorAll('a[href]')) a.addEventListener('click', e => { e.preventDefault() - const href = a.getAttribute('href') - const uri = section?.resolveHref?.(href) ?? href - if (book?.isExternal?.(uri)) - Promise.resolve(emit?.({ type: 'external-link', a, uri })) - .then(x => x ? null : window.open(uri, '_blank')) + const href_ = a.getAttribute('href') + const href = section?.resolveHref?.(href_) ?? href_ + if (book?.isExternal?.(href)) + Promise.resolve(emit?.({ type: 'external-link', a, href })) + .then(x => x ? null : window.open(href, '_blank')) .catch(e => console.error(e)) - else Promise.resolve(emit?.({ type: 'link', a, uri })) - .then(x => x ? null : this.goTo(uri)) + else Promise.resolve(emit?.({ type: 'link', a, href })) + .then(x => x ? null : this.goTo(href)) .catch(e => console.error(e)) }) }