From 9cb216d323f7763a5918fe8ecd0d4afe6eb779f6 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 11 Apr 2022 15:17:08 +0200 Subject: [PATCH] replace links --- main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.js b/main.js index e69de29..f473a99 100644 --- a/main.js +++ b/main.js @@ -0,0 +1,19 @@ +const replaceLinks = () => { + const links = document.querySelectorAll('.download a') + + for (let link of links) { + let href = link.getAttribute('href') + + if (link.classList.contains('archive-link')) { + href = 'https://dl.gitnet.fr' + href + } else { + href = href.replace('https://gitnet.fr', 'https://dl.gitnet.fr') + } + + link.setAttribute('href', href) + } +} + +document.addEventListener("DOMContentLoaded", () => { + replaceLinks() +})