|
63 | 63 | </button>
|
64 | 64 | </div>
|
65 | 65 | <div class="copy-result">
|
66 |
| - <span id="copy-notification"></span> |
| 66 | + <span id="copy-notification"></span> |
67 | 67 | </div>
|
68 | 68 | </div>
|
69 | 69 | <div class='authorship'>
|
|
279 | 279 | {{/if}}
|
280 | 280 |
|
281 | 281 | <script type="text/javascript">
|
282 |
| - if (!Clipboard.isSupported()) { |
283 |
| - document.getElementById('crate-download-button').classList.add('hidden'); |
284 |
| - } |
| 282 | + if (!Clipboard.isSupported()) { |
| 283 | + document.getElementById('crate-download-button').classList.add('hidden'); |
| 284 | + } |
285 | 285 |
|
286 |
| - var clipboard = new Clipboard('#crate-download-button'); |
287 |
| - var notificationElement = document.getElementById('copy-notification'); |
288 |
| - clipboard.on('success', function(e) { |
289 |
| - var successText = 'Copied !'; |
| 286 | + var clipboard = new Clipboard('#crate-download-button'); |
| 287 | + var notificationElement = document.getElementById('copy-notification'); |
290 | 288 |
|
291 |
| - e.clearSelection(); |
292 |
| - notificationElement.classList.add('copy-success') |
293 |
| - notificationElement.textContent = successText; |
294 |
| - fadeOffElement(notificationElement, 2000); |
295 |
| - }); |
296 |
| - clipboard.on('error', function(e) { |
297 |
| - var failureText = 'An error occured. Please use CTRL+C.'; |
| 289 | + clipboard.on('success', function(e) { |
| 290 | + var successText = 'Copied !'; |
298 | 291 |
|
299 |
| - notificationElement.classList.add('copy-failure') |
300 |
| - notificationElement.textContent = failureText; |
301 |
| - fadeOffElement(notificationElement, 2000); |
302 |
| - }); |
| 292 | + e.clearSelection(); |
| 293 | + notificationElement.classList.add('copy-success') |
| 294 | + notificationElement.textContent = successText; |
| 295 | + fadeOffElement(notificationElement, 2000); |
| 296 | + }); |
303 | 297 |
|
304 |
| - function fadeOffElement(element, delay) { |
305 |
| - setTimeout(function() { |
306 |
| - resetElement(element); |
307 |
| - }, delay); |
308 |
| - } |
| 298 | + clipboard.on('error', function(e) { |
| 299 | + var failureText = 'An error occured. Please use CTRL+C.'; |
309 | 300 |
|
310 |
| - function resetElement(element) { |
311 |
| - element.innerHTML = ''; |
312 |
| - element.className = ''; |
313 |
| - } |
| 301 | + notificationElement.classList.add('copy-failure') |
| 302 | + notificationElement.textContent = failureText; |
| 303 | + fadeOffElement(notificationElement, 2000); |
| 304 | + }); |
314 | 305 |
|
| 306 | + function fadeOffElement(element, delay) { |
| 307 | + setTimeout(function() { |
| 308 | + resetElement(element); |
| 309 | + }, delay); |
| 310 | + } |
| 311 | +
|
| 312 | + function resetElement(element) { |
| 313 | + element.innerHTML = ''; |
| 314 | + element.className = ''; |
| 315 | + } |
315 | 316 | </script>
|
0 commit comments