From a8071b3b64d2c18405c0f48c4a20a892d51de361 Mon Sep 17 00:00:00 2001 From: Guille Paz Date: Mon, 23 Jun 2014 23:59:13 -0300 Subject: [PATCH] Update analytics url. Build version 1.1.3 --- dist/gesturekit.js | 6 +++--- dist/gesturekit.min.js | 2 +- package.json | 2 +- src/Analytics.js | 2 +- src/index.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/gesturekit.js b/dist/gesturekit.js index f692796..6b6d2cf 100644 --- a/dist/gesturekit.js +++ b/dist/gesturekit.js @@ -1,5 +1,5 @@ /*! - * gesturekit.js v1.1.2 + * gesturekit.js v1.1.3 * http://gesturekit.com/ * * Copyright (c) 2014, RoamTouch @@ -13,7 +13,7 @@ * @author Guille Paz */ -var url = 'http://www.gesturekit.com/sdk/sendanalytics/'; +var url = 'http://www.gesturekit.com/dashboard/sdk/sendanalytics/'; /** * Creates a new instance of Analytics. @@ -729,7 +729,7 @@ gesturekit = new Gesturekit(); /** * gesturekit version. */ -gesturekit.version = '1.1.2'; +gesturekit.version = '1.1.3'; // Expose gesturekit module.exports = gesturekit; diff --git a/dist/gesturekit.min.js b/dist/gesturekit.min.js index d496ffa..7efa0a6 100644 --- a/dist/gesturekit.min.js +++ b/dist/gesturekit.min.js @@ -1 +1 @@ -/*! gesturekit.js v1.1.2 http://gesturekit.com/ | Released under the Apache v2 License. */!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.gesturekit=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0?b[0].score:0,count:b.length});var g={json:{device_id:"",platform_id:"pc",gid:gesturekit._options.gid,reports:[]},gid:gesturekit._options.gid,version:1};g.json.reports.push({gestures:c,date:0|(new window.Date).getTime()/1e3}),g.json=JSON.stringify(g.json);for(a in g)f.push(a+"="+g[a]);return f=f.join("&"),e.open("POST",d,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send(f),this},b.exports=c},{}],2:[function(a,b){"use strict";function c(){return this}c.prototype.on=function(a,b,c){return this._eventsCollection=this._eventsCollection||{},b.once=c||!1,void 0===this._eventsCollection[a]&&(this._eventsCollection[a]=[]),this._eventsCollection[a].push(b),this},c.prototype.once=function(a,b){return this.on(a,b,!0),this},c.prototype.off=function(a,b){if(void 0===this._eventsCollection)return this;var c=this._eventsCollection[a];return void 0!==c&&c.forEach(function(a,d){return a===b?(c.splice(d,1),void 0):void 0}),this},c.prototype.getListeners=function(a){return this._eventsCollection[a]},c.prototype.emit=function(){var a,b=Array.prototype.slice.call(arguments,0),c=b.shift(),d=this;return"string"==typeof c&&(c={type:c}),c.target||(c.target=this),void 0!==this._eventsCollection&&void 0!==this._eventsCollection[c.type]&&(a=this._eventsCollection[c.type],a.forEach(function(a){a.apply(d,b),a.once&&d.off(c.type,a)})),this},b.exports=c},{}],3:[function(a,b){"use strict";function c(a){var b;for(b in l)a.hasOwnProperty(b)||(a[b]=l[b]);return a}function d(){return this}var e,f=a("./helpers").inherit,g=a("./Emitter"),h=a("./touchEvents"),i=a("./Recognizer"),j=a("./Analytics"),k=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),l={sensor:window.document.documentElement,enabled:!0,threshold:0},m=!1;f(d,g),d.prototype.init=function(a){return void 0===this.recognizer&&(this._options=c(a||{}),this._threshold=this._options.threshold,this.sensor=this._options.sensor,this._setPointerEvents(),this._enabled=this._options.enabled,new j),this},d.prototype._setPointerEvents=function(){var a=this;return this.recognizer=new i(this._options.gid),this._update=function(){clearTimeout(a._wait),a.recognizer.setPoints(e.touches),a.emit("gesturemotion",e),m=!1},this._captureMotion=function(b){a.emit("pointermove",b),!m&&a._enabled&&(b.preventDefault(),e=b,m=!0,k(a._update))},this.sensor.addEventListener(h.start,function(b){a.emit("pointerstart",b),a._enabled&&(a.recognizer.setPoints(b.touches),a.emit("gesturestart",b))},!1),this.sensor.addEventListener(h.move,a._captureMotion,!1),this.sensor.addEventListener(h.end,function(b){a.emit("pointerend",b),(m||a._enabled)&&(m=!1,a._wait=setTimeout(function(){a.recognizer.recognizeGesture(),a.emit("gestureend",b)},a._threshold))},!1),this},d.prototype.enable=function(){return this._enabled=!0,this.emit("enable"),this},d.prototype.disable=function(){return this._enabled=!1,this.emit("disable"),this},b.exports=d},{"./Analytics":1,"./Emitter":2,"./Recognizer":4,"./helpers":5,"./touchEvents":8}],4:[function(a,b){"use strict";function c(a){return this.gid=a,this.init(),this}var d=a("./pdollar").Pdollar,e=a("./pdollar").Point,f="http://api.gesturekit.com/v1.0/index.php/sdk/getgestures/";c.prototype.init=function(){return this.pointsCollection=[],this.pdollar=new d,this.metadata={},this.loadGestures(),this},c.prototype.loadGestures=function(){var a,b,c=this,d=new XMLHttpRequest;return d.open("GET",f+this.gid),d.onreadystatechange=function(){d.readyState===d.DONE&&(a=d.status,a>=200&&300>a||304===a||0===a?(b=JSON.parse(d.response||d.responseText),c.addGestures(b.gestureset.gestures),gesturekit.emit("load",b)):gesturekit.emit("fail"))},d.send(),this},c.prototype.addGestures=function(a){var b,c,d,f=this;return a.forEach(function(a){b=a.method,c=a.metadata,""!==c&&null!==c&&void 0===f.metadata[b]&&(f.metadata[b]=c),d=[],a.gesture.forEach(function(a){d.push(new e(parseFloat(a.X),parseFloat(a.Y),a.ID))}),f.pdollar.addGesture(b,d)}),this},c.prototype.setPoints=function(a){var b=this;return this._pointers=a.length,[].forEach.call(a,function(a,c){b.pointsCollection.push(new e(a.pageX,a.pageY,c))}),this},c.prototype.processPoints=function(){return this.pointsCollection.sort(function(a,b){return a.ID>b.ID?1:a.IDg;g+=1)k[g]||(i=e(a[m],b[g]),f>i&&(f=i,d=g));k[d]=!0,h=1-(m-c+j)%j/j,l+=h*f,m=(m+1)%j}while(m!==c);return l}function g(a,b){var c,d,e=.5,g=o.floor(o.pow(a.length,1-e)),h=+1/0,i=0,j=a.length;for(i;j>i;i+=g)c=f(a,b.points,i),d=f(b.points,a,i),h=o.min(h,o.min(c,d));return h}function h(a){var b=0,c=1,d=a.length;for(c;d>c;c+=1)a[c].ID===a[c-1].ID&&(b+=e(a[c-1],a[c]));return b}function i(a,b){var d,f,g,i,j=h(a)/(b-1),k=0,l=[a[0]],m=1;for(m;m=j?(f=a[m-1].X+(j-k)/d*(a[m].X-a[m-1].X),g=a[m-1].Y+(j-k)/d*(a[m].Y-a[m-1].Y),i=new c(f,g,a[m].ID),l.push(i),a.splice(m,0,i),k=0):k+=d);return l.length===b-1&&l.push(new c(a[a.length-1].X,a[a.length-1].Y,a[a.length-1].ID)),l}function j(a){var b,d,e,f=0,g=0,h=a.length,i=+1/0,j=-1/0,k=+1/0,l=-1/0,m=[];for(f;h>f;f+=1)i=o.min(i,a[f].X),k=o.min(k,a[f].Y),j=o.max(j,a[f].X),l=o.max(l,a[f].Y);for(b=o.max(j-i,l-k),g;h>g;g+=1)d=(a[g].X-i)/b,e=(a[g].Y-k)/b,m.push(new c(d,e,a[g].ID));return m}function k(a){var b=0,d=0,e=0,f=a.length;for(e;f>e;e+=1)b+=a[e].X,d+=a[e].Y;return b/=f,d/=f,new c(b,d,0)}function l(a,b){var d,e,f=k(a),g=[],h=0,i=a.length;for(h;i>h;h+=1)d=a[h].X+b.X-f.X,e=a[h].Y+b.Y-f.Y,g.push(new c(d,e,a[h].ID));return g}function m(a,b){var c=0,d=0,f=a.length,g=b.length;for(f>g&&(f=g),c;f>c;c+=1)d+=e(a[c],b[c]);return d}function n(){this.pointClouds=[],this.recognize=function(a){a=i(a,p),a=j(a),a=l(a,q);var b,c,d,e,f={name:s,score:t},h=+1/0,k=-1,n=+1/0,u=-1;return this.pointClouds.forEach(function(c,d){b=g(a,c),h>b?(n=h,u=k,h=b,k=d):n>b&&(n=b,u=d)}),-1!==k&&(c=m(a,this.pointClouds[k].points),d=m(a,this.pointClouds[u].points),e=0,c>d?(f.name=this.pointClouds[u].name,e=n):(f.name=this.pointClouds[k].name,e=h),r>=e?f.score=o.max((e-2)/-2,0):f.name=s),f},this.addGesture=function(a,b){this.pointClouds.push(new d(a,b))}}var o=window.Math,p=32,q=new c(0,0,0),r=1.5,s="No match.",t=0;b.exports.Pdollar=n,b.exports.Point=c},{}],8:[function(a,b){"use strict";var c=window.navigator.msPointerEnabled,d={start:c?"MSPointerDown":"touchstart",move:c?"MSPointerMove":"touchmove",end:c?"MSPointerUp":"touchend"};b.exports=d},{}]},{},[6])(6)}); \ No newline at end of file +/*! gesturekit.js v1.1.3 http://gesturekit.com/ | Released under the Apache v2 License. */!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.gesturekit=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0?b[0].score:0,count:b.length});var g={json:{device_id:"",platform_id:"pc",gid:gesturekit._options.gid,reports:[]},gid:gesturekit._options.gid,version:1};g.json.reports.push({gestures:c,date:0|(new window.Date).getTime()/1e3}),g.json=JSON.stringify(g.json);for(a in g)f.push(a+"="+g[a]);return f=f.join("&"),e.open("POST",d,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send(f),this},b.exports=c},{}],2:[function(a,b){"use strict";function c(){return this}c.prototype.on=function(a,b,c){return this._eventsCollection=this._eventsCollection||{},b.once=c||!1,void 0===this._eventsCollection[a]&&(this._eventsCollection[a]=[]),this._eventsCollection[a].push(b),this},c.prototype.once=function(a,b){return this.on(a,b,!0),this},c.prototype.off=function(a,b){if(void 0===this._eventsCollection)return this;var c=this._eventsCollection[a];return void 0!==c&&c.forEach(function(a,d){return a===b?(c.splice(d,1),void 0):void 0}),this},c.prototype.getListeners=function(a){return this._eventsCollection[a]},c.prototype.emit=function(){var a,b=Array.prototype.slice.call(arguments,0),c=b.shift(),d=this;return"string"==typeof c&&(c={type:c}),c.target||(c.target=this),void 0!==this._eventsCollection&&void 0!==this._eventsCollection[c.type]&&(a=this._eventsCollection[c.type],a.forEach(function(a){a.apply(d,b),a.once&&d.off(c.type,a)})),this},b.exports=c},{}],3:[function(a,b){"use strict";function c(a){var b;for(b in l)a.hasOwnProperty(b)||(a[b]=l[b]);return a}function d(){return this}var e,f=a("./helpers").inherit,g=a("./Emitter"),h=a("./touchEvents"),i=a("./Recognizer"),j=a("./Analytics"),k=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),l={sensor:window.document.documentElement,enabled:!0,threshold:0},m=!1;f(d,g),d.prototype.init=function(a){return void 0===this.recognizer&&(this._options=c(a||{}),this._threshold=this._options.threshold,this.sensor=this._options.sensor,this._setPointerEvents(),this._enabled=this._options.enabled,new j),this},d.prototype._setPointerEvents=function(){var a=this;return this.recognizer=new i(this._options.gid),this._update=function(){clearTimeout(a._wait),a.recognizer.setPoints(e.touches),a.emit("gesturemotion",e),m=!1},this._captureMotion=function(b){a.emit("pointermove",b),!m&&a._enabled&&(b.preventDefault(),e=b,m=!0,k(a._update))},this.sensor.addEventListener(h.start,function(b){a.emit("pointerstart",b),a._enabled&&(a.recognizer.setPoints(b.touches),a.emit("gesturestart",b))},!1),this.sensor.addEventListener(h.move,a._captureMotion,!1),this.sensor.addEventListener(h.end,function(b){a.emit("pointerend",b),(m||a._enabled)&&(m=!1,a._wait=setTimeout(function(){a.recognizer.recognizeGesture(),a.emit("gestureend",b)},a._threshold))},!1),this},d.prototype.enable=function(){return this._enabled=!0,this.emit("enable"),this},d.prototype.disable=function(){return this._enabled=!1,this.emit("disable"),this},b.exports=d},{"./Analytics":1,"./Emitter":2,"./Recognizer":4,"./helpers":5,"./touchEvents":8}],4:[function(a,b){"use strict";function c(a){return this.gid=a,this.init(),this}var d=a("./pdollar").Pdollar,e=a("./pdollar").Point,f="http://api.gesturekit.com/v1.0/index.php/sdk/getgestures/";c.prototype.init=function(){return this.pointsCollection=[],this.pdollar=new d,this.metadata={},this.loadGestures(),this},c.prototype.loadGestures=function(){var a,b,c=this,d=new XMLHttpRequest;return d.open("GET",f+this.gid),d.onreadystatechange=function(){d.readyState===d.DONE&&(a=d.status,a>=200&&300>a||304===a||0===a?(b=JSON.parse(d.response||d.responseText),c.addGestures(b.gestureset.gestures),gesturekit.emit("load",b)):gesturekit.emit("fail"))},d.send(),this},c.prototype.addGestures=function(a){var b,c,d,f=this;return a.forEach(function(a){b=a.method,c=a.metadata,""!==c&&null!==c&&void 0===f.metadata[b]&&(f.metadata[b]=c),d=[],a.gesture.forEach(function(a){d.push(new e(parseFloat(a.X),parseFloat(a.Y),a.ID))}),f.pdollar.addGesture(b,d)}),this},c.prototype.setPoints=function(a){var b=this;return this._pointers=a.length,[].forEach.call(a,function(a,c){b.pointsCollection.push(new e(a.pageX,a.pageY,c))}),this},c.prototype.processPoints=function(){return this.pointsCollection.sort(function(a,b){return a.ID>b.ID?1:a.IDg;g+=1)k[g]||(i=e(a[m],b[g]),f>i&&(f=i,d=g));k[d]=!0,h=1-(m-c+j)%j/j,l+=h*f,m=(m+1)%j}while(m!==c);return l}function g(a,b){var c,d,e=.5,g=o.floor(o.pow(a.length,1-e)),h=+1/0,i=0,j=a.length;for(i;j>i;i+=g)c=f(a,b.points,i),d=f(b.points,a,i),h=o.min(h,o.min(c,d));return h}function h(a){var b=0,c=1,d=a.length;for(c;d>c;c+=1)a[c].ID===a[c-1].ID&&(b+=e(a[c-1],a[c]));return b}function i(a,b){var d,f,g,i,j=h(a)/(b-1),k=0,l=[a[0]],m=1;for(m;m=j?(f=a[m-1].X+(j-k)/d*(a[m].X-a[m-1].X),g=a[m-1].Y+(j-k)/d*(a[m].Y-a[m-1].Y),i=new c(f,g,a[m].ID),l.push(i),a.splice(m,0,i),k=0):k+=d);return l.length===b-1&&l.push(new c(a[a.length-1].X,a[a.length-1].Y,a[a.length-1].ID)),l}function j(a){var b,d,e,f=0,g=0,h=a.length,i=+1/0,j=-1/0,k=+1/0,l=-1/0,m=[];for(f;h>f;f+=1)i=o.min(i,a[f].X),k=o.min(k,a[f].Y),j=o.max(j,a[f].X),l=o.max(l,a[f].Y);for(b=o.max(j-i,l-k),g;h>g;g+=1)d=(a[g].X-i)/b,e=(a[g].Y-k)/b,m.push(new c(d,e,a[g].ID));return m}function k(a){var b=0,d=0,e=0,f=a.length;for(e;f>e;e+=1)b+=a[e].X,d+=a[e].Y;return b/=f,d/=f,new c(b,d,0)}function l(a,b){var d,e,f=k(a),g=[],h=0,i=a.length;for(h;i>h;h+=1)d=a[h].X+b.X-f.X,e=a[h].Y+b.Y-f.Y,g.push(new c(d,e,a[h].ID));return g}function m(a,b){var c=0,d=0,f=a.length,g=b.length;for(f>g&&(f=g),c;f>c;c+=1)d+=e(a[c],b[c]);return d}function n(){this.pointClouds=[],this.recognize=function(a){a=i(a,p),a=j(a),a=l(a,q);var b,c,d,e,f={name:s,score:t},h=+1/0,k=-1,n=+1/0,u=-1;return this.pointClouds.forEach(function(c,d){b=g(a,c),h>b?(n=h,u=k,h=b,k=d):n>b&&(n=b,u=d)}),-1!==k&&(c=m(a,this.pointClouds[k].points),d=m(a,this.pointClouds[u].points),e=0,c>d?(f.name=this.pointClouds[u].name,e=n):(f.name=this.pointClouds[k].name,e=h),r>=e?f.score=o.max((e-2)/-2,0):f.name=s),f},this.addGesture=function(a,b){this.pointClouds.push(new d(a,b))}}var o=window.Math,p=32,q=new c(0,0,0),r=1.5,s="No match.",t=0;b.exports.Pdollar=n,b.exports.Point=c},{}],8:[function(a,b){"use strict";var c=window.navigator.msPointerEnabled,d={start:c?"MSPointerDown":"touchstart",move:c?"MSPointerMove":"touchmove",end:c?"MSPointerUp":"touchend"};b.exports=d},{}]},{},[6])(6)}); \ No newline at end of file diff --git a/package.json b/package.json index 658198b..2a3df89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gesturekit", - "version": "1.1.2", + "version": "1.1.3", "description": "A JavaScript library to recognize gestures on web browsers.", "author": "Guille Paz ", "scripts": { diff --git a/src/Analytics.js b/src/Analytics.js index dbe10f7..bf298cc 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -4,7 +4,7 @@ * @author Guille Paz */ -var url = 'http://www.gesturekit.com/sdk/sendanalytics/'; +var url = 'http://www.gesturekit.com/dashboard/sdk/sendanalytics/'; /** * Creates a new instance of Analytics. diff --git a/src/index.js b/src/index.js index 4332597..e993aa5 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ gesturekit = new Gesturekit(); /** * gesturekit version. */ -gesturekit.version = '1.1.2'; +gesturekit.version = '1.1.3'; // Expose gesturekit module.exports = gesturekit; \ No newline at end of file