Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Disable inline animation via config param #252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/addtohomescreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ ath.defaults = {
onAdd: null, // when the application is launched the first time from the homescreen (guesstimate)
onPrivate: null, // executed if user is in private mode
privateModeOverride: false, // show the message even in private mode (very rude)
detectHomescreen: false // try to detect if the site has been added to the homescreen (false | true | 'hash' | 'queryString' | 'smartURL')
detectHomescreen: false, // try to detect if the site has been added to the homescreen (false | true | 'hash' | 'queryString' | 'smartURL')
useInlineAnimations: true // enable/disable inline animations. If false the widget will not be animated ( tarnslated from top to bottom for example )
};

// browser info and capability
Expand Down Expand Up @@ -527,9 +528,12 @@ ath.Class.prototype = {
// create the actual message element
this.element = document.createElement('div');
this.element.className = 'ath-container ath-' + ath.OS + ' ath-' + ath.OS + (parseInt(ath.OSVersion) || '') + ' ath-' + (ath.isTablet ? 'tablet' : 'phone');
this.element.style.cssText = '-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0s;-webkit-transition-timing-function:ease-out;transition-property:transform,opacity;transition-duration:0s;transition-timing-function:ease-out;';
this.element.style.webkitTransform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
this.element.style.transform = 'translate3d(0,-' + window.innerHeight + 'px,0)';

if( this.options.useInlineAnimations ) {
this.element.style.cssText = '-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0s;-webkit-transition-timing-function:ease-out;transition-property:transform,opacity;transition-duration:0s;transition-timing-function:ease-out;';
this.element.style.webkitTransform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
this.element.style.transform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
}

// add the application icon
if ( this.options.icon && this.applicationIcon ) {
Expand Down Expand Up @@ -587,13 +591,15 @@ ath.Class.prototype = {
}, 1000);
}

// kick the animation
setTimeout(function () {
that.element.style.webkitTransitionDuration = '1.2s';
that.element.style.transitionDuration = '1.2s';
that.element.style.webkitTransform = 'translate3d(0,0,0)';
that.element.style.transform = 'translate3d(0,0,0)';
}, 0);
if( this.options.useInlineAnimations ) {
// kick the animation
setTimeout(function () {
that.element.style.webkitTransitionDuration = '1.2s';
that.element.style.transitionDuration = '1.2s';
that.element.style.webkitTransform = 'translate3d(0,0,0)';
that.element.style.transform = 'translate3d(0,0,0)';
}, 0);
}

// set the destroy timer
if ( this.options.lifespan ) {
Expand Down