2022-05-27 10:11:40 +03:00
|
|
|
!function(){"use strict";var u=window.location,d=window.document,w=d.currentScript,f=w.getAttribute("data-api")||new URL(w.src).origin+"/api/event";function g(t){console.warn("Ignoring Event: "+t)}function t(t,e){if(!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)){try{if("true"===window.localStorage.plausible_ignore)return g("localStorage flag")}catch(t){}var i=w&&w.getAttribute("data-include"),a=w&&w.getAttribute("data-exclude");if("pageview"===t){var n=!i||i&&i.split(",").some(c),r=a&&a.split(",").some(c);if(!n||r)return g("exclusion rule")}var p={};p.n=t,p.u=u.href,p.d=w.getAttribute("data-domain"),p.r=d.referrer||null,p.w=window.innerWidth,e&&e.meta&&(p.m=JSON.stringify(e.meta)),e&&e.props&&(p.p=e.props);var o=w.getAttributeNames().filter(function(t){return"event-"===t.substring(0,6)}),s=p.p||{};o.forEach(function(t){var e=t.replace("event-",""),i=w.getAttribute(t);s[e]=s[e]||i}),p.p=s;var l=new XMLHttpRequest;l.open("POST",f,!0),l.setRequestHeader("Content-Type","text/plain"),l.send(JSON.stringify(p)),l.onreadystatechange=function(){4===l.readyState&&e&&e.callback&&e.callback()}}function c(t){return u.pathname.match(new RegExp("^"+t.trim().replace(/\*\*/g,".*").replace(/([^\.])\*/g,"$1[^\\s/]*")+"/?$"))}}var e=["pdf","xlsx","docx","txt","rtf","csv","exe","key","pps","ppt","pptx","7z","pkg","rar","gz","zip","avi","mov","mp4","mpeg","wmv","midi","mp3","wav","wma"],i=w.getAttribute("file-types"),a=w.getAttribute("add-file-types"),p=i&&i.split(",")||a&&a.split(",").concat(e)||e;function n(t){for(var e=t.target,i="auxclick"===t.type&&2===t.which,a="click"===t.type;e&&(void 0===e.tagName||"a"!==e.tagName.toLowerCase()||!e.href);)e=e.parentNode;var n,r=e&&e.href&&e.href.split("?")[0];r&&(n=r.split(".").pop(),p.some(function(t){return t===n}))&&((i||a)&&plausible("File Download",{props:{url:r}}),e.target&&!e.target.match(/^_(self|parent|top)$/i)||t.ctrlKey||t.metaKey||t.shiftKey||!a||(setTimeout(function(){u.href=e.href},150),t.preventDefault()))}d.addEventListener("click",n),d.addEventListener("auxclick",n);var r=window.plausible&&window.plausible.q||[];window.plausible=t;for(var o,s=0;s<r.length;s++)t.apply(this,r[s]);function l(){o!==u.pathname&&(o=u.pathname,t("pageview"))}var c,v=window.history;v.pushState&&(c=v.pushState,v.pushState=function(){c.apply(this,arguments),l()},window.addEventListener("popstate",l)),"prerender"===d.visibilityState?d.addEventListener("visibilitychange",function(){o||"visible"!==d.visibilityState||l()}):l()}();
|