diff options
author | Manuel Hiebel <leuhmanu@mageia.org> | 2019-07-16 08:19:11 +0200 |
---|---|---|
committer | Manuel Hiebel <leuhmanu@mageia.org> | 2019-07-16 08:19:11 +0200 |
commit | 59ef5f5ae640736d820763b907febd556c42169f (patch) | |
tree | 94a67573e30155839488c4910a02368fce6fc98a /en | |
parent | b8e435375e83f085303ed29eae950452ab4869fe (diff) | |
download | www-59ef5f5ae640736d820763b907febd556c42169f.tar www-59ef5f5ae640736d820763b907febd556c42169f.tar.gz www-59ef5f5ae640736d820763b907febd556c42169f.tar.bz2 www-59ef5f5ae640736d820763b907febd556c42169f.tar.xz www-59ef5f5ae640736d820763b907febd556c42169f.zip |
add function to copy checksum data to clipboard
Diffstat (limited to 'en')
-rw-r--r-- | en/downloads/get/index.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php index 222d01ab4..3ec90ebd2 100644 --- a/en/downloads/get/index.php +++ b/en/downloads/get/index.php @@ -254,7 +254,7 @@ $chksm_cmd = ''; $sig_links = array(); foreach ($checksums as $checksum) { if (isset($product[$checksum])) { - $sum_links[] = "<a href=\"$download.$checksum\">" . basename($download) . ".$checksum</a>"; + $sum_links[] = "<a href=\"$download.$checksum\">" . basename($download) . '.' . $checksum .'</a><span class="copy-icon" data-toggle="tooltip" title="' . _r("Copy"). '" data-clip="'. $product[$checksum]. '"></span>'; $chksm_cmd .= '$ ' . $checksum . 'sum -c ' . basename($download) . '.' . $checksum . ' # ' . _r('You need both iso and checksum file in the same folder'); $chksm_cmd .= "\n<strong>" . basename($download) . ": " . _r("OK") . " </strong>\n" . PHP_EOL; if (isset($product["$checksum.gpg"])) { @@ -398,7 +398,23 @@ $(function() { {lang: '<?php echo $locale; ?>'} }); + + $('[data-toggle="tooltip"]').tooltip() + + $('.copy-icon').click(function() { + var el = $(this); + var text = document.createElement("textarea"); + text.value = el.data('clip'); + document.body.appendChild(text); + text.select(); + document.execCommand('copy'); + el.attr('data-original-title', '<?php _g('Copied'); ?>').tooltip('show'); + document.body.removeChild(text); + el.attr('data-original-title', '<?php _g('Copy'); ?>'); + }); }); + + </script> </body> </html> |