@@ -139,8 +139,15 @@ function show_source_releases()
139139 <?php download_link ($ rel ['filename ' ], $ rel ['filename ' ]); ?>
140140 <span class="releasedate"><?php echo date ('d M Y ' , strtotime ($ rel ['date ' ])); ?> </span>
141141 <?php
142- if (isset ($ rel ['md5 ' ])) echo '<span class="md5sum"> ' , $ rel ['md5 ' ], '</span> ' ;
143- if (isset ($ rel ['sha256 ' ])) echo '<span class="sha256"> ' , $ rel ['sha256 ' ], '</span> ' ;
142+ if (isset ($ rel ['md5 ' ])) {
143+ echo '<span class="md5sum"> ' , $ rel ['md5 ' ], '</span> ' ;
144+ }
145+ if (isset ($ rel ['sha256 ' ])) {
146+ echo '<span class="sha256-row"> ' ;
147+ echo '<span class="sha256"> ' , $ rel ['sha256 ' ], '</span> ' ;
148+ echo '<button type="button" class="sha256-copy" data-copy-text=" ' , $ rel ['sha256 ' ], '" aria-label="Copy sha256 checksum">Copy</button> ' ;
149+ echo '</span> ' ;
150+ }
144151 ?>
145152 <?php if (isset ($ rel ['note ' ]) && $ rel ['note ' ]): ?>
146153 <p>
@@ -161,5 +168,20 @@ function show_source_releases()
161168 </div>
162169 <?php endforeach ; ?>
163170 <?php endforeach ; /* major releases loop end */ ?>
171+ <script>
172+ document.addEventListener('click', function (event) {
173+ var button = event.target.closest('.sha256-copy');
174+ if (!button || !navigator.clipboard) {
175+ return console.error('Clipboard API not available');
176+ }
177+
178+ navigator.clipboard.writeText(button.dataset.copyText).then(function () {
179+ button.textContent = 'Copied';
180+ setTimeout(function () {
181+ button.textContent = 'Copy';
182+ }, 3000);
183+ });
184+ });
185+ </script>
164186<?php
165187}
0 commit comments