arnaucube
arnaucube/commonroutesAppPublic Self-hosted repository
commonroutesApp/www/lib/angular-material/modules/js/swipe/swipe.js
www/lib/angular-material/modules/js/swipe/swipe.jsRaw
  1/*!
  2 * Angular Material Design
  3 * https://github.com/angular/material
  4 * @license MIT
  5 * v1.1.1
  6 */
  7(function( window, angular, undefined ){
  8"use strict";
  9
 10/**
 11 * @ngdoc module
 12 * @name material.components.swipe
 13 * @description Swipe module!
 14 */
 15/**
 16 * @ngdoc directive
 17 * @module material.components.swipe
 18 * @name mdSwipeLeft
 19 *
 20 * @restrict A
 21 *
 22 * @description
 23 * The md-swipe-left directive allows you to specify custom behavior when an element is swiped
 24 * left.
 25 *
 26 * @usage
 27 * <hljs lang="html">
 28 * <div md-swipe-left="onSwipeLeft()">Swipe me left!</div>
 29 * </hljs>
 30 */
 31/**
 32 * @ngdoc directive
 33 * @module material.components.swipe
 34 * @name mdSwipeRight
 35 *
 36 * @restrict A
 37 *
 38 * @description
 39 * The md-swipe-right directive allows you to specify custom behavior when an element is swiped
 40 * right.
 41 *
 42 * @usage
 43 * <hljs lang="html">
 44 * <div md-swipe-right="onSwipeRight()">Swipe me right!</div>
 45 * </hljs>
 46 */
 47/**
 48 * @ngdoc directive
 49 * @module material.components.swipe
 50 * @name mdSwipeUp
 51 *
 52 * @restrict A
 53 *
 54 * @description
 55 * The md-swipe-up directive allows you to specify custom behavior when an element is swiped
 56 * up.
 57 *
 58 * @usage
 59 * <hljs lang="html">
 60 * <div md-swipe-up="onSwipeUp()">Swipe me up!</div>
 61 * </hljs>
 62 */
 63/**
 64 * @ngdoc directive
 65 * @module material.components.swipe
 66 * @name mdSwipeDown
 67 *
 68 * @restrict A
 69 *
 70 * @description
 71 * The md-swipe-down directive allows you to specify custom behavior when an element is swiped
 72 * down.
 73 *
 74 * @usage
 75 * <hljs lang="html">
 76 * <div md-swipe-down="onSwipDown()">Swipe me down!</div>
 77 * </hljs>
 78 */
 79
 80angular.module('material.components.swipe', ['material.core'])
 81    .directive('mdSwipeLeft', getDirective('SwipeLeft'))
 82    .directive('mdSwipeRight', getDirective('SwipeRight'))
 83    .directive('mdSwipeUp', getDirective('SwipeUp'))
 84    .directive('mdSwipeDown', getDirective('SwipeDown'));
 85
 86function getDirective(name) {
 87    DirectiveFactory.$inject = ["$parse"];
 88  var directiveName = 'md' + name;
 89  var eventName = '$md.' + name.toLowerCase();
 90
 91  return DirectiveFactory;
 92
 93  /* ngInject */
 94  function DirectiveFactory($parse) {
 95      return { restrict: 'A', link: postLink };
 96      function postLink(scope, element, attr) {
 97        var fn = $parse(attr[directiveName]);
 98        element.on(eventName, function(ev) {
 99          scope.$applyAsync(function() { fn(scope, { $event: ev }); });
100        });
101      }
102    }
103}
104
105
106
107})(window, window.angular);