From 4ce9cd7727c539884c5122ef6173ee9c2e95bb79 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 15 Apr 2024 09:32:03 +0200 Subject: [PATCH] cards.js to fix links --- docs/js/cards.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/js/cards.js b/docs/js/cards.js index ee2fc023..c814821a 100644 --- a/docs/js/cards.js +++ b/docs/js/cards.js @@ -3,12 +3,11 @@ $(function() { $('.card-wrapper > div > a').each(function() { let destUrl = $(this).attr('href'); if ('//' === destUrl.substring(0, 2)) { - destUrl = 'http:' + destUrl; + destUrl = document.location.protocol + destUrl; + } else if ('/' === destUrl.substring(0, 1)) { + destUrl = document.location.protocol + '//' + document.location.host + destUrl; } destUrl = new URL(destUrl); - if (destUrl.host !== document.location.host) { - destUrl.host = document.location.host; - } let destPath = destUrl.pathname.split('/'), srcPath = document.location.pathname.split('/'); if (destPath[version_path_index] !== srcPath[version_path_index]) {