mirror of
https://github.com/NickKaramoff/shareon
synced 2025-03-09 16:00:17 +01:00
Add script to format with Deno
This commit is contained in:
parent
722411b7ec
commit
6a4009b1a2
@ -2,5 +2,8 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"lib": ["dom", "dom.iterable", "dom.asynciterable"]
|
"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";
|
import "./shareon.css";
|
||||||
|
|
||||||
// prettier-ignore
|
// deno-fmt-ignore
|
||||||
/**
|
/**
|
||||||
* Map of social networks to their respective URL builders.
|
* Map of social networks to their respective URL builders.
|
||||||
*
|
*
|
||||||
@ -61,8 +61,7 @@ const init = () => {
|
|||||||
// if it's "Copy URL"
|
// if it's "Copy URL"
|
||||||
if (cls === "copy-url") {
|
if (cls === "copy-url") {
|
||||||
child.addEventListener("click", () => {
|
child.addEventListener("click", () => {
|
||||||
const url =
|
const url = child.dataset.url ||
|
||||||
child.dataset.url ||
|
|
||||||
container.dataset.url ||
|
container.dataset.url ||
|
||||||
window.location.href;
|
window.location.href;
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
@ -83,13 +82,11 @@ const init = () => {
|
|||||||
// if it's "Web Share"
|
// if it's "Web Share"
|
||||||
if (cls === "web-share") {
|
if (cls === "web-share") {
|
||||||
const data = {
|
const data = {
|
||||||
title:
|
title: child.dataset.title ||
|
||||||
child.dataset.title ||
|
|
||||||
container.dataset.title ||
|
container.dataset.title ||
|
||||||
document.title,
|
document.title,
|
||||||
text: child.dataset.text || container.dataset.text || "",
|
text: child.dataset.text || container.dataset.text || "",
|
||||||
url:
|
url: child.dataset.url ||
|
||||||
child.dataset.url ||
|
|
||||||
container.dataset.url ||
|
container.dataset.url ||
|
||||||
window.location.href,
|
window.location.href,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user