blob: 4aae41cd5ac839370c716c72b64bd529d93c284a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// ==UserScript==
// @name Twitter to Nitter
// @author Jesús E.
// @namespace NitterRedirect
// @description Scan page for Twitter and urls replace with Nitter
// @homepageURL https://libregit.spks.xyz/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[.]13ad[.]de/.*$/
// @exclude /^http(s|)://(www[.]|)nitter[.]nixnet[.]xyz/.*$/
// @exclude /^http(s|)://(www[.]|)nitter[.]drycat[.]fr/.*$/
// @exclude /^http(s|)://(www[.]|)tw[.]openalgeria[.]org/.*$/
// @version 0.1.2
// @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 (let i = 0; i < document.links.length; i++) {
let elem = document.links[i];
if (elem.href.match(/http(s|):\/\/(mobile[.]|www[.]|)twitter[.]com\/(#!\/)?(.*$)/i)) {
elem.href='https://' + instance + '/' + RegExp.$4;
}
}
statuscheck()
}
function statuscheck(){
// Console Feedback
console.log("%cUSERSCRIPT | " + GM_info.script.name + " " + GM_info.script.version + " | successfully initialized", consoleCSS);
}
window.addEventListener('load', () => {
rewriteLinks();
});
|