1/*! third-party-defer.js 2Loads the Mailchimp validator *after* page load. 3You control per-page disabling with your existing PHP flags: 4$disableMailchimp, 5(they get emitted as <meta> tags by meta-links.inc) 6 7Edit defaults here if you ever need to: 8*/ 9(function () { 10if (window.__TP3P_LOADED__) return; 11window.__TP3P_LOADED__ = true; 12 13// ---- Defaults you rarely change ---- 14var DELAY_MS = 1200; // Wait this long *after* window.onload before loading 15 16// ---- Read <meta> flags that PHP emits (no template fluff needed) ---- 17function hasMeta(name) { 18 return !!document.querySelector('meta[name="' + name + '"]'); 19} 20var DISABLE_MAILCHIMP = hasMeta('tp3p:disable-mailchimp'); 21 22// Helpers 23function afterLoad(fn) { 24 if (document.readyState === 'complete') fn(); 25 else window.addEventListener('load', fn, { once: true }); 26} 27function afterIdle(fn) { 28 if ('requestIdleCallback' in window) { 29 window.requestIdleCallback(fn, { timeout: 5000 }); 30 } else { 31 setTimeout(fn, 1500); 32 } 33} 34function loadScript(src, attrs, onload) { 35 var s = document.createElement('script'); 36 s.src = src; 37 if (attrs) for (var k in attrs) s.setAttribute(k, attrs[k] === true ? '' : String(attrs[k])); 38 if (onload) s.onload = onload; 39 document.head.appendChild(s); 40 return s; 41} 42 43afterLoad(function () { 44 setTimeout(function () { 45 afterIdle(function () { 46 // Mailchimp validator (lightweight; only load if disabled AND a Mailchimp-ish form exists) 47 if (!DISABLE_MAILCHIMP) { 48 var hasMC = document.querySelector('form[action*="list-manage.com"], .mc-field-group, #mc_embed_signup'); 49 if (hasMC && !window.__MC_VALIDATOR_LOADED__) { 50 window.__MC_VALIDATOR_LOADED__ = true; 51 loadScript('https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js', { async: true }, function () { 52 try { 53 (function($) { 54 window.fnames = []; window.ftypes = []; 55 fnames[1]='FNAME'; ftypes[1]='text'; 56 fnames[0]='EMAIL'; ftypes[0]='email'; 57 fnames[4]='PHONE'; ftypes[4]='phone'; 58 fnames[2]='LNAME'; ftypes[2]='text'; 59 fnames[3]='ADDRESS';ftypes[3]='address'; 60 fnames[5]='COMPANY';ftypes[5]='text'; 61 fnames[6]='BIRTHDAY';ftypes[6]='text'; 62 }(window.jQuery)); 63 window.$mcj = window.jQuery && window.jQuery.noConflict ? window.jQuery.noConflict(true) : undefined; 64 } catch (e) { /* fine if no jQuery or no MC markup */ } 65 }); 66 } 67 } 68 69 }); 70 }, Math.max(0, DELAY_MS || 0)); 71}); 72})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.