Skip to content

Commit fc001b7

Browse files
committed
Remove server part, fix up release and add copy button
1 parent f1407e9 commit fc001b7

File tree

9 files changed

+16
-67
lines changed

9 files changed

+16
-67
lines changed

.github/workflows/static.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

compose.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/index.html renamed to index.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ <h2>Uppgifter</h2>
4040
</tr>
4141
<tr>
4242
<td>
43-
<button type="button" onclick="writeSignature();">Tryck här</button>
43+
<button type="button" onclick="writeSignature();">Skapa signatur</button>
4444
</td>
4545
</tr>
4646
</table>
4747

4848
<h2>Förhandsvisning</h2>
4949
<div id="preview"></div>
50-
51-
<h2>HTML</h2>
52-
<div><pre id="code"></pre></div>
50+
<button type="button" onclick="copySignature();">Kopiera signatur</button>
5351

5452
</body>
5553
</html>

nginx/favicon.ico

-4.92 KB
Binary file not shown.

nginx/logo.png

-13.8 KB
Binary file not shown.

nginx/nginx.conf

Lines changed: 0 additions & 20 deletions
This file was deleted.
File renamed without changes.

src/signature.js renamed to signature.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ async function getTemplate() {
99
});
1010
}
1111

12-
async function getSignature() {
13-
const template = await getTemplate();
14-
12+
async function getSignature(template) {
1513
var signatureFields = ['name', 'job', 'year', 'mail', 'phone'];
1614

1715
const signature = template.replace(
@@ -23,11 +21,21 @@ async function getSignature() {
2321
}
2422

2523
async function writeSignature() {
26-
const signature = await getSignature();
24+
const template = await getTemplate();
25+
26+
const signature = await getSignature(template);
2727

2828
document.getElementById("preview").innerHTML = signature;
29+
}
2930

30-
cleanedSignature = signature.replace(/</g, "&lt").replace(/>/g, "&gt");
31+
function copySignature() {
32+
htmlContent = document.getElementById("preview").innerHTML;
33+
const blob = new Blob([htmlContent], { type: 'text/html' });
34+
const item = new ClipboardItem({ 'text/html': blob });
3135

32-
document.getElementById("code").innerHTML = cleanedSignature;
36+
navigator.clipboard.write([item]).then(function () {
37+
console.log('HTML content copied to clipboard!');
38+
}).catch(function (err) {
39+
console.error('Error copying to clipboard:', err);
40+
});
3341
}

src/f.png

-4.92 KB
Binary file not shown.

0 commit comments

Comments
 (0)