From 39df0d7c4d84f9d188c44e7207bdeb45b466b0d2 Mon Sep 17 00:00:00 2001 From: Guille Paz Date: Fri, 30 Oct 2015 16:19:18 -0300 Subject: [PATCH] Builded v0.1.10. --- dist/slideout.js | 18 +++++++++++++----- dist/slideout.min.js | 2 +- index.js | 15 ++++++++++++--- package.json | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/dist/slideout.js b/dist/slideout.js index 3d19bd2..1655815 100644 --- a/dist/slideout.js +++ b/dist/slideout.js @@ -177,7 +177,7 @@ Slideout.prototype._initTouchEvents = function() { * Prevents touchmove event if slideout is moving */ this._preventMove = function(eve) { - if (self._moved) { + if (self._moved || self._opened) { eve.preventDefault(); } }; @@ -251,16 +251,25 @@ Slideout.prototype._initTouchEvents = function() { this.panel.addEventListener(touch.move, this._onTouchMoveFn); }; +/** + * Enable opening the slideout via touch events. + */ Slideout.prototype.enableTouch = function() { this._touch = true; return this; }; +/** + * Disable opening the slideout via touch events. + */ Slideout.prototype.disableTouch = function() { this._touch = false; return this; }; +/** + * Destroy an instance of slideout. + */ Slideout.prototype.destroy = function() { // Close before clean this.close(); @@ -275,8 +284,8 @@ Slideout.prototype.destroy = function() { // Remove methods this.open = this.close = function() {}; - - // Return the instance so it can be easily dereferenced + + // Return the instance so it can be easily dereferenced return this; }; @@ -318,7 +327,6 @@ function decouple(node, event, fn) { } node.addEventListener(event, captureEvent, false); - return captureEvent; } /** @@ -482,4 +490,4 @@ exports["default"] = Emitter; module.exports = exports["default"]; },{}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9kZWNvdXBsZS9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9lbWl0dGVyL2Rpc3QvaW5kZXguan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SBFbWl0dGVyO1xubW9kdWxlLmV4cG9ydHMgPSBleHBvcnRzW1wiZGVmYXVsdFwiXTsiXX0= diff --git a/dist/slideout.min.js b/dist/slideout.min.js index 936a4ef..dd6c893 100644 --- a/dist/slideout.min.js +++ b/dist/slideout.min.js @@ -1 +1 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Slideout=t()}}(function(){var t,e,n;return function i(t,e,n){function o(s,a){if(!e[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!a&&u)return u(s,!0);if(r)return r(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return o(n?n:e)},l,l.exports,i,t,e,n)}return e[s].exports}var r=typeof require=="function"&&require;for(var s=0;st._tolerance?t.open():t.close()}t._moved=false});this.panel.addEventListener(l.move,function(e){if(s||t._preventOpen||typeof e.touches==="undefined"){return}var n=e.touches[0].clientX-t._startOffsetX;var i=t._currentOffsetX=n;if(Math.abs(i)>t._padding){return}if(Math.abs(n)>20){t._opening=true;var o=n*t._orientation;if(t._opened&&o>0||!t._opened&&o<0){return}if(o<=0){i=n+t._padding*t._orientation;t._opening=false}if(!t._moved&&u.className.search("slideout-open")===-1){u.className+=" slideout-open"}t.panel.style[c+"transform"]=t.panel.style.transform="translate3d("+i+"px, 0, 0)";t.emit("translate",i);t._moved=true}})};d.prototype.enableTouch=function(){this._touch=true;return this};d.prototype.disableTouch=function(){this._touch=false;return this};e.exports=d},{decouple:2,emitter:3}],2:[function(t,e,n){"use strict";var i=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();function o(t,e,n){var o,r=false;function s(t){o=t;a()}function a(){if(!r){i(u);r=true}}function u(){n.call(t,o);r=false}t.addEventListener(e,s,false)}e.exports=o},{}],3:[function(t,e,n){"use strict";var i=function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}};n.__esModule=true;var o=function(){function t(){i(this,t)}t.prototype.on=function e(t,n){this._eventCollection=this._eventCollection||{};this._eventCollection[t]=this._eventCollection[t]||[];this._eventCollection[t].push(n);return this};t.prototype.once=function n(t,e){var n=this;function i(){n.off(t,i);e.apply(this,arguments)}i.listener=e;this.on(t,i);return this};t.prototype.off=function o(t,e){var n=undefined;if(!this._eventCollection||!(n=this._eventCollection[t])){return this}n.forEach(function(t,i){if(t===e||t.listener===e){n.splice(i,1)}});if(n.length===0){delete this._eventCollection[t]}return this};t.prototype.emit=function r(t){var e=this;for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;oe._tolerance?e.open():e.close()}e._moved=false};this.panel.addEventListener(f.end,this._onTouchEndFn);this._onTouchMoveFn=function(t){if(r||e._preventOpen||typeof t.touches==="undefined"){return}var n=t.touches[0].clientX-e._startOffsetX;var i=e._currentOffsetX=n;if(Math.abs(i)>e._padding){return}if(Math.abs(n)>20){e._opening=true;var o=n*e._orientation;if(e._opened&&o>0||!e._opened&&o<0){return}if(o<=0){i=n+e._padding*e._orientation;e._opening=false}if(!e._moved&&u.className.search("slideout-open")===-1){u.className+=" slideout-open"}e.panel.style[c+"transform"]=e.panel.style.transform="translate3d("+i+"px, 0, 0)";e.emit("translate",i);e._moved=true}};this.panel.addEventListener(f.move,this._onTouchMoveFn)};d.prototype.enableTouch=function(){this._touch=true;return this};d.prototype.disableTouch=function(){this._touch=false;return this};d.prototype.destroy=function(){this.close();a.removeEventListener(f.move,this._preventMove);this.panel.removeEventListener(f.start,this._resetTouchFn);this.panel.removeEventListener("touchcancel",this._onTouchCancelFn);this.panel.removeEventListener(f.end,this._onTouchEndFn);this.panel.removeEventListener(f.move,this._onTouchMoveFn);a.removeEventListener("scroll",this._onScrollFn);this.open=this.close=function(){};return this};t.exports=d},{decouple:2,emitter:3}],2:[function(e,t,n){"use strict";var i=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();function o(e,t,n){var o,s=false;function r(e){o=e;a()}function a(){if(!s){i(u);s=true}}function u(){n.call(e,o);s=false}e.addEventListener(t,r,false)}t.exports=o},{}],3:[function(e,t,n){"use strict";var i=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}};n.__esModule=true;var o=function(){function e(){i(this,e)}e.prototype.on=function t(e,n){this._eventCollection=this._eventCollection||{};this._eventCollection[e]=this._eventCollection[e]||[];this._eventCollection[e].push(n);return this};e.prototype.once=function n(e,t){var n=this;function i(){n.off(e,i);t.apply(this,arguments)}i.listener=t;this.on(e,i);return this};e.prototype.off=function o(e,t){var n=undefined;if(!this._eventCollection||!(n=this._eventCollection[e])){return this}n.forEach(function(e,i){if(e===t||e.listener===t){n.splice(i,1)}});if(n.length===0){delete this._eventCollection[e]}return this};e.prototype.emit=function s(e){var t=this;for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o", - "version": "0.1.9", + "version": "0.1.10", "scripts": { "build": "node browserify.js", "test": "npm run build && _mocha",