aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Hiebel <leuhmanu@mageia.org>2019-07-16 08:19:11 +0200
committerManuel Hiebel <leuhmanu@mageia.org>2019-07-16 08:19:11 +0200
commit59ef5f5ae640736d820763b907febd556c42169f (patch)
tree94a67573e30155839488c4910a02368fce6fc98a
parentb8e435375e83f085303ed29eae950452ab4869fe (diff)
downloadwww-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
-rw-r--r--en/downloads/get/index.php18
-rwxr-xr-xg/style/bootstrap_theme.css11
2 files changed, 27 insertions, 2 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>
diff --git a/g/style/bootstrap_theme.css b/g/style/bootstrap_theme.css
index e6c10c83e..97268380d 100755
--- a/g/style/bootstrap_theme.css
+++ b/g/style/bootstrap_theme.css
@@ -131,7 +131,16 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/s
background-size: 100%;
background-repeat: no-repeat;
}
-
+.copy-icon:after{
+ content:'';
+ width: 1rem;
+ height: 1rem;
+ margin-left: 0.3rem;
+ display: inline-block;
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cpath d='M 4 2 C 2.895 2 2 2.895 2 4 L 2 18 L 4 18 L 4 4 L 18 4 L 18 2 L 4 2 z M 8 6 C 6.895 6 6 6.895 6 8 L 6 20 C 6 21.105 6.895 22 8 22 L 20 22 C 21.105 22 22 21.105 22 20 L 22 8 C 22 6.895 21.105 6 20 6 L 8 6 z M 8 8 L 20 8 L 20 20 L 8 20 L 8 8 z'%3E%3C/path%3E%3C/svg%3E");
+ background-size: 100%;
+ background-repeat: no-repeat;
+}
/* custom css for website*/
/* overwrite all.css */