Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 15 additions & 1 deletion extensions/amp-story/1.0/amp-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import {isPreviewMode} from './embed-mode';
import {isRTL, removeElement} from '#core/dom';
import {parseQueryString} from '#core/types/string/url';
import {
isTransformed,
removeAttributeInMutate,
setAttributeInMutate,
shouldShowStoryUrlInfo,
Expand Down Expand Up @@ -417,12 +418,25 @@ export class AmpStory extends AMP.BaseElement {
if (
isExperimentOn(this.win, 'story-disable-animations-first-page') ||
isPreviewMode(this.win) ||
prefersReducedMotion(this.win)
prefersReducedMotion(this.win) ||
isTransformed(this.getAmpDoc())
) {
Services.performanceFor(this.win).addEnabledExperiment(
'story-disable-animations-first-page'
);
}
// [i-amphtml-version] marks that the style was inlined in the doc server-side.
if (
this.getAmpDoc()
.getRootNode()
.documentElement.querySelector(
'style[amp-extension="amp-story"][i-amphtml-version]'
)
) {
Services.performanceFor(this.win).addEnabledExperiment(
'story-inline-css'
);
}
if (isExperimentOn(this.win, 'story-load-inactive-outside-viewport')) {
Services.performanceFor(this.win).addEnabledExperiment(
'story-load-inactive-outside-viewport'
Expand Down
5 changes: 3 additions & 2 deletions extensions/amp-story/1.0/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
scopedQuerySelector,
scopedQuerySelectorAll,
} from '#core/dom/query';
import {timeStrToMillis, unscaledClientRect} from './utils';
import {isTransformed, timeStrToMillis, unscaledClientRect} from './utils';
import {isExperimentOn} from '#experiments';
import {isPreviewMode} from './embed-mode';

Expand Down Expand Up @@ -548,7 +548,8 @@ export class AnimationManager {

const firstPageAnimationDisabled =
isExperimentOn(ampdoc.win, 'story-disable-animations-first-page') ||
isPreviewMode(ampdoc.win);
isPreviewMode(ampdoc.win) ||
isTransformed(ampdoc);

/** @private @const {bool} */
this.skipAnimations_ =
Expand Down
9 changes: 9 additions & 0 deletions extensions/amp-story/1.0/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,12 @@ export const maybeMakeProxyUrl = (url, ampDoc) => {
);
return loc.origin + '/i/s/' + resolvedRelativeUrl.replace(/https?:\/\//, '');
};

/**
* Whether the document is transformed
* @param {!AmpDoc} ampdoc
* @return {boolean}
*/
export function isTransformed(ampdoc) {
return ampdoc.getRootNode().documentElement.hasAttribute('transformed');
}