0byt3m1n1
Path:
/
var
/
www
/
clients
/
client38
/
web37
/
web
/
wp-content
/
plugins
/
post-views-counter
/
js
/
[
Home
]
File: frontend.min.js
document.addEventListener("DOMContentLoaded",function(){(PostViewsCounter={promise:null,init:function(e){"rest_api"===e.mode?this.promise=this.request(e.requestURL,{},"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8","X-WP-Nonce":e.nonce}):this.promise=this.request(e.requestURL,{action:"pvc-check-post",pvc_nonce:e.nonce,id:e.postID},"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"})},request:function(e,t,n,o){let i={method:n,mode:"cors",cache:"no-cache",credentials:"same-origin",headers:o,body:this.prepareData(t)},r=this;return fetch(e,i).then(function(e){if(!e.ok)throw Error(e.statusText);return e.json()}).then(function(e){try{"object"==typeof e&&null!==e&&r.triggerEvent("pvcCheckPost",e)}catch(t){console.log("Invalid JSON data"),console.log(t)}}).catch(function(e){console.log("Invalid response"),console.log(e)})},prepareData:function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&").replace(/%20/g,"+")},triggerEvent:function(e,t){let n=new CustomEvent(e,{bubbles:!0,detail:t});document.dispatchEvent(n)}}).init(pvcArgsFrontend)});