PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.9
Boxzilla – WordPress Popup Builder v3.1.9
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | assets/browserify/script.js +18 -4 3.1.183.1.9 View file →
@@ -6,8 +6,16 @@
6 6
7 7 // expose Boxzilla object to window
8 8 window.Boxzilla = Boxzilla;
9 9
10 + function ready(fn) {
11 + if (document.readyState != 'loading'){
12 + fn();
13 + } else {
14 + document.addEventListener('DOMContentLoaded', fn);
15 + }
16 + }
17 +
10 18 // helper function for setting CSS styles
11 19 function css(element, styles) {
12 20 if( styles.background_color ) {
13 21 element.style.background = styles.background_color;
@@ -75,9 +83,15 @@
75 83 box.element.firstChild.firstChild.className += " first-child";
76 84 box.element.firstChild.lastChild.className += " last-child";
77 85 }
78 86
79 - // set flag to prevent initialising twice
87 + /**
88 + * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
89 + *
90 + * TODO: Just set location hash from MailChimp for WP?
91 + */
92 + window.addEventListener('load', openMailChimpForWordPressBox);
93 +
80 94 options.inited = true;
81 95
82 96 // trigger "done" event.
83 97 Boxzilla.trigger('done');
@@ -97,7 +111,7 @@
97 111 }
98 112 }
99 113 }
100 114
101 - window.addEventListener('load', openMailChimpForWordPressBox);
102 - createBoxesFromConfig();
103 -})();
115 + // create boxes as soon as document.ready fires
116 + ready(createBoxesFromConfig);
117 +})();