1'use strict'; 2 3(function ($) { 4 $(function () { 5 // ready 6 var wpcss = 0; 7 var wpcssInterval = setInterval(function () { 8 wpcss++; 9 10 if ($('.wc-block-cart-items').length || wpcss > 60) { 11 clearInterval(wpcssInterval); 12 } 13 14 if ($('.wc-block-cart-items').length && $('.wpcss-footer-btn').length) { 15 $('.wpcss-footer-btn .wpcss-btn').insertAfter('.wc-block-cart-items'); 16 } 17 }, 500); 18 }); 19 20 $(document).on('click touch', '.wpcss-checkbox-all', function () { 21 $('.wpcss-checkbox-all').prop('checked', this.checked); 22 $('.wpcss-checkbox').not(this).prop('checked', this.checked); 23 }); 24 25 $(document).on('click touch', '.wpcss-popup-close', function () { 26 $('.wpcss-area').removeClass('wpcss-area-show'); 27 }); 28 29 $(document).on('click touch', '.wpcss-area', function (e) { 30 if ($(e.target).closest('.wpcss-popup').length === 0) { 31 $('.wpcss-area').removeClass('wpcss-area-show'); 32 } 33 }); 34 35 $(document).on('click touch', '.wpcss-btn', function (e) { 36 var hash = $(this).data('hash'); 37 e.preventDefault(); 38 39 $(this).removeClass('wpcss-added').addClass('wpcss-adding'); 40 41 var data = { 42 action: 'wpcss_share', hash: hash, nonce: wpcss_vars.nonce, 43 }; 44 45 $.post(wpcss_vars.wc_ajax_url.toString().replace('%%endpoint%%', 'wpcss_share'), data, function (response) { 46 $('.wpcss-btn').removeClass('wpcss-adding').addClass('wpcss-added'); 47 $('.wpcss-popup-content').html(response); 48 $('.wpcss-area').addClass('wpcss-area-show'); 49 }); 50 }); 51 52 // copy link 53 $(document).on('click touch', '#wpcss_copy_url, #wpcss_copy_btn', function (e) { 54 wpcss_copy_to_clipboard('#wpcss_copy_url'); 55 }); 56 57 function wpcss_copy_to_clipboard(el) { 58 // resolve the element 59 el = (typeof el === 'string') ? document.querySelector(el) : el; 60 61 // handle iOS as a special case 62 if (navigator.userAgent.match(/ipad|ipod|iphone/i)) { 63 // save current contentEditable/readOnly status 64 var editable = el.contentEditable; 65 var readOnly = el.readOnly; 66 67 // convert to editable with readonly to stop iOS keyboard opening 68 el.contentEditable = true; 69 el.readOnly = true; 70 71 // create a selectable range 72 var range = document.createRange(); 73 range.selectNodeContents(el); 74 75 // select the range 76 var selection = window.getSelection(); 77 selection.removeAllRanges(); 78 selection.addRange(range); 79 el.setSelectionRange(0, 999999); 80 81 // restore contentEditable/readOnly to original state 82 el.contentEditable = editable; 83 el.readOnly = readOnly; 84 } else { 85 el.select(); 86 } 87 88 // execute copy command 89 document.execCommand('copy'); 90 91 // alert 92 alert(wpcss_vars.copied_text.replace('%s', el.value)); 93 } 94})(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.