PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Partial/forms/popup.php +182 -89 10.1.4 → 11.1.0 View file →
@@ -1,31 +1,42 @@
1 1 <?php
2 -$hideForScroll = '';
3 -if (!$edition && isset($form->settings['display']['scroll']) && $form->settings['display']['scroll'] != 0) {
4 - $hideForScroll = 'style="display: none;"';
5 -}
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals.
3 +defined('ABSPATH') || die('Restricted Access');
6 4 ?>
7 -<div id="acym_fulldiv_<?php echo $form->form_tag_name; ?>"
8 - class="acym__subscription__form__popup__overlay acym__subscription__form-erase"
9 - <?php echo $hideForScroll; ?>>
5 +<div id="acym_fulldiv_<?php echo esc_attr($form->form_tag_name); ?>"
6 + class="acym__subscription__form__popup__overlay acym__subscription__form-erase"
7 + role="dialog"
8 + aria-modal="true"
9 + aria-label="<?php echo esc_attr(acym_translation('ACYM_SUBSCRIPTION')); ?>"
10 + <?php
11 + if (!$edition && isset($form->settings['display']['scroll']) && $form->settings['display']['scroll'] != 0) {
12 + echo 'style="display: none;"';
13 + }
14 + ?>>
10 15 <div class="acym__subscription__form__popup">
11 - <div class="acym__subscription__form__popup__close acymicon-close"></div>
16 + <button type="button" class="acym__subscription__form__popup__close acymicon-close" aria-label="<?php echo esc_attr(acym_translation('ACYM_CLOSE')); ?>"></button>
12 17 <?php
13 18 if ($edition) {
14 - echo '<form action="#" onsubmit="return false;" id="'.$form->form_tag_name.'">';
19 + echo '<form action="#" onsubmit="return false;" id="'.esc_attr($form->form_tag_name).'">';
15 20 } else {
16 21 $isButton = $form->settings['display']['display_action'] === 'yes';
17 22 if ($isButton) {
18 - $cookieExpirationAttr = 'acym-data-cookie="0"';
23 + $cookieExpiration = '0';
19 24 } else {
20 - $cookieExpirationAttr = empty($form->settings['cookie']['cookie_expiration']) ? 'acym-data-cookie="1"'
21 - : 'acym-data-cookie="'.$form->settings['cookie']['cookie_expiration'].'"';
25 + $cookieExpiration = empty($form->settings['cookie']['cookie_expiration']) ? '1' : $form->settings['cookie']['cookie_expiration'];
22 26 }
23 - echo '<form acym-data-id="'.$form->id.'" '.$cookieExpirationAttr.' action="'.$form->form_tag_action.'" id="'.$form->form_tag_name.'" name="'.$form->form_tag_name.'" enctype="multipart/form-data" onsubmit="return submitAcymForm(\'subscribe\',\''.$form->form_tag_name.'\', \'acymSubmitSubForm\')">';
27 + echo '<form acym-data-id="'.esc_attr($form->id).'"
28 + acym-data-cookie="'.intval($cookieExpiration).'"
29 + action="'.esc_url($form->form_tag_action).'"
30 + id="'.esc_attr($form->form_tag_name).'"
31 + name="'.esc_attr($form->form_tag_name).'"
32 + aria-label="'.esc_attr(acym_translation('ACYM_SUBSCRIPTION')).'"
33 + enctype="multipart/form-data"
34 + onsubmit="return submitAcymForm(\'subscribe\',\''.esc_attr($form->form_tag_name).'\', \'acymSubmitSubForm\')">';
24 35 }
25 36 if (in_array($form->settings['style']['position'], ['image-top', 'image-left'])) {
26 37 if (!empty($form->settings['message']['text']) && $form->settings['message']['position'] === 'before-image') {
27 - echo '<p id="acym__subscription__form__popup-text">'.nl2br(acym_translation($form->settings['message']['text'])).'</p>';
38 + echo '<p id="acym__subscription__form__popup-text">'.nl2br(esc_html(acym_translation($form->settings['message']['text']))).'</p>';
28 39 }
29 40 include acym_getPartial('forms', 'image');
30 41 }
31 42 echo '<div class="acym__subscription__form__popup__fields-button">';
@@ -30,26 +41,41 @@
30 41 }
31 42 echo '<div class="acym__subscription__form__popup__fields-button">';
32 43 include acym_getPartial('forms', 'fields');
33 44 if (!empty($form->settings['message']['text']) && $form->settings['message']['position'] == 'before-button') {
34 - echo '<p id="acym__subscription__form__popup-text">'.nl2br(acym_translation($form->settings['message']['text'])).'</p>';
45 + echo '<p id="acym__subscription__form__popup-text">'.nl2br(esc_html(acym_translation($form->settings['message']['text']))).'</p>';
35 46 }
36 47 include acym_getPartial('forms', 'button');
37 48 echo '</div>';
38 49 if (in_array($form->settings['style']['position'], ['image-bottom', 'image-right'])) {
39 50 if (!empty($form->settings['message']['text']) && $form->settings['message']['position'] == 'before-image') {
40 - echo '<p id="acym__subscription__form__popup-text">'.nl2br(acym_translation($form->settings['message']['text'])).'</p>';
51 + echo '<p id="acym__subscription__form__popup-text">'.nl2br(esc_html(acym_translation($form->settings['message']['text']))).'</p>';
41 52 }
42 53 include acym_getPartial('forms', 'image');
43 54 }
44 55 include acym_getPartial('forms', 'hidden_params');
56 + echo '</form>';
45 57 ?>
46 - </form>
47 58 </div>
48 59 </div>
60 +<?php
61 +$popupPosition = $form->settings['display']['popup_position'] ?? 'center';
62 +$positionMap = [
63 + 'top_left' => 'top: 20px; left: 20px;',
64 + 'top_center' => 'top: 20px; left: 50%; transform: translateX(-50%);',
65 + 'top_right' => 'top: 20px; right: 20px;',
66 + 'middle_left' => 'top: 50%; left: 20px; transform: translateY(-50%);',
67 + 'middle_right' => 'top: 50%; right: 20px; transform: translateY(-50%);',
68 + 'bottom_left' => 'bottom: 20px; left: 20px;',
69 + 'bottom_center' => 'bottom: 20px; left: 50%; transform: translateX(-50%);',
70 + 'bottom_right' => 'bottom: 20px; right: 20px;',
71 +];
72 +$positionCss = $positionMap[$popupPosition] ?? 'top: 50%; left: 50%; transform: translate(-50%, -50%);';
73 +?>
49 74 <style>
50 - <?php echo '#acym_fulldiv_'.$form->form_tag_name; ?>.acym__subscription__form__popup__overlay{
51 - display: <?php echo $edition ? 'inline' : 'none';?>;
75 + #acym_fulldiv_<?php echo esc_html($form->form_tag_name); ?>.acym__subscription__form__popup__overlay{
76 + display: <?php echo $edition ? 'inline' : 'none'; ?>;
77 + <?php if ($popupPosition === 'center') { ?>
52 78 position: fixed;
53 79 top: 0;
54 80 bottom: 0;
55 81 right: 0;
@@ -54,12 +80,14 @@
54 80 bottom: 0;
55 81 right: 0;
56 82 left: 0;
57 83 background-color: rgba(200, 200, 200, .5);
58 - z-index: 999999;
84 + <?php } else { ?>
85 + position: static;
86 + <?php } ?> z-index: 999999;
59 87 }
60 88
61 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup__close{
89 + #acym_fulldiv_<?php echo esc_html($form->form_tag_name); ?> .acym__subscription__form__popup__close{
62 90 position: absolute;
63 91 top: 10px;
64 92 right: 10px;
65 93 font-weight: bold;
@@ -64,22 +92,26 @@
64 92 right: 10px;
65 93 font-weight: bold;
66 94 font-size: 1rem;
67 95 cursor: pointer;
96 + background: none;
97 + border: none;
98 + padding: 0;
99 + line-height: 1;
100 + color: inherit;
68 101 }
69 102
70 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup{
103 + #acym_fulldiv_<?php echo esc_html($form->form_tag_name); ?> .acym__subscription__form__popup{
71 104 position: fixed;
72 - left: 50%;
73 - transform: translate(-50%, -50%);
74 - top: 50%;
75 - padding: <?php echo $form->settings['style']['padding']['height'];?>px <?php echo $form->settings['style']['padding']['width'];?>px;
76 - background-color: <?php echo $form->settings['style']['background_color'];?>;
77 - color: <?php echo $form->settings['style']['text_color'];?> !important;
78 - background-image: url("<?php echo $form->settings['style']['background_image']; ?>");
79 - background-size: <?php echo $form->settings['style']['background_size']; ?>;
80 - background-position: <?php echo str_replace('_', ' ', $form->settings['style']['background_position']); ?>;
81 - background-repeat: <?php echo $form->settings['style']['background_repeat']; ?>;
105 + <?php echo esc_html($positionCss); ?> padding: <?php echo esc_html($form->settings['style']['padding']['height']); ?>px <?php echo esc_html($form->settings['style']['padding']['width']); ?>px;
106 + background-color: <?php echo esc_html($form->settings['style']['background_color']); ?>;
107 + color: <?php echo esc_html($form->settings['style']['text_color']); ?> !important;
108 + background-image: url("<?php echo esc_url($form->settings['style']['background_image']); ?>");
109 + background-size: <?php echo esc_html($form->settings['style']['background_size']); ?>;
110 + background-position: <?php echo esc_html(str_replace('_', ' ', $form->settings['style']['background_position'])); ?>;
111 + background-repeat: <?php echo esc_html($form->settings['style']['background_repeat']); ?>;
112 + border-radius: <?php echo intval($form->settings['style']['border_radius'] ?? 0); ?>px;
113 + box-shadow: <?php echo intval($form->settings['style']['shadow_x'] ?? 0); ?>px <?php echo intval($form->settings['style']['shadow_y'] ?? 0); ?>px <?php echo intval($form->settings['style']['shadow_blur'] ?? 0); ?>px<?php echo esc_html($form->settings['style']['shadow_color'] ?? 'rgba(0,0,0,0.2)'); ?>;
82 114 z-index: 999999;
83 115 text-align: center;
84 116 display: flex;
85 117 justify-content: center;
@@ -85,75 +117,75 @@
85 117 justify-content: center;
86 118 align-items: center;
87 119 }
88 120
89 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .responseContainer{
121 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .responseContainer{
90 122 margin-bottom: 0 !important;
91 123 padding: .4rem !important;
92 124 }
93 125
94 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup <?php echo '#'.$form->form_tag_name;?>{
126 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup <?php echo '#'.esc_html($form->form_tag_name); ?>{
95 127 margin: 0;
96 128 }
97 129
98 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields, <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__button{
130 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields, <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__button{
99 131 display: block;
100 132 width: 100%;
101 133 margin: 1rem 0 !important;
102 134 }
103 135
104 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input:not([type="radio"]):not([type="checkbox"]), <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields label{
136 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input:not([type="radio"]):not([type="checkbox"]), <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields label{
105 137 display: block;
106 138 }
107 139
108 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input[type="radio"], <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input[type="checkbox"]{
140 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input[type="radio"], <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields input[type="checkbox"]{
109 141 margin-left: 5px;
110 142 }
111 143
112 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields .acym__subscription__form__lists{
144 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields .acym__subscription__form__lists{
113 145 display: block;
114 146 width: 100%;
115 147 margin: 1rem 10px !important;
116 148 }
117 149
118 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields .acym__user__edit__email{
150 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup .acym__subscription__form__fields .acym__user__edit__email{
119 151 margin: auto;
120 152 }
121 153
122 - <?php if(!empty($form->settings['message']['color'])) { ?>
123 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>#acym__subscription__form__popup-text{
124 - color: <?php echo $form->settings['message']['color']; ?>;
154 + <?php if (!empty($form->settings['message']['color'])) { ?>
155 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>#acym__subscription__form__popup-text{
156 + color: <?php echo esc_html($form->settings['message']['color']); ?>;
125 157 }
126 158
127 159 <?php } ?>
128 160
129 - <?php if (in_array($form->settings['style']['position'], ['image-right', 'image-left'])){?>
130 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup <?php echo '#'.$form->form_tag_name;?>{
161 + <?php if (in_array($form->settings['style']['position'], ['image-right', 'image-left'])) { ?>
162 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup <?php echo '#'.esc_html($form->form_tag_name); ?>{
131 163 display: flex;
132 164 justify-content: center;
133 165 align-items: center
134 166 }
135 167
136 - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__popup__fields-button, <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__image{
168 + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__popup__fields-button, <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__image{
137 169 display: inline-block;
138 170 }
139 171
140 - <?php }?>
172 + <?php } ?>
141 173
142 174 </style>
143 175 <?php if (!$edition) { ?>
144 176 <script type="text/javascript">
145 - const acymBackupFormTimeout<?php echo $form->form_tag_name; ?> = setTimeout(() => {
146 - acym_initPopupDisplay<?php echo $form->form_tag_name; ?>(true);
177 + const acymBackupFormTimeout<?php echo esc_html($form->form_tag_name); ?> = setTimeout(() => {
178 + acym_initPopupDisplay<?php echo esc_html($form->form_tag_name); ?>(true);
147 179 }, 1000);
148 180
149 181 window.addEventListener('DOMContentLoaded', function () {
150 - clearTimeout(acymBackupFormTimeout<?php echo $form->form_tag_name; ?>);
151 - acym_initPopupDisplay<?php echo $form->form_tag_name; ?>();
182 + clearTimeout(acymBackupFormTimeout<?php echo esc_html($form->form_tag_name); ?>);
183 + acym_initPopupDisplay<?php echo esc_html($form->form_tag_name); ?>();
152 184 });
153 185
154 - function acym_initPopupDisplay<?php echo $form->form_tag_name; ?>(addedDelayForBackup = false) {
155 - const acym_popupForm = document.querySelector('#acym_fulldiv_<?php echo $form->form_tag_name; ?>.acym__subscription__form__popup__overlay');
186 + function acym_initPopupDisplay<?php echo esc_html($form->form_tag_name); ?>(addedDelayForBackup = false) {
187 + const acym_popupForm = document.querySelector('#acym_fulldiv_<?php echo esc_html($form->form_tag_name); ?>.acym__subscription__form__popup__overlay');
156 188
157 189 if (!acym_popupForm) {
158 190 return;
159 191 }
@@ -158,12 +190,62 @@
158 190 return;
159 191 }
160 192
161 193 const isDisplayButton = <?php echo $isButton ? 'true' : 'false'; ?>;
194 + let acymLastFocusedElement = null;
162 195
163 - function acym_closePopupform<?php echo $form->form_tag_name;?>(element) {
196 + function acymGetFocusableElements() {
197 + return acym_popupForm.querySelectorAll(
198 + 'button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])'
199 + );
200 + }
201 +
202 + function acymPopupKeydown(event) {
203 + if (event.key === 'Escape' || event.key === 'Esc') {
204 + acym_closePopupform<?php echo esc_html($form->form_tag_name); ?>(acym_popupForm);
205 + return;
206 + }
207 +
208 + if (event.key !== 'Tab') {
209 + return;
210 + }
211 +
212 + const focusable = acymGetFocusableElements();
213 + if (focusable.length === 0) {
214 + return;
215 + }
216 +
217 + const first = focusable[0];
218 + const last = focusable[focusable.length - 1];
219 +
220 + if (event.shiftKey && document.activeElement === first) {
221 + event.preventDefault();
222 + last.focus();
223 + } else if (!event.shiftKey && document.activeElement === last) {
224 + event.preventDefault();
225 + first.focus();
226 + }
227 + }
228 +
229 + function acym_openPopupform<?php echo esc_html($form->form_tag_name); ?>() {
230 + acymLastFocusedElement = document.activeElement;
231 + acym_popupForm.style.display = 'inline';
232 + acym_popupForm.addEventListener('keydown', acymPopupKeydown);
233 +
234 + const focusable = acymGetFocusableElements();
235 + if (focusable.length > 0) {
236 + focusable[0].focus();
237 + }
238 + }
239 +
240 + function acym_closePopupform<?php echo esc_html($form->form_tag_name); ?>(element) {
164 241 element.style.display = 'none';
242 + acym_popupForm.removeEventListener('keydown', acymPopupKeydown);
165 243
244 + if (acymLastFocusedElement && typeof acymLastFocusedElement.focus === 'function') {
245 + acymLastFocusedElement.focus();
246 + }
247 +
166 248 if (isDisplayButton) {
167 249 return;
168 250 }
169 251
@@ -168,20 +250,23 @@
168 250 }
169 251
170 252 let expirationDate = new Date();
171 253 expirationDate.setDate(expirationDate.getDate() + <?php echo empty($form->settings['cookie']['cookie_expiration']) ? 1
172 - : $form->settings['cookie']['cookie_expiration'];?>);
173 - document.cookie = 'acym_form_<?php echo $form->id; ?>=' + Date.now() + ';expires=' + expirationDate.toUTCString() + ';path=/';
254 + : intval($form->settings['cookie']['cookie_expiration']); ?>);
255 + document.cookie = 'acym_form_<?php echo esc_html($form->id); ?>=' + Date.now() + ';expires=' + expirationDate.toUTCString() + ';path=/';
174 256 }
175 257
258 + <?php if ($popupPosition === 'center') { ?>
176 259 acym_popupForm.addEventListener('click', function (event) {
177 260 if (event.target.closest('.acym__subscription__form__popup') === null) {
178 - acym_closePopupform<?php echo $form->form_tag_name; ?>(this);
261 + acym_closePopupform<?php echo esc_html($form->form_tag_name); ?>(this);
179 262 }
180 263 });
181 - document.querySelector('#acym_fulldiv_<?php echo $form->form_tag_name; ?> .acym__subscription__form__popup__close').addEventListener('click', function (event) {
182 - acym_closePopupform<?php echo $form->form_tag_name; ?>(event.target.closest('.acym__subscription__form__popup__overlay'));
183 - });
264 + <?php } ?>
265 + document.querySelector('#acym_fulldiv_<?php echo esc_html($form->form_tag_name); ?> .acym__subscription__form__popup__close')
266 + .addEventListener('click', function (event) {
267 + acym_closePopupform<?php echo esc_html($form->form_tag_name); ?>(event.target.closest('.acym__subscription__form__popup__overlay'));
268 + });
184 269
185 270 if (isDisplayButton) {
186 271 displayByButton();
187 272 } else {
@@ -188,29 +273,31 @@
188 273 displayByDelayAndScroll();
189 274 }
190 275
191 276 function displayByButton() {
192 - const button = document.querySelector('#<?php echo $form->settings['display']['button'];?>');
277 + const button = document.querySelector('#<?php echo esc_html($form->settings['display']['button']); ?>');
193 278
194 279 if (!button) {
195 - console.error('Could not find the button with the ID <?php echo $form->settings['display']['button'];?>');
280 + console.error('Could not find the button with the ID <?php echo esc_html($form->settings['display']['button']); ?>');
196 281 return;
197 282 }
198 283
199 284 button.addEventListener('click', function () {
200 - acym_popupForm.style.display = 'inline';
285 + acym_openPopupform<?php echo esc_html($form->form_tag_name); ?>();
201 286 });
202 287 }
203 288
204 289 function displayByDelayAndScroll() {
205 - const delayDisplay = parseInt(<?php echo $form->settings['display']['delay']; ?>);
206 - const scrollPercentLimit = parseInt(<?php echo $form->settings['display']['scroll']; ?>);
290 + const delayDisplay = parseInt(<?php echo esc_html($form->settings['display']['delay']); ?>);
291 + const scrollPercentLimit = parseInt(<?php echo esc_html($form->settings['display']['scroll']); ?>);
207 292 let windowSize;
208 293 let browserHeight;
209 294 let delayRemaining = false;
295 +
210 296 if (delayDisplay > 0) {
211 297 delayRemaining = true;
212 298 }
299 +
213 300 let scrollRemaining = false;
214 301 if (scrollPercentLimit > 0) {
215 302 scrollRemaining = true;
216 303 }
@@ -216,41 +303,47 @@
216 303 }
217 304
218 305 windowSize = document.getElementsByTagName('body')[0].clientHeight;
219 306 browserHeight = document.documentElement.clientHeight;
220 - if (windowSize <= browserHeight && !delayRemaining) {
307 +
308 + if (!delayRemaining && (
309 + windowSize <= browserHeight || !scrollRemaining
310 + )) {
221 311 scrollRemaining = false;
222 - acym_popupForm.style.display = 'inline';
223 - }
224 -
225 - function displayAcymPopupForm() {
226 - let scrollPercent = Math.round((window.scrollY) / (windowSize - browserHeight) * 100);
227 - if (scrollPercent >= scrollPercentLimit) {
228 - scrollRemaining = false;
229 - window.removeEventListener('scroll', displayAcymPopupForm);
230 - if (!delayRemaining) {
231 - if (acym_popupForm) {
232 - acym_popupForm.style.display = 'inline';
312 + acym_openPopupform<?php echo esc_html($form->form_tag_name); ?>();
313 + } else {
314 + function displayAcymPopupForm() {
315 + let scrollPercent = Math.round((
316 + window.scrollY
317 + ) / (
318 + windowSize - browserHeight
319 + ) * 100);
320 + if (scrollPercent >= scrollPercentLimit) {
321 + scrollRemaining = false;
322 + window.removeEventListener('scroll', displayAcymPopupForm);
323 + if (!delayRemaining && acym_popupForm) {
324 + acym_openPopupform<?php echo esc_html($form->form_tag_name); ?>();
233 325 }
234 326 }
235 327 }
236 - }
237 328
238 - window.addEventListener('scroll', displayAcymPopupForm);
329 + window.addEventListener('scroll', displayAcymPopupForm);
239 330
240 - let delayInMs = delayDisplay * 1000;
241 - if (addedDelayForBackup && delayDisplay > 1000) {
242 - delayInMs -= 1000;
243 - }
331 + let delayInMs = delayDisplay * 1000;
332 + if (addedDelayForBackup && delayDisplay > 1000) {
333 + delayInMs -= 1000;
334 + }
244 335
245 - setTimeout(function () {
246 - if (acym_popupForm !== null) {
247 - delayRemaining = false;
248 - if (!scrollRemaining) {
249 - acym_popupForm.style.display = 'inline';
336 + setTimeout(function () {
337 + if (acym_popupForm !== null) {
338 + delayRemaining = false;
339 + if (!scrollRemaining) {
340 + acym_openPopupform<?php echo esc_html($form->form_tag_name); ?>();
341 + window.removeEventListener('scroll', displayAcymPopupForm);
342 + }
250 343 }
251 - }
252 - }, delayInMs);
344 + }, delayInMs);
345 + }
253 346 }
254 347 }
255 348 </script>
256 349 <?php