Comparing version 0.6.3 to 0.7.0
{ | ||
"name": "eventi", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"homepage": "https://github.com/nbubna/Eventi", | ||
@@ -22,2 +22,3 @@ "bugs": "https://github.com/nbubna/nbubna/issues", | ||
"fire", | ||
"type", | ||
"listener", | ||
@@ -32,3 +33,3 @@ "history", | ||
"pubsub", | ||
"signal", | ||
"signals", | ||
"declarative" | ||
@@ -35,0 +36,0 @@ ], |
{ | ||
"name": "eventi", | ||
"repo": "nbubna/Eventi", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"keywords": [ | ||
@@ -13,2 +13,3 @@ "event", | ||
"fire", | ||
"type", | ||
"listener", | ||
@@ -23,3 +24,3 @@ "handler", | ||
"pubsub", | ||
"signal", | ||
"signals", | ||
"declarative" | ||
@@ -26,0 +27,0 @@ ], |
@@ -1,2 +0,2 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
@@ -332,5 +332,5 @@ * Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
if (response) { | ||
response = _.resolve(response, node) || _.resolve(response) || response; | ||
if (typeof response === "function") { | ||
response.call(node, e); | ||
var fn = _.resolve(response, node) || _.resolve(response); | ||
if (typeof fn === "function") { | ||
fn.call(node, e); | ||
} else { | ||
@@ -539,3 +539,3 @@ Eventi.fire(node, response, e); | ||
}; | ||
_.version = "0.6.3"; | ||
_.version = "0.7.0"; | ||
@@ -542,0 +542,0 @@ var sP = (Event && Event.prototype.stopPropagation) || _.noop, |
@@ -1,4 +0,4 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
* Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),document&&(_.init=function(){for(var a=document.querySelectorAll("[data-eventi]"),b=0,c=a.length;c>b;b++){var d=a[b],e=d.getAttribute("data-eventi");e&&_.declare(e,d)}(a.length||document.querySelectorAll("[click]").length)&&Eventi.on("click keyup",_.check)},_.declare=function(a,b){for(var c=a.split(_.splitRE),d=0,e=c.length;e>d;d++){var f=c[d],g=f.lastIndexOf("="),h=g>0?f.substring(g+1):void 0,i="/"===f.charAt(0),j=i?_.global:b;b=b||document,h&&(f=f.substring(0,g)),i&&(f=f.substring(1)),Eventi.on(j,f,_.mapped,b,h)}},_.mapped=function(a,b,c){for(var d=c||a.type,e=_.declarers(b,d,this!==_.global&&a.target),f=0,g=e.length;g>f;f++)_.declared(e[f],d,a)},_.declarers=function(a,b,c){var d="["+b+"]";if(c){for(var e=[];c&&c.matches&&c!==a.parentNode;)c.matches(d)&&e.push(c),c=c.parentNode;return e}return a.querySelectorAll(d)},_.declared=function(a,b,c){var d=a.getAttribute(b);d&&(d=_.resolve(d,a)||_.resolve(d)||d,"function"==typeof d?d.call(a,c):Eventi.fire(a,d,c))},_.check=function(a){var b="click"===a.type&&_.click(a.target)||13===a.keyCode&&_.click(a.target,!0);b&&(_.mapped(a,document.documentElement,"click"),"noDefault"!==b||_.allowDefault(a.target)||a.preventDefault())},_.allowDefault=function(a){return"radio"===a.type||"checkbox"===a.type},_.click=function(a,b){var c=a.getAttribute("click");if(c&&"false"!==c)return"noDefault";if(!a.isContentEditable){var d=a.nodeName.toLowerCase();return"textarea"!==d&&("select"!==d||b)&&(b?!("a"===d&&a.getAttribute("href")||"button"===d||"input"===d&&_.buttonRE.test(a.type)):"input"!==d||_.buttonRE.test(a.type))}},_.buttonRE=/^(submit|button|reset)$/,Eventi.on("DOMContentLoaded",_.init)),_.properties.unshift([/^\^/,function(){this._singleton=!0}]),_.singleton=function(a,b){_.remember(a,b),b.bubbles&&!b.propagationStopped&&a!==_.global&&_.singleton(a.parentNode||a.parentObject||_.global,b)};var _skey=_._skey="^"+_key;_.remember=function(a,b){var c=a[_skey]||[];c.length||Object.defineProperty(a,_skey,{value:c,configurable:!0}),b[_skey]=!0,c.push(b)},Eventi.on(_,"handler#new",function(a,b){if(b.match._singleton){var c=b._fn=b.fn;b.fn=function(a){_.unhandle(b),a[_skey]||_.remember(b.target,a),c.apply(this,arguments)};for(var d=b.target[_skey]||[],e=0,f=d.length;f>e;e++){var g=d[e];if(_.matches(g,b.match)){var h=_.target(b,g.target);if(h){_.execute(h,g,b),b.fn=_.noop;break}}}}}),document&&Eventi.on("DOMContentLoaded",function(a){_.fire(document.documentElement,["^ready"],void 0,[a])}),_.keyRE=/\[([a-z-0-9,\.\/\[\`\\\]\']+)\]/,_.properties.push([_.keyRE,function(a,b){for(var c,d;(c=b.indexOf("-"))>0;)d=b.substring(0,c),b=b.substring(c+1),this[(_.special[d]||d)+"Key"]=!0;this.keyCode=_.codes[b]||parseInt(b,10)||0}]),_.special={command:"meta",apple:"meta"},_.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,capsLock:20,escape:27,start:91,command:224,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,multiply:106,plus:107,minus:109,point:110,divide:111,numLock:144,",":188,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,space:32};for(var n=0;10>n;n++)_.codes["num"+n]=96+n;for(var f=1;13>f;f++)_.codes["f"+f]=111+f;"abcdefghijklmnopqrstuvwxyz 0123456789".split("").forEach(function(a){_.codes[a]=a.toUpperCase().charCodeAt(0)});var h=global.history,l=global.location;_.pushState=h.pushState,h.pushState=function(){var a=_.pushState.apply(this,arguments);return _.dispatch(_.global,new Eventi("pushstate",{uri:arguments[2]})),a},Eventi.on("!popstate !hashchange !pushstate",_.at=function(a,b){return b=b||decodeURI(l.pathname+l.search+l.hash),b!==_.uri&&_.dispatch(_.global,new Eventi("location",{oldURI:_.uri,uri:_.uri=b,srcEvent:a})),b}).on("!location",function(a,b,c){if("string"==typeof b){var d=_.keys(b);d&&(b=d.reduce(function(a,b){return a.replace(new RegExp("\\{"+b+"\\}","g"),c[b]||global.location[b]||"")},b)),a.uri=b,b!==_.uri&&h.pushState(null,null,encodeURI(b))}else a.uri||(a.uri=_.uri)}).on(_,"handler#new",function(a,b){if("location"===b.match.type){if(b._target=b.target,b.target=_.global,b.selector){var c=b.selector;delete b.selector,"string"==typeof c&&(c=c.replace(/([.*+?^=!:$(|\[\/\\])/g,"\\$1"),(b.keys=_.keys(c))?c=c.replace(/\{\w+\}/g,"([^/?#]+)"):c.replace(/\{/g,"\\{"),c=new RegExp(c)),b.regexp=c}else b.regexp=/.+/;b._fn=b.fn,b.fn=function(a){_.location(a.uri,b,arguments)},_.execute(null,new Eventi("location",{uri:_.uri||_.at()}),b)}}),_.keys=function(a){var b=a.match(/\{\w+\}/g);return b&&b.map(function(a){return a.substring(1,a.length-1)})},_.location=function(a,b,c){var d=(a||_.uri).match(b.regexp);d&&(c=_.slice(c),c.splice.apply(c,[1,0].concat(d)),b.keys&&(c[1]=b.keys.reduce(function(a,b){return a[b]=d.shift(),a},{match:d.shift()})),b._fn.apply(b._target,c))},_.version="0.6.3";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),document&&(_.init=function(){for(var a=document.querySelectorAll("[data-eventi]"),b=0,c=a.length;c>b;b++){var d=a[b],e=d.getAttribute("data-eventi");e&&_.declare(e,d)}(a.length||document.querySelectorAll("[click]").length)&&Eventi.on("click keyup",_.check)},_.declare=function(a,b){for(var c=a.split(_.splitRE),d=0,e=c.length;e>d;d++){var f=c[d],g=f.lastIndexOf("="),h=g>0?f.substring(g+1):void 0,i="/"===f.charAt(0),j=i?_.global:b;b=b||document,h&&(f=f.substring(0,g)),i&&(f=f.substring(1)),Eventi.on(j,f,_.mapped,b,h)}},_.mapped=function(a,b,c){for(var d=c||a.type,e=_.declarers(b,d,this!==_.global&&a.target),f=0,g=e.length;g>f;f++)_.declared(e[f],d,a)},_.declarers=function(a,b,c){var d="["+b+"]";if(c){for(var e=[];c&&c.matches&&c!==a.parentNode;)c.matches(d)&&e.push(c),c=c.parentNode;return e}return a.querySelectorAll(d)},_.declared=function(a,b,c){var d=a.getAttribute(b);if(d){var e=_.resolve(d,a)||_.resolve(d);"function"==typeof e?e.call(a,c):Eventi.fire(a,d,c)}},_.check=function(a){var b="click"===a.type&&_.click(a.target)||13===a.keyCode&&_.click(a.target,!0);b&&(_.mapped(a,document.documentElement,"click"),"noDefault"!==b||_.allowDefault(a.target)||a.preventDefault())},_.allowDefault=function(a){return"radio"===a.type||"checkbox"===a.type},_.click=function(a,b){var c=a.getAttribute("click");if(c&&"false"!==c)return"noDefault";if(!a.isContentEditable){var d=a.nodeName.toLowerCase();return"textarea"!==d&&("select"!==d||b)&&(b?!("a"===d&&a.getAttribute("href")||"button"===d||"input"===d&&_.buttonRE.test(a.type)):"input"!==d||_.buttonRE.test(a.type))}},_.buttonRE=/^(submit|button|reset)$/,Eventi.on("DOMContentLoaded",_.init)),_.properties.unshift([/^\^/,function(){this._singleton=!0}]),_.singleton=function(a,b){_.remember(a,b),b.bubbles&&!b.propagationStopped&&a!==_.global&&_.singleton(a.parentNode||a.parentObject||_.global,b)};var _skey=_._skey="^"+_key;_.remember=function(a,b){var c=a[_skey]||[];c.length||Object.defineProperty(a,_skey,{value:c,configurable:!0}),b[_skey]=!0,c.push(b)},Eventi.on(_,"handler#new",function(a,b){if(b.match._singleton){var c=b._fn=b.fn;b.fn=function(a){_.unhandle(b),a[_skey]||_.remember(b.target,a),c.apply(this,arguments)};for(var d=b.target[_skey]||[],e=0,f=d.length;f>e;e++){var g=d[e];if(_.matches(g,b.match)){var h=_.target(b,g.target);if(h){_.execute(h,g,b),b.fn=_.noop;break}}}}}),document&&Eventi.on("DOMContentLoaded",function(a){_.fire(document.documentElement,["^ready"],void 0,[a])}),_.keyRE=/\[([a-z-0-9,\.\/\[\`\\\]\']+)\]/,_.properties.push([_.keyRE,function(a,b){for(var c,d;(c=b.indexOf("-"))>0;)d=b.substring(0,c),b=b.substring(c+1),this[(_.special[d]||d)+"Key"]=!0;this.keyCode=_.codes[b]||parseInt(b,10)||0}]),_.special={command:"meta",apple:"meta"},_.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,capsLock:20,escape:27,start:91,command:224,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,multiply:106,plus:107,minus:109,point:110,divide:111,numLock:144,",":188,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,space:32};for(var n=0;10>n;n++)_.codes["num"+n]=96+n;for(var f=1;13>f;f++)_.codes["f"+f]=111+f;"abcdefghijklmnopqrstuvwxyz 0123456789".split("").forEach(function(a){_.codes[a]=a.toUpperCase().charCodeAt(0)});var h=global.history,l=global.location;_.pushState=h.pushState,h.pushState=function(){var a=_.pushState.apply(this,arguments);return _.dispatch(_.global,new Eventi("pushstate",{uri:arguments[2]})),a},Eventi.on("!popstate !hashchange !pushstate",_.at=function(a,b){return b=b||decodeURI(l.pathname+l.search+l.hash),b!==_.uri&&_.dispatch(_.global,new Eventi("location",{oldURI:_.uri,uri:_.uri=b,srcEvent:a})),b}).on("!location",function(a,b,c){if("string"==typeof b){var d=_.keys(b);d&&(b=d.reduce(function(a,b){return a.replace(new RegExp("\\{"+b+"\\}","g"),c[b]||global.location[b]||"")},b)),a.uri=b,b!==_.uri&&h.pushState(null,null,encodeURI(b))}else a.uri||(a.uri=_.uri)}).on(_,"handler#new",function(a,b){if("location"===b.match.type){if(b._target=b.target,b.target=_.global,b.selector){var c=b.selector;delete b.selector,"string"==typeof c&&(c=c.replace(/([.*+?^=!:$(|\[\/\\])/g,"\\$1"),(b.keys=_.keys(c))?c=c.replace(/\{\w+\}/g,"([^/?#]+)"):c.replace(/\{/g,"\\{"),c=new RegExp(c)),b.regexp=c}else b.regexp=/.+/;b._fn=b.fn,b.fn=function(a){_.location(a.uri,b,arguments)},_.execute(null,new Eventi("location",{uri:_.uri||_.at()}),b)}}),_.keys=function(a){var b=a.match(/\{\w+\}/g);return b&&b.map(function(a){return a.substring(1,a.length-1)})},_.location=function(a,b,c){var d=(a||_.uri).match(b.regexp);d&&(c=_.slice(c),c.splice.apply(c,[1,0].concat(d)),b.keys&&(c[1]=b.keys.reduce(function(a,b){return a[b]=d.shift(),a},{match:d.shift()})),b._fn.apply(b._target,c))},_.version="0.7.0";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); |
@@ -1,2 +0,2 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
@@ -332,5 +332,5 @@ * Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
if (response) { | ||
response = _.resolve(response, node) || _.resolve(response) || response; | ||
if (typeof response === "function") { | ||
response.call(node, e); | ||
var fn = _.resolve(response, node) || _.resolve(response); | ||
if (typeof fn === "function") { | ||
fn.call(node, e); | ||
} else { | ||
@@ -706,4 +706,4 @@ Eventi.fire(node, response, e); | ||
// memoizes results | ||
_.signal = function(type) { | ||
return _.signal[type] || (_.signal[type] = function signal(target) { | ||
_.types = function(type) { | ||
return _.types[type] || (_.types[type] = function types(target) { | ||
var args = _.slice(arguments), | ||
@@ -721,7 +721,7 @@ index = this.index || 1; | ||
var bound = function bound(){ return fn.apply(o, arguments); }; | ||
bound.index = fn.index;// keep index for _.signal to use | ||
bound.index = fn.index;// keep index for _.types to use | ||
return bound; | ||
}; | ||
(Eventi.signal = function(o) { | ||
var signals = _.slice(arguments); | ||
(Eventi.types = function(o) { | ||
var types = _.slice(arguments); | ||
if (typeof o === "string") { | ||
@@ -734,8 +734,8 @@ o = Eventi; | ||
if (o !== Eventi && fn === Eventi[p]) { | ||
// use local copy of fn to bind context and avoid shared signals | ||
// use local copy of fn to bind context and avoid shared types | ||
fn = o[p] = _.bind(o, fn); | ||
} | ||
for (var i=0,m=signals.length; i<m; i++) { | ||
var type = signals[i]; | ||
fn[type] = _.signal(type); | ||
for (var i=0,m=types.length; i<m; i++) { | ||
var type = types[i]; | ||
fn[type] = _.types(type); | ||
} | ||
@@ -745,3 +745,3 @@ } | ||
}).utility = true; | ||
_.version = "0.6.3"; | ||
_.version = "0.7.0"; | ||
@@ -748,0 +748,0 @@ var sP = (Event && Event.prototype.stopPropagation) || _.noop, |
@@ -1,4 +0,4 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
* Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),document&&(_.init=function(){for(var a=document.querySelectorAll("[data-eventi]"),b=0,c=a.length;c>b;b++){var d=a[b],e=d.getAttribute("data-eventi");e&&_.declare(e,d)}(a.length||document.querySelectorAll("[click]").length)&&Eventi.on("click keyup",_.check)},_.declare=function(a,b){for(var c=a.split(_.splitRE),d=0,e=c.length;e>d;d++){var f=c[d],g=f.lastIndexOf("="),h=g>0?f.substring(g+1):void 0,i="/"===f.charAt(0),j=i?_.global:b;b=b||document,h&&(f=f.substring(0,g)),i&&(f=f.substring(1)),Eventi.on(j,f,_.mapped,b,h)}},_.mapped=function(a,b,c){for(var d=c||a.type,e=_.declarers(b,d,this!==_.global&&a.target),f=0,g=e.length;g>f;f++)_.declared(e[f],d,a)},_.declarers=function(a,b,c){var d="["+b+"]";if(c){for(var e=[];c&&c.matches&&c!==a.parentNode;)c.matches(d)&&e.push(c),c=c.parentNode;return e}return a.querySelectorAll(d)},_.declared=function(a,b,c){var d=a.getAttribute(b);d&&(d=_.resolve(d,a)||_.resolve(d)||d,"function"==typeof d?d.call(a,c):Eventi.fire(a,d,c))},_.check=function(a){var b="click"===a.type&&_.click(a.target)||13===a.keyCode&&_.click(a.target,!0);b&&(_.mapped(a,document.documentElement,"click"),"noDefault"!==b||_.allowDefault(a.target)||a.preventDefault())},_.allowDefault=function(a){return"radio"===a.type||"checkbox"===a.type},_.click=function(a,b){var c=a.getAttribute("click");if(c&&"false"!==c)return"noDefault";if(!a.isContentEditable){var d=a.nodeName.toLowerCase();return"textarea"!==d&&("select"!==d||b)&&(b?!("a"===d&&a.getAttribute("href")||"button"===d||"input"===d&&_.buttonRE.test(a.type)):"input"!==d||_.buttonRE.test(a.type))}},_.buttonRE=/^(submit|button|reset)$/,Eventi.on("DOMContentLoaded",_.init)),_.properties.unshift([/^\^/,function(){this._singleton=!0}]),_.singleton=function(a,b){_.remember(a,b),b.bubbles&&!b.propagationStopped&&a!==_.global&&_.singleton(a.parentNode||a.parentObject||_.global,b)};var _skey=_._skey="^"+_key;_.remember=function(a,b){var c=a[_skey]||[];c.length||Object.defineProperty(a,_skey,{value:c,configurable:!0}),b[_skey]=!0,c.push(b)},Eventi.on(_,"handler#new",function(a,b){if(b.match._singleton){var c=b._fn=b.fn;b.fn=function(a){_.unhandle(b),a[_skey]||_.remember(b.target,a),c.apply(this,arguments)};for(var d=b.target[_skey]||[],e=0,f=d.length;f>e;e++){var g=d[e];if(_.matches(g,b.match)){var h=_.target(b,g.target);if(h){_.execute(h,g,b),b.fn=_.noop;break}}}}}),document&&Eventi.on("DOMContentLoaded",function(a){_.fire(document.documentElement,["^ready"],void 0,[a])}),_.keyRE=/\[([a-z-0-9,\.\/\[\`\\\]\']+)\]/,_.properties.push([_.keyRE,function(a,b){for(var c,d;(c=b.indexOf("-"))>0;)d=b.substring(0,c),b=b.substring(c+1),this[(_.special[d]||d)+"Key"]=!0;this.keyCode=_.codes[b]||parseInt(b,10)||0}]),_.special={command:"meta",apple:"meta"},_.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,capsLock:20,escape:27,start:91,command:224,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,multiply:106,plus:107,minus:109,point:110,divide:111,numLock:144,",":188,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,space:32};for(var n=0;10>n;n++)_.codes["num"+n]=96+n;for(var f=1;13>f;f++)_.codes["f"+f]=111+f;"abcdefghijklmnopqrstuvwxyz 0123456789".split("").forEach(function(a){_.codes[a]=a.toUpperCase().charCodeAt(0)});var h=global.history,l=global.location;_.pushState=h.pushState,h.pushState=function(){var a=_.pushState.apply(this,arguments);return _.dispatch(_.global,new Eventi("pushstate",{uri:arguments[2]})),a},Eventi.on("!popstate !hashchange !pushstate",_.at=function(a,b){return b=b||decodeURI(l.pathname+l.search+l.hash),b!==_.uri&&_.dispatch(_.global,new Eventi("location",{oldURI:_.uri,uri:_.uri=b,srcEvent:a})),b}).on("!location",function(a,b,c){if("string"==typeof b){var d=_.keys(b);d&&(b=d.reduce(function(a,b){return a.replace(new RegExp("\\{"+b+"\\}","g"),c[b]||global.location[b]||"")},b)),a.uri=b,b!==_.uri&&h.pushState(null,null,encodeURI(b))}else a.uri||(a.uri=_.uri)}).on(_,"handler#new",function(a,b){if("location"===b.match.type){if(b._target=b.target,b.target=_.global,b.selector){var c=b.selector;delete b.selector,"string"==typeof c&&(c=c.replace(/([.*+?^=!:$(|\[\/\\])/g,"\\$1"),(b.keys=_.keys(c))?c=c.replace(/\{\w+\}/g,"([^/?#]+)"):c.replace(/\{/g,"\\{"),c=new RegExp(c)),b.regexp=c}else b.regexp=/.+/;b._fn=b.fn,b.fn=function(a){_.location(a.uri,b,arguments)},_.execute(null,new Eventi("location",{uri:_.uri||_.at()}),b)}}),_.keys=function(a){var b=a.match(/\{\w+\}/g);return b&&b.map(function(a){return a.substring(1,a.length-1)})},_.location=function(a,b,c){var d=(a||_.uri).match(b.regexp);d&&(c=_.slice(c),c.splice.apply(c,[1,0].concat(d)),b.keys&&(c[1]=b.keys.reduce(function(a,b){return a[b]=d.shift(),a},{match:d.shift()})),b._fn.apply(b._target,c))},_.off=function(a,b,c){var d=a[_key];if(d){for(var e=0,f=b.length;f>e;e++){var g={fn:c,match:{}},h=_.parse(b[e],g.match);if(delete g.match.tags,h)_.clean(h,g,d,a);else for(h in d.s)_.clean(h,g,d,a)}_.empty(d.s)&&delete a[_key]}},_.unhandle=function(a){_.off(a.target,[a.text],a._fn||a.fn)},_.empty=function(a){for(var b in a)return!b;return!0},_.clean=function(a,b,c,d){var e=c.s[a];if(e){for(var f=0,g=e.length;g>f;f++)if(_.cleans(e[f],b)){var h=e.splice(f--,1)[0];d!==_&&Eventi.fire(_,"handler#off",h),g--}e.length||(d.removeEventListener&&d.removeEventListener(a,c),delete c.s[a])}},_.cleans=function(a,b){return _.matches(a.match,b.match,!0)&&(!b.fn||b.fn===(a._fn||a.fn))},Eventi.off=_.wrap("off",3),_.until=function(a,b,c,d,e,f){"string"!=typeof d&&(void 0!==e&&(f=f?f.unshift(e)&&f:[e]),e=d);for(var g=0,h=c.length;h>g;g++){var i=_.handler(a,c[g],d,e,f);_.untilAfter(i,b)}},_.untilAfter=function(a,b){var c=_.untilFn(a,b),d=a._fn=a.fn;a.fn=function(){d.apply(this,arguments),c()&&_.unhandle(a)}},_.untilFn=function(a,b){switch(typeof b){case"undefined":case"function":return b;case"number":return function(){return!--b};case"string":var c="!"===b.charAt(0);return c&&(b=b.substring(1)),function(){var d=_.resolve(b,a.target);return void 0===d&&(d=_.resolve(b)),c?!d:d}}},Eventi.until=_.wrap("until",5,2),_.comboRE=/\+|>/,_.fireAll=function(a,b,c,d){for(var e,f,g=0;g<b.length;g++){f=c.sequence=b[g].split(_.comboRE);for(var h=d||0;h<f.length&&(!e||!e.isSequencePaused());h++)f[h]?(c.index=h,e=c.previousEvent=_.create(f[h],c),_.sequence(e,c,a),_.dispatch(a,e)):f.splice(h--,1)}return e},_.sequence=function(a,b,c,d){a.resumeSequence=function(a){d&&(d=!1,_.fireAll(c,b.sequence,b,a||b.index))},a.pauseSequence=function(a){return d!==!1?(d=!0,a&&a.then(this.resumeSequence)):void 0},a.isSequencePaused=function(){return!!d}},Eventi.on(_,"handler#new",function(a,b){var c=b.text,d=c.match(_.comboRE);if(d){for(var e=c.split(d[0]),f=b.comboFn=_.comboFn(">"===d[0],e,c),g=0,h=e.length;h>g;g++)e[g]=_.handler(b.target,e[g],b.selector,f).type;f.reset()}}),_.comboTimeout=1e3,_.comboFn=function(a,b,c){var d,e,f=function(){e&&clearTimeout(e),d=b.slice()},g=function(b){e||(e=setTimeout(f,_.comboTimeout));var g=d.indexOf(b.type);(a?0===g:g>=0)&&(d.splice(g,1),d.length||(_.fire(b.target,c),f()))};return g.reset=f,g},Eventi.on(_,"handler#off",function(a,b){b.comboFn&&_.off(b.target,"",b.comboFn)}),_.signal=function(a){return _.signal[a]||(_.signal[a]=function(b){var c=_.slice(arguments),d=this.index||1;return("object"!=typeof b||!b.dispatchEvent&&!b[_key])&&d--,c.splice(d,0,a),this.apply(null,c)})},_.bind=function(a,b){var c=function(){return b.apply(a,arguments)};return c.index=b.index,c},(Eventi.signal=function(a){var b=_.slice(arguments);"string"==typeof a&&(a=Eventi);for(var c in Eventi){var d=a[c];if("function"==typeof d&&!d.utility){a!==Eventi&&d===Eventi[c]&&(d=a[c]=_.bind(a,d));for(var e=0,f=b.length;f>e;e++){var g=b[e];d[g]=_.signal(g)}}}}).utility=!0,_.version="0.6.3";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),document&&(_.init=function(){for(var a=document.querySelectorAll("[data-eventi]"),b=0,c=a.length;c>b;b++){var d=a[b],e=d.getAttribute("data-eventi");e&&_.declare(e,d)}(a.length||document.querySelectorAll("[click]").length)&&Eventi.on("click keyup",_.check)},_.declare=function(a,b){for(var c=a.split(_.splitRE),d=0,e=c.length;e>d;d++){var f=c[d],g=f.lastIndexOf("="),h=g>0?f.substring(g+1):void 0,i="/"===f.charAt(0),j=i?_.global:b;b=b||document,h&&(f=f.substring(0,g)),i&&(f=f.substring(1)),Eventi.on(j,f,_.mapped,b,h)}},_.mapped=function(a,b,c){for(var d=c||a.type,e=_.declarers(b,d,this!==_.global&&a.target),f=0,g=e.length;g>f;f++)_.declared(e[f],d,a)},_.declarers=function(a,b,c){var d="["+b+"]";if(c){for(var e=[];c&&c.matches&&c!==a.parentNode;)c.matches(d)&&e.push(c),c=c.parentNode;return e}return a.querySelectorAll(d)},_.declared=function(a,b,c){var d=a.getAttribute(b);if(d){var e=_.resolve(d,a)||_.resolve(d);"function"==typeof e?e.call(a,c):Eventi.fire(a,d,c)}},_.check=function(a){var b="click"===a.type&&_.click(a.target)||13===a.keyCode&&_.click(a.target,!0);b&&(_.mapped(a,document.documentElement,"click"),"noDefault"!==b||_.allowDefault(a.target)||a.preventDefault())},_.allowDefault=function(a){return"radio"===a.type||"checkbox"===a.type},_.click=function(a,b){var c=a.getAttribute("click");if(c&&"false"!==c)return"noDefault";if(!a.isContentEditable){var d=a.nodeName.toLowerCase();return"textarea"!==d&&("select"!==d||b)&&(b?!("a"===d&&a.getAttribute("href")||"button"===d||"input"===d&&_.buttonRE.test(a.type)):"input"!==d||_.buttonRE.test(a.type))}},_.buttonRE=/^(submit|button|reset)$/,Eventi.on("DOMContentLoaded",_.init)),_.properties.unshift([/^\^/,function(){this._singleton=!0}]),_.singleton=function(a,b){_.remember(a,b),b.bubbles&&!b.propagationStopped&&a!==_.global&&_.singleton(a.parentNode||a.parentObject||_.global,b)};var _skey=_._skey="^"+_key;_.remember=function(a,b){var c=a[_skey]||[];c.length||Object.defineProperty(a,_skey,{value:c,configurable:!0}),b[_skey]=!0,c.push(b)},Eventi.on(_,"handler#new",function(a,b){if(b.match._singleton){var c=b._fn=b.fn;b.fn=function(a){_.unhandle(b),a[_skey]||_.remember(b.target,a),c.apply(this,arguments)};for(var d=b.target[_skey]||[],e=0,f=d.length;f>e;e++){var g=d[e];if(_.matches(g,b.match)){var h=_.target(b,g.target);if(h){_.execute(h,g,b),b.fn=_.noop;break}}}}}),document&&Eventi.on("DOMContentLoaded",function(a){_.fire(document.documentElement,["^ready"],void 0,[a])}),_.keyRE=/\[([a-z-0-9,\.\/\[\`\\\]\']+)\]/,_.properties.push([_.keyRE,function(a,b){for(var c,d;(c=b.indexOf("-"))>0;)d=b.substring(0,c),b=b.substring(c+1),this[(_.special[d]||d)+"Key"]=!0;this.keyCode=_.codes[b]||parseInt(b,10)||0}]),_.special={command:"meta",apple:"meta"},_.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,capsLock:20,escape:27,start:91,command:224,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,multiply:106,plus:107,minus:109,point:110,divide:111,numLock:144,",":188,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,space:32};for(var n=0;10>n;n++)_.codes["num"+n]=96+n;for(var f=1;13>f;f++)_.codes["f"+f]=111+f;"abcdefghijklmnopqrstuvwxyz 0123456789".split("").forEach(function(a){_.codes[a]=a.toUpperCase().charCodeAt(0)});var h=global.history,l=global.location;_.pushState=h.pushState,h.pushState=function(){var a=_.pushState.apply(this,arguments);return _.dispatch(_.global,new Eventi("pushstate",{uri:arguments[2]})),a},Eventi.on("!popstate !hashchange !pushstate",_.at=function(a,b){return b=b||decodeURI(l.pathname+l.search+l.hash),b!==_.uri&&_.dispatch(_.global,new Eventi("location",{oldURI:_.uri,uri:_.uri=b,srcEvent:a})),b}).on("!location",function(a,b,c){if("string"==typeof b){var d=_.keys(b);d&&(b=d.reduce(function(a,b){return a.replace(new RegExp("\\{"+b+"\\}","g"),c[b]||global.location[b]||"")},b)),a.uri=b,b!==_.uri&&h.pushState(null,null,encodeURI(b))}else a.uri||(a.uri=_.uri)}).on(_,"handler#new",function(a,b){if("location"===b.match.type){if(b._target=b.target,b.target=_.global,b.selector){var c=b.selector;delete b.selector,"string"==typeof c&&(c=c.replace(/([.*+?^=!:$(|\[\/\\])/g,"\\$1"),(b.keys=_.keys(c))?c=c.replace(/\{\w+\}/g,"([^/?#]+)"):c.replace(/\{/g,"\\{"),c=new RegExp(c)),b.regexp=c}else b.regexp=/.+/;b._fn=b.fn,b.fn=function(a){_.location(a.uri,b,arguments)},_.execute(null,new Eventi("location",{uri:_.uri||_.at()}),b)}}),_.keys=function(a){var b=a.match(/\{\w+\}/g);return b&&b.map(function(a){return a.substring(1,a.length-1)})},_.location=function(a,b,c){var d=(a||_.uri).match(b.regexp);d&&(c=_.slice(c),c.splice.apply(c,[1,0].concat(d)),b.keys&&(c[1]=b.keys.reduce(function(a,b){return a[b]=d.shift(),a},{match:d.shift()})),b._fn.apply(b._target,c))},_.off=function(a,b,c){var d=a[_key];if(d){for(var e=0,f=b.length;f>e;e++){var g={fn:c,match:{}},h=_.parse(b[e],g.match);if(delete g.match.tags,h)_.clean(h,g,d,a);else for(h in d.s)_.clean(h,g,d,a)}_.empty(d.s)&&delete a[_key]}},_.unhandle=function(a){_.off(a.target,[a.text],a._fn||a.fn)},_.empty=function(a){for(var b in a)return!b;return!0},_.clean=function(a,b,c,d){var e=c.s[a];if(e){for(var f=0,g=e.length;g>f;f++)if(_.cleans(e[f],b)){var h=e.splice(f--,1)[0];d!==_&&Eventi.fire(_,"handler#off",h),g--}e.length||(d.removeEventListener&&d.removeEventListener(a,c),delete c.s[a])}},_.cleans=function(a,b){return _.matches(a.match,b.match,!0)&&(!b.fn||b.fn===(a._fn||a.fn))},Eventi.off=_.wrap("off",3),_.until=function(a,b,c,d,e,f){"string"!=typeof d&&(void 0!==e&&(f=f?f.unshift(e)&&f:[e]),e=d);for(var g=0,h=c.length;h>g;g++){var i=_.handler(a,c[g],d,e,f);_.untilAfter(i,b)}},_.untilAfter=function(a,b){var c=_.untilFn(a,b),d=a._fn=a.fn;a.fn=function(){d.apply(this,arguments),c()&&_.unhandle(a)}},_.untilFn=function(a,b){switch(typeof b){case"undefined":case"function":return b;case"number":return function(){return!--b};case"string":var c="!"===b.charAt(0);return c&&(b=b.substring(1)),function(){var d=_.resolve(b,a.target);return void 0===d&&(d=_.resolve(b)),c?!d:d}}},Eventi.until=_.wrap("until",5,2),_.comboRE=/\+|>/,_.fireAll=function(a,b,c,d){for(var e,f,g=0;g<b.length;g++){f=c.sequence=b[g].split(_.comboRE);for(var h=d||0;h<f.length&&(!e||!e.isSequencePaused());h++)f[h]?(c.index=h,e=c.previousEvent=_.create(f[h],c),_.sequence(e,c,a),_.dispatch(a,e)):f.splice(h--,1)}return e},_.sequence=function(a,b,c,d){a.resumeSequence=function(a){d&&(d=!1,_.fireAll(c,b.sequence,b,a||b.index))},a.pauseSequence=function(a){return d!==!1?(d=!0,a&&a.then(this.resumeSequence)):void 0},a.isSequencePaused=function(){return!!d}},Eventi.on(_,"handler#new",function(a,b){var c=b.text,d=c.match(_.comboRE);if(d){for(var e=c.split(d[0]),f=b.comboFn=_.comboFn(">"===d[0],e,c),g=0,h=e.length;h>g;g++)e[g]=_.handler(b.target,e[g],b.selector,f).type;f.reset()}}),_.comboTimeout=1e3,_.comboFn=function(a,b,c){var d,e,f=function(){e&&clearTimeout(e),d=b.slice()},g=function(b){e||(e=setTimeout(f,_.comboTimeout));var g=d.indexOf(b.type);(a?0===g:g>=0)&&(d.splice(g,1),d.length||(_.fire(b.target,c),f()))};return g.reset=f,g},Eventi.on(_,"handler#off",function(a,b){b.comboFn&&_.off(b.target,"",b.comboFn)}),_.types=function(a){return _.types[a]||(_.types[a]=function(b){var c=_.slice(arguments),d=this.index||1;return("object"!=typeof b||!b.dispatchEvent&&!b[_key])&&d--,c.splice(d,0,a),this.apply(null,c)})},_.bind=function(a,b){var c=function(){return b.apply(a,arguments)};return c.index=b.index,c},(Eventi.types=function(a){var b=_.slice(arguments);"string"==typeof a&&(a=Eventi);for(var c in Eventi){var d=a[c];if("function"==typeof d&&!d.utility){a!==Eventi&&d===Eventi[c]&&(d=a[c]=_.bind(a,d));for(var e=0,f=b.length;f>e;e++){var g=b[e];d[g]=_.types(g)}}}}).utility=!0,_.version="0.7.0";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); |
@@ -1,2 +0,2 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
@@ -278,3 +278,3 @@ * Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
_.version = "0.6.3"; | ||
_.version = "0.7.0"; | ||
@@ -281,0 +281,0 @@ var sP = (Event && Event.prototype.stopPropagation) || _.noop, |
@@ -1,4 +0,4 @@ | ||
/*! Eventi - v0.6.3 - 2014-03-07 | ||
/*! Eventi - v0.7.0 - 2014-03-13 | ||
* https://github.com/nbubna/Eventi | ||
* Copyright (c) 2014 ESHA Research; Licensed MIT */ | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),_.version="0.6.3";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); | ||
!function(global,document){"use strict";function Eventi(){return _.create.apply(this,arguments)}global.CustomEvent||(global.CustomEvent=document?function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail),c}:function(a,b){b=b||{},this.type=a,this.bubbles=!!b.bubbles,this.detail=b.detail,this.timestamp=Date.now()});var _={global:new Function("return this")(),noop:function(){},slice:function(a,b){return Array.prototype.slice.call(a,b)},copy:function(a,b,c){if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},async:global.setImmediate||function(a){return setTimeout(a,0)},resolveRE:/^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/,resolve:function(reference,context){return _.resolveRE.test(reference)?(context=context||global,eval("context"+("["!==reference.charAt(0)?"."+reference:reference))):void 0},create:function(a,b){var c={text:a+""};a=_.parse(c.text,c),_.copy(b,c),"bubbles"in c||(c.bubbles=!0);var d=new CustomEvent(a,c);for(var e in c)_.skip.indexOf(e)<0&&(d[_.prop(e)]=c[e]);return d},skip:"bubbles cancelable detail type".split(" "),prop:function(a){return a},parse:function(a,b){return _.properties.forEach(function(c){a=a.replace(c[0],function(){return c[1].apply(b,arguments)||""})}),a?b.type=a:a},properties:[[/^_/,function(){this.bubbles=!1}],[/^\!/,function(){this._protect=!0}],[/\((.*)\)/,function(a,b){try{this.detail=_.resolve(b)||JSON.parse(b)}catch(c){this.detail=b}}],[/#(\w+)/g,function(a,b){(this.tags||(this.tags=[])).push(b),this[b]=!0}],[/^(\w+):/,function(a,b){this.category=b}]],splitRE:/ (?![^\(\)]*\))+/g,wrap:function(a,b,c){c=c||1;var d=function(d){var e=_.slice(arguments);d&&"string"!=typeof d||(d=this&&this!==Eventi?this:_.global,e.unshift(d)),e[c]=e[c]?(e[c]+"").split(_.splitRE):[""],e.length>b&&(e[b]=e.slice(b),e=e.slice(0,b+1));var f,g=_[a];if("length"in d&&d!==_.global)for(var h=0,i=d.length;i>h;h++)f=g.apply(e[0]=d[h],e);else f=g.apply(d,e);return void 0===f?this:f};return d.index=c,d}};Eventi._=_,(Eventi.fy=function(a){for(var b in Eventi){var c=Eventi[b];"function"!=typeof c||c.utility||Object.defineProperty(a,b,{value:c,writable:!0,configurable:!0})}return a}).utility=!0,_.fire=function(a,b,c,d){return"object"!=typeof c||c instanceof Event||!("bubbles"in c||"detail"in c||"cancelable"in c)?(void 0!==c&&(d=d?d.unshift(c)&&d:[c]),c={data:d}):c.data=d,_.fireAll(a,b,c)},_.fireAll=function(a,b,c){for(var d,e=0;e<b.length;e++)d=_.create(b[e],c),_.dispatch(a,d);return d},_.dispatch=function(a,b,c){(a.dispatchEvent||a[_key]||_.noop).call(a,b),a.parentObject&&b.bubbles&&!b.propagationStopped&&_.dispatch(a.parentObject,b,!0),!c&&b._singleton&&_.singleton(a,b)},Eventi.fire=_.wrap("fire",3),_.on=function(a,b,c,d,e){"function"==typeof c&&(void 0!==d&&(e=e?e.unshift(d)&&e:[d]),d=c,c=null);for(var f=0,g=b.length;g>f;f++)_.handler(a,b[f],c,d,e)},_.handler=function(a,b,c,d,e){var f={target:a,selector:c,fn:d,data:e,text:b,match:{}};return _.parse(b,f.match),delete f.match.tags,a!==_&&Eventi.fire(_,"handler#new",f),f.fn!==_.noop&&_.handlers(f.target,f.match.type).push(f),f},_.handlers=function(a,b){var c=_.listener(a),d=c.s[b];return d||(d=c.s[b]=[],a.addEventListener&&a.addEventListener(b,c)),d};var _key=_._key="_eventi"+Date.now();if(_.listener=function(a){var b=a[_key];return b||(b=function(a){var c=b.s[a.type];c&&_.handle(a,c)},b.s={},Object.defineProperty(a,_key,{value:b,writeable:!1,configurable:!0})),b},_.handle=function(a,b){for(var c,d,e=0;e<b.length&&!(_.matches(a,(c=b[e]).match)&&(d=_.target(c,a.target))&&(_.execute(d,a,c),a.immediatePropagationStopped));e++);},_.execute=function(a,b,c){var d=[b];b.data&&d.push.apply(d,b.data),c.data&&d.push.apply(d,c.data);try{c.fn.apply(a,d)}catch(e){_.async(function(){throw e})}},_.unhandle=function(a){a.fn=_.noop},_.matches=function(a,b,c){for(var d in b)if(b[d]!==a[d]&&(c||"_"!==d.charAt(0)))return!1;if(c)for(d in a)if("_"===d.charAt(0)&&a[d]!==b[d])return!1;return!0},_.target=function(a,b){return a.selector?_.closest(b,a.selector):a.target},_.closest=function(a,b){for(;a&&a.matches;){if(a.matches(b))return a;a=a.parentNode}},global.Element){var Ep=Element.prototype,aS="atchesSelector";Ep.matches||Object.defineProperty(Ep,"matches",{value:Ep["webkitM"+aS]||Ep["mozM"+aS]||Ep["msM"+aS]})}Eventi.on=_.wrap("on",4),_.version="0.7.0";var sP=Event&&Event.prototype.stopPropagation||_.noop,sIP=Event&&Event.prototype.stopImmediatePropagation||_.noop;CustomEvent.prototype.stopPropagation=function(){this.propagationStopped=!0,sP.call(this)},CustomEvent.prototype.stopImmediatePropagation=function(){this.immediatePropagationStopped=!0,sIP.call(this)};var define=global.define||_.noop;define((global.exports||global).Eventi=Eventi)}(this,this.document); |
@@ -25,3 +25,3 @@ module.exports = function(grunt) { | ||
'src/declare.js', 'src/singleton.js', 'src/key.js', 'src/location.js', | ||
'src/off.js', 'src/until.js', 'src/combo.js', 'src/signal.js'] | ||
'src/off.js', 'src/until.js', 'src/combo.js', 'src/types.js'] | ||
}, | ||
@@ -28,0 +28,0 @@ tall: { |
{ | ||
"name": "eventi", | ||
"title": "Eventi", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"homepage": "https://github.com/nbubna/Eventi", | ||
@@ -47,2 +47,3 @@ "author": { | ||
"fire", | ||
"type", | ||
"listener", | ||
@@ -57,5 +58,5 @@ "handler", | ||
"pubsub", | ||
"signal", | ||
"signals", | ||
"declarative" | ||
] | ||
} |
@@ -33,6 +33,6 @@ # Eventi | ||
* Robust, error tolerant listener execution | ||
* Support for best-practices like "signals" and declarative event mapping | ||
* Support for best-practices like "signals" (aka pre-defined types) and declarative event mapping | ||
* Lots of solid, maintainable test code | ||
* Impressive visual and/or interactive demo (ideas, anyone?) | ||
* Three versions (tall, grande, venti): tall is frame/core/fire/on, grande adds declare/singleton/key/location, venti adds off/until/combo/signal | ||
* Three versions (tall, grande, venti): tall is frame/core/fire/on, grande adds declare/singleton/key/location, venti adds off/until/combo/types | ||
* Venti is the default version to encourage much event-based awesomeness for everyone. | ||
@@ -118,7 +118,7 @@ * Grande includes basic webapp tools. | ||
#### signal.js (requires core) | ||
* provide both global signals and local signals with minimal API | ||
* global: `Eventi.signal('type');` -> `Eventi.on.type([target, ]handler)` | ||
* local (after Eventi.fy(o)): `Eventi.signal(o, 'type', 'type2')` -> `target.until.type2(1, handler)` | ||
* obviously, signals cannot have the same name as Function properties like 'call' or 'length' | ||
#### types.js (requires core) | ||
* provide both global and local type specification with minimal API | ||
* global: `Eventi.types('type');` -> `Eventi.on.type([target, ]handler)` | ||
* local (after Eventi.fy(o)): `Eventi.types(o, 'type', 'type2')` -> `target.until.type2(1, handler)` | ||
* obviously, types cannot have the same name as Function properties like 'call' or 'length' | ||
@@ -139,8 +139,6 @@ | ||
* 2014-03-07 [v0.6.3][] (location events, crucial fixes) | ||
* 2014-03-13 [v0.7.0][] (s/signal/types, crucial fixes) | ||
[v0.5.0]: https://github.com/nbubna/Eventi/tree/0.5.0 | ||
[v0.6.3]: https://github.com/nbubna/Eventi/tree/0.6.3 | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/nbubna/eventi/trend.png)](https://bitdeli.com/free "Bitdeli Badge") | ||
[v0.7.0]: https://github.com/nbubna/Eventi/tree/0.7.0 |
@@ -55,5 +55,5 @@ if (document) { | ||
if (response) { | ||
response = _.resolve(response, node) || _.resolve(response) || response; | ||
if (typeof response === "function") { | ||
response.call(node, e); | ||
var fn = _.resolve(response, node) || _.resolve(response); | ||
if (typeof fn === "function") { | ||
fn.call(node, e); | ||
} else { | ||
@@ -60,0 +60,0 @@ Eventi.fire(node, response, e); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6308
286949
142