View app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delay(time = 500) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, time); | |
}); | |
} | |
let spinner = document.querySelector('.spinner'); | |
spinner.classList.add('active'); | |
fetch('./books.json') |
View getAllFocusableElements.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAllFocusableElements = (parent) => Array.from(parent.querySelectorAll('*')).filter(elm => elm.tabIndex > -1).sort((a,b) => a.tabIndex > b.tabIndex ? 1 : a.tabIndex < b.tabIndex ? -1 : 0); |
View formProgress.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function (win, doc) { | |
'use strict'; | |
if (!win.XMLHttpRequest || !win.FormData || !win.addEventListener || !doc.querySelectorAll) { | |
// doesn't cut the mustard. | |
return; | |
} | |
function hijaxForm (formElement) { | |
var progressBar; |
View functional-utils.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// array utils | |
// ================================================================================================= | |
const combine = (...arrays) => [].concat(...arrays); | |
const compact = arr => arr.filter(Boolean); | |
const contains = (() => Array.prototype.includes | |
? (arr, value) => arr.includes(value) | |
: (arr, value) => arr.some(el => el === value) |
View scriptloader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptLoader () { | |
const loader = url => new Promise((resolve, reject) => { | |
const script = document.createElement('script') | |
script.src = url | |
script.async = !0 | |
script.addEventListener('load', resolve(script), !1) | |
script.addEventListener('error', reject(script), !1) | |
body.appendChild(script) | |
}) | |
this.load = url => loader(url) |
View darkthemeswitcher-inline.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(d=>{var css=`html{background:#fefefe;filter:invert(100%)}*{background:inherit}img:not([src*=".svg"]),video{filter:invert(100%)}`,style,id='dark-theme-snippet',ee=d.getElementById(id);if(null !=ee)ee.parentNode.removeChild(ee);else{style=d.createElement('style');style.id=id;style.styleSheet?style.styleSheet.cssText=css:style.appendChild(d.createTextNode(css));d.head.appendChild(style)}})(document) |
View contains.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleClick = e => { | |
if (!modalEl.contains(e.target)) modalEl.hidden = !0 | |
} |