Commit 7dd0fef9 authored by Simon's avatar Simon

release 1.14.0 fix

parent a68ee308
...@@ -64,7 +64,7 @@ if ( ! defined( 'WPINC' ) ) die; ...@@ -64,7 +64,7 @@ if ( ! defined( 'WPINC' ) ) die;
<div class="c-form--row"> <div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro-contacts'); ?></label> <label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>"> <div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error' || !$nameValue): ?> autofocus="autofocus" <?php endif; ?>> <input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error' || !$nameValue && $_SESSION['position--s'] === 2): ?> autofocus="autofocus" <?php endif; ?>>
</div> </div>
<?php if ($nameMessage): ?> <?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>"> <div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
?> ?>
<script src="/wp-content/themes/biuro/js/main-34d6e5f2.min.js" async defer></script> <script src="/wp-content/themes/biuro/js/main-40a0e7ff.min.js" async defer></script>
<script src="/wp-content/themes/biuro/js/vendor/modernizr-custom.js" async defer></script> <script src="/wp-content/themes/biuro/js/vendor/modernizr-custom.js" async defer></script>
......
...@@ -17,7 +17,11 @@ const execute = (node, action) => { ...@@ -17,7 +17,11 @@ const execute = (node, action) => {
} }
}; };
export default async function inititateRecaptcha (node) { const inititate = (node) => {
if (intervalID) {
return;
}
const action = node.dataset.action || ''; const action = node.dataset.action || '';
loadJS('https://www.google.com/recaptcha/api.js?render=' + key).then(() => { loadJS('https://www.google.com/recaptcha/api.js?render=' + key).then(() => {
...@@ -30,3 +34,25 @@ export default async function inititateRecaptcha (node) { ...@@ -30,3 +34,25 @@ export default async function inititateRecaptcha (node) {
}); });
}); });
}; };
export default async function inititateRecaptcha (node) {
if ('IntersectionObserver' in window) {
const form = node.closest('form');
const io = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
inititate(node);
io.unobserve(entry.target);
}
});
}, {});
io.observe(form);
} else if (window.requestIdleCallback) {
window.requestIdleCallback(() => { inititate(node); });
} else {
inititate(node);
}
};
This diff is collapsed.
This diff is collapsed.
...@@ -388,11 +388,5 @@ if (document.getElementById('popup') && (!window.sessionStorage || !window.sessi ...@@ -388,11 +388,5 @@ if (document.getElementById('popup') && (!window.sessionStorage || !window.sessi
const recaptcha = document.getElementById('g-recaptcha-response'); const recaptcha = document.getElementById('g-recaptcha-response');
if (recaptcha) { if (recaptcha) {
if (window.requestIdleCallback) { inititateRecaptcha(recaptcha);
window.requestIdleCallback(() => {
inititateRecaptcha(recaptcha);
});
} else {
inititateRecaptcha(recaptcha);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment