From 59ef5f5ae640736d820763b907febd556c42169f Mon Sep 17 00:00:00 2001 From: Manuel Hiebel Date: Tue, 16 Jul 2019 08:19:11 +0200 Subject: add function to copy checksum data to clipboard --- en/downloads/get/index.php | 18 +++++++++++++++++- g/style/bootstrap_theme.css | 11 ++++++++++- 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[] = "" . basename($download) . ".$checksum"; + $sum_links[] = "" . basename($download) . '.' . $checksum .''; $chksm_cmd .= '$ ' . $checksum . 'sum -c ' . basename($download) . '.' . $checksum . ' # ' . _r('You need both iso and checksum file in the same folder'); $chksm_cmd .= "\n" . basename($download) . ": " . _r("OK") . " \n" . PHP_EOL; if (isset($product["$checksum.gpg"])) { @@ -398,7 +398,23 @@ $(function() { {lang: ''} }); + + $('[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', '').tooltip('show'); + document.body.removeChild(text); + el.attr('data-original-title', ''); + }); }); + + 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 */ -- cgit v1.2.1