Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // I was getting quite fucking sick of typing document.getELementById().addEventListener, so....
- function SceneQuery(el){
- if ((typeof el === 'string') && (!el.match(/^</))){
- this.elements = document.querySelectorAll(el);
- }else{
- throw "not implemented";
- }
- return this;
- }
- SceneQuery.prototype.click = function(func){
- this.elements.forEach(function(el){
- el.addEventListener("click", func);
- });
- }
- $ = function(el){
- return new SceneQuery(el);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement