bitcoin-atm
bitcoin atm for pyc inc.
git clone https://9o.is/git/bitcoin-atm.git
ui-bootstrap-tpls.js
(3754B)
1 /*
2 * angular-ui-bootstrap
3 * http://angular-ui.github.io/bootstrap/
4
5 * Version: 0.11.0-SNAPSHOT - 2014-04-03
6 * License: MIT
7 */
8 angular.module("ui.bootstrap", ["ui.bootstrap.bindHtml","ui.bootstrap.transition"]);
9 angular.module('ui.bootstrap.bindHtml', [])
10
11 .directive('bindHtmlUnsafe', function () {
12 return function (scope, element, attr) {
13 element.addClass('ng-binding').data('$binding', attr.bindHtmlUnsafe);
14 scope.$watch(attr.bindHtmlUnsafe, function bindHtmlUnsafeWatchAction(value) {
15 element.html(value || '');
16 });
17 };
18 });
19 angular.module('ui.bootstrap.transition', [])
20
21 /**
22 * $transition service provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete.
23 * @param {DOMElement} element The DOMElement that will be animated.
24 * @param {string|object|function} trigger The thing that will cause the transition to start:
25 * - As a string, it represents the css class to be added to the element.
26 * - As an object, it represents a hash of style attributes to be applied to the element.
27 * - As a function, it represents a function to be called that will cause the transition to occur.
28 * @return {Promise} A promise that is resolved when the transition finishes.
29 */
30 .factory('$transition', ['$q', '$timeout', '$rootScope', function($q, $timeout, $rootScope) {
31
32 var $transition = function(element, trigger, options) {
33 options = options || {};
34 var deferred = $q.defer();
35 var endEventName = $transition[options.animation ? 'animationEndEventName' : 'transitionEndEventName'];
36
37 var transitionEndHandler = function(event) {
38 $rootScope.$apply(function() {
39 element.unbind(endEventName, transitionEndHandler);
40 deferred.resolve(element);
41 });
42 };
43
44 if (endEventName) {
45 element.bind(endEventName, transitionEndHandler);
46 }
47
48 // Wrap in a timeout to allow the browser time to update the DOM before the transition is to occur
49 $timeout(function() {
50 if ( angular.isString(trigger) ) {
51 element.addClass(trigger);
52 } else if ( angular.isFunction(trigger) ) {
53 trigger(element);
54 } else if ( angular.isObject(trigger) ) {
55 element.css(trigger);
56 }
57 //If browser does not support transitions, instantly resolve
58 if ( !endEventName ) {
59 deferred.resolve(element);
60 }
61 });
62
63 // Add our custom cancel function to the promise that is returned
64 // We can call this if we are about to run a new transition, which we know will prevent this transition from ending,
65 // i.e. it will therefore never raise a transitionEnd event for that transition
66 deferred.promise.cancel = function() {
67 if ( endEventName ) {
68 element.unbind(endEventName, transitionEndHandler);
69 }
70 deferred.reject('Transition cancelled');
71 };
72
73 return deferred.promise;
74 };
75
76 // Work out the name of the transitionEnd event
77 var transElement = document.createElement('trans');
78 var transitionEndEventNames = {
79 'WebkitTransition': 'webkitTransitionEnd',
80 'MozTransition': 'transitionend',
81 'OTransition': 'oTransitionEnd',
82 'transition': 'transitionend'
83 };
84 var animationEndEventNames = {
85 'WebkitTransition': 'webkitAnimationEnd',
86 'MozTransition': 'animationend',
87 'OTransition': 'oAnimationEnd',
88 'transition': 'animationend'
89 };
90 function findEndEventName(endEventNames) {
91 for (var name in endEventNames){
92 if (transElement.style[name] !== undefined) {
93 return endEventNames[name];
94 }
95 }
96 }
97 $transition.transitionEndEventName = findEndEventName(transitionEndEventNames);
98 $transition.animationEndEventName = findEndEventName(animationEndEventNames);
99 return $transition;
100 }]);