Merge branch 'main' into cours
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2024-01-19 16:36:05 +01:00
commit f2a6fe6ddd
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 33 additions and 2 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

@ -40,11 +40,42 @@
document.querySelectorAll("main a").forEach(function (link) { document.querySelectorAll("main a").forEach(function (link) {
link.setAttribute("target", "_blank"); link.setAttribute("target", "_blank");
link.setAttribute("rel", "noreferrer"); link.setAttribute("rel", "noreferrer");
link.addEventListener("click", function (event) { link.addEventListener("mousedown", function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
}) })
); );
/* Open cards link */
const openLink = (url) => {
const backgroundtab = () =>
Object.assign(document.createElement("a"), {
href: url,
target: "_blank",
rel: "noreferrer",
}).dispatchEvent(
new MouseEvent("click", { ctrlKey: true, metaKey: true })
);
switch (event.button) {
case 0:
/* Left click */
if (event.ctrlKey || event.metaKey) {
backgroundtab();
} else {
window.open(url, "_blank", "noreferrer");
}
break;
case 1:
/* Middle click */
event.preventDefault();
backgroundtab();
break;
default:
break;
}
};
</script> </script>
</body> </body>
</html> </html>