Skip to content

Commit

Permalink
cards.js to fix links
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendupuis committed Apr 15, 2024
1 parent c9dc818 commit 4ce9cd7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/js/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit 4ce9cd7

Please sign in to comment.