Replaced 3r-party clipboard logic with simplified one

Signed-off-by: simonmicro <simon@simonmicro.de>
This commit is contained in:
simonmicro 2025-10-29 17:43:03 +01:00
parent 79f522f0e4
commit 40fb972948
No known key found for this signature in database
GPG key ID: 033A4D4CE4E063D6
2 changed files with 24 additions and 33 deletions

File diff suppressed because one or more lines are too long

View file

@ -55,8 +55,9 @@
<td> <td>
<div style="position: relative; display: flex; align-items: center;"> <div style="position: relative; display: flex; align-items: center;">
<pre class="gvlk-value">{{ gvlk }}</pre> <pre class="gvlk-value">{{ gvlk }}</pre>
<button class="button is-small is-primary copy-button" data-clipboard-text="{{ gvlk }}" title="Copy to clipboard"> <button class="button is-small ml-3" title="Copy to clipboard"
Copy onclick="copyClick(this, '{{ gvlk }}');">
📋
</button> </button>
</div> </div>
</td> </td>
@ -66,34 +67,31 @@
</tbody> </tbody>
</table> </table>
<!-- Include the clipboard.js library -->
<script src="{{ url_for('static', filename='scripts/2.0.8/clipboard.min.js') }}"></script>
<script> <script>
// Initialize Clipboard.js // Clipboard copy functionality
var clipboard = new ClipboardJS('.copy-button'); function copyClick(button, gvlk) {
navigator.clipboard.writeText(gvlk).then(function () {
clipboard.on('success', function(e) { button.classList.add('is-success');
e.trigger.innerText = 'Copied!'; button.textContent = '✅';
setTimeout(function() { console.log('GVLK copied to clipboard: ' + gvlk);
e.trigger.innerText = 'Copy'; }, function (err) {
}, 1000); button.classList.add('is-danger');
e.clearSelection(); button.textContent = '⚠️';
}); alert('Could not copy "' + gvlk + '" to clipboard: ' + err);
clipboard.on('error', function(e) {
e.trigger.innerText = 'Failed';
setTimeout(function() {
e.trigger.innerText = 'Copy';
}, 1000);
}); });
// reset the color after a few seconds
setTimeout(function () {
button.classList.remove('is-success', 'is-danger');
button.textContent = '📋';
}, 3000);
}
// Search functionality // Search functionality
document.getElementById('search').addEventListener('input', function() { document.getElementById('search').addEventListener('input', function () {
var searchValue = this.value.toLowerCase(); var searchValue = this.value.toLowerCase();
var rows = document.querySelectorAll('#product-table-body tr'); var rows = document.querySelectorAll('#product-table-body tr');
rows.forEach(function(row) { rows.forEach(function (row) {
var nameCell = row.querySelector('.product-name'); var nameCell = row.querySelector('.product-name');
var nameText = nameCell.textContent.toLowerCase(); var nameText = nameCell.textContent.toLowerCase();