aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNunoSempere <nuno.sempere@protonmail.com>2023-11-08 23:24:06 +0000
committerNunoSempere <nuno.sempere@protonmail.com>2023-11-08 23:24:06 +0000
commit0ba87b8cdc62d89e6ac10273dd43617ea80f062a (patch)
treee1919b73dee0eececd911c8716d4a4cb3d75eebf
parenta7c1f8f57e90c6071b0285cd2f67a4e4eb2fad9f (diff)
savepoint: add functionality to not show twitter videos
-rw-r--r--plugins/style/style.c2
-rw-r--r--plugins/style/style.h2
-rw-r--r--plugins/style/style.js10
3 files changed, 10 insertions, 4 deletions
diff --git a/plugins/style/style.c b/plugins/style/style.c
index a9b4135..7429ff4 100644
--- a/plugins/style/style.c
+++ b/plugins/style/style.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define STYLE_N 5436 + 100
+#define STYLE_N 6252 + 100
void read_style_js(char* string)
{
diff --git a/plugins/style/style.h b/plugins/style/style.h
index 1927c79..40ebc7a 100644
--- a/plugins/style/style.h
+++ b/plugins/style/style.h
@@ -1,7 +1,7 @@
#ifndef STYLE
#define STYLE
-#define STYLE_N 5436 + 100
+#define STYLE_N 6252 + 100
void read_style_js(char* string);
diff --git a/plugins/style/style.js b/plugins/style/style.js
index 0500b7e..4c17f17 100644
--- a/plugins/style/style.js
+++ b/plugins/style/style.js
@@ -94,8 +94,14 @@ if (document.domain == "twitter.com") {
document
.querySelectorAll('[data-testid="videoPlayer"]')
.forEach(function (videoPlayer) {
- var grandparentElement = videoPlayer.parentElement.parentElement;
- grandparentElement.style.display = "none";
+ var grandparentElement = videoPlayer.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
+ // grandparentElement.style.display = "none";
+ grandparentElement.innerHtml = "none";
+ // Make sure not to replace the content if it's already been replaced
+ if (grandparentElement.getAttribute('data-content-replaced') !== 'true') {
+ grandparentElement.textContent = ' [twitter video]';
+ grandparentElement.setAttribute('data-content-replaced', 'true');
+ }
});
}