From 3e8b34be2fdeccf16c8b46f1ee518f970853768d Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Tue, 24 Oct 2017 16:59:48 -0400 Subject: Adding in materialize source and templates --- .../static/materialize/js/jquery.hammer.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/dispatch/static/materialize/js/jquery.hammer.js (limited to 'app/dispatch/static/materialize/js/jquery.hammer.js') diff --git a/app/dispatch/static/materialize/js/jquery.hammer.js b/app/dispatch/static/materialize/js/jquery.hammer.js new file mode 100644 index 0000000..43e4db5 --- /dev/null +++ b/app/dispatch/static/materialize/js/jquery.hammer.js @@ -0,0 +1,33 @@ +(function(factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', 'hammerjs'], factory); + } else if (typeof exports === 'object') { + factory(require('jquery'), require('hammerjs')); + } else { + factory(jQuery, Hammer); + } +}(function($, Hammer) { + function hammerify(el, options) { + var $el = $(el); + if(!$el.data("hammer")) { + $el.data("hammer", new Hammer($el[0], options)); + } + } + + $.fn.hammer = function(options) { + return this.each(function() { + hammerify(this, options); + }); + }; + + // extend the emit method to also trigger jQuery events + Hammer.Manager.prototype.emit = (function(originalEmit) { + return function(type, data) { + originalEmit.call(this, type, data); + $(this.element).trigger({ + type: type, + gesture: data + }); + }; + })(Hammer.Manager.prototype.emit); +})); -- cgit v1.2.3