///COPYRIGHT INZU LIMITED � 2014 ///All rights reserved function task(sel, el){ if (!(this instanceof task)) { // return a new task object if called without the "new" keyword return new task(sel); } ///Add selections to array this.sel=sel; if (this.sel) { if(typeof this.sel === "string"){ if ( el !== null && typeof el === "object" ) { this.Nodes = el.querySelectorAll(this.sel); } else { this.Nodes = document.querySelectorAll(this.sel); } } else { if ( el !== null && typeof el === "object" ) { this.Nodes = el[this.sel]; } else { this.Nodes = [this.sel]; } } } } task.prototype = { constructor: task, ready:function(func){ document.addEventListener("DOMContentLoaded", function(event) { func(); }); } , obj:function(sel){ return this.Nodes[0]; } , change:function(func){ this.event(func, 'change'); } , click:function(func){ this.event(func, 'click'); } , touchstart:function(func){ this.event(func, 'touchstart'); } , mouseover:function(func){ this.event(func, 'mouseover'); } , mouseout:function(func){ this.event(func, 'mouseout'); } , mouseleave:function(func){ this.event(func, 'mouseleave'); } , event:function(func,eventType){ for (var i = 0; i < this.Nodes.length; i++) { var obj = this; (function (obj,i) { obj.Nodes[i].addEventListener(eventType, function(event){ var targetElement = event.target; var sourceElement = event.currentTarget; func(sourceElement,targetElement,i,event); }, false); }(obj,i)); } return this; } , ofClass:function(sel_class){ this.Nodes = this.Nodes[0].querySelectorAll(sel_class); return this; } , firstChild:function(){ childArray = new Array(); for(i=0; i