1
0
mirror of https://github.com/NickKaramoff/shareon synced 2025-03-09 16:00:17 +01:00

Fix code with Deno

This commit is contained in:
Nikita Karamov 2025-01-28 08:49:12 +01:00
parent 205cacf564
commit 7ae5eb275f

View File

@ -41,7 +41,7 @@ const urlBuilderMap = {
};
const openUrl = (buttonUrl) => () => {
window.open(buttonUrl, "_blank", "noopener,noreferrer");
globalThis.open(buttonUrl, "_blank", "noopener,noreferrer");
};
const init = () => {
@ -63,7 +63,7 @@ const init = () => {
child.addEventListener("click", () => {
const url = child.dataset.url ||
container.dataset.url ||
window.location.href;
globalThis.location.href;
navigator.clipboard.writeText(url);
child.classList.add("done");
setTimeout(() => {
@ -75,7 +75,7 @@ const init = () => {
// if it's "Print"
if (cls === "print") {
child.addEventListener("click", () => {
window.print();
globalThis.print();
});
}
@ -88,7 +88,7 @@ const init = () => {
text: child.dataset.text || container.dataset.text || "",
url: child.dataset.url ||
container.dataset.url ||
window.location.href,
globalThis.location.href,
};
if (navigator.canShare && navigator.canShare(data)) {
@ -106,7 +106,7 @@ const init = () => {
url: encodeURIComponent(
child.dataset.url ||
container.dataset.url ||
window.location.href,
globalThis.location.href,
),
title: encodeURIComponent(
child.dataset.title ||