1(function($){ 2 3 var popoverTemplate = wp.template('popover-content'); 4 5 // Scope to each carousel on the page 6 $carousels = $('[id^="carousel_"]'); 7 8 $carousels.each(function(index, value) { 9 //Cache our selectors 10 var $print = $(this).find('.share-list .print'), 11 $share = $(this).find('.share-list .email'), 12 $close = $(this).find('.share-window .close'), 13 $form = $(this).find('.share-by-email'), 14 $catalogLink = $(this).find('img'); 15 16 $print.on('click', function(e){ 17 var data = { 18 'action': 'st_print_list', 19 'post_type': $(this).data('post-type'), 20 'taxonomy': $(this).data('taxonomy'), 21 'term_slug': $(this).data('term-slug') 22 }; 23 24 $.ajax({ 25 method: 'POST', 26 url: window.mcFeVars.ajaxUrl, 27 data: data, 28 success: printWindow, 29 async: false //We make this syncronous so it works with popup blockers 30 }); 31 }); 32 33 $share.on('click', function(e){ 34 $(this).closest('.book-carousel-wrapper').addClass('share'); 35 $share.attr('aria-expanded', 'true'); 36 }); 37 38 $close.on('click', function(e){ 39 $(this).closest('.book-carousel-wrapper').removeClass('share'); 40 $share.attr('aria-expanded', 'false'); 41 }); 42 43 $form.on('submit', function(e){ 44 e.preventDefault(); 45 var data = { 46 'action': 'st_email_list', 47 }; 48 49 var $button = $(this).find('button'), 50 buttonText = $button.text(); 51 $button.text('Sending...').attr("disabled", true); 52 $.each($(this).serializeArray(), function(i, field) { 53 data[field.name] = field.value; 54 }); 55 56 57 58 $.post(window.mcFeVars.ajaxUrl, data, function(response) { 59 $button.text('Sent!'); 60 setTimeout(function(){ 61 $close.trigger('click'); 62 }, 900); 63 }) 64 .fail(function() { 65 $button.text('Error! Message could not be sent.'); 66 }) 67 .always(function(){ 68 setTimeout(function(){ 69 $button.text(buttonText).attr("disabled", false); 70 }, 1000); 71 }) 72 73 }); 74 75 $(document).ready(function(){ 76 77 $catalogLink.each( function ( index, value ) { 78 var $this = $(this), 79 description = $this.attr('data-description') || ''; 80 // Trim the description 81 if ( description.length > 240 ) { 82 description = description.substr(0, 240) + '...'; 83 } 84 85 var carouselPopoverDefaults = { 86 placement: 'horizontal', 87 trigger: 'hover', 88 width: 300, 89 title: '', 90 }; 91 92 var webUiArgs = Object.assign({}, carouselPopoverDefaults, window.carouselPopoverArgs || {}); 93 94 webUiArgs.content = function() { 95 var tmplData = { 96 thumb: $this.attr('src'), 97 title: $this.attr('data-title') || $this.attr('alt'), 98 author: $this.attr('data-author'), 99 description: description, 100 caption: $this.attr('data-caption'), 101 catalogLink: $this.closest('a').attr('href') 102 }; 103 return popoverTemplate(tmplData); 104 } 105 106 $this.webuiPopover(webUiArgs); 107 }); 108 }); 109 110 }) 111 112 113 114 115 116 function printWindow(data) { 117 var mywindow = window.open('', 'Print List...', 'height=400,width=600'); 118 mywindow.document.write(data); 119 120 // We have to give it time to load the elements on the page (i.e. images). 121 setTimeout(function(){ 122 mywindow.document.close(); // necessary for IE >= 10 123 mywindow.focus(); // necessary for IE >= 10 124 mywindow.print(); 125 mywindow.close(); 126 }, 1500); 127 128 return true; 129 } 130 131 132})(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.