A Website built on with
Built with:
class TableOfContents { | |
static listContainerClass = 'articleTOC__list'; | |
static listItemClass = 'articleTOC__item'; | |
static listLinkClass = 'articleTOC__link'; | |
static modifierSeparator = '--'; | |
/* | |
* @description Gets a list of all title elements having an ID in a given container | |
* @param {HTMLElement} container - An element containing title elements (h1, h2, h3) |
/** | |
* @class Locker | |
* @description who doesn't like Konami? | |
* @example const locker = new Locker(); locker.initialize(); | |
* | |
*/ | |
// I'm not going to use Babel for a tiny static site | |
// eslint-disable-next-line no-unused-vars | |
class Locker { | |
/** |
/* | |
* Conjunctions | |
* https://www.english-grammar-revolution.com/list-of-conjunctions.html | |
*/ | |
module.exports = [ | |
{ | |
conjunction: ['and'], | |
type: 'coordinating', | |
}, |
/* | |
where "title" is the full class name | |
/class=(.*[ "]title[ "].*)/g | |
*/ | |
const className = 'title'; | |
const regex = new RegExp(`/class=(.*[ "]${className}[ "].*)/g`); |
/** | |
* Class for adding CSS with JavaScript that relies on the CSSOM | |
*/ | |
class JSCSS { | |
/** | |
* @param {string} cssText Text for a stylesheet. Rulesets, queries, and all | |
*/ | |
constructor(cssText = '') { | |
const sheet = JSCSS.addStyleSheet(); | |
this.stylesheet = JSCSS.getStyleSheet(sheet.title); |
/** queryCSSByPropertyName | |
* queries the CSSOM looking for CSS rulesets containing a particular CSS property. | |
* @param {string} queryPropName CSS property name | |
* @param {string} queryPropValue value of CSS property | |
* @returns Map with key as CSS selector, value as CSS properties. | |
*/ | |
function queryCSSByProperty(queryPropName, queryPropValue) { | |
const styleSheets= document.styleSheets; // get all the stylesheets | |
const properties = new Map(); // set up the variable that'll store our result | |
/* Courtesy of Jake Albaugh: https://twitter.com/jake_albaugh/status/1118611365508337665 */ | |
const bars = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]; | |
const ctx = new AudioContext(); | |
const analyser = ctx.createAnalyser(); | |
analyser.fftSize = 32; | |
const uIntArray = new Uint8Array(16); | |
navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => { | |
ctx.createMediaStreamSource(stream).connect(analyser); | |
updateUrl(); |
/** Evaluates an array, makes the key lowercasee and makes the value an object with original keyname | |
* @param {Array} iterable=[] an array of arrays:[[key,val],[key,val]] | |
* @returns Array | |
*/ | |
function LowercaseIterable(iterable = []) { | |
if (iterable.length === 0) return []; | |
const newIterable = iterable.map(([key, val]) => { | |
const entry = [ | |
key.toLowerCase(), |
const these = _itshelf = itshelf = _shelf = shelf = _itself = itself =_self = self = _me = me = _that = that = _this = this; |