fix links in cards
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2024-01-19 12:10:38 +01:00
parent 05c86564d0
commit d485946d56
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 23 additions and 1 deletions

View file

@ -1,5 +1,5 @@
{{#metadata}} {{#info}} {{#portfolio}} {{#link}} {{#metadata}} {{#info}} {{#portfolio}} {{#link}}
<li role="button" onclick="window.open('{{link}}', '_blank', 'noreferrer');"> <li role="button" onmousedown="openLink('{{link}}');">
{{>portfolio/project.html}} {{>portfolio/project.html}}
</li> </li>
{{/link}} {{^link}} {{/link}} {{^link}}

View file

@ -45,6 +45,28 @@
}); });
}) })
); );
/* Open cards link */
const openLink = (url) => {
switch (event.button) {
case 0:
/* Left click */
window.open(url, "_blank", "noreferrer");
break;
case 1:
/* Middle click */
Object.assign(document.createElement("a"), {
href: url,
target: "_blank",
rel: "noreferrer",
}).dispatchEvent(
new MouseEvent("click", { ctrlKey: true, metaKey: true })
);
break;
default:
break;
}
};
</script> </script>
</body> </body>
</html> </html>