• Resolved Argentum

    (@argentum)


    Hi!
    Today we realised that our configuration of EME and Autoptimize javascript aggregation stopped the booking of events from accepting bookings. The event booking forms worked and everything seemed fine, but for one thing. The new booking was never created. I tested the booking with Chrome dev console open and no errors. I then disabled Autoptimize javascript aggregation and the EME bookings started working again. We have quite a few javascript exclusions for EME in use already:
    events-made-easy/js/eme_location_map.js, events-made-easy/js/eme.js, events-made-easy/js/client-clock.js, latitude_, longitude_, map_text_

    Is there some new javascript file that should be added to the exclusion list?

    • This topic was modified 5 years, 3 months ago by Argentum.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Ambyomoron

    (@josiah-s-carberry)

    For what it’s worth, I use both plugins (latest versions) and do not have this issue. Might it be necessary to clear the Autoptimize cache? Or other caches you might be using?

    Thread Starter Argentum

    (@argentum)

    Possibly. But I am asking the author just the same if any javascript file we’re not excluding at the moment but should exclude. And it was a very sneaky error. The look and behaviour of the form suggested that the booking was made, but no confirmation mail was sent and no booking added in the EME backend.

    Any JS errors on the browser console?

    You could always try with plugins/events-made-easy as catch-all exclusion + untick the “also aggregate inline JS” option to ensure no inline EME JS gets aggregated?

    Plugin Author Franky

    (@liedekef)

    Sometimes I try using an optimizer plugin and never encountered problems. I try to use the wordpress standards for enqueueing scripts (and some inline javascript might be needed too, but I try to avoid it). I always wonder how optimizers handle scripts that get translated by wordpress (to replace certain strings) …
    Anyway, for now I’d say to exclude everything in events-made-easy/js, but for the frontend purely related to bookings this is limited to eme.js (fdatepicker, eme_location_map.js, eme_autocomplete_rsvp.js and others are used too, but not for the booking itself).

    I always wonder how optimizers handle scripts that get translated by wordpress (to replace certain strings) …

    Well, Autoptimize by default leaves inline JS as is ??

    Thread Starter Argentum

    (@argentum)

    I see no errors in the console, apart from
    Uncaught TypeError: Cannot read property ‘language’ of undefined
    at fdatepicker.sv.js?ver=2.1.54:12
    at fdatepicker.sv.js?ver=2.1.54:9
    at fdatepicker.sv.js?ver=2.1.54:11

    I added the exclusion rule events-made-easy/js. Seems to be working now.

    Would be nice to receive a mail to the admin account if a booking fails … ??

    Plugin Author Franky

    (@liedekef)

    There is indeed a typo in the language file js/fdatepicker/js/i18n/fdatepicker.sv.js
    It currently has the line:
    $.fn.datepicker.language
    which should be:
    $.fn.fdatepicker.language

    That will solve the issue for you. I’ll verify all those this evening to make sure all are correct.

    @optimizingmatters : I mean the following: eme.js is a javascript file, but wordpress replaces strings in that file using wp_localize_script. So I wonder how an optimizer handles those replacements via done wp_localize_script.
    I still find it weird that it wouldn’t work, and I’m always willing to learn to make sure the code works with optimizers too (and in my tests it works just fine).

    @liedekef wp_localize_script leaves eme.js (which is just a static file) be and adds the transalations in inline JS, e.g.

    <script type='text/javascript'>/* <![CDATA[ */
    var emebasic = {"translate_plugin_url":"https:\/\/www.e-dynamics.be\/wordpress\/wp-content\/plugins\/events-made-easy\/","translate_ajax_url":"https:\/\/www.e-dynamics.be\/wordpress\/wp-admin\/admin-ajax.php","translate_selectstate":"State","translate_selectcountry":"Country","translate_frontendnonce":"2bb6d6e9a5","translate_error":"An error has occurred","translate_clear":"Clear","translate_mailingpreferences":"Mailing preferences","translate_yessure":"Yes, I'm sure","translate_iwantmails":"I want to receive mails","translate_firstDayOfWeek":"0","translate_flanguage":"en","translate_fdateformat":"D j M Y","translate_ftimeformat":"H:i"};
    /* ]]> */</script>
    <script type='text/javascript' defer="defer" src='https://www.e-dynamics.be/wordpress/wp-content/plugins/events-made-easy/js/eme.js?ver=2.1.54'></script>

    and indeed AO leaves that inline part (except if “also aggregate inline JS” is activated by the user) be ??

    groeten uit Lokeren,
    frank

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Autoptimize and EME javascript’ is closed to new replies.