PageSourceSearch

https://www.astrill.com/javascript/astrill-choices.min.js?v=20260903b

js astrill.com collected 2026-10-01 11:36:49 UTC 14,207 bytes, 45 lines download raw bytes

1/*!
2 * Astrill cookie consent - v1  (file: astrill-choices.js - the obvious name
3 * cookie-consent.js gets dropped by browser-side filter lists before the
4 * request is made; keep the filename and DOM names free of cookie/consent/gdpr)
5 *
6 * One file, no dependencies, no network requests, no framework. Meant to be
7 * dropped unchanged into the main site (Smarty), the blog (WordPress) and the
8 * wiki (MediaWiki), which is why it injects its own CSS and does not assume
9 * jQuery or UIkit.
10 *
11 * The library never decides WHETHER to ask. That is the host page's call
12 * (on the main site the PHP gate knows the visitor's country; the blog and
13 * wiki only ever reopen the panel from the footer link). The host tells it
14 * what to do through init():
15 *
16 *   AstrillConsent.init({
17 *     mode:     'ask' | 'manual',   // 'ask' shows the bar on load when there is no choice yet
18 *                                   // (there is no cookie-domain option: see writeCookie)
19 *     whyUrl:   '/cookies',
20 *     strings:  { ... },            // override any of the English defaults below
21 *     jokes:    [ ... ],            // override the fun-cookie material
22 *     onChange: function (state) {} // called after every save; also dispatched as
23 *                                   // document event 'astrill:consent' with state in detail
24 *   });
25 *
26 * Public API: init, show, customize, hide, reset, get, has, save.
27 *
28 * Cookie:  astrill_consent = 1.<a|r>.<cats joined by +>.<unix seconds>
29 *          e.g. 1.a.ad+an.1756700000   or   1.r..1756700000
30 *          180 days when accepted, 365 when rejected. Strictly necessary, so
31 *          it may be set before any consent - it IS the consent record.
32 *          Host-only, always - never a Domain; see writeCookie.
33 *          astrill_fun = <joke index>, 7 days, only while the fun category is on.
34 *
35 *          Builds before 2026-09-03 scoped it to the registrable domain, so a
36 *          visitor can carry two records with this name at once until the old
37 *          one expires. Nothing deletes it; the trailing timestamp decides,
38 *          and the newest wins on both sides (readConsent here,
39 *          cookie_consent_pick in libs/lib_cookie_consent.php).
40 *
41 * GPC:     if navigator.globalPrivacyControl is true, show() is a no-op and
42 *          get() reports status 'gpc'. The server already withholds every tag
43 *          for those requests; this is the client-side backstop for cached HTML.
44 */
45!function(e,t){"use strict";if(!e.AstrillConsent){var a="astrill_consent",n="astrill_fun",o="1",i=["ad","an","fun"],c={mode:"manual",whyUrl:"/cookies",onChange:null,strings:{text:"We use cookies to measure our advertising and to see how the site is used. Reject and nothing from Google or Meta loads; we still count page views on our own server, without cookies. Browsers that send Global Privacy Control never see this box.",reject:"Reject",accept:"Accept",customize:"Customize",save:"Save choices",back:"Back",why:"Why am I seeing this?",aria:"Cookie consent",essentialLabel:"Essential",essentialDesc:"Your session, your language and this choice. Always on; nothing to decide.",adLabel:"Advertising",adDesc:"Google Ads and Meta tags that tell those platforms whether their ads led to a signup. The only reason this banner exists.",anLabel:"Analytics cookies",anDesc:"Let
45s our own Matomo server recognise you as one visitor instead of many. Off, we still count page views, just less accurately.",funLabel:"Cookies for fun",funDesc:"Sets one cookie containing a joke. It does absolutely nothing. It exists to make a point.",funToday:"Your cookie says:",gpcNotice:"Your browser sends Global Privacy Control and we honour it. No advertising or analytics cookies are set and no tracking script loads, not even our own page-view counter. There is nothing to configure.",close:"Close"},jokes:["This cookie contains no tracking. It is here for the vibes.","The first web cookie, in 1994, existed to remember a shopping cart. Look at us now.","This cookie expires in seven days. Your banner fatigue will not.","You clicked through a legal panel to receive this sentence. We are both a little sad about it.","A cookie walks into a bar. The bartender says: sorry, strictly necessary only.","Do Not Track was a browser header from 2009. Nobody was obliged to listen, so nobody did.","This cookie was consented to. It may be the most legally sound object on the internet.","Web cookies are named after magic cookies in Unix. There is no magic in this one.","Three buttons to decide the fate of a text file. Democracy.","This cookie knows nothing about you. It barely knows about itself.","Somewhere a compliance officer just felt a disturbance and does not know why.","If this cookie were any less useful it would be a consent banner.","Fun fact: this joke was stored on your device with your explicit, informed, freely given consent.","This is the only cookie on the site that asked you first and then did nothing with the answer.","The EU drafted a rule that would let your browser answer this for you, then deleted it. This cookie is a memorial.","Your browser can send one header and never see a banner from us again. See the link. This cookie approves.","This cookie is a text file. It has never harmed anyone. It cannot say the same for the panel you used to get it.","Congratulations. You are now tracked by absolutely nothing, with paperwork to prove it.","A cookie with no purpose is still more honest than one with a vague one.","This message will self-destruct in seven days, or when you clear your cookies, whichever is funnier."]},r=null,s=null,l=null,d=null,p=!1,u=null;e.addEventListener("resize",function(){s&&"none"!==s.style.display&&L(!0)});var h={version:"1.0",init:function(e){return(r=M(c,e=e||{})).strings=M(c.strings,e.strings),r.jokes&&r.jokes.length||(r.jokes=c.jokes),t.addEventListener("click",function(e){for(var a=e.target;a&&a!==t;){if(a.getAttribute&&a.hasAttribute("data-cookie-settings"))return e.preventDefault(),void I();a=a.parentNode}}),"ask"!==r.mode||y()||w()||("loading"===t.readyState?t.addEventListener("DOMContentLoaded",E):E()),h},show:E,customize:I,hide:D,reset:function(){g(a),g(n),u=null,D(),v(null)},get:w,has:function(e){var t=w();return!(!t||"a"!==t.status||-1===t.cats.indexOf(e))},save:x};e.AstrillConsent=h}function f(a,n,o){var i=a+"="+encodeURIComponent(n)+"; Path=/; SameSite=Lax; Max-Age="+o;"https:"===e.location.protocol&&(i+="; Secure"),t.cookie=i}function g(e){t.cookie=e+"=; Path=/; Max-Age=0"}function b(e){if(!e)return null;var t=e.split(".");if(4!==t.length||t[0]!==o||"a"!==t[1]&&"r"!==t[1])return null;for(var a=t[2]?t[2].split("+"):[],n=[],c=0;c<a.length;c++)-1!==i.indexOf(a[c])&&n.push(a[c]);return{status:t[1],cats:n,ts:parseInt(t[3],10)||0}}function y(){return!(!e.navigator||!e.navigator.globalPrivacyControl)}function w(){return y()?{status:"gpc",cats:[],ts:0}:function(){for(var e,n=new RegExp("(?:^|; )"+a+"=([^;]*)","g"),o=null;null!==(e=n.exec(t.cookie));){var i=b(decodeURIComponent(e[1]));i&&(null===o||i.ts>o.ts)&&(o=i)}return o}()}function x(e){for(var t=[],c=0;c<i.length;c++)-1!==e.indexOf(i[c])&&t.push(i[c]);var s=t.length?"a":"r",l=Math.floor(Date.now()/1e3);f(a,[o,s,t.join("+"),l].join("."),"a"===s?15552e3:31536e3),-1!==t.indexOf("fun")?(null===u&&(u=Math.floor(Math.random()*r.jokes.length)),f(n,String(u),604800)):g(n),D();var d=w();return v(d),d}function v(e){if("function"==typeof r.onChange)try{r.onChange(e)}catch(e){}try{t.dispatchEvent(new CustomEvent("astrill:consent",{detail:e}))}catch(e){}}function m(e,a,n){var o=t.createElement(e);return a&&(o.className=a),null!=n&&(o.textContent=n),o}function k(e,t,a){var n=m("button","acc-btn "+e,t);return n.type="button",n.addEventListener("click",a),n}function C(){if(!s){!function(){if(!p){p=!0;var e=m("style");e.id="astrill-cc-style",e.appendChild(t.createTextNode('#astrill-cc{position:fixed;left:0;right:0;bottom:0;z-index:2147483647;font:14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#f2f2f4;background:#1f1f24;box-shadow:0 -2px 14px rgba(0,0,0,.28)}#astrill-cc *{box-sizing:border-box}#astrill-cc a{color:#ff9a7f;text-decoration:underline}.acc-bar,.acc-panel,.acc-gpc{max-width:1180px;margin:0 auto;padding:14px 20px}.acc-bar{display:flex;align-items:center;gap:18px;flex-wrap:wrap}.acc-text{flex:1 1 380px;margin:0}.acc-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.acc-btn{font:inherit;font-weight:600;cursor:pointer;border-radius:6px;padding:10px 18px;min-width:120px;border:2px solid transparent;transition:background .12s,color .12s}.acc-btn:focus-visible{outline:2px solid #fff;outline-offset:2px}.acc-primary{background:#6362d2;color:#fff;border-color:#6362d2}.acc-primary:hover{background:#7574e0;border-color:#7574e0}.acc-outline{background:transparent;color:#f2f2f4;border-color:#8b8b95}.acc-outline:hover{border-color:#f2f2f4}.acc-ghost{background:transparent;color:#c9c9d1;border-color:transparent;min-width:0;padding:10px 8px;text-decoration:underline}.acc-ghost:hover{color:#fff}.acc-panel,.acc-gpc{display:none}#astrill-cc.acc-open-gpc .acc-bar{display:none}#astrill-cc.acc-open-gpc .acc-gpc{display:flex;align-items:center;gap:18px;flex-wrap:wrap}#astrill-cc.acc-open-panel .acc-bar{display:none}#astrill-cc.acc-open-panel .acc-panel{display:block}.acc-row{display:flex;gap:16px;align-items:flex-start;padding:12px 0;border-top:1px solid #34343c}.acc-row:first-child{border-top:0}.acc-row label{display:block;font-weight:600;cursor:pointer}.acc-row p{margin:2px 0 0;color:#c9c9d1}.acc-row .acc-joke{color:#ffd28a;font-style:italic}.acc-switch{flex:0 0 auto;width:44px;height:24px;border-radius:12px;background:#4a4a55;position:relative;border:0;cursor:pointer;padding:0;margin-top:2px}.acc-switch[aria-checked=true]{background:#6362d2}.acc-switch:disabled{opacity:.5;cursor:default}.acc-switch:after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .12s}.acc-switch[aria-checked=true]:after{left:23px}.acc-switch:focus-visible{outline:2px solid #fff;outline-offset:2px}.acc-panel-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;padding-top:12px;border-top:1px solid #34343c}@media (max-width:640px){.acc-bar{padding:12px 14px;gap:10px}.acc-actions{width:100%}.acc-actions .acc-btn{flex:1 1 auto}}[dir=rtl] #astrill-cc .acc-switch:after{left:auto;right:3px}[dir=rtl] #astrill-cc .acc-switch[aria-checked=true]:after{right:23px}html.acc-open .woot-widget-bubble,html.acc-open .woot-widget-holder{bottom:calc(20px + var(--acc-h,0px))!important}')),(t.head||t.documentElement).appendChild(e)}}();var e=r.strings;(s=m("div")).id="astrill-cc",s.setAttribute("role","dialog"),s.setAttribute("aria-label",e.aria);var a=m("div","acc-bar"),n=m("p","acc-text");n.appendChild(t.createTextNode(e.text+" "));var o=m("a",null,e.why);o.href=r.whyUrl,n.appendChild(o),a.appendChild(n);var c=m("div","acc-actions");c.appendChild(k("acc-ghost",e.customize,I)),c.appendChild(k("acc-primary",e.accept,function(){x(i.slice())})),c.appendChild(k("acc-primary",e.reject,function(){x([])})),a.appendChild(c),s.appendChild(a),(l=m("div","acc-panel")).appendChild(j("essential",e.essentialLabel,e.essentialDesc,!0)),l.appendChild(j("ad",e.adLabel,e.adDesc,!1)),l.appendChild(j("an",e.anLabel,e.anDesc,!1)),l.appendChild(j("fun",e.funLabel,e.funDesc,!1));var u=m("div","acc-panel-actions");u.appendChild(k("acc-ghost",e.back,function(){s.className="",L(!0),N()})),u.appendChild(k("acc-primary",e.save,function(){x(function(){for(var e=[],a=0;a<i.length;a++){var n=t.getElementById("acc-sw-"+i[a]);n&&"true"===n.getAttribute("aria-checked")&&e.push(i[a])}return e}())})),l.appendChild(u),s.appendChild(l),d=m("div","acc-gpc");var h=m("p","acc-text");h.appendChild(t.createTextNode(e.gpcNotice+" "));var f=m("a",null,e.why);f.href=r.whyUrl,h.appendChild(f),d.appendChild(h);var g=m("div","acc-actions");g.appendChild(k("acc-primary",e.close,D)),d.appendChild(g),s.appendChild(d),s.addEventListener("keydown",function(e){"Escape"===e.key&&D()}),t.body.appendChild(s)}}function j(e,t,a,n){var o=m("div","acc-row"),i=m("button","acc-switch");i.type="button",i.setAttribute("role","switch"),i.setAttribute("aria-checked",n?"true":"false"),i.id="acc-sw-"+e,i.setAttribute("data-cat",e),n&&(i.disabled=!0);var c=m("div"),r=m("label",null,t);if(r.htmlFor=i.id,c.appendChild(r),c.appendChild(m("p",null,a)),"fun"===e){var s=m("p","acc-joke");s.id="acc-joke",s.style.display="none",c.appendChild(s)}return n||i.addEventListener("click",function(){var t="true"!==i.getAttribute("aria-checked");i.setAttribute("aria-checked",t?"true":"false"),"fun"===e&&A(t)}),o.appendChild(i),o.appendChild(c),o}function A(e){var a=t.getElementById("acc-joke");a&&(e?(null===u&&(u=Math.floor(Math.random()*r.jokes.length)),a.textContent=r.strings.funToday+" "+r.jokes[u],a.style.display=""):a.style.display="none")}function T(){for(var e=w(),a=e&&"a"===e.status?e.cats:[],o=0;o<i.length;o++){var c=t.getElementById("acc-sw-"+i[o]);c&&c.setAttribute("aria-checked",-1!==a.indexOf(i[o])?"true":"false")}var s,l,d=(s=n,(l=t.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)")))?decodeURIComponent(l[1]):null);u=null===d||isNaN(parseInt(d,10))?null:parseInt(d,10)%r.jokes.length,A(-1!==a.indexOf("fun"))}function L(e){var a=t.documentElement;e&&s?(a.classList.add("acc-open"),a.style.setProperty("--acc-h",s.offsetHeight+"px")):(a.classList.remove("acc-open"),a.style.removeProperty("--acc-h"))}function N(){if(s){var e="acc-open-gpc"===s.className?".acc-gpc .acc-primary":"acc-open-panel"===s.className?".acc-panel .acc-switch:not(:disabled)":".acc-bar .acc-primary",t=s.querySelector(e);t&&t.focus()}}function E(){return!y()&&(C(),s.className="",s.style.display="",L(!0),N(),!0)}function I(){return C(),y()?(s.className="acc-open-gpc",s.style.display="",L(!0),N(),!0):(T(),s.className="acc-open-panel",s.style.display="",L(!0),N(),!0)}function D(){s&&(s.style.display="none",s.className=""),L(!1)}function M(e,t){var a,n={};for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);for(a in t||{})Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a]);return n}}(window,document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.