aboutsummaryrefslogtreecommitdiffstats
path: root/scripts-greasemonkey/twitter_to_nitter.user.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts-greasemonkey/twitter_to_nitter.user.js')
-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();