This commit is contained in:
parent
cb0b836d92
commit
c2034b0a6b
|
@ -5,7 +5,6 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "kill-the-newsletter",
|
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -18,7 +17,8 @@
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fs-extra": "^9.1.0",
|
"fs-extra": "^9.1.0",
|
||||||
"mailparser": "^3.1.0",
|
"mailparser": "^3.1.0",
|
||||||
"smtp-server": "^3.8.0"
|
"smtp-server": "^3.8.0",
|
||||||
|
"tagged-template-noop": "^2.1.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"kill-the-newsletter": "lib/index.js"
|
"kill-the-newsletter": "lib/index.js"
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fs-extra": "^9.1.0",
|
"fs-extra": "^9.1.0",
|
||||||
"mailparser": "^3.1.0",
|
"mailparser": "^3.1.0",
|
||||||
"smtp-server": "^3.8.0"
|
"smtp-server": "^3.8.0",
|
||||||
|
"tagged-template-noop": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.11",
|
"@types/express": "^4.17.11",
|
||||||
|
|
26
src/index.ts
26
src/index.ts
|
@ -11,6 +11,7 @@ import { html, HTML } from "@leafac/html";
|
||||||
import { css, process as processCSS } from "@leafac/css";
|
import { css, process as processCSS } from "@leafac/css";
|
||||||
import { sql, Database } from "@leafac/sqlite";
|
import { sql, Database } from "@leafac/sqlite";
|
||||||
import databaseMigrate from "@leafac/sqlite-migration";
|
import databaseMigrate from "@leafac/sqlite-migration";
|
||||||
|
import javascript from "tagged-template-noop";
|
||||||
|
|
||||||
const VERSION = require("../package.json").version;
|
const VERSION = require("../package.json").version;
|
||||||
|
|
||||||
|
@ -208,6 +209,31 @@ export default function killTheNewsletter(
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
<script>
|
||||||
|
for (const copyable of document.querySelectorAll(".copyable"))
|
||||||
|
copyable.insertAdjacentHTML(
|
||||||
|
"afterend",
|
||||||
|
$${"`"}
|
||||||
|
$${html`
|
||||||
|
<br />
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick="${javascript`
|
||||||
|
(async () => {
|
||||||
|
await navigator.clipboard.writeText("\${copyable.innerText}");
|
||||||
|
const originalInnerText = this.innerText;
|
||||||
|
this.innerText = "Copied";
|
||||||
|
await new Promise(resolve => window.setTimeout(resolve, 500));
|
||||||
|
this.innerText = originalInnerText;
|
||||||
|
})();
|
||||||
|
`}"
|
||||||
|
>
|
||||||
|
Copy
|
||||||
|
</button>
|
||||||
|
`}
|
||||||
|
$${"`"}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`);
|
`);
|
||||||
|
|
Loading…
Reference in New Issue