1(function ($) { 2 "use strict"; 3 4 /** 5 * All of the code for your common JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 jQuery(document).ready(function ($) { 32 // user email submittion from modal on creating single PDF. 33 $("#pgfw-submit-email-user").click(function (e) { 34 e.preventDefault(); 35 var post_id = $("#pgfw_current_post_id").data("post-id"); 36 var email = $("#pgfw-user-email-input").val(); 37 var use_account_email = $("#pgfw-user-email-from-account").is(":checked"); 38 $("#pgfw-user-email-submittion-message").html( 39 pgfw_common_param.processing_html 40 ); 41 $.ajax({ 42 url: pgfw_common_param.ajaxurl, 43 method: "post", 44 data: { 45 action: "wps_pgfw_ajax_for_single_pdf_mail", 46 nonce: pgfw_common_param.nonce, 47 name: "single_pdf_mail", 48 email: use_account_email ? "use_account_email" : email, 49 post_id: post_id, 50 }, 51 success: function (msg) { 52 $("#pgfw-user-email-submittion-message").html(msg); 53 setTimeout(function () { 54 location.reload(); 55 }, 5000); 56 }, 57 error: function () { 58 $("#pgfw-user-email-submittion-message").html( 59 pgfw_common_param.email_submit_error 60 ); 61 }, 62 }); 63 }); 64 }); 65$(document).on("click", ".flipbook-open-btn", function (e) { 66 e.preventDefault(); 67 const targetSelector = $(this).data("target"); 68 const $modal = $(targetSelector); 69 if ($modal.length) { 70 if ($modal.parent().length && !$modal.parent().is("body")) { 71 $modal.detach().appendTo("body"); 72 } 73 74 // show modal. 75 $modal.attr("aria-hidden", "false").addClass("is-active"); 76 } else { 77 console.warn("Modal not found:", targetSelector); 78 } 79 }); 80 81 // close modal on backdrop or X button. 82 $(document).on("click", ".flipbook-modal [data-close]", function () { 83 $(this).closest(".flipbook-modal").attr("aria-hidden", "true").removeClass("is-active"); 84 }); 85 86 $(document).ready(function() { 87 const canvasWidth = $('.stf__canvas').attr('width'); 88 if (canvasWidth) { 89 $('.flipbook-wrap').css('max-width', canvasWidth + 'px'); 90 console.log("Max width set to:", canvasWidth + "px"); 91 } else { 92 console.warn("Canvas width not found!"); 93 } 94}); 95 96})(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.