From 152445c6d7a0743d0210fc29e5989d192b2612fd Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 8 Nov 2023 23:18:10 +0000 Subject: try event listener (didn't work) --- plugins/style/style.c | 2 +- plugins/style/style.h | 2 +- plugins/style/style.js | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'plugins/style') diff --git a/plugins/style/style.c b/plugins/style/style.c index 0cd6b4f..a9b4135 100644 --- a/plugins/style/style.c +++ b/plugins/style/style.c @@ -1,7 +1,7 @@ #include #include #include -#define STYLE_N 4709 + 100 +#define STYLE_N 5436 + 100 void read_style_js(char* string) { diff --git a/plugins/style/style.h b/plugins/style/style.h index 7797eae..1927c79 100644 --- a/plugins/style/style.h +++ b/plugins/style/style.h @@ -1,7 +1,7 @@ #ifndef STYLE #define STYLE -#define STYLE_N 4709 + 100 +#define STYLE_N 5436 + 100 void read_style_js(char* string); diff --git a/plugins/style/style.js b/plugins/style/style.js index 6af94ed..46bbc63 100644 --- a/plugins/style/style.js +++ b/plugins/style/style.js @@ -82,12 +82,26 @@ if (document.domain == "twitter.com") { /* hide video */ [data-testid^="videoPlayer"] { - display: none; + display: none !important; } [data-testid^="videoPlayer"]:before { content: '[twitter video]'; } `; + + document.addEventListener('DOMContentLoaded', function() { + // Select all the videoPlayer elements + var videoPlayers = document.querySelectorAll('[data-testid="videoPlayer"]'); + + // Loop through the NodeList + videoPlayers.forEach(function(videoPlayer) { + // Traverse two levels up the DOM tree + var grandparentElement = videoPlayer.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; + + // Hide the grandparent element + grandparentElement.style.display = 'none'; + }); + }); } if (document.domain == "reddit.com" || document.domain == "old.reddit.com") { -- cgit v1.2.3