PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.5.7
Post Views Counter v1.5.7
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.min.js
post-views-counter / js Last commit date
admin-dashboard.js 8 months ago admin-post.js 5 years ago admin-quick-edit.js 8 months ago admin-settings.js 8 months ago admin-widgets.js 5 years ago block-editor.min.js 8 months ago counter.js 8 months ago counter.min.js 8 months ago dummy.js 8 months ago frontend.js 8 months ago frontend.min.js 8 months ago
frontend.min.js
1 lines
1 var initPostViewsCounter=function(){(PostViewsCounter={promise:null,args:{},init:function(e){this.args=e;var t={};t.storage_type="cookies",t.storage_data=this.readCookieData("pvc_visits"+(!1!==e.multisite?"_"+parseInt(e.multisite):"")),"rest_api"===e.mode?this.promise=this.request(e.requestURL,t,"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8","X-WP-Nonce":e.nonce}):(t.action="pvc-check-post",t.pvc_nonce=e.nonce,t.id=e.postID,this.promise=this.request(e.requestURL,t,"POST",{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"}))},request:function(e,t,o,i){var n={method:o,mode:"cors",cache:"no-cache",credentials:"same-origin",headers:i,body:this.prepareRequestData(t)},a=this;return fetch(e,n).then(function(e){if(!e.ok)throw Error(e.statusText);return e.json()}).then(function(e){try{"object"==typeof 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(t){console.log("PVC: Invalid JSON data."),console.log(t)}}).catch(function(e){console.log("PVC: Invalid response."),console.log(e)})},prepareRequestData:function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&").replace(/%20/g,"+")},triggerEvent:function(e,t){var o=new CustomEvent(e,{bubbles:!0,detail:t});document.dispatchEvent(o)},saveCookieData:function(e){if(e.hasOwnProperty("name")){var t="";"https:"===document.location.protocol&&(t=";secure");for(var o=0;o<e.name.length;o++){var i=new Date,n=parseInt(e.expiry[o]);n?n*=1e3:n=i.getTime()+864e5,i.setTime(n),document.cookie=e.name[o]+"="+e.value[o]+";expires="+i.toUTCString()+";path=/"+("/"===this.args.path?"":this.args.path)+";domain="+this.args.domain+t+";SameSite=Lax"}}},readCookieData:function(e){var t=[];return document.cookie.split(";").forEach(function(o){var i=o.split("="),n=i[0],a=i[1],r=n.trim();RegExp(e+"\\[\\d+\\]").test(r)&&t.push(a)}),t.join("a")}}).init(pvcArgsFrontend)};document.addEventListener("DOMContentLoaded",initPostViewsCounter);