From ac484c8b544609647e71b9516daee0d2d1000aa6 Mon Sep 17 00:00:00 2001 From: Hezekiah Michael Date: Mon, 18 Jul 2022 03:22:32 -0400 Subject: [PATCH] Add goodreads and amazon author name selectors --- extension/content.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extension/content.ts b/extension/content.ts index a44ab4f..6812347 100644 --- a/extension/content.ts +++ b/extension/content.ts @@ -31,7 +31,7 @@ function fixupSiteStyles() { .assigned-label-transphobic { outline: 2px solid var(--ShinigamiEyesTransphobic) !important; } .assigned-label-t-friendly { outline: 1px solid var(--ShinigamiEyesTFriendly) !important; } `); - } else if (hostname == 'rationalwiki.org' || domainIs(hostname, 'wikipedia.org')) { + } else if (hostname == 'rationalwiki.org' || domainIs(hostname, 'wikipedia.org') || hostname == 'amazon.com' || hostname == 'goodreads.com') { addStyleSheet(` .assigned-label-transphobic { outline: 1px solid var(--ShinigamiEyesTransphobic) !important; } .assigned-label-t-friendly { outline: 1px solid var(--ShinigamiEyesTFriendly) !important; } @@ -430,10 +430,19 @@ function getIdentifierFromElementImpl(element: HTMLAnchorElement, originalTarget } } else if (domainIs(hostname, 'wikipedia.org')) { if (element.classList.contains('interlanguage-link-target')) return null; + } else if (hostname == 'goodreads.com') { + if (element.classList.contains('authorName')) return element.textContent; + if (element.classList.contains('author')) return element.textContent; + if (element.classList.contains('gr-book__authorLink')) return element.textContent; + } else if (hostname == 'amazon.com') { + if (element.classList.contains('contributorNameID')) return element.textContent; + if (element.classList.contains('._cDEzb_p13n-sc-css-line-clamp-1_2o7X6')) return element.textContent; } if (element.classList.contains('tumblelog')) return element.textContent.replace('@', '') + '.tumblr.com'; + + const href = element.href; if (href && (!href.endsWith('#') || href.includes('&stick='))) return getIdentifierFromURLImpl(tryParseURL(href)); return null;