1/* <fs_premium_only> */ 2function wfeaCalendarModalHandler() { 3 (function ($) { 4 $("body").on('click', ".wfea-share-button", function () { 5 $("#" + $(this).attr('data-target')).show(); 6 }); 7 $("body").on('click', ".wfea-modal .close", function () { 8 $('.wfea-modal').hide(); 9 }); 10 var calendar_modal = document.getElementById("wfea-calendar-modal"); 11 var social_modal = document.getElementById("wfea-social-modal"); 12 window.onclick = function (event) { 13 if (event.target == calendar_modal) { 14 calendar_modal.style.display = "none"; 15 } 16 if (event.target == social_modal) { 17 social_modal.style.display = "none"; 18 } 19 } 20 })(jQuery); 21} 22 23/* </fs_premium_only> */ 24 25(function ($) { 26 'use strict'; 27 28 /** 29 * All of the code for your public-facing JavaScript source 30 * should reside in this file. 31 * 32 * Note: It has been assumed you will write jQuery code here, so the 33 * $ function reference has been prepared for usage within the scope 34 * of this function. 35 * 36 * This enables you to define handlers, for when the DOM is ready: 37 * 38 * $(function() { 39 * 40 * }); 41 * 42 * When the window is loaded: 43 * 44 * $( window ).load(function() { 45 * 46 * }); 47 * 48 * ...and/or other possibilities. 49 * 50 * Ideally, it is not considered best practise to attach more than a 51 * single DOM-ready or window-load handler for a particular page. 52 * Although scripts in the WordPress core, Plugins and Themes may be 53 * practising this, we should strive to set a better example in our own work. 54 * 55 * 56 */ 57 /* <fs_premium_only> */ 58 $(function () { 59 60 /* -- modal -- */ 61 62 wfeaCalendarModalHandler(); 63 $('body').on('click', '.wfea-modal-view-details', function () { 64 var $button = $(this); 65 var $modalContainer = $('.wfea-modal-container'); 66 $modalContainer.addClass('active'); 67 68 // Move .wfea-modal-container immediately after <body> 69 $modalContainer.prependTo('body'); 70 71 $modalContainer.find('.scrollable-modal').addClass('loading').html('<div class="scrollable-modal-loader"></div>'); 72 // Collect all data attributes 73 var data = { 74 action: 'wfea_full_modal', 75 nonce: wfea_frontend.nonce, 76 eventbrite_id: $button.data('eventbrite_id') 77 }; 78 // Get all data attributes that start with 'wfea' 79 $.each($button[0].attributes, function(_, attr) { 80 if (attr.name.startsWith('data-wfea')) { 81 let key = attr.name; 82 data[key] = attr.value; 83 } 84 }); 85 console.log(data); 86 $.ajax({ 87 url: wfea_frontend.ajaxurl, 88 method: 'POST', 89 data: data, 90 success: function (res) { 91 $modalContainer.find('.scrollable-modal').removeClass('loading').html(res); 92 try { 93 $("[data-eb-id]").wfeaBindLinksToEB(); 94 } catch (e) { 95 // that is OK just no popup 96 } 97 } 98 }); 99 }); 100 101 $('body').on('click', '.wfea-backdrop, .wfea-modal-close-button, .wfea-modal-checkout-button', function () { 102 $('.wfea-modal-container').removeClass('active'); 103 }); 104 105 /* -- accordion -- */ 106 $('body').on('click', '.wfea-accordion .tab', function () { 107 var accordionContent = $(this).next('.tab__content'); 108 109 if (accordionContent.hasClass('open')) { 110 accordionContent.slideUp(400, function () { 111 accordionContent.removeClass('open').addClass('closed'); 112 }); 113 $(this).removeClass('open').addClass('closed'); 114 } else { 115 $('.tab__content.open').slideUp(400).removeClass('open').addClass('closed'); 116 $('.tab.open').removeClass('open').addClass('closed'); 117 118 accordionContent.slideDown(400, function () { 119 accordionContent.removeClass('closed').addClass('open'); 120 }); 121 $(this).removeClass('closed').addClass('open'); 122 } 123 }); 124 125 }); 126 /* </fs_premium_only> */ 127 128 jQuery(document).on('click', '.wfea-search__submit, .wfea-search_cal__submit', function (e) { 129 if (e.target.matches('input.wfea-search_cal__submit')) { 130 e.preventDefault(); 131 132 // Get the closest form to the clicked submit button 133 var form = $(this).closest('form'); 134 135 // Check if the form exists in the DOM 136 if (form.length) { 137 var searchVal = form.find('.wfea-search__input').val(); 138 var section = form.parent('div').nextAll('div').find('section.wfea').first(); 139 console.log(section); 140 section.attr('data-wfea-search', searchVal); // Add data attribute to adjacent section 141 142 // Render the calendar
143 wfea_render_calendar(); 144 } 145 return; 146 } 147 e.preventDefault(); 148 const url = new URL(window.location.href); 149 const searchInput = jQuery('.wfea-search__input').val(); 150 const searchParams = { 151 wfea_s: searchInput, 152 wfea_s_target: jQuery('input[name="wfea_s_target"]').val(), 153 _wfea_nonce: jQuery('input[name="_wfea_nonce"]').val(), 154 }; 155 156 for (const [key, value] of Object.entries(searchParams)) { 157 if (searchInput && value) { 158 url.searchParams.set(key, value); 159 } else { 160 url.searchParams.delete(key); 161 } 162 } 163 164 // Redirect to the modified URL 165 window.location.href = url.toString(); 166 }); 167 168})(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.