aboutsummaryrefslogtreecommitdiff
path: root/assets/javascript
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-09-05 00:16:37 +0300
committerValentin Popov <valentin@popov.link>2024-09-05 00:16:37 +0300
commit7eff3fde5720eb23449e2f8c8ea0b8218efe4dde (patch)
treefbaedd693902c1a6d56a005b28b189ef76fe23f4 /assets/javascript
parentecf9a15e77509d344ab4ee02ae0dbf8a116021f1 (diff)
downloadpopov.link-7eff3fde5720eb23449e2f8c8ea0b8218efe4dde.tar.xz
popov.link-7eff3fde5720eb23449e2f8c8ea0b8218efe4dde.zip
Initial Astro project
Diffstat (limited to 'assets/javascript')
-rw-r--r--assets/javascript/count.js254
-rw-r--r--assets/javascript/html5shiv-3.7.3.min.js1
-rw-r--r--assets/javascript/respond-1.4.2.min.js1
3 files changed, 0 insertions, 256 deletions
diff --git a/assets/javascript/count.js b/assets/javascript/count.js
deleted file mode 100644
index e85f0bc..0000000
--- a/assets/javascript/count.js
+++ /dev/null
@@ -1,254 +0,0 @@
-// GoatCounter: https://www.goatcounter.com
-// This file is released under the ISC license: https://opensource.org/licenses/ISC
-;(function() {
- 'use strict';
-
- if (window.goatcounter && window.goatcounter.vars) // Compatibility with very old version; do not use.
- window.goatcounter = window.goatcounter.vars
- else
- window.goatcounter = window.goatcounter || {}
-
- // Load settings from data-goatcounter-settings.
- var s = document.querySelector('script[data-goatcounter]')
- if (s && s.dataset.goatcounterSettings) {
- try { var set = JSON.parse(s.dataset.goatcounterSettings) }
- catch (err) { console.error('invalid JSON in data-goatcounter-settings: ' + err) }
- for (var k in set)
- if (['no_onload', 'no_events', 'allow_local', 'allow_frame', 'path', 'title', 'referrer', 'event'].indexOf(k) > -1)
- window.goatcounter[k] = set[k]
- }
-
- var enc = encodeURIComponent
-
- // Get all data we're going to send off to the counter endpoint.
- var get_data = function(vars) {
- var data = {
- p: (vars.path === undefined ? goatcounter.path : vars.path),
- r: (vars.referrer === undefined ? goatcounter.referrer : vars.referrer),
- t: (vars.title === undefined ? goatcounter.title : vars.title),
- e: !!(vars.event || goatcounter.event),
- s: [window.screen.width, window.screen.height, (window.devicePixelRatio || 1)],
- b: is_bot(),
- q: location.search,
- }
-
- var rcb, pcb, tcb // Save callbacks to apply later.
- if (typeof(data.r) === 'function') rcb = data.r
- if (typeof(data.t) === 'function') tcb = data.t
- if (typeof(data.p) === 'function') pcb = data.p
-
- if (is_empty(data.r)) data.r = document.referrer
- if (is_empty(data.t)) data.t = document.title
- if (is_empty(data.p)) data.p = get_path()
-
- if (rcb) data.r = rcb(data.r)
- if (tcb) data.t = tcb(data.t)
- if (pcb) data.p = pcb(data.p)
- return data
- }
-
- // Check if a value is "empty" for the purpose of get_data().
- var is_empty = function(v) { return v === null || v === undefined || typeof(v) === 'function' }
-
- // See if this looks like a bot; there is some additional filtering on the
- // backend, but these properties can't be fetched from there.
- var is_bot = function() {
- // Headless browsers are probably a bot.
- var w = window, d = document
- if (w.callPhantom || w._phantom || w.phantom)
- return 150
- if (w.__nightmare)
- return 151
- if (d.__selenium_unwrapped || d.__webdriver_evaluate || d.__driver_evaluate)
- return 152
- if (navigator.webdriver)
- return 153
- return 0
- }
-
- // Object to urlencoded string, starting with a ?.
- var urlencode = function(obj) {
- var p = []
- for (var k in obj)
- if (obj[k] !== '' && obj[k] !== null && obj[k] !== undefined && obj[k] !== false)
- p.push(enc(k) + '=' + enc(obj[k]))
- return '?' + p.join('&')
- }
-
- // Show a warning in the console.
- var warn = function(msg) {
- if (console && 'warn' in console)
- console.warn('goatcounter: ' + msg)
- }
-
- // Get the endpoint to send requests to.
- var get_endpoint = function() {
- var s = document.querySelector('script[data-goatcounter]')
- if (s && s.dataset.goatcounter)
- return s.dataset.goatcounter
- return (goatcounter.endpoint || window.counter) // counter is for compat; don't use.
- }
-
- // Get current path.
- var get_path = function() {
- var loc = location,
- c = document.querySelector('link[rel="canonical"][href]')
- if (c) { // May be relative or point to different domain.
- var a = document.createElement('a')
- a.href = c.href
- if (a.hostname.replace(/^www\./, '') === location.hostname.replace(/^www\./, ''))
- loc = a
- }
- return (loc.pathname + loc.search) || '/'
- }
-
- // Run function after DOM is loaded.
- var on_load = function(f) {
- if (document.body === null)
- document.addEventListener('DOMContentLoaded', function() { f() }, false)
- else
- f()
- }
-
- // Filter some requests that we (probably) don't want to count.
- goatcounter.filter = function() {
- if ('visibilityState' in document && document.visibilityState === 'prerender')
- return 'visibilityState'
- if (!goatcounter.allow_frame && location !== parent.location)
- return 'frame'
- if (!goatcounter.allow_local && location.hostname.match(/(localhost$|^127\.|^10\.|^172\.(1[6-9]|2[0-9]|3[0-1])\.|^192\.168\.|^0\.0\.0\.0$)/))
- return 'localhost'
- if (!goatcounter.allow_local && location.protocol === 'file:')
- return 'localfile'
- if (localStorage && localStorage.getItem('skipgc') === 't')
- return 'disabled with #toggle-goatcounter'
- return false
- }
-
- // Get URL to send to GoatCounter.
- window.goatcounter.url = function(vars) {
- var data = get_data(vars || {})
- if (data.p === null) // null from user callback.
- return
- data.rnd = Math.random().toString(36).substr(2, 5) // Browsers don't always listen to Cache-Control.
-
- var endpoint = get_endpoint()
- if (!endpoint)
- return warn('no endpoint found')
-
- return endpoint + urlencode(data)
- }
-
- // Count a hit.
- window.goatcounter.count = function(vars) {
- var f = goatcounter.filter()
- if (f)
- return warn('not counting because of: ' + f)
- var url = goatcounter.url(vars)
- if (!url)
- return warn('not counting because path callback returned null')
- navigator.sendBeacon(url)
- }
-
- // Get a query parameter.
- window.goatcounter.get_query = function(name) {
- var s = location.search.substr(1).split('&')
- for (var i = 0; i < s.length; i++)
- if (s[i].toLowerCase().indexOf(name.toLowerCase() + '=') === 0)
- return s[i].substr(name.length + 1)
- }
-
- // Track click events.
- window.goatcounter.bind_events = function() {
- if (!document.querySelectorAll) // Just in case someone uses an ancient browser.
- return
-
- var send = function(elem) {
- return function() {
- goatcounter.count({
- event: true,
- path: (elem.dataset.goatcounterClick || elem.name || elem.id || ''),
- title: (elem.dataset.goatcounterTitle || elem.title || (elem.innerHTML || '').substr(0, 200) || ''),
- referrer: (elem.dataset.goatcounterReferrer || elem.dataset.goatcounterReferral || ''),
- })
- }
- }
-
- Array.prototype.slice.call(document.querySelectorAll("*[data-goatcounter-click]")).forEach(function(elem) {
- if (elem.dataset.goatcounterBound)
- return
- var f = send(elem)
- elem.addEventListener('click', f, false)
- elem.addEventListener('auxclick', f, false) // Middle click.
- elem.dataset.goatcounterBound = 'true'
- })
- }
-
- // Add a "visitor counter" frame or image.
- window.goatcounter.visit_count = function(opt) {
- on_load(function() {
- opt = opt || {}
- opt.type = opt.type || 'html'
- opt.append = opt.append || 'body'
- opt.path = opt.path || get_path()
- opt.attr = opt.attr || {width: '200', height: (opt.no_branding ? '60' : '80')}
-
- opt.attr['src'] = get_endpoint() + 'er/' + enc(opt.path) + '.' + enc(opt.type) + '?'
- if (opt.no_branding) opt.attr['src'] += '&no_branding=1'
- if (opt.style) opt.attr['src'] += '&style=' + enc(opt.style)
- if (opt.start) opt.attr['src'] += '&start=' + enc(opt.start)
- if (opt.end) opt.attr['src'] += '&end=' + enc(opt.end)
-
- var tag = {png: 'img', svg: 'img', html: 'iframe'}[opt.type]
- if (!tag)
- return warn('visit_count: unknown type: ' + opt.type)
-
- if (opt.type === 'html') {
- opt.attr['frameborder'] = '0'
- opt.attr['scrolling'] = 'no'
- }
-
- var d = document.createElement(tag)
- for (var k in opt.attr)
- d.setAttribute(k, opt.attr[k])
-
- var p = document.querySelector(opt.append)
- if (!p)
- return warn('visit_count: append not found: ' + opt.append)
- p.appendChild(d)
- })
- }
-
- // Make it easy to skip your own views.
- if (location.hash === '#toggle-goatcounter') {
- if (localStorage.getItem('skipgc') === 't') {
- localStorage.removeItem('skipgc', 't')
- alert('GoatCounter tracking is now ENABLED in this browser.')
- }
- else {
- localStorage.setItem('skipgc', 't')
- alert('GoatCounter tracking is now DISABLED in this browser until ' + location + ' is loaded again.')
- }
- }
-
- if (!goatcounter.no_onload)
- on_load(function() {
- // 1. Page is visible, count request.
- // 2. Page is not yet visible; wait until it switches to 'visible' and count.
- // See #487
- if (!('visibilityState' in document) || document.visibilityState === 'visible')
- goatcounter.count()
- else {
- var f = function(e) {
- if (document.visibilityState !== 'visible')
- return
- document.removeEventListener('visibilitychange', f)
- goatcounter.count()
- }
- document.addEventListener('visibilitychange', f)
- }
-
- if (!goatcounter.no_events)
- goatcounter.bind_events()
- })
-})();
diff --git a/assets/javascript/html5shiv-3.7.3.min.js b/assets/javascript/html5shiv-3.7.3.min.js
deleted file mode 100644
index d4e6ec3..0000000
--- a/assets/javascript/html5shiv-3.7.3.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
diff --git a/assets/javascript/respond-1.4.2.min.js b/assets/javascript/respond-1.4.2.min.js
deleted file mode 100644
index 1c26da8..0000000
--- a/assets/javascript/respond-1.4.2.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);