mirror of
https://github.com/NickKaramoff/shareon
synced 2025-03-08 23:48:10 +01:00
Add script to format with Deno
This commit is contained in:
parent
722411b7ec
commit
6a4009b1a2
@ -2,5 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"checkJs": true,
|
||||
"lib": ["dom", "dom.iterable", "dom.asynciterable"]
|
||||
},
|
||||
"fmt": {
|
||||
"exclude": ["pnpm-lock.yaml", "**/*.md"]
|
||||
}
|
||||
}
|
||||
|
7
script/fmt
Executable file
7
script/fmt
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
ROOT="$(dirname "$(dirname "$0")")"
|
||||
|
||||
deno fmt "$@" "$ROOT"
|
@ -1,6 +1,6 @@
|
||||
import "./shareon.css";
|
||||
|
||||
// prettier-ignore
|
||||
// deno-fmt-ignore
|
||||
/**
|
||||
* Map of social networks to their respective URL builders.
|
||||
*
|
||||
@ -61,8 +61,7 @@ const init = () => {
|
||||
// if it's "Copy URL"
|
||||
if (cls === "copy-url") {
|
||||
child.addEventListener("click", () => {
|
||||
const url =
|
||||
child.dataset.url ||
|
||||
const url = child.dataset.url ||
|
||||
container.dataset.url ||
|
||||
window.location.href;
|
||||
navigator.clipboard.writeText(url);
|
||||
@ -83,13 +82,11 @@ const init = () => {
|
||||
// if it's "Web Share"
|
||||
if (cls === "web-share") {
|
||||
const data = {
|
||||
title:
|
||||
child.dataset.title ||
|
||||
title: child.dataset.title ||
|
||||
container.dataset.title ||
|
||||
document.title,
|
||||
text: child.dataset.text || container.dataset.text || "",
|
||||
url:
|
||||
child.dataset.url ||
|
||||
url: child.dataset.url ||
|
||||
container.dataset.url ||
|
||||
window.location.href,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user