use I2P urls, replace with clearnet URLS on clearnet pages via Javascript

This commit is contained in:
idk
2020-01-28 22:10:36 -05:00
parent c4eb0965d4
commit 8c51d6ec16
3 changed files with 35 additions and 1 deletions

View File

@ -13,7 +13,9 @@ index: README
@echo "</head>" >> index.html
@echo "<body>" >> index.html
sed "s|magnetsub|[Magnet Link]($(MAGNET))|g" README.md | \
sed 's|https://github.com/eyedeekay/various-i2p-browsers/tree/master||g' | markdown | tee -a index.html
sed 's|https://github.com/eyedeekay/various-i2p-browsers/tree/master||g' | \
markdown | tee -a index.html
@echo " <script src=\"script.js\" type=\"text/javascript\"></script>" >> index.html
@echo "</body>" >> index.html
@echo "</html>" >> index.html

View File

@ -92,5 +92,6 @@ them.</p>
<p>Getting nervous, about to flash an up-to-date coreboot port to my netbook via
a ch341a flasher. I'm about 99% sure I'm not going to hurt anything, but who
knows?</p>
<script src="script.js" type="text/javascript"></script>
</body>
</html>

31
script.js Normal file
View File

@ -0,0 +1,31 @@
for (var i = document.links.length; i-- > 0; ) {
console.log("hostname", document, "link:", document.links[i].href);
if (document.URL.includes(".i2p/")) {
if (document.links[i].href.includes("https://github.com/eyedeekay/"))
document.links[i].href = document.links[i].href.replace(
"https://github.com/eyedeekay/",
"http://git.idk.i2p/idk/"
);
if (document.links[i].href.includes("https://geti2p.net"))
document.links[i].href = document.links[i].href.replace(
"https://geti2p.net",
"http://i2p-projekt.i2p"
);
}
}
for (var i = document.links.length; i-- > 0; ) {
console.log("hostname", document, "link:", document.links[i].href);
if (document.URL.includes("github.io/")) {
if (document.links[i].href.includes("http://git.idk.i2p/idk/"))
document.links[i].href = document.links[i].href.replace(
"http://git.idk.i2p/idk/",
"https://github.com/eyedeekay/"
);
if (document.links[i].href.includes("http://i2p-projekt.i2p"))
document.links[i].href = document.links[i].href.replace(
"http://i2p-projekt.i2p",
"https://geti2p.net"
);
}
}