fuzzyworld

tools / commit

Add initial personal userscripts.

ed65ca099b88306d10bef5d54933980844be03d1 · Pavel Safronov · 2022-01-20 11:08:42 -0800 · parents 4ee076fcb575

Add initial personal userscripts.
 userscripts/add-hover-text-COMICS/readme.md        |  3 ++
 userscripts/add-hover-text-COMICS/script.user.js   | 32 ++++++++++++++++++++++
 userscripts/click-red-button-SMBC/readme.md        |  3 ++
 userscripts/click-red-button-SMBC/script.user.js   | 16 +++++++++++
 userscripts/remove-header-NAR/readme.md            |  3 ++
 userscripts/remove-header-NAR/script.user.js       | 17 ++++++++++++
 userscripts/remove-video-SIMPSONS-WIKI/readme.md   |  3 ++
 .../remove-video-SIMPSONS-WIKI/script.user.js      | 22 +++++++++++++++
 8 files changed, 99 insertions(+)

diff --git a/userscripts/add-hover-text-COMICS/readme.md b/userscripts/add-hover-text-COMICS/readme.md
new file mode 100644
index 0000000..01374b4
--- /dev/null
+++ b/userscripts/add-hover-text-COMICS/readme.md
@@ -0,0 +1,3 @@
+# Add Hover Text - Comics
+
+This userscript adds the comics' hovertext to a div under the comic.
\ No newline at end of file
diff --git a/userscripts/add-hover-text-COMICS/script.user.js b/userscripts/add-hover-text-COMICS/script.user.js
new file mode 100644
index 0000000..a7fa58b
--- /dev/null
+++ b/userscripts/add-hover-text-COMICS/script.user.js
@@ -0,0 +1,32 @@
+// ==UserScript==
+// @name         Add Hover Text to Webcomics
+// @namespace    https://gitlab.com/fuzzy-rp/tools
+// @version      0.2
+// @description  Add hover text as paragraph under comics.
+// @author       Pavel Safronov
+// @match        https://xkcd.com/*
+// @match        https://www.smbc-comics.com/*
+// @grant        none
+// ==/UserScript==
+
+(function () {
+    'use strict';
+
+    const hostnameToComicDivIdDict = {
+        "www.smbc-comics.com": "cc-comicbody",
+        "xkcd.com": "comic"
+    }
+    const hostname = window.location.hostname;
+    const comicDivId = hostnameToComicDivIdDict[hostname];
+
+    if (comicDivId) {
+        const comicDiv = document.getElementById(comicDivId);
+        const image = comicDiv.getElementsByTagName("img")[0];
+        const altText = image && image.title;
+        if (altText) {
+            const p = document.createElement("p");
+            p.innerText = `Hover text: ${altText}`;
+            comicDiv.parentNode.insertBefore(p, comicDiv.nextSibling);
+        }
+    }
+})();
\ No newline at end of file
diff --git a/userscripts/click-red-button-SMBC/readme.md b/userscripts/click-red-button-SMBC/readme.md
new file mode 100644
index 0000000..1183ccc
--- /dev/null
+++ b/userscripts/click-red-button-SMBC/readme.md
@@ -0,0 +1,3 @@
+# Click Red Button - SMBC script
+
+This is a userscript that will click the red button on the comics website [SMBC](https://www.smbc-comics.com).
diff --git a/userscripts/click-red-button-SMBC/script.user.js b/userscripts/click-red-button-SMBC/script.user.js
new file mode 100644
index 0000000..3a7dce2
--- /dev/null
+++ b/userscripts/click-red-button-SMBC/script.user.js
@@ -0,0 +1,16 @@
+// ==UserScript==
+// @name         Click the red button
+// @namespace    https://gitlab.com/fuzzy-rp/tools
+// @version      0.1
+// @description  Click the red button on SMBC comics
+// @author       Pavel Safronov
+// @match        https://www.smbc-comics.com/*
+// @icon         https://www.google.com/s2/favicons?domain=smbc-comics.com
+// @grant        none
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    toggleBlock("aftercomic");
+})();
\ No newline at end of file
diff --git a/userscripts/remove-header-NAR/readme.md b/userscripts/remove-header-NAR/readme.md
new file mode 100644
index 0000000..14659e9
--- /dev/null
+++ b/userscripts/remove-header-NAR/readme.md
@@ -0,0 +1,3 @@
+# Remove Header - Not Always Right
+
+This userscript removes the header on [Not Always Right](https://notalwaysright.com).
\ No newline at end of file
diff --git a/userscripts/remove-header-NAR/script.user.js b/userscripts/remove-header-NAR/script.user.js
new file mode 100644
index 0000000..f05b570
--- /dev/null
+++ b/userscripts/remove-header-NAR/script.user.js
@@ -0,0 +1,17 @@
+// ==UserScript==
+// @name         Remove NAR header
+// @namespace    https://gitlab.com/fuzzy-rp/tools
+// @version      0.1
+// @description  Remove NAR header
+// @author       Pavel Safronov
+// @match        https://notalwaysright.com/*
+// @icon         https://www.google.com/s2/favicons?domain=notalwaysright.com
+// @grant        none
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    const element = document.getElementById('site-header');
+    element.remove();
+})();
\ No newline at end of file
diff --git a/userscripts/remove-video-SIMPSONS-WIKI/readme.md b/userscripts/remove-video-SIMPSONS-WIKI/readme.md
new file mode 100644
index 0000000..e920faf
--- /dev/null
+++ b/userscripts/remove-video-SIMPSONS-WIKI/readme.md
@@ -0,0 +1,3 @@
+# Remove Video - Simpsons Wiki
+
+This userscript removes the video element from the Simpsons Wiki.
diff --git a/userscripts/remove-video-SIMPSONS-WIKI/script.user.js b/userscripts/remove-video-SIMPSONS-WIKI/script.user.js
new file mode 100644
index 0000000..b815feb
--- /dev/null
+++ b/userscripts/remove-video-SIMPSONS-WIKI/script.user.js
@@ -0,0 +1,22 @@
+// ==UserScript==
+// @name         Simpsons Wiki Remove Video
+// @namespace    https://gitlab.com/fuzzy-rp/tools
+// @version      0.1
+// @description  Hide the video on Simpsons Wiki articles
+// @author       Pavel Safronov
+// @match        https://simpsons.fandom.com/wiki/*
+// @icon         https://www.google.com/s2/favicons?domain=fandom.com
+// @grant        none
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    const videos = document.querySelectorAll('[itemprop="video"]');
+    if (videos) {
+        const video = videos[0];
+        if (video) {
+            video.style.display = "none";
+        }
+    }
+})();
\ No newline at end of file