Refresh recycled DOM elements on new Twitter UI
This commit is contained in:
parent
21dea6ca27
commit
e381f8a319
@ -129,7 +129,13 @@ var lastRightClickedElement: HTMLElement = null;
|
|||||||
var lastAppliedYouTubeUrl: string = null;
|
var lastAppliedYouTubeUrl: string = null;
|
||||||
var lastAppliedYouTubeTitle: string = null;
|
var lastAppliedYouTubeTitle: string = null;
|
||||||
|
|
||||||
|
var lastAppliedTwitterUrl: string = null;
|
||||||
|
|
||||||
function updateTwitterClasses() {
|
function updateTwitterClasses() {
|
||||||
|
if (location.href != lastAppliedTwitterUrl) {
|
||||||
|
setTimeout(updateAllLabels, 200);
|
||||||
|
lastAppliedTwitterUrl = location.href;
|
||||||
|
}
|
||||||
for (const a of document.querySelectorAll('a')) {
|
for (const a of document.querySelectorAll('a')) {
|
||||||
if (a.assignedCssLabel && !a.classList.contains('has-assigned-label')) {
|
if (a.assignedCssLabel && !a.classList.contains('has-assigned-label')) {
|
||||||
a.classList.add('assigned-label-' + a.assignedCssLabel);
|
a.classList.add('assigned-label-' + a.assignedCssLabel);
|
||||||
@ -221,7 +227,7 @@ function applyLabel(a: HTMLAnchorElement, identifier: string) {
|
|||||||
function initLink(a: HTMLAnchorElement) {
|
function initLink(a: HTMLAnchorElement) {
|
||||||
var identifier = getIdentifier(a);
|
var identifier = getIdentifier(a);
|
||||||
if (!identifier) {
|
if (!identifier) {
|
||||||
if (hostname == 'youtube.com')
|
if (hostname == 'youtube.com' || hostname == 'twitter.com')
|
||||||
applyLabel(a, '');
|
applyLabel(a, '');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user