From 724221b540796d175c34076cecfee9cceff94254 Mon Sep 17 00:00:00 2001 From: shinigami-eyes <43276258+shinigami-eyes@users.noreply.github.com> Date: Mon, 13 Apr 2020 08:05:46 +0000 Subject: [PATCH] Handle profile pic on React facebook --- extension/content.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extension/content.ts b/extension/content.ts index 2d7de07..14228f9 100644 --- a/extension/content.ts +++ b/extension/content.ts @@ -356,6 +356,11 @@ function getIdentifierFromElementImpl(element: HTMLAnchorElement): string { // React post timestamp if (element.getAttribute('role') == 'link' && parent && parent.tagName == 'SPAN' && firstChild && firstChild.tagName == 'SPAN') return null; + // React big profile picture (user or page) + if (firstChild && firstChild.firstElementChild instanceof SVGElement && !getMatchingAncestorByCss(element, '[role=article]')) { + return getIdentifier(window.location.href); + } + if (dataset) { const hovercard = dataset.hovercard; if (hovercard) { @@ -656,7 +661,7 @@ browser.runtime.onMessage.addListenertarget).href) break; + if (target instanceof HTMLAnchorElement) break; target = target.parentElement; }