PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / trunk
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification vtrunk
5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 All 38 releases
double-opt-in / core / assets / copy-to-clipboard.js

copy-to-clipboard.js in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification trunk, at core/assets/copy-to-clipboard.js

33 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Just copy content to the clipboard
3 * using the .copy-to-clipboard class
4 *
5 * @version 1.0
6 */
7 (function($){
8 /*
9 * Add the icon which indicates the copy to clipboard
10 */
11 $(document).ready(function() {
12 $(document).find('.copy-to-clipboard').each(function () {
13 $(this).wrap('<div class="copy-to-clipboard-wrapper"></div>');
14 $(this).parent().append('<div class="copy-icon dashicons dashicons-admin-page"></div>');
15 });
16 });
17
18 /*
19 * Add the copy to clipboard function
20 */
21 $(document).on('click','.copy-to-clipboard-wrapper .copy-icon', function(){
22 var copyText = $(this).parent().find('.copy-to-clipboard').html();
23 copyText = copyText.trim();
24 navigator.clipboard.writeText(copyText);
25
26 $(this).removeClass('dashicons-admin-page').addClass('dashicons-yes');
27
28 var c = $(this);
29 setTimeout(function(){
30 c.removeClass('dashicons-yes').addClass('dashicons-admin-page');
31 }, 2500);
32 });
33 })(jQuery)