SCRIPTS
(that you can run)jQuery at Home
This is a minimal front-end framework, offering improved ergonomics for dynamic HTML, as well as an incredibly small bundle size.It's time to ditch jQuery and React!
export function $(name, ...options) {
const elem = document.createElement(name);
let i = 0;
if (typeof options[0] === "object" && !(options[0] instanceof Node)) {
Object.assign(elem, options[0]);
i = 1;
}
for (; i < options.length; i++) {
elem.append(options[i]);
}
return elem;
}
There is also a minified version:
export function $(n,...o) {const e = document.createElement(n);let i = 0;if(typeof o[0]==="object"&&!(o[0] instanceof Node)){Object.assign(e, o[0]);i = 1}for(;i<o.length;i++){e.append(o[i])}return e}
rainbowScript.js
You can paste it into a browser console anywhere to make the page go rainbow.let allElements = document.getElementsByTagName("*");
let timeNow = undefined;
window.setInterval(function(){
timeNow = new Date()
for (let i = 0, max = allElements.length; i < max; i++) {
allElements[i].style.backgroundColor = "hsl(" + ((timeNow.getTime() / 10 + i * 50) % 360) + ",100%,30%)";
}
}, 30);