Working on the templating of our TNEW V7 site and we've encountered a pretty specific problem with script loading orders. On our event listing page, we load a script file that triggers the scripts on $(window).load(function(). The script file loads every time and the console log always indicates that the script fires. However, the script impacts the loaded performance content, and sometimes the script fires after that content is loaded which is correct, but sometimes the script fires before that content loads. It's about 50/50 when it works.The $(window).load(function() trigger is the only one we could get to work at all, but I guess this inconsistency tells me that the performance information can load after the window. Has anybody experienced and fixed this? Is there a JS trigger that could work?
In v6 the calendar/listing content was loaded dynamically into the page whenever you shifted months or used filters, I expect v7 is the same. Have you tested to see if that is what you're seeing?
That's probably exactly it. Is there a way to use scripts on that content? Specifically, we're using jquery to add divs.
That's a great question. I don't know of there's an event handler or something that you could tie into.
I had this issue with v6 when overriding urls in performance content so that they would point to our development content server when being displayed by our QA TNEW site. Since it was content in the DB, I just ran a URL updater on the content table in the database during Live->Test copies. Obviously, I can't do that with v7. I think I have an enhancement request in to be able to do arbitrary URL mangling for TNEW config in QA...
Are you on the TN Web slack channel?
Would something like $(window).ajaxComplete(function() work for you?
I think I was asking about this exact same thing in the TN_WebShare slack a couple of days ago: https://tn-webshare.slack.com/archives/C02GE71RP/p1554299345073600
I was looking into .ajaxComplete() since it looked like TNEW is using jQuery's ajax library to do its async loading, but it seemed like there were a number of different ajax calls happening so I was curious how I could be more specific with my hook. Can/does TNEW fire a specific event once the events are loaded and the DOM is ready to be manipulated? (Someone in chat suggested using a MutationObserver, but I haven't yet looked into how this would be implemented.)
We don't pay for slack around here, but I'm on the planning committee channel so there must be some way I can get there. Do you have to invite me?
Chaz Stuart if youd like to request access to our developer slack channel, you can complete the form here on tessituranetwork.com:
https://www.tessituranetwork.com/devs
Slack is free to download and use if you have access to a channel. Once you submit the form, you'll receive an email at the address you indicate that will walk you through it.
Thanks
Chris