This commit is contained in:
parent
05c86564d0
commit
d485946d56
2 changed files with 23 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
{{#metadata}} {{#info}} {{#portfolio}} {{#link}}
|
||||
<li role="button" onclick="window.open('{{link}}', '_blank', 'noreferrer');">
|
||||
<li role="button" onmousedown="openLink('{{link}}');">
|
||||
{{>portfolio/project.html}}
|
||||
</li>
|
||||
{{/link}} {{^link}}
|
||||
|
|
|
@ -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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue