1jQuery( function( $ ) { 2 const updateWidgetContent = ( params, widgetPreviewElement ) => { 3 jQuery.ajax({ 4 url: customAjax.ajaxurl, 5 type: 'POST', 6 data: { 7 action: 'update_widget_content', 8 nonce: customAjax.nonce, 9 params: params 10 }, 11 success: function(response) { 12 widgetPreviewElement.find( '.wfea-preview' ).html( response ); 13 if ( typeof wfea_render_calendar === 'function' ) { 14 wfea_render_calendar(); 15 } 16 widgetPreviewElement.find( '[data-eb-id]' ).wfeaBindLinksToEB(); 17 } 18 }); 19 }; 20 21 if ( typeof elementorFrontend === 'undefined' ) { 22 return; 23 } 24 25 const getShortcodeArgs = ( $scope ) => { 26 const widgetInstance = elementorFrontend.config.elements.data[ $scope.data('model-cid') ]; 27 const data = Object.keys( widgetInstance.attributes ) 28 .filter( key => key.startsWith( 'wfea_' ) ) 29 .reduce( ( result, key ) => { 30 if ( isNonBooleanAttribute( key ) ) { 31 result[ key.slice(5) ] = widgetInstance.attributes[key]; 32 } else { 33 result[ key.slice(5) ] = !! widgetInstance.attributes[key]; 34 } 35 36 return result; 37 }, {}); 38 39 return data; 40 }; 41 42 const isNonBooleanAttribute = ( attribute ) => { 43 const nonBooleanAtts = [ 'wfea_layout', 'wfea_set_style_venue', 'wfea_set_style_slider', 'wfea_limit', 'wfea_search', 'wfea_filter_location', 'wfea_filter_title', 'wfea_tags', 'wfea_start_date_range_start', 'wfea_start_date_range_end', 'wfea_eb_id', 'wfea_organizer_id', 'wfea_organization_id', 'wfea_collection_id', 'wfea_venue_id', 'wfea_booknow_text', 'wfea_css_class', 'wfea_cssID', 'wfea_thumb_default', 'wfea_length', 44 'wfea_readmore_text', 'wfea_no_events_found_text', 'wfea_online_events_address_text', 'wfea_location_title', 'wfea_tickets_at_the_door_button', 'wfea_canceled_event_button', 'wfea_coming_soon_button', 'wfea_link_custom_page', 'wfea_past_event_button', 'wfea_postponed_button', 'wfea_sales_ended_button', 'wfea_sold_out_button', 45 'wfea_started_event_button', 'wfea_unavailable_button', 'wfea_search_box_button', 'wfea_search_box_text', 'wfea_category_id', 'wfea_subcategory_id', 'wfea_subcategory_id', 'wfea_format_id', 'wfea_order_by', 'wfea_location', 'wfea_paginate_position', 'wfea_status', 'wfea_show_availability', 'wfea_events_per_page', 'wfea_api_key', 46 'wfea_style', 'wfea_accordion_tab_attr', 'wfea_cal_default_view', 'wfea_cal_list_header_left', 'wfea_cal_list_header_right', 'wfea_cal_list_days', 'wfea_thumb_align', 'wfea_thumb_width', 'wfea_filter_by_attr', 'wfea_order_by_attr' ]; 47 return nonBooleanAtts.includes( attribute ); 48 }; 49 50 if ( typeof elementorFrontend !== 'undefined' && elementorFrontend.hasOwnProperty( 'hooks' ) ) { 51 elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) { 52 if ( $scope.data( 'widget_type') !== 'eventbrite-widget.default' ) { 53 return; 54 } 55 56 const data = getShortcodeArgs( $scope ); 57 data['css_class'] = data['css_class'] + ' wfea-blocks'; 58 updateWidgetContent( data, $scope ); 59 } ); 60 } 61} ); 62 63jQuery( document ).on( 'change', ( e ) => { 64 if ( e.target.dataset.setting !== 'wfea_start_date_range_start' && e.target.dataset.setting !== 'wfea_start_date_range_end' ) { 65 return; 66 } 67 68 jQuery.ajax({ 69 url: customAjax.ajaxurl, 70 type: 'POST', 71 data: { 72 action: 'validate_date', 73 nonce: customAjax.nonce, 74 wfea_date_value: e.target.value 75 }, 76 success: function( response ) { 77 const controlContainer = e.target.closest( '.elementor-control-content' ); 78 if ( ! controlContainer ) { 79 return; 80 } 81 if ( ! response ) { 82 if ( ! controlContainer.querySelector( '.message' ) ) { 83 jQuery( controlContainer ).append( jQuery( '<p class="message">Could not convert the date try something like last day of march</p>' ) ); 84 } 85 } else { 86 controlContainer.querySelector( '.message' )?.remove(); 87 } 88 } 89 }); 90});
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.