ember-animated-outlet-mobile
Advanced tools
Comparing version 1.0.5 to 2.0.0
/** | ||
Write me... | ||
@class AnimatedContainerView | ||
@@ -11,3 +11,3 @@ @namespace Ember | ||
classNames: ['ember-animated-container'], | ||
init: function() { | ||
@@ -19,3 +19,3 @@ this._super(); | ||
}, | ||
willDestroy: function() { | ||
@@ -28,3 +28,3 @@ this._super(); | ||
}, | ||
//Override parent method | ||
@@ -114,3 +114,3 @@ _currentViewWillChange: Ember.beforeObserver(function() { | ||
}, | ||
setCurrentViewAnimated: function(currentView, effect) { | ||
@@ -124,6 +124,6 @@ this.enqueueAnimation(effect); | ||
Ember.AnimatedContainerView.reopenClass({ | ||
/** | ||
All animated outlets registers itself in this hash | ||
@private | ||
@@ -144,6 +144,11 @@ @property {Object} _views | ||
Enqueue effects to be executed by the given outlets when the next route transition happens. | ||
@param {Object} animations A hash with keys corresponding to outlet views and values with the desired animation effect. | ||
*/ | ||
enqueueAnimations: function(animations) { | ||
// Animations cause race conditions in testing so we just disable them | ||
if (Ember.testing) { | ||
return; | ||
} | ||
for (var name in animations) { | ||
@@ -166,5 +171,5 @@ if (!animations.hasOwnProperty(name)) continue; | ||
Register a new effect. | ||
The `callback` function will be passed the following parameters: | ||
- The `Ember.AnimatedContainerView` instance. | ||
@@ -551,225 +556,1 @@ - The new view. | ||
})(); | ||
/* | ||
https://github.com/JamesHight/emberjs-touch | ||
Copyright (c) 2012 by: | ||
* James Hight | ||
* | ||
* Update to support ember-animated-outlet by Jake Craige 2013 | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
(function(){ | ||
var touch = { | ||
start: false, // has the touchstart event been triggered and is it still a valid click event? | ||
// starting coordinates of touch event | ||
x: null, | ||
y: null, | ||
enabled: true | ||
}; | ||
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0; | ||
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent); | ||
var fastClick = { | ||
findControl: function(labelElement) { | ||
if (labelElement.control !== undefined) { | ||
return labelElement.control; | ||
} | ||
// All browsers under test that support touch events also support the HTML5 htmlFor attribute | ||
if (labelElement.htmlFor) { | ||
return document.getElementById(labelElement.htmlFor); | ||
} | ||
// If no for attribute exists, attempt to retrieve the first labellable descendant element | ||
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label | ||
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea'); | ||
}, | ||
needsFocus: function(target) { | ||
switch (target.nodeName.toLowerCase()) { | ||
case 'textarea': | ||
return true; | ||
case 'select': | ||
return !deviceIsAndroid; | ||
case 'input': | ||
switch (target.type) { | ||
case 'button': | ||
case 'checkbox': | ||
case 'file': | ||
case 'image': | ||
case 'radio': | ||
case 'submit': | ||
return false; | ||
} | ||
// No point in attempting to focus disabled inputs | ||
return !target.disabled && !target.readOnly; | ||
default: | ||
return (/\bneedsfocus\b/).test(target.className); | ||
} | ||
} | ||
} | ||
// Temporarily disable touch to prevent duplicate clicks | ||
function disableTouch() { | ||
if (touch.enabled) { | ||
touch.enabled = false; | ||
setTimeout(function() { | ||
touch.enabled = true; | ||
}, 400); | ||
} | ||
} | ||
Ember.EventDispatcher.reopen({ | ||
setupHandler: function(rootElement, event, eventName) { | ||
var self = this, | ||
moved; | ||
if (!touch.enabled) return; | ||
var touchHandler = function(evt, triggeringManager) { | ||
// Track touch events to see how far the user's finger has moved | ||
// If it is > 20 it will not trigger a click event | ||
switch(evt.type) { | ||
// Remember our starting point | ||
case 'touchstart': | ||
touch.start = true; | ||
touch.x = evt.originalEvent.touches[0].clientX; | ||
touch.y = evt.originalEvent.touches[0].clientY; | ||
evt.stopPropagation(); | ||
break; | ||
// Monitor touchmove in case the user moves their finger away and then back to the original starting point | ||
case 'touchmove': | ||
if (touch.start) { | ||
moved = Math.max(Math.abs(evt.originalEvent.touches[0].clientX - touch.x), | ||
Math.abs(evt.originalEvent.touches[0].clientY - touch.y)); | ||
if (moved > 20) | ||
touch.start = false; | ||
} | ||
break; | ||
// Check end point | ||
case 'touchend': | ||
if (touch.start) { | ||
moved = Math.max(Math.abs(evt.originalEvent.changedTouches[0].clientX - touch.x), | ||
Math.abs(evt.originalEvent.changedTouches[0].clientY - touch.y)); | ||
var $target = $(evt.target); | ||
if(deviceIsAndroid && $target.is(':input,select')) { | ||
// Android fix for input's and selects | ||
} else if (moved < 20) { | ||
evt.preventDefault(); | ||
evt.stopImmediatePropagation(); | ||
// All tests have passed, trigger click event | ||
if (touch.enabled) { | ||
var control | ||
var type = $target.attr('type'); | ||
var tagName = evt.target.tagName.toLowerCase() | ||
if(tagName === 'label') { | ||
control = $(fastClick.findControl(evt.target)); | ||
if(control.attr('type') == 'checkbox') { | ||
control.prop('checked', !control.prop('checked')).change() | ||
} else { | ||
$(control).focus() | ||
} | ||
} else if(type == 'checkbox') { | ||
$target.prop('checked', !$target.prop('checked')).change() | ||
} else if (!$target.hasClass('needsclick') && fastClick.needsFocus(evt.target)){ | ||
if (deviceIsIOS && evt.target.setSelectionRange && evt.target.type.indexOf('date') !== 0 && evt.target.type !== 'time') { | ||
length = evt.target.value.length; | ||
evt.target.setSelectionRange(length, length); | ||
} else { | ||
evt.target.focus(); | ||
} | ||
} else { | ||
if (document.activeElement && document.activeElement !== evt.target) { | ||
document.activeElement.blur(); | ||
} | ||
$target.click(); | ||
} | ||
} | ||
} | ||
touch.start = false; | ||
} | ||
break; | ||
} | ||
// END touch code | ||
var view = Ember.View.views[this.id], | ||
result = true, manager = null; | ||
manager = self._findNearestEventManager(view,eventName); | ||
if (manager && manager !== triggeringManager) { | ||
if (eventName == 'click') { | ||
if (touch.enabled) | ||
disableTouch(); | ||
else | ||
return false; | ||
} | ||
result = self._dispatchEvent(manager, evt, eventName, view); | ||
} else if (view) { | ||
result = self._bubbleEvent(view,evt,eventName); | ||
} else { | ||
evt.stopPropagation(); | ||
} | ||
return result; | ||
} | ||
rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) { | ||
return touchHandler.call(this, evt, triggeringManager) | ||
}); | ||
rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) { | ||
var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'), | ||
action = Ember.Handlebars.ActionHelper.registeredActions[actionId], | ||
handler = null; | ||
if (action && action.handler && action.eventName === eventName) { | ||
handler = action.handler; | ||
if (touch.enabled) | ||
disableTouch(); | ||
else | ||
return false; | ||
return handler(evt); | ||
} | ||
}); | ||
rootElement.delegate('.animated-link-view', event + '.ember', function(evt, triggeringManager) { | ||
return touchHandler.call(this, evt, triggeringManager) | ||
}); | ||
} | ||
}); | ||
})(); | ||
@@ -1,1 +0,1 @@ | ||
Ember.AnimatedContainerView=Ember.ContainerView.extend({classNames:["ember-animated-container"],init:function(){this._super(),Ember.AnimatedContainerView._views[this.get("name")]=this,this._isAnimating=!1},willDestroy:function(){this._super();var a=this.get("name");delete Ember.AnimatedContainerView._views[a],delete Ember.AnimatedContainerView._animationQueue[a]},_currentViewWillChange:Ember.beforeObserver(function(){var a=Ember.get(this,"currentView");a&&this.set("oldView",a)},"currentView"),_currentViewDidChange:Ember.observer(function(){var a=Ember.get(this,"currentView"),b=Ember.get(this,"oldView"),c=this.get("name"),d=null;a&&(b&&(Ember.assert("Ember.AnimatedContainerView can only animate non-virtual views. You need to explicitly define your view class.",!b.isVirtual),Ember.assert("Ember.AnimatedContainerView can only animate non-virtual views. You need to explicitly define your view class.",!a.isVirtual),d=Ember.AnimatedContainerView._animationQueue[c],delete Ember.AnimatedContainerView._animationQueue[c],d&&!Ember.AnimatedContainerView._effects[d]&&(Ember.warn("Unknown animation effect: "+d),d=null),this.set("oldView",null)),this._queuedAnimation&&(b.destroy(),b=this._queuedAnimation.oldView),this._queuedAnimation={newView:a,oldView:b,effect:d},this._handleAnimationQueue())},"currentView"),_handleAnimationQueue:function(){if(!this._isAnimating){var a=this,b=this._queuedAnimation;if(b){var c=b.newView,d=b.oldView,e=b.effect;this._queuedAnimation=null,this.pushObject(c),d&&e?(this._isAnimating=!0,c.on("didInsertElement",function(){Ember.AnimatedContainerView._effects[e](a,c,d,function(){Em.run(function(){a.removeObject(d),d.destroy(),a._isAnimating=!1,a._handleAnimationQueue()})})})):d&&(this.removeObject(d),d.destroy())}}},enqueueAnimation:function(a){Ember.AnimatedContainerView._animationQueue[this.get("name")]=a},setCurrentViewAnimated:function(a,b){this.enqueueAnimation(b),this.set("currentView",a)}}),Ember.AnimatedContainerView.reopenClass({_views:{},_animationQueue:{},enqueueAnimations:function(a){for(var b in a)a.hasOwnProperty(b)&&(this._animationQueue[b]=a[b])},_effects:{},registerEffect:function(a,b){this._effects[a]=b}}),Handlebars.registerHelper("animated-outlet",function(a,b){var c;for(a&&a.data&&a.data.isRenderData&&(b=a,a="main"),c=b.data.view;!c.get("template.isTop");)c=c.get("_parentView");return b.data.view.set("outletSource",c),b.hash.currentViewBinding="_view.outletSource._outlets."+a,Ember.Handlebars.helpers.view.call(this,Ember.AnimatedContainerView,b)}),Handlebars.registerHelper("animatedOutlet",function(){return Ember.warn("The 'animatedOutlet' view helper is deprecated in favor of 'animated-outlet'"),Ember.Handlebars.helpers["animated-outlet"].apply(this,arguments)});var get=Ember.get,set=Ember.set;Ember.onLoad("Ember.Handlebars",function(){function a(a){var b=get(a,"parameters.params").slice(),c=a.parameters.animations;return b.splice(1,0,c),b}var b=(Ember.Router.resolveParams,Ember.ViewUtils.isSimpleClick),c=Ember.AnimatedLinkView=Ember.LinkView.extend({classNames:["animated-link-view"],_invoke:function(c){if(!b(c))return!0;if(c.preventDefault(),this.bubbles===!1&&c.stopPropagation(),get(this,"_isDisabled"))return!1;if(get(this,"loading"))return Ember.Logger.warn("This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid."),!1;var d=this.get("router"),e=a(this,d);get(this,"replace")?d.replaceWithAnimated.apply(d,e):d.transitionToAnimated.apply(d,e)}});c.toString=function(){return"AnimatedLinkView"},Ember.Handlebars.registerHelper("link-to-animated",function(a){var b=[].slice.call(arguments,-1)[0],d=[].slice.call(arguments,0,-1),e=b.hash;Ember.assert("link-to-animated must contain animations","string"==typeof e.animations);for(var f=/\s*([a-z]+)\s*:\s*([a-z]+)/gi,g={};match=f.exec(e.animations);)g[match[1]]=match[2];return delete e.animations,e.namedRoute=a,e.currentWhen=e.currentWhen||a,e.disabledBinding=e.disabledWhen,e.parameters={context:this,options:b,animations:g,params:d},Ember.Handlebars.helpers.view.call(this,c,b)}),Ember.Handlebars.registerHelper("linkToAnimated",function(){return Ember.warn("The 'linkToAnimated' view helper is deprecated in favor of 'link-to-animated'"),Ember.Handlebars.helpers["link-to-animated"].apply(this,arguments)})}),Ember.Router.reopen({transitionToAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.transitionTo.apply(this,arguments)},replaceWithAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.replaceWith.apply(this,arguments)}}),Ember.Route.reopen({transitionToAnimated:function(){var a=this.router;return a.transitionToAnimated.apply(a,arguments)},replaceWithAnimated:function(){var a=this.router;return a.replaceWithAnimated.apply(a,arguments)}}),Ember.ControllerMixin.reopen({transitionToRouteAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.transitionToRoute.apply(this,arguments)},replaceRouteAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.replaceRoute.apply(this,arguments)}}),Ember.AnimatedContainerView.registerEffect("fade",function(a,b,c,d){var e=b.$(),f=c.$();e.addClass("ember-animated-container-fade-new"),f.addClass("ember-animated-container-fade-old"),setTimeout(function(){f.addClass("ember-animated-container-fade-old-fading"),setTimeout(function(){e.removeClass("ember-animated-container-fade-new"),d()},550)},0)}),Ember.AnimatedContainerView.registerEffect("flip",function(a,b,c,d){var e=a.$(),f=b.$(),g=c.$();e.wrap('<div class="ember-animated-container-flip-wrap"></div>'),e.addClass("ember-animated-container-flip-ct"),f.addClass("ember-animated-container-flip-new"),g.addClass("ember-animated-container-flip-old"),setTimeout(function(){e.addClass("ember-animated-container-flip-ct-flipping"),setTimeout(function(){e.unwrap(),e.removeClass("ember-animated-container-flip-ct"),e.removeClass("ember-animated-container-flip-ct-flipping"),f.removeClass("ember-animated-container-flip-new"),d()},650)},0)}),function(){var a=function(a,b,c,d,e,f){var g=a.$(),h=b.$(),i=f?2050:450;g.addClass("ember-animated-container-slide-"+e+"-ct"),f&&g.addClass("ember-animated-container-slide-slow-ct"),h.addClass("ember-animated-container-slide-"+e+"-new"),setTimeout(function(){g.addClass("ember-animated-container-slide-"+e+"-ct-sliding"),setTimeout(function(){g.removeClass("ember-animated-container-slide-"+e+"-ct"),f&&g.removeClass("ember-animated-container-slide-slow-ct"),g.removeClass("ember-animated-container-slide-"+e+"-ct-sliding"),h.removeClass("ember-animated-container-slide-"+e+"-new"),d()},i)},0)};Ember.AnimatedContainerView.registerEffect("slideLeft",function(b,c,d,e){a(b,c,d,e,"left",!1)}),Ember.AnimatedContainerView.registerEffect("slideRight",function(b,c,d,e){a(b,c,d,e,"right",!1)}),Ember.AnimatedContainerView.registerEffect("slideUp",function(b,c,d,e){a(b,c,d,e,"up",!1)}),Ember.AnimatedContainerView.registerEffect("slideDown",function(b,c,d,e){a(b,c,d,e,"down",!1)}),Ember.AnimatedContainerView.registerEffect("slowSlideLeft",function(b,c,d,e){a(b,c,d,e,"left",!0)}),Ember.AnimatedContainerView.registerEffect("slowSlideRight",function(b,c,d,e){a(b,c,d,e,"right",!0)}),Ember.AnimatedContainerView.registerEffect("slowSlideUp",function(b,c,d,e){a(b,c,d,e,"up",!1)}),Ember.AnimatedContainerView.registerEffect("slowSlideDown",function(b,c,d,e){a(b,c,d,e,"down",!1)})}(),function(){var a=function(a,b,c,d,e){var f=a.$(),g=b.$(),h=450;f.addClass("ember-animated-container-slideOver-old"),g.addClass("ember-animated-container-slideOver-"+e+"-new"),setTimeout(function(){g.addClass("ember-animated-container-slideOver-"+e+"-new-sliding"),setTimeout(function(){g.removeClass("ember-animated-container-slideOver-"+e+"-new"),g.removeClass("ember-animated-container-slideOver-"+e+"-new-sliding"),f.removeClass("ember-animated-container-slideOver-old"),d()},h)},0)};Ember.AnimatedContainerView.registerEffect("slideOverLeft",function(b,c,d,e){a(b,c,d,e,"left")}),Ember.AnimatedContainerView.registerEffect("slideOverRight",function(b,c,d,e){a(b,c,d,e,"right")}),Ember.AnimatedContainerView.registerEffect("slideOverUp",function(b,c,d,e){a(b,c,d,e,"up")}),Ember.AnimatedContainerView.registerEffect("slideOverDown",function(b,c,d,e){a(b,c,d,e,"down")})}(),function(){function a(){b.enabled&&(b.enabled=!1,setTimeout(function(){b.enabled=!0},400))}var b={start:!1,x:null,y:null,enabled:!0},c=navigator.userAgent.indexOf("Android")>0,d=/iP(ad|hone|od)/.test(navigator.userAgent),e={findControl:function(a){return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},needsFocus:function(a){switch(a.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!c;case"input":switch(a.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}}};Ember.EventDispatcher.reopen({setupHandler:function(f,g,h){var i,j=this;if(b.enabled){var k=function(f,g){switch(f.type){case"touchstart":b.start=!0,b.x=f.originalEvent.touches[0].clientX,b.y=f.originalEvent.touches[0].clientY,f.stopPropagation();break;case"touchmove":b.start&&(i=Math.max(Math.abs(f.originalEvent.touches[0].clientX-b.x),Math.abs(f.originalEvent.touches[0].clientY-b.y)),i>20&&(b.start=!1));break;case"touchend":if(b.start){i=Math.max(Math.abs(f.originalEvent.changedTouches[0].clientX-b.x),Math.abs(f.originalEvent.changedTouches[0].clientY-b.y));var k=$(f.target);if(c&&k.is(":input,select"));else if(20>i&&(f.preventDefault(),f.stopImmediatePropagation(),b.enabled)){var l,m=k.attr("type"),n=f.target.tagName.toLowerCase();"label"===n?(l=$(e.findControl(f.target)),"checkbox"==l.attr("type")?l.prop("checked",!l.prop("checked")).change():$(l).focus()):"checkbox"==m?k.prop("checked",!k.prop("checked")).change():!k.hasClass("needsclick")&&e.needsFocus(f.target)?d&&f.target.setSelectionRange&&0!==f.target.type.indexOf("date")&&"time"!==f.target.type?(length=f.target.value.length,f.target.setSelectionRange(length,length)):f.target.focus():(document.activeElement&&document.activeElement!==f.target&&document.activeElement.blur(),k.click())}b.start=!1}}var o=Ember.View.views[this.id],p=!0,q=null;if(q=j._findNearestEventManager(o,h),q&&q!==g){if("click"==h){if(!b.enabled)return!1;a()}p=j._dispatchEvent(q,f,h,o)}else o?p=j._bubbleEvent(o,f,h):f.stopPropagation();return p};f.delegate(".ember-view",g+".ember",function(a,b){return k.call(this,a,b)}),f.delegate("[data-ember-action]",g+".ember",function(c){var d=Ember.$(c.currentTarget).attr("data-ember-action"),e=Ember.Handlebars.ActionHelper.registeredActions[d],f=null;return e&&e.handler&&e.eventName===h?(f=e.handler,b.enabled?(a(),f(c)):!1):void 0}),f.delegate(".animated-link-view",g+".ember",function(a,b){return k.call(this,a,b)})}}})}(); | ||
Ember.AnimatedContainerView=Ember.ContainerView.extend({classNames:["ember-animated-container"],init:function(){this._super(),Ember.AnimatedContainerView._views[this.get("name")]=this,this._isAnimating=!1},willDestroy:function(){this._super();var a=this.get("name");delete Ember.AnimatedContainerView._views[a],delete Ember.AnimatedContainerView._animationQueue[a]},_currentViewWillChange:Ember.beforeObserver(function(){var a=Ember.get(this,"currentView");a&&this.set("oldView",a)},"currentView"),_currentViewDidChange:Ember.observer(function(){var a=Ember.get(this,"currentView"),b=Ember.get(this,"oldView"),c=this.get("name"),d=null;a&&(b&&(Ember.assert("Ember.AnimatedContainerView can only animate non-virtual views. You need to explicitly define your view class.",!b.isVirtual),Ember.assert("Ember.AnimatedContainerView can only animate non-virtual views. You need to explicitly define your view class.",!a.isVirtual),d=Ember.AnimatedContainerView._animationQueue[c],delete Ember.AnimatedContainerView._animationQueue[c],d&&!Ember.AnimatedContainerView._effects[d]&&(Ember.warn("Unknown animation effect: "+d),d=null),this.set("oldView",null)),this._queuedAnimation&&(b.destroy(),b=this._queuedAnimation.oldView),this._queuedAnimation={newView:a,oldView:b,effect:d},this._handleAnimationQueue())},"currentView"),_handleAnimationQueue:function(){if(!this._isAnimating){var a=this,b=this._queuedAnimation;if(b){var c=b.newView,d=b.oldView,e=b.effect;this._queuedAnimation=null,this.pushObject(c),d&&e?(this._isAnimating=!0,c.on("didInsertElement",function(){Ember.AnimatedContainerView._effects[e](a,c,d,function(){Em.run(function(){a.removeObject(d),d.destroy(),a._isAnimating=!1,a._handleAnimationQueue()})})})):d&&(this.removeObject(d),d.destroy())}}},enqueueAnimation:function(a){Ember.AnimatedContainerView._animationQueue[this.get("name")]=a},setCurrentViewAnimated:function(a,b){this.enqueueAnimation(b),this.set("currentView",a)}}),Ember.AnimatedContainerView.reopenClass({_views:{},_animationQueue:{},enqueueAnimations:function(a){if(!Ember.testing)for(var b in a)a.hasOwnProperty(b)&&(this._animationQueue[b]=a[b])},_effects:{},registerEffect:function(a,b){this._effects[a]=b}}),Handlebars.registerHelper("animated-outlet",function(a,b){var c;for(a&&a.data&&a.data.isRenderData&&(b=a,a="main"),c=b.data.view;!c.get("template.isTop");)c=c.get("_parentView");return b.data.view.set("outletSource",c),b.hash.currentViewBinding="_view.outletSource._outlets."+a,Ember.Handlebars.helpers.view.call(this,Ember.AnimatedContainerView,b)}),Handlebars.registerHelper("animatedOutlet",function(){return Ember.warn("The 'animatedOutlet' view helper is deprecated in favor of 'animated-outlet'"),Ember.Handlebars.helpers["animated-outlet"].apply(this,arguments)});var get=Ember.get,set=Ember.set;Ember.onLoad("Ember.Handlebars",function(){function a(a){var b=get(a,"parameters.params").slice(),c=a.parameters.animations;return b.splice(1,0,c),b}var b=(Ember.Router.resolveParams,Ember.ViewUtils.isSimpleClick),c=Ember.AnimatedLinkView=Ember.LinkView.extend({classNames:["animated-link-view"],_invoke:function(c){if(!b(c))return!0;if(c.preventDefault(),this.bubbles===!1&&c.stopPropagation(),get(this,"_isDisabled"))return!1;if(get(this,"loading"))return Ember.Logger.warn("This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid."),!1;var d=this.get("router"),e=a(this,d);get(this,"replace")?d.replaceWithAnimated.apply(d,e):d.transitionToAnimated.apply(d,e)}});c.toString=function(){return"AnimatedLinkView"},Ember.Handlebars.registerHelper("link-to-animated",function(a){var b=[].slice.call(arguments,-1)[0],d=[].slice.call(arguments,0,-1),e=b.hash;Ember.assert("link-to-animated must contain animations","string"==typeof e.animations);for(var f=/\s*([a-z]+)\s*:\s*([a-z]+)/gi,g={};match=f.exec(e.animations);)g[match[1]]=match[2];return delete e.animations,e.namedRoute=a,e.currentWhen=e.currentWhen||a,e.disabledBinding=e.disabledWhen,e.parameters={context:this,options:b,animations:g,params:d},Ember.Handlebars.helpers.view.call(this,c,b)}),Ember.Handlebars.registerHelper("linkToAnimated",function(){return Ember.warn("The 'linkToAnimated' view helper is deprecated in favor of 'link-to-animated'"),Ember.Handlebars.helpers["link-to-animated"].apply(this,arguments)})}),Ember.Router.reopen({transitionToAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.transitionTo.apply(this,arguments)},replaceWithAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.replaceWith.apply(this,arguments)}}),Ember.Route.reopen({transitionToAnimated:function(){var a=this.router;return a.transitionToAnimated.apply(a,arguments)},replaceWithAnimated:function(){var a=this.router;return a.replaceWithAnimated.apply(a,arguments)}}),Ember.ControllerMixin.reopen({transitionToRouteAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.transitionToRoute.apply(this,arguments)},replaceRouteAnimated:function(a,b){return Ember.AnimatedContainerView.enqueueAnimations(b),Array.prototype.splice.call(arguments,1,1),this.replaceRoute.apply(this,arguments)}}),Ember.AnimatedContainerView.registerEffect("fade",function(a,b,c,d){var e=b.$(),f=c.$();e.addClass("ember-animated-container-fade-new"),f.addClass("ember-animated-container-fade-old"),setTimeout(function(){f.addClass("ember-animated-container-fade-old-fading"),setTimeout(function(){e.removeClass("ember-animated-container-fade-new"),d()},550)},0)}),Ember.AnimatedContainerView.registerEffect("flip",function(a,b,c,d){var e=a.$(),f=b.$(),g=c.$();e.wrap('<div class="ember-animated-container-flip-wrap"></div>'),e.addClass("ember-animated-container-flip-ct"),f.addClass("ember-animated-container-flip-new"),g.addClass("ember-animated-container-flip-old"),setTimeout(function(){e.addClass("ember-animated-container-flip-ct-flipping"),setTimeout(function(){e.unwrap(),e.removeClass("ember-animated-container-flip-ct"),e.removeClass("ember-animated-container-flip-ct-flipping"),f.removeClass("ember-animated-container-flip-new"),d()},650)},0)}),function(){var a=function(a,b,c,d,e,f){var g=a.$(),h=b.$(),i=f?2050:450;g.addClass("ember-animated-container-slide-"+e+"-ct"),f&&g.addClass("ember-animated-container-slide-slow-ct"),h.addClass("ember-animated-container-slide-"+e+"-new"),setTimeout(function(){g.addClass("ember-animated-container-slide-"+e+"-ct-sliding"),setTimeout(function(){g.removeClass("ember-animated-container-slide-"+e+"-ct"),f&&g.removeClass("ember-animated-container-slide-slow-ct"),g.removeClass("ember-animated-container-slide-"+e+"-ct-sliding"),h.removeClass("ember-animated-container-slide-"+e+"-new"),d()},i)},0)};Ember.AnimatedContainerView.registerEffect("slideLeft",function(b,c,d,e){a(b,c,d,e,"left",!1)}),Ember.AnimatedContainerView.registerEffect("slideRight",function(b,c,d,e){a(b,c,d,e,"right",!1)}),Ember.AnimatedContainerView.registerEffect("slideUp",function(b,c,d,e){a(b,c,d,e,"up",!1)}),Ember.AnimatedContainerView.registerEffect("slideDown",function(b,c,d,e){a(b,c,d,e,"down",!1)}),Ember.AnimatedContainerView.registerEffect("slowSlideLeft",function(b,c,d,e){a(b,c,d,e,"left",!0)}),Ember.AnimatedContainerView.registerEffect("slowSlideRight",function(b,c,d,e){a(b,c,d,e,"right",!0)}),Ember.AnimatedContainerView.registerEffect("slowSlideUp",function(b,c,d,e){a(b,c,d,e,"up",!1)}),Ember.AnimatedContainerView.registerEffect("slowSlideDown",function(b,c,d,e){a(b,c,d,e,"down",!1)})}(),function(){var a=function(a,b,c,d,e){var f=a.$(),g=b.$(),h=450;f.addClass("ember-animated-container-slideOver-old"),g.addClass("ember-animated-container-slideOver-"+e+"-new"),setTimeout(function(){g.addClass("ember-animated-container-slideOver-"+e+"-new-sliding"),setTimeout(function(){g.removeClass("ember-animated-container-slideOver-"+e+"-new"),g.removeClass("ember-animated-container-slideOver-"+e+"-new-sliding"),f.removeClass("ember-animated-container-slideOver-old"),d()},h)},0)};Ember.AnimatedContainerView.registerEffect("slideOverLeft",function(b,c,d,e){a(b,c,d,e,"left")}),Ember.AnimatedContainerView.registerEffect("slideOverRight",function(b,c,d,e){a(b,c,d,e,"right")}),Ember.AnimatedContainerView.registerEffect("slideOverUp",function(b,c,d,e){a(b,c,d,e,"up")}),Ember.AnimatedContainerView.registerEffect("slideOverDown",function(b,c,d,e){a(b,c,d,e,"down")})}(); |
@@ -20,3 +20,2 @@ var fs = require('fs'); | ||
'src/js/effects/*.js', | ||
'src/js/ember-fastclick.js' | ||
], | ||
@@ -23,0 +22,0 @@ dest: 'dist/ember-animated-outlet-mobile.js' |
{ | ||
"name": "ember-animated-outlet-mobile", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "Ember Animated Outlet (for mobile) is a plug'n'play module to support animated route transitions in Ember.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/poetic/ember-animated-outlet-mobile", |
@@ -1,3 +0,6 @@ | ||
# Ember Animated Outlet Mobile | ||
## Deprecation notice | ||
We will no longer be maintaining this repo as we will be using [liquid-fire](https://github.com/ef4/liquid-fire) on future projects. | ||
Fork of [Ember Animated Outlet](https://travis-ci.org/billysbilling/ember-animated-outlet) | ||
@@ -8,2 +11,5 @@ | ||
If you need to respond to touch events, please include | ||
[fastclick](https://github.com/ftlabs/fastclick) in your project | ||
15
524604
593