DmitrMakeev commited on
Commit
22a0d02
·
verified ·
1 Parent(s): ba32f27

Update crypto.html

Browse files
Files changed (1) hide show
  1. crypto.html +25 -14
crypto.html CHANGED
@@ -5,6 +5,7 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Шифрование ссылки</title>
7
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
 
8
  <style>
9
  body {
10
  font-family: Arial, sans-serif;
@@ -51,18 +52,12 @@
51
  #encryptButton:hover {
52
  background-color: #388E3C;
53
  }
54
- h2 {
55
- margin-top: 40px;
56
- color: #4CAF50;
57
- }
58
- textarea {
59
- width: 80%;
60
- height: 100px;
61
- padding: 10px;
62
  font-size: 16px;
63
- border: 1px solid #ccc;
64
- border-radius: 5px;
65
- margin-top: 10px;
66
  }
67
  </style>
68
  </head>
@@ -80,9 +75,9 @@
80
  <button type="button" id="encryptButton" onclick="encryptLink()">Зашифровать</button>
81
  </form>
82
 
83
- <h2>Зашифрованная ссылка:</h2>
84
- <textarea id="encryptedLink" rows="4" cols="50" readonly></textarea>
85
 
 
86
  <script>
87
  function encryptLink() {
88
  const key = document.getElementById('key').value;
@@ -90,7 +85,23 @@
90
  // Шифрование с использованием AES
91
  const encryptedLink = CryptoJS.AES.encrypt(link, key).toString();
92
  // Вывод зашифрованной ссылки
93
- document.getElementById('encryptedLink').value = encryptedLink;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
  </script>
96
  </body>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Шифрование ссылки</title>
7
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
8
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
9
  <style>
10
  body {
11
  font-family: Arial, sans-serif;
 
52
  #encryptButton:hover {
53
  background-color: #388E3C;
54
  }
55
+ #encryptedLink {
56
+ margin-top: 20px;
 
 
 
 
 
 
57
  font-size: 16px;
58
+ color: #333;
59
+ cursor: pointer;
60
+ text-decoration: underline;
61
  }
62
  </style>
63
  </head>
 
75
  <button type="button" id="encryptButton" onclick="encryptLink()">Зашифровать</button>
76
  </form>
77
 
78
+ <div id="encryptedLink" onclick="copyToClipboard(this)">Кликните после шифрования, чтобы скопировать зашифрованную ссылку.</div>
 
79
 
80
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
81
  <script>
82
  function encryptLink() {
83
  const key = document.getElementById('key').value;
 
85
  // Шифрование с использованием AES
86
  const encryptedLink = CryptoJS.AES.encrypt(link, key).toString();
87
  // Вывод зашифрованной ссылки
88
+ document.getElementById('encryptedLink').innerText = encryptedLink;
89
+ }
90
+
91
+ function copyToClipboard(element) {
92
+ var tempInput = document.createElement("input");
93
+ tempInput.value = element.innerText;
94
+ document.body.appendChild(tempInput);
95
+ tempInput.select();
96
+ document.execCommand("copy");
97
+ document.body.removeChild(tempInput);
98
+ Toastify({
99
+ text: "Зашифрованная ссылка скопирована",
100
+ duration: 3000,
101
+ gravity: "top",
102
+ position: "center",
103
+ backgroundColor: "#4CAF50",
104
+ }).showToast();
105
  }
106
  </script>
107
  </body>