Skip to content

Commit

Permalink
cards.js: Now, hosts can be compared
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendupuis committed Apr 15, 2024
1 parent 95081a5 commit 40a2c14
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/js/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ $(function() {
destUrl = document.location.protocol + '//' + document.location.host + destUrl;
}
destUrl = new URL(destUrl);
let destPath = destUrl.pathname.split('/'),
srcPath = document.location.pathname.split('/');
if (destPath[version_path_index] !== srcPath[version_path_index]) {
destPath[version_path_index] = srcPath[version_path_index];
if (destUrl.host === document.location.host) {
let destPath = destUrl.pathname.split('/'),
srcPath = document.location.pathname.split('/');
if (destPath[version_path_index] !== srcPath[version_path_index]) {
destPath[version_path_index] = srcPath[version_path_index];
}
destUrl.pathname = destPath.join('/');
$(this).attr('href', destUrl.pathname);
}
destUrl.pathname = destPath.join('/');
$(this).attr('href', destUrl.href);
});
});

0 comments on commit 40a2c14

Please sign in to comment.