1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing 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 $(document).ready(function() { 32 33 $('#location_select').on('change', function() { 34 var venue = $(this).val(); 35 var lat = $(this).find(':selected').data('lat'); 36 var lng = $(this).find(':selected').data('lng'); 37 $('#wps_etmfw_event_map').attr('src', 'https://maps.google.it/maps?q=' + encodeURIComponent(venue) + '&output=embed'); 38 $('#wps_etmfw_event_venue').val(venue); 39 $('#wps_etmfw_event_venue_lat').val(lat); 40 $('#wps_etmfw_event_venue_lng').val(lng); 41 }); 42 43 jQuery(window).on('load', function() { 44 var event_view = etmfwp_public_param.event_view; 45 if (event_view == 'calendar') { 46 var data = { 47 action: 'wps_etmfw_get_calendar_events', 48 wps_nonce: etmfwp_public_param.wps_etmfw_nonce, 49 }; 50 $.ajax({ 51 dataType: 'json', 52 type: 'POST', 53 url: etmfwp_public_param.ajaxurl, 54 data: data, 55 success: function(response) { 56 var calendarEl = document.getElementById('wps-calendar'); 57 58 if (!calendarEl) { 59 return; 60 } 61 62 var calendar = new FullCalendar.Calendar(calendarEl, { 63 initialView: 'dayGridMonth', 64 initialDate: new Date(), 65 headerToolbar: { 66 left: 'prev,next today', 67 center: 'title', 68 right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek' 69 }, 70 events: response.result 71 }); 72 calendar.render(); 73 }, 74 error: function(response) { 75 console.log("ajax fails1"); 76 } 77 }); 78 } 79 }); 80 81 // Js For Calendar Shortcode start here.// 82 $(window).on('load', function() { 83 var event_view = etmfwp_public_param.wps_is_event_in_calender_shortcode; 84 if ( event_view ) { 85 var data = { 86 action: 'wps_etmfw_calendar_events_shortcode', 87 wps_nonce: etmfwp_public_param.wps_etmfw_nonce, 88 }; 89 $.ajax({ 90 dataType: 'json', 91 type: 'POST', 92 url: etmfwp_public_param.ajaxurl, 93 data: data, 94 success: function (response) { 95 var calendarEl = document.getElementById('wps_event_listing_in_calender'); 96 var calendar = new FullCalendar.Calendar(calendarEl, { 97 initialView: 'dayGridMonth', 98 initialDate: new Date(), 99 headerToolbar: { 100 left: 'prev,next today', 101 center: 'title', 102 right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek' 103 }, 104 events: response.result 105 }); 106 calendar.render(); 107 }, 108 error: function (response) { 109 console.log("ajax fails2"); 110 } 111 }); 112 } 113 }); 114 // Js For Calendar Shortcode end here.// 115 116 var $toggle = $("#wps-etmfw-share-toggle"); 117 var $shadowPop = $(".wps-pop_shadow"); 118 var $popup = $("#wps-etmfw-share-popup"); 119 120 $toggle.on("click", function (e) { 121 e.stopPropagation(); 122 $("body").prepend($popup.detach()); 123 $("body").prepend($shadowPop.detach()); 124 $shadowPop.show(); 125 setTimeout(function (e) { 126 $popup.addClass("pop-active"); 127 },200); 128 }); 129 130 $(document).on( 131 "click", 132 ".wps-etmfw-share-close, .wps-pop_shadow", 133 function (e) { 134 e.stopPropagation(); 135 $popup.removeClass("pop-active"); 136 setTimeout(function (e) { 137 $shadowPop.hide(); 138 },200); 139 } 140 ); 141 142 // $(document).on('click', function(e) { 143 // if (!$(e.target).closest('#wps-etmfw-share-popup, #wps-etmfw-share-toggle').length) { 144 // $popup.hide(); 145 // } 146 // }); 147 }); 148 149})(jQuery); 150 151 152jQuery(document).ready(function ($) { 153 if ('on' == etmfwp_public_param.wps_etmfw_enable_subscribe_checkbox && etmfwp_public_param.is_checkout ) {
154 function runAjax() { 155 var data = { 156 action: 'wps_etmfwp_notification_fun_calbck', 157 wps_nonce: etmfwp_public_param.wps_etmfw_nonce, 158 wps_subscribe_for_events: $('#wps_etmfw_subscribe_for_events').is(':checked'), 159 }; 160 $.ajax( 161 { 162 dataType: 'json', 163 url: etmfwp_public_param.ajaxurl, 164 type: "POST", 165 data: data, 166 success: function (response) { 167 // console.log(response); 168 } 169 } 170 ); 171 172 } 173 setInterval(runAjax, 1500); 174 175 // Wait for the WooCommerce Blocks checkout to fully load 176 const interval = setInterval(function () { 177 const checkoutForm = $('.wc-block-checkout__add-note'); // Selector for the checkout form 178 179 if (checkoutForm.length > 0) { 180 // Clear interval once the form is found 181 clearInterval(interval); 182 183 // Add the checkbox dynamically 184 const checkboxHTML = ` 185 <div class="wps-etmfw-subscribe-checkbox"> 186 <input type="checkbox" id="wps_etmfw_subscribe_for_events" name="wps_etmfw_subscribe_for_events"> 187 <label for="wps_etmfw_subscribe_for_events">`+ etmfwp_public_param.wps_label_future_sub + `</label> 188 </div> 189 `; 190 191 // Append the checkbox before the Place Order button 192 checkoutForm.append(checkboxHTML); 193 194 // Optionally, listen for changes to the checkbox 195 $('#wps_etmfw_subscribe_for_events').on('change', function () { 196 console.log('Checkbox value:', $(this).is(':checked')); 197 }); 198 } 199 }, 500); // Check every 500ms 200 201 } 202}); 203
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.