Kumi
72ef4d8c0c
Replaces the dynamic origin-based DOI URL with a standardized URL using freedoi.org. This ensures consistent and accurate DOI links, improving user experience and reliability.
22 lines
699 B
JavaScript
22 lines
699 B
JavaScript
document.addEventListener("DOMContentLoaded", function () {
|
|
const doiLink = document.getElementById("doi-link");
|
|
const doiCopyMessage = document.getElementById("doi-copy-message");
|
|
|
|
doiLink.addEventListener("click", function (event) {
|
|
event.preventDefault();
|
|
const doi = doiLink.getAttribute("data-doi");
|
|
const fullDoiUrl = `https://freedoi.org/${doi}`;
|
|
|
|
navigator.clipboard.writeText(fullDoiUrl).then(
|
|
function () {
|
|
doiCopyMessage.style.display = "inline";
|
|
setTimeout(function () {
|
|
doiCopyMessage.style.display = "none";
|
|
}, 2000);
|
|
},
|
|
function () {
|
|
alert("Failed to copy DOI to clipboard.");
|
|
}
|
|
);
|
|
});
|
|
});
|