File Editor
Directories:
.. (Back)
Files:
wordads-ccpa.min.asset.php
wordads-ccpa.min.js
Create New File
Create
Edit File: wordads-ccpa.min.js
!function(){var e=function(e){return e&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},t=function(e,t,o,n,a,c){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var i="";if(o)switch(o.constructor){case Number:i=o===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+o;break;case String:i="; expires="+o;break;case Date:i="; expires="+o.toUTCString()}return"rootDomain"!==a&&".rootDomain"!==a||(a=(".rootDomain"===a?".":"")+document.location.hostname.split(".").slice(-2).join(".")),document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+i+(a?"; domain="+a:"")+(n?"; path="+n:"")+(c?"; secure":""),!0};window.__uspapi=function(t,o,n){if("function"==typeof n)if("getUSPData"===t&&1===o)if(navigator.globalPrivacyControl)n({version:1,uspString:"1YYN"},!0);else{var a=e("usprivacy");null!==a?n({version:1,uspString:a},!0):n(null,!1)}else n(null,!1)};var o=function(e){var o=".wordpress.com"===location.hostname.slice(-14)?".rootDomain":location.hostname;t("ccpa_applies",e,86400,"/",o)},n=function(){var e=document.querySelector("#ccpa-modal");e&&e.parentElement.removeChild(e)},a=function(){var t;n(),t=document.createElement("div"),document.body.insertBefore(t,document.body.firstElementChild),t.outerHTML='<div id="ccpa-loading" class="cleanslate ccpa__loading-wrapper"><div class="ccpa__loading-overlay"><span class="ccpa__loading-message">'+ccpaSettings.strings.pleaseWait+"...</span></div></div>";var o=new XMLHttpRequest;o.open("GET",ccpaSettings.ajaxUrl+"?action=privacy_optout_markup&security="+ccpaSettings.ajaxNonce,!0),o.onreadystatechange=function(){if(4===this.readyState&&200===this.status){document.getElementById("ccpa-loading").remove();var t=document.createElement("div");document.body.insertBefore(t,document.body.firstElementChild),t.outerHTML=this.response,document.getElementById("ccpa-opt-out").focus(),document.querySelector("#ccpa-modal .opt-out").addEventListener("click",(function(e){var t=new XMLHttpRequest;t.open("POST",ccpaSettings.ajaxUrl,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),t.onreadystatechange=function(){if(4===this.readyState&&200===this.status){var t=JSON.parse(this.response);t&&t.success&&(t.data?(e.target.parentNode.classList.add("is-checked"),e.target.parentNode.parentNode.classList.add("is-checked")):(e.target.parentNode.classList.remove("is-checked"),e.target.parentNode.parentNode.classList.remove("is-checked")))}},t.send("action=privacy_optout&optout="+e.target.checked+"&security="+ccpaSettings.ajaxNonce)}));var o=e("usprivacy"),a=o&&"Y"===o[2],c=document.querySelector("#ccpa-modal .opt-out");c.checked=a,a&&(c.parentNode.classList.add("is-checked"),c.parentNode.parentNode.classList.add("is-checked"));var i=document.querySelectorAll("#ccpa-modal .components-button");Array.prototype.forEach.call(i,(function(e){e.addEventListener("click",(function(){n()}))}))}},o.send()},c=function(e){var t=document.createEvent("CustomEvent");t.initCustomEvent("wordads-ccpa-initialized",!0,!1,{ccpaApplies:e}),document.dispatchEvent(t)},i=function(e,o){var n,i,s=document.querySelectorAll(".ccpa-do-not-sell");null===o&&(e?0===s.length?(n=ccpaSettings.defaultOptOutCookieString,i=".wordpress.com"===location.hostname.slice(-14)?".rootDomain":location.hostname,t("usprivacy",n,86400,"/",i)):function(){var e=ccpaSettings.defaultOptInCookieString,o=".wordpress.com"===location.hostname.slice(-14)?".rootDomain":location.hostname;t("usprivacy",e,31536e3,"/",o)}():function(){var e=".wordpress.com"===location.hostname.slice(-14)?".rootDomain":location.hostname;t("usprivacy","1---",86400,"/",e)}()),e||"false"!==ccpaSettings.forceApplies?(Array.prototype.forEach.call(s,(function(e){e.addEventListener("click",(function(e){if(e.preventDefault(),!ccpaSettings.stylesLoaded){var t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.href=ccpaSettings.ccpaCssUrl,document.getElementsByTagName("HEAD")[0].appendChild(t),ccpaSettings.stylesLoaded=!0}a()})),e.style.display=""})),c(!0)):c(!1)};document.addEventListener("DOMContentLoaded",(function(){var t=e("usprivacy");if(null===t){var n=e("ccpa_applies");if(null===n){var a=new XMLHttpRequest;a.open("GET","https://public-api.wordpress.com/geo/",!0),a.onreadystatechange=function(){if(4===this.readyState)if(200===this.status){var e=JSON.parse(this.response),t=e.region?e.region.toLowerCase():"",n=["california","colorado","connecticut","utah","virginia"].indexOf(t)>-1;o(n),i(n,null)}else o(!0),i(!0,null)},a.send()}else i("true"===n,null)}else i("1---"!==t,t)}))}();
Save Changes
Rename File
Rename