init of v2 of the awesome monkey repo
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// ==UserScript==
|
||||
// @name Redtolib
|
||||
// @version 1.0
|
||||
// @match https://*.reddit.com/*
|
||||
// @match https://reddit.com/*
|
||||
// @author Stabosa87
|
||||
// @grant none
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.innerText = 'VIEW ON REDLIB';
|
||||
|
||||
link.style.position = 'fixed';
|
||||
link.style.top = '0';
|
||||
link.style.left = '0';
|
||||
link.style.zIndex = '6969696969';
|
||||
link.style.display = 'none';
|
||||
|
||||
fetch("https://raw.githubusercontent.com/redlib-org/redlib-instances/main/instances.json")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data && data.instances && data.instances.length > 0) {
|
||||
const Redliburl = data.instances[0].url;
|
||||
const path = window.location.pathname + window.location.search + window.location.hash;
|
||||
link.href = Redliburl + path;
|
||||
link.style.display = 'inline';
|
||||
}
|
||||
})
|
||||
.catch(e => console.error(e));
|
||||
|
||||
document.body.appendChild(link);
|
||||
})();
|
||||
Reference in New Issue
Block a user