aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-12-06 22:10:22 -0500
committerJesús <heckyel@hyperbola.info>2019-12-06 22:10:22 -0500
commit487e635f1ac454aa2d67e6ad8677f61c109e5b4b (patch)
tree91e42d4abe6f0ba903a80deefa5ed75feb8ee2fa
parent09eea773907768da43f354580671c6e9d7e851f2 (diff)
downloadbook-487e635f1ac454aa2d67e6ad8677f61c109e5b4b.tar.lz
book-487e635f1ac454aa2d67e6ad8677f61c109e5b4b.tar.xz
book-487e635f1ac454aa2d67e6ad8677f61c109e5b4b.zip
Added NitterRedirect
-rw-r--r--scripts-greasemonkey/twitter_to_nitter.user.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts-greasemonkey/twitter_to_nitter.user.js b/scripts-greasemonkey/twitter_to_nitter.user.js
new file mode 100644
index 0000000..307accd
--- /dev/null
+++ b/scripts-greasemonkey/twitter_to_nitter.user.js
@@ -0,0 +1,41 @@
+// ==UserScript==
+// @name Twitter to Nitter
+// @author Jesús E.
+// @namespace NitterRedirect
+// @description Scan page for Twitter and urls replace with Nitter
+// @homepageURL https://libregit.org/heckyel/book/src/branch/master/scripts-greasemonkey
+// @include *
+// @exclude /^http(s|)://(www[.]|)nitter[.]net/.*$/
+// @exclude /^http(s|)://(www[.]|)nitter[.]pro/.*$/
+// @exclude /^http(s|)://(www[.]|)nitter[.]snopyta[.]org/.*$/
+// @exclude /^http(s|)://(www[.]|)nitter[.]42l[.]fr/.*$/
+// @exclude /^http(s|)://(www[.]|)nitter[.]nixnet[.]xyz/.*$/
+// @version 0.1
+// @grant none
+// @license GPL version 3 or any later version::: https://www.gnu.org/licenses/gpl-3.0.html
+// ==/UserScript==
+/* jshint esversion: 6 */
+
+// Set you favorite Nitter instance! (https://github.com/zedeus/nitter/wiki/Instances)
+let instance = 'nitter.net';
+
+// Console Style - Debug
+let consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
+
+// Do the actual rewrite
+function rewriteLinks() {
+ for (var i = 0; i < document.links.length; i++) {
+ var elem = document.links[i];
+ if (elem.href.match(/(mobile\.)?twitter\.com\/([^&#]+)/i)) {
+ elem.href='https://' + instance + RegExp.$2;
+ }
+ }
+ statuscheck()
+}
+
+function statuscheck(){
+ // Console Feedback
+ console.log("%cUSERSCRIPT | " + GM_info.script.name + " " + GM_info.script.version + " | successfully initialized", consoleCSS);
+}
+
+rewriteLinks();