From bd10edeb73ded1b0af0c4c715ef4399e9db248e8 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 23 Jan 2023 13:50:37 +0100
Subject: [PATCH] Update 'Old Wikipedia Design' to redirect faster

---
 Wikipedia/OldDesign.user.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Wikipedia/OldDesign.user.js b/Wikipedia/OldDesign.user.js
index 042fcaa..af69481 100644
--- a/Wikipedia/OldDesign.user.js
+++ b/Wikipedia/OldDesign.user.js
@@ -2,14 +2,14 @@
 // @name         Old Wikipedia Design
 // @description  Reverts to the old Vector design.
 // @author       Vusys, chylex
-// @version      1
+// @version      2
 // @license      MIT
 // @namespace    https://chylex.com
 // @homepageURL  https://github.com/chylex/Userscripts
 // @supportURL   https://github.com/chylex/Userscripts/issues
 // @include      https://*.wikipedia.org/*
 // @exclude      https://*.wikipedia.org/
-// @run-at       document-end
+// @run-at       document-start
 // @grant        none
 // ==/UserScript==
 
@@ -25,9 +25,11 @@
 		return;
 	}
 	
-	for (const a of document.getElementsByTagName("a")) {
-		if (a.hostname.includes("wikipedia.org")) {
-			a.href = fixUrl(a.href);
+	document.addEventListener("DOMContentLoaded", function() {
+		for (const a of document.getElementsByTagName("a")) {
+			if (a.hostname.includes("wikipedia.org")) {
+				a.href = fixUrl(a.href);
+			}
 		}
-	}
+	});
 })();