(function(w, d, a){ 'use strict'; const b = () => { for (let el of d.getElementsByTagName('a')) { const h = el.href.replace(/javascript:location=(.*);void 0/, '$1'); el.setAttribute('data-href', el.href); if (h != el.href) el.href = eval(h); else el.href = "https://alxu.ca/analytics?url=" + el.href.replace(/%/g, '%25').replace(/&/g, '%26').replace(/;/g, '%3B'); } }; if (location.hostname === 'www.alxu.ca') { let t, p = []; const f = () => { clearTimeout(t); navigator.sendBeacon('/analytics', new Blob([JSON.stringify(p)], {type: 'application/json'})); p = []; }; const q = (kind, details) => { clearTimeout(t); p.push({created_ts: Date.now(), kind: kind, details: details}); t = setTimeout(f, 2000); }; q('l', ''); d[a]('visibilitychange', () => { const vs = d.visibilityState; q('v', vs); if (vs === 'hidden') f(); }); d[a]('click', e => { const a = e.target.closest('a'); if (a) q('c', a.href); }); w[a]('beforeprint', b); w[a]('afterprint', function () { for (let el of d.getElementsByTagName('a')) { el.href = el.getAttribute('data-href'); el.removeAttribute('data-href'); } }); } else { b(); } if (d.documentMode) ie.style.display = "block"; const css = d.styleSheets[0]; // changing @page causes chrome to claim layout shift if (w.safari) { css.insertRule("@media print{@page{margin:10mm}}", css.cssRules.length); css.insertRule("@media print{body{margin:-2mm 0 -2mm 0;padding:0 15mm 0 7mm}}", css.cssRules.length); } else if (w.chrome) css.insertRule("@media print{@page{margin-top:auto;margin-bottom:auto}}", css.cssRules.length); }(window, document, 'addEventListener'));