-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·65 lines (62 loc) · 2.39 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="./style.css">
<title>Heksaszyfrer</title>
</head>
<body>
<nav style="-webkit-app-region: drag">
<h1 class="title">Heksaszyfrer</h1>
</nav>
<main>
<div class="encrypt-box">
<h1>a => xx</h1>
<div class="input-container">
<input type="text" name="enrypt" id="encrypt-input">
<img id="copy-encrypt" src="./images/content_copy-24px.svg" alt="Copy">
</div>
<div class="centerer">
<h3 id="encrypt-output"></h3>
</div>
</div>
<div class="decrypt-box">
<h1>xx => a</h1>
<div class="input-container">
<input type="text" name="decrypt" id="decrypt-input">
<img id="copy-decrypt" src="./images/content_copy-24px.svg" alt="Copy">
</div>
<div class="centerer">
<h3 id="decrypt-output"></h3>
</div>
</div>
</main>
<script>
const electron = require('electron');
const { ipcRenderer } = electron;
document.querySelector("#copy-encrypt").addEventListener('click', () => {
const textToCopy = document.querySelector("#encrypt-output").textContent;
navigator.clipboard.writeText(textToCopy);
});
document.querySelector("#copy-decrypt").addEventListener('click', () => {
const textToCopy = document.querySelector("#decrypt-output").textContent;
navigator.clipboard.writeText(textToCopy);
});
document.querySelector("#encrypt-input").addEventListener('input', (e) => {
e.preventDefault();
const value = document.querySelector("#encrypt-input").value;
ipcRenderer.send('encrypt:input', value);
});
document.querySelector("#decrypt-input").addEventListener('input', (e) => {
e.preventDefault();
const value = document.querySelector("#decrypt-input").value;
ipcRenderer.send('decrypt:input', value);
});
ipcRenderer.on('encrypt:output', (e, value) => {
document.querySelector("#encrypt-output").textContent = value;
});
ipcRenderer.on('decrypt:output', (e, value) => {
document.querySelector("#decrypt-output").textContent = value;
});
</script>
</body>
</html>