PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.7.4
Post Views Counter v1.7.4
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / js / frontend.js
post-views-counter / js Last commit date
admin-columns.js 5 months ago admin-dashboard.js 5 months ago admin-post.js 5 months ago admin-quick-edit.js 5 months ago admin-settings.js 5 months ago admin-theme.js 5 months ago admin-widgets.js 5 months ago block-editor.js 5 months ago counter.js 5 months ago dummy.js 5 months ago frontend.js 5 months ago integration-gutenberg.js 5 months ago
frontend.js
2 lines
1 function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}window.PostViewsCounter={promise:null,args:{},init:function(t){this.args=t;var e={storage_type:"cookies",storage_data:this.readCookieData("pvc_visits".concat(!1!==t.multisite?"_".concat(parseInt(t.multisite,10)):""))};"rest_api"===t.mode?this.promise=this.request(t.requestURL,e,"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8","X-WP-Nonce":t.nonce}):(e.action="pvc-check-post",e.pvc_nonce=t.nonce,e.id=t.postID,this.promise=this.request(t.requestURL,e,"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"}))},request:function(e,o,n,c){var a=this,r={method:n,mode:"cors",cache:"no-cache",credentials:"same-origin",headers:c,body:this.prepareRequestData(o)};return fetch(e,r).then(function(t){if(!t.ok)throw Error(t.statusText);return t.json()}).then(function(e){try{"object"===t(e)&&null!==e?"success"in e&&!1===e.success?(console.log("PVC: Request error."),console.log(e.data)):(a.saveCookieData(e.storage),a.triggerEvent("pvcCheckPost",e)):(console.log("PVC: Invalid object."),console.log(e))}catch(o){console.log("PVC: Invalid JSON data."),console.log(o)}}).catch(function(t){console.log("PVC: Invalid response."),console.log(t)})},prepareRequestData:function(t){return Object.keys(t).map(function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t[e]))}).join("&").replace(/%20/g,"+")},triggerEvent:function(t,e){var o=new CustomEvent(t,{bubbles:!0,detail:e});document.dispatchEvent(o)},saveCookieData:function(t){if(t&&Object.prototype.hasOwnProperty.call(t,"name")){var e="";"https:"===document.location.protocol&&(e=";secure");for(var o=0;o<t.name.length;o++){var n=new Date,c=parseInt(t.expiry[o],10);c?c*=1e3:c=n.getTime()+864e5,n.setTime(c),document.cookie="".concat(t.name[o],"=").concat(t.value[o],";expires=").concat(n.toUTCString(),";path=/").concat("/"===this.args.path?"":this.args.path,";domain=").concat(this.args.domain).concat(e,";SameSite=Lax")}}},readCookieData:function(t){var e=[];return document.cookie.split(";").forEach(function(o){if(o&&o.trim()){var n=o.split("="),c=n[0],a=n.slice(1).join("=");if(c){var r=c.trim();new RegExp("".concat(t,"\\[\\d+\\]")).test(r)&&e.push(a||"")}}}),e.join("a")}};var e=function(){return window.PostViewsCounter.init(pvcArgsFrontend)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e();
2