1/* global jQuery */ 2/* global document */ 3 4(function($) { 5 6 'use strict'; 7 8 var copyCoupon = function() { 9 var 10 Coupons = $('.adace-coupon-wrap'); 11 Coupons.each(function(){ 12 if ( $(this).hasClass('active') ){ 13 return; 14 } else { 15 $(this).addClass('active'); 16 } 17 var 18 CopyBtn = $(this).find('.coupon-copy'), 19 CopyAction = $(this).find('.coupon-action'), 20 CopyActionText = CopyAction.text(), 21 CopyCode = $(this).find('.coupon-code'), 22 CopyCodeText = CopyCode.text(); 23 CopyBtn.click(function(e){ 24 e.preventDefault(); 25 26 // Create element for this pin. 27 var CopyArea = $('<input class="copy-area" style="visibillity:hidden;" value="' + CopyCodeText + '" />'); 28 29 // Copy code 30 CopyCode.prepend(CopyArea); 31 32 CopyArea = $('.copy-area'); 33 34 CopyArea.select(); 35 36 try { 37 document.execCommand('copy'); 38 } catch (err) { 39 alert( 'This feature is not supported in your browser, please copy the coupon manually.'); 40 $('.adace-coupon-code').select(); 41 } 42 43 CopyArea.blur().remove(); 44 45 if( CopyBtn.hasClass('copied') ){ 46 return; 47 } 48 49 CopyBtn.addClass('copied blink'); 50 51 setTimeout(function(){ 52 CopyAction.html(CopyAction.data('copied')); 53 CopyBtn.removeClass('blink'); 54 }, 375); 55 56 setTimeout(function(){ 57 CopyBtn.addClass('blink'); 58 }, 4625); 59 60 setTimeout(function(){ 61 CopyAction.html(CopyActionText); 62 CopyBtn.removeClass('copied blink'); 63 }, 5000); 64 }); 65 }); 66 }; 67 68 $(document).ready(function(){ 69 copyCoupon(); 70 }); 71 72})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.