From e381f8a3195e208b62ef6739d7ffee335db05016 Mon Sep 17 00:00:00 2001 From: shinigami-eyes <43276258+shinigami-eyes@users.noreply.github.com> Date: Sat, 3 Aug 2019 12:40:29 +0200 Subject: [PATCH] Refresh recycled DOM elements on new Twitter UI --- extension/content.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/content.ts b/extension/content.ts index 6246bde..394b448 100644 --- a/extension/content.ts +++ b/extension/content.ts @@ -129,7 +129,13 @@ var lastRightClickedElement: HTMLElement = null; var lastAppliedYouTubeUrl: string = null; var lastAppliedYouTubeTitle: string = null; +var lastAppliedTwitterUrl: string = null; + function updateTwitterClasses() { + if (location.href != lastAppliedTwitterUrl) { + setTimeout(updateAllLabels, 200); + lastAppliedTwitterUrl = location.href; + } for (const a of document.querySelectorAll('a')) { if (a.assignedCssLabel && !a.classList.contains('has-assigned-label')) { a.classList.add('assigned-label-' + a.assignedCssLabel); @@ -221,7 +227,7 @@ function applyLabel(a: HTMLAnchorElement, identifier: string) { function initLink(a: HTMLAnchorElement) { var identifier = getIdentifier(a); if (!identifier) { - if (hostname == 'youtube.com') + if (hostname == 'youtube.com' || hostname == 'twitter.com') applyLabel(a, ''); return; }