From f605b5ac4ac6ff3caf4e0a5f221a07f80fbb7bf4 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 9 Aug 2021 22:44:50 -0400 Subject: [PATCH] Made Copy to Clipoard button work undr client logins --- client_logins.php | 7 ++++--- edit_login_modal.php | 4 ++-- js/app.js | 50 +++++++++++++++++++++++--------------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/client_logins.php b/client_logins.php index f1a494ac..3e1c3ff1 100644 --- a/client_logins.php +++ b/client_logins.php @@ -104,9 +104,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); - - - + + + +
- +
@@ -76,7 +76,7 @@
- +
diff --git a/js/app.js b/js/app.js index bbff55d0..f2d800f5 100644 --- a/js/app.js +++ b/js/app.js @@ -25,39 +25,41 @@ $('.datetimepicker').datetimepicker({ // Data Input Mask $('[data-mask]').inputmask(); -// Tooltip ClipboardJS - -$('.clipboardjs').tooltip({ - trigger: 'click', - placement: 'bottom' -}); - -function setTooltip(message) { - $('.clipboardjs').tooltip('hide') - .attr('data-original-title', message) - .tooltip('show'); -} - -function hideTooltip() { - setTimeout(function() { - $('.clipboardjs').tooltip('hide'); - }, 1000); -} - // ClipboardJS //Fix to allow Clipboard Copying within Bootstrap Modals //For use in Bootstrap Modals or with any other library that changes the focus you'll want to set the focused element as the container value. $.fn.modal.Constructor.prototype._enforceFocus = function() {}; -var clipboard = new ClipboardJS('.clipboardjs'); +// Tooltip + +$('button').tooltip({ + trigger: 'click', + placement: 'bottom' +}); + +function setTooltip(btn, message) { + $(btn).tooltip('hide') + .attr('data-original-title', message) + .tooltip('show'); +} + +function hideTooltip(btn) { + setTimeout(function() { + $(btn).tooltip('hide'); + }, 1000); +} + +// Clipboard + +var clipboard = new ClipboardJS('button'); clipboard.on('success', function(e) { - setTooltip('Copied!'); - hideTooltip(); + setTooltip(e.trigger, 'Copied!'); + hideTooltip(e.trigger); }); clipboard.on('error', function(e) { - setTooltip('Failed!'); - hideTooltip(); + setTooltip(e.trigger, 'Failed!'); + hideTooltip(e.trigger); }); \ No newline at end of file