Last active
August 25, 2018 19:41
-
-
Save ianfabs/25d6655e92578cfb8c1ce91ff4ba0a22 to your computer and use it in GitHub Desktop.
ESQuery, a lightweight alternative to jQuery for the modern ECMAScript developer. Or not... I guess
This file contains hidden or 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 d = window.document; | |
const qs = d.querySelector.bind(d); | |
Element.prototype.qs = Element.prototype.querySelector; | |
const qsa = d.querySelectorAll.bind(d); | |
Element.prototype.qsa = Element.prototype.querySelectorAll; | |
const f = window.fetch; | |
const newTab = uri => window.open(uri, "_target"); | |
const redirect = uri => window.open(uri, "_self"); | |
const ce = d.createElement.bind(d); | |
Element.prototype.ac = Element.prototype.appendChild; | |
const ctn = d.createTextNode.bind(d); | |
console.__proto__.beep = () => { | |
let context = new AudioContext(); | |
o = context.createOscillator() | |
g = context.createGain() | |
o.connect(g) | |
o.type = 'sine'; | |
g.connect(context.destination) | |
o.start(0) | |
g.gain.exponentialRampToValueAtTime( | |
10, context.currentTime | |
) | |
setTimeout(()=>{ | |
o.stop(); | |
}, 500); | |
}; | |
document.cookie.__proto__.getItem = (key) => (`; ${document.cookie}`.split(`; ${key}=`)).pop().split(";").shift()[0]; | |
document.cookie.__proto__.setItem = (key, val)=>document.cookie = `${key}=${val};`; | |
function sleep(ms) {return new Promise(resolve => setTimeout(resolve, ms));} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment