|
157 | 157 | updateText(); |
158 | 158 | updatePage(); |
159 | 159 | }); |
160 | | - })(); |
161 | 160 |
|
162 | | - function copyText() { |
163 | | - const copy_button = document.getElementById("button"); |
164 | | - // Copy text to clipboard onclick. |
165 | | - if (!(v in values) || values[v] === "") { |
166 | | - copy_button.innerHTML = 'Not all fields are filled'; |
167 | | - } |
168 | | - else { |
169 | | - const copyText = document.getElementById("text"); |
170 | | - const title = document.getElementById("title"); |
171 | | - navigator.clipboard.writeText(copyText.value); |
172 | | - |
173 | | - // Button text change from "Copy Text" to "Copied", and text turns grey. |
174 | | - copy_button.innerHTML = 'Copied'; |
175 | | - copy_button.className = 'copied'; |
176 | | - } |
177 | | - } |
| 161 | + const copy_button = document.getElementById("button"); |
| 162 | + |
| 163 | + window.copyText = () => { |
| 164 | + const copy_button = document.getElementById("button"); |
| 165 | + // Copy text to clipboard onclick. |
| 166 | + const copyText = document.getElementById("text"); |
| 167 | + const title = document.getElementById("title"); |
| 168 | + navigator.clipboard.writeText(copyText.value); |
178 | 169 |
|
179 | | - function refreshButton() { |
180 | | - const copy_button = document.getElementById("button"); |
181 | | - if (!(v in values) || values[v] === "") { |
182 | | - copy_button.innerHTML = 'Not all fields are filled'; |
| 170 | + // Button text change from "Copy Text" to "Copied", and text turns grey. |
| 171 | + copy_button.innerHTML = 'Copied'; |
| 172 | + copy_button.className = 'copied'; |
183 | 173 | } |
184 | | - else { |
| 174 | + |
| 175 | + window.refreshButton = () => { |
185 | 176 | copy_button.innerHTML = 'Copy Text'; |
| 177 | + copy_button.className = 'fresh'; |
186 | 178 | } |
187 | | - copy_button.className = 'fresh'; |
188 | | - } |
| 179 | + })(); |
| 180 | + |
| 181 | + |
189 | 182 | </script> |
190 | 183 | </body> |
191 | 184 | </html> |
0 commit comments