angular-ui-router-anim-in-out
Advanced tools
Comparing version 1.0.0 to 1.0.1
(function() { | ||
'use strict'; | ||
angular.module('anim-in-out', ['ngAnimate']) | ||
.animation('.anim-in-out', ['$rootScope', '$timeout', '$window', | ||
function($rootScope, $timeout, $window) { | ||
return { | ||
enter: function(element, done) { | ||
var sync = $rootScope.$eval(angular.element(element).attr('data-anim-sync')) !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-sync')) : false, | ||
speed = angular.element(element).attr('data-anim-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-speed')) : 1000, | ||
inSpeed = angular.element(element).attr('data-anim-in-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-in-speed')) : speed, | ||
outSpeed = angular.element(element).attr('data-anim-out-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-out-speed')) : speed; | ||
var module = angular.module('hj.animInOut', ['ngAnimate']); | ||
try { | ||
var observer = new MutationObserver(function(mutations) { | ||
observer.disconnect(); | ||
angular.module('anim-in-out', ['hj.animInOut']); | ||
$window.requestAnimationFrame(function() { | ||
$timeout(done, sync ? 0 : outSpeed); | ||
}); | ||
}); | ||
module.animation('.anim-in-out', ['$rootScope', '$timeout', '$window', | ||
function($rootScope, $timeout, $window) { | ||
return { | ||
enter: function(element, done) { | ||
var sync = $rootScope.$eval(angular.element(element).attr('data-anim-sync')) !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-sync')) : false, | ||
speed = angular.element(element).attr('data-anim-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-speed')) : 1000, | ||
inSpeed = angular.element(element).attr('data-anim-in-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-in-speed')) : speed, | ||
outSpeed = angular.element(element).attr('data-anim-out-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-out-speed')) : speed; | ||
observer.observe(element[0], { | ||
attributes: true, | ||
childList: false, | ||
characterData: false | ||
try { | ||
var observer = new MutationObserver(function(mutations) { | ||
observer.disconnect(); | ||
$window.requestAnimationFrame(function() { | ||
$timeout(done, sync ? 0 : outSpeed); | ||
}); | ||
}); | ||
} catch (e) { | ||
$timeout(done, Math.max(100, sync ? 0 : outSpeed)); | ||
} | ||
observer.observe(element[0], { | ||
attributes: true, | ||
childList: false, | ||
characterData: false | ||
}); | ||
angular.element(element).addClass('anim-in-setup'); | ||
} catch (e) { | ||
$timeout(done, Math.max(100, sync ? 0 : outSpeed)); | ||
} | ||
return function(cancelled) { | ||
angular.element(element).removeClass('anim-in-setup'); | ||
angular.element(element).addClass('anim-in'); | ||
angular.element(element).addClass('anim-in-setup'); | ||
if (!cancelled) { | ||
$timeout(function() { | ||
$rootScope.$broadcast('animEnd', element, inSpeed); | ||
return function(cancelled) { | ||
angular.element(element).removeClass('anim-in-setup'); | ||
angular.element(element).addClass('anim-in'); | ||
angular.element(element).removeClass('anim-in'); | ||
}, inSpeed); | ||
} | ||
}; | ||
}, | ||
leave: function(element, done) { | ||
var speed = angular.element(element).attr('data-anim-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-speed')) : 1000, | ||
outSpeed = angular.element(element).attr('data-anim-out-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-out-speed')) : speed; | ||
if (!cancelled) { | ||
$timeout(function() { | ||
$rootScope.$broadcast('animEnd', element, inSpeed); | ||
$rootScope.$broadcast('animStart', element, outSpeed); | ||
angular.element(element).removeClass('anim-in'); | ||
}, inSpeed); | ||
} | ||
}; | ||
}, | ||
leave: function(element, done) { | ||
var speed = angular.element(element).attr('data-anim-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-speed')) : 1000, | ||
outSpeed = angular.element(element).attr('data-anim-out-speed') !== undefined ? $rootScope.$eval(angular.element(element).attr('data-anim-out-speed')) : speed; | ||
try { | ||
var observer = new MutationObserver(function(mutations) { | ||
observer.disconnect(); | ||
$rootScope.$broadcast('animStart', element, outSpeed); | ||
$window.requestAnimationFrame(function() { | ||
angular.element(element).removeClass('anim-out-setup'); | ||
angular.element(element).addClass('anim-out'); | ||
try { | ||
var observer = new MutationObserver(function(mutations) { | ||
observer.disconnect(); | ||
$timeout(done, outSpeed); | ||
}); | ||
}); | ||
$window.requestAnimationFrame(function() { | ||
angular.element(element).removeClass('anim-out-setup'); | ||
angular.element(element).addClass('anim-out'); | ||
observer.observe(element[0], { | ||
attributes: true, | ||
childList: false, | ||
characterData: false | ||
$timeout(done, outSpeed); | ||
}); | ||
}); | ||
} catch (e) { | ||
angular.element(element).removeClass('anim-out-setup'); | ||
angular.element(element).addClass('anim-out'); | ||
observer.observe(element[0], { | ||
attributes: true, | ||
childList: false, | ||
characterData: false | ||
}); | ||
$timeout(done, Math.max(100, outSpeed)); | ||
} | ||
} catch (e) { | ||
angular.element(element).removeClass('anim-out-setup'); | ||
angular.element(element).addClass('anim-out'); | ||
angular.element(element).addClass('anim-out-setup'); | ||
$timeout(done, Math.max(100, outSpeed)); | ||
} | ||
}; | ||
} | ||
]); | ||
angular.element(element).addClass('anim-out-setup'); | ||
} | ||
}; | ||
} | ||
]); | ||
})(); |
{ | ||
"name": "angular-ui-router-anim-in-out", | ||
"description": "Directive for use with ngAnimate and ui-router, providing events between transition phases", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": [ | ||
@@ -6,0 +6,0 @@ "anim-in-out.js", |
{ | ||
"name": "angular-ui-router-anim-in-out", | ||
"version": "1.0.0", | ||
"description": "An animation directive to use with ngAnimate 1.2+ and ui-router", | ||
"main": "anim-in-out.js", | ||
"version": "1.0.1", | ||
"description": "An animation directive to use with ngAnimate 1.2+ and ui-router, providing events between transition phases", | ||
"main": "index.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
317
21731