Suggestion to improve the Tradays website widget

My client uses the tradays widget on their website. Since it is a European company we are not allowed to set cookies when the visitor didn’t have their consent. The tradays tool also sets cookies so we can only show the widget then consent is given.

Currently the tool can only been initialized when the DOMContentLoaded or window load event is triggered. The consent of the user is given in a later stage of course. To check if the consent Is given we need to use javascript and initialize the widget with the “economicCalendarEvent” function. But when we do this after the DOMContentloaded or window load event was trigged nothing happens.

By adjusting the code of the tradays widget.js a bit it’s quite easy to make it work it work after those events where fired. Here is my suggestion (I unminified the widget.js). In the code these eventlistneers are there:

document.addEventListener("DOMContentLoaded", r, !1);
window.addEventListener("load", r, !1);

I’m suggesting the replace this by something like this:

if (document.readyState !== "complete") {
    document.addEventListener("DOMContentLoaded", r, !1);
    window.addEventListener("load", r, !1);
} else {

Hope you can implement some like this.


Hello! Thank you for contacting us. We have corrected the code.

Please use this version: