From 1dadabcc00fc9759438314add0d727a5ddff1b0c Mon Sep 17 00:00:00 2001 From: MatiasStorm Date: Tue, 12 May 2020 16:24:09 +0200 Subject: Added elements with the 'onclick' attribute to allowed hints --- src/content/presenters/FollowPresenter.ts | 6 +++++- src/content/presenters/Hint.ts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/content/presenters/FollowPresenter.ts b/src/content/presenters/FollowPresenter.ts index 8aef819..827652a 100644 --- a/src/content/presenters/FollowPresenter.ts +++ b/src/content/presenters/FollowPresenter.ts @@ -11,6 +11,7 @@ const TARGET_SELECTOR = [ '[contenteditable=""]', "[tabindex]", '[role="button"]', + "[onclick]", "summary", ].join(","); @@ -92,7 +93,10 @@ export class FollowPresenterImpl implements FollowPresenter { } createHints(viewSize: Size, framePosition: Point, tags: string[]): void { + const t0 = performance.now(); const targets = this.getTargets(viewSize, framePosition); + const t1 = performance.now(); + console.log("Took: " + (t1 - t0)); const min = Math.min(targets.length, tags.length); for (let i = 0; i < min; ++i) { const target = targets[i]; @@ -129,7 +133,7 @@ export class FollowPresenterImpl implements FollowPresenter { const filtered = Array.prototype.filter.call( all, (element: HTMLElement) => { - const style = window.getComputedStyle(element); + const style = element.style; // AREA's 'display' in Browser style is 'none' return ( diff --git a/src/content/presenters/Hint.ts b/src/content/presenters/Hint.ts index 3f39060..8bf265b 100644 --- a/src/content/presenters/Hint.ts +++ b/src/content/presenters/Hint.ts @@ -119,7 +119,10 @@ export class InputHint extends Hint { default: if (doms.isContentEditable(target)) { return target.focus(); - } else if (target.hasAttribute("tabindex")) { + } else if ( + target.hasAttribute("tabindex") || + target.hasAttribute("onclick") + ) { return target.click(); } } -- cgit v1.2.3 From 0600963862460aaf2250ffe7f2e84ce340d088f8 Mon Sep 17 00:00:00 2001 From: MatiasStorm Date: Tue, 12 May 2020 16:25:22 +0200 Subject: Removed performance measurements --- src/content/presenters/FollowPresenter.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/content/presenters/FollowPresenter.ts b/src/content/presenters/FollowPresenter.ts index 827652a..b928b3f 100644 --- a/src/content/presenters/FollowPresenter.ts +++ b/src/content/presenters/FollowPresenter.ts @@ -93,10 +93,7 @@ export class FollowPresenterImpl implements FollowPresenter { } createHints(viewSize: Size, framePosition: Point, tags: string[]): void { - const t0 = performance.now(); const targets = this.getTargets(viewSize, framePosition); - const t1 = performance.now(); - console.log("Took: " + (t1 - t0)); const min = Math.min(targets.length, tags.length); for (let i = 0; i < min; ++i) { const target = targets[i]; -- cgit v1.2.3 From 41b1a9aabd05cd442977bcd4be7919806e7179a5 Mon Sep 17 00:00:00 2001 From: MatiasStorm Date: Tue, 12 May 2020 16:45:58 +0200 Subject: Reverted change in getTargets --- src/content/presenters/FollowPresenter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/presenters/FollowPresenter.ts b/src/content/presenters/FollowPresenter.ts index b928b3f..e9105bc 100644 --- a/src/content/presenters/FollowPresenter.ts +++ b/src/content/presenters/FollowPresenter.ts @@ -130,7 +130,7 @@ export class FollowPresenterImpl implements FollowPresenter { const filtered = Array.prototype.filter.call( all, (element: HTMLElement) => { - const style = element.style; + const style = window.getComputedStyle(element); // AREA's 'display' in Browser style is 'none' return ( -- cgit v1.2.3