Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the core amp-story component #11511

Merged
merged 27 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fdceda3
Add the core amp-story component
newmuis Sep 29, 2017
2962489
Add TODO LDAP
newmuis Oct 2, 2017
d29cd02
Update amp-story.css
newmuis Oct 2, 2017
da7a048
Update amp-story.js
newmuis Oct 2, 2017
0756948
Fix eslint errors in amp-story.js and add back experiment
newmuis Oct 3, 2017
414ea9f
Fix lint errors in test-amp-story.js
newmuis Oct 3, 2017
fca94da
amp-story.js lint changes
newmuis Oct 3, 2017
353d4a4
Update test-amp-story.js
newmuis Oct 3, 2017
3461012
Update amp-story.js
newmuis Oct 3, 2017
ac58407
Update amp-story.js
newmuis Oct 3, 2017
9a38d84
Add @const where possible.
newmuis Oct 3, 2017
aad4cd6
Add fixes for various integration points that broke during merges.
newmuis Oct 3, 2017
a53e57e
Remove renamed 'AnalyticsTrigger'
newmuis Oct 3, 2017
124432b
Add missing trailing comma to test file
newmuis Oct 3, 2017
6a90554
Update closure type annotations.
newmuis Oct 3, 2017
765c4ba
Remove double nullability indicators
newmuis Oct 3, 2017
1693614
Explicitly import animation typedefs.
newmuis Oct 3, 2017
d2c0584
Update typedefs for animation-types
newmuis Oct 3, 2017
758f8a2
Partial fixes for closure type issues
newmuis Oct 3, 2017
20eb67f
Partial fixes for closure type issues (part 2)
newmuis Oct 4, 2017
73760f6
Partial fixes for closure type issues (part 3)
newmuis Oct 4, 2017
4219fb0
Remove extra whitespace
newmuis Oct 4, 2017
6e988a8
Partial fixes for closure type issues (part 4)
newmuis Oct 4, 2017
06fc986
Fix missing imports and typos
newmuis Oct 4, 2017
f50b638
Fix missing imports and typos
newmuis Oct 4, 2017
2163bea
Fix remaining type issues
newmuis Oct 4, 2017
e6bca32
Skip failing amp-story tests; fix loading screen when no elements req…
newmuis Oct 4, 2017
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
22 changes: 12 additions & 10 deletions extensions/amp-story/0.1/amp-story-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export class AmpStoryPage extends AMP.BaseElement {
constructor(element) {
super(element);

/** @private @const {?AnimationManager} */
/** @private {?AnimationManager} */
this.animationManager_ = null;

/** @private @const {!Array<!PageElement>} */
/** @private {!Array<!PageElement>} */
this.pageElements_ = [];

/** @private {?function()} */
Expand Down Expand Up @@ -215,6 +215,7 @@ export class AmpStoryPage extends AMP.BaseElement {
markPageAsLoaded_() {
this.isLoaded_ = true;
this.element.classList.add(PAGE_LOADED_CLASS_NAME);
this.markPageAsShown_();
this.resolveLoadPromise_();
}

Expand Down Expand Up @@ -248,7 +249,7 @@ export class AmpStoryPage extends AMP.BaseElement {
* @public
*/
calculateLoadStatus() {
if (this.isLoaded_) {
if (this.isLoaded_ || this.pageElements_.length == 0) {
return true;
}

Expand Down Expand Up @@ -451,21 +452,22 @@ export class AmpStoryPage extends AMP.BaseElement {
/**
* Determines whether the specified element is a valid media element for auto-
* advance.
* @param {?Element} el
* @param {?Element} elOrNull
* @param {!function()} callback
* @private
*/
onMediaElementComplete_(el, callback) {
user().assertElement(el, 'ID specified for automatic advance ' +
`does not refer to any element on page '${this.element.id}'.`);
onMediaElementComplete_(elOrNull, callback) {
const el = user().assertElement(elOrNull,
'ID specified for automatic advance does not refer to any element' +
`on page '${this.element.id}'.`);

const mediaElement = this.getMediaElement_(el);
if (mediaElement) {
this.autoAdvanceUnlistenDef_ =
listenOnce(mediaElement, 'ended', callback);
} else if (this.isVideoInterfaceVideo_(el)) {
this.autoAdvanceUnlistenDef_ =
listenOnce(el, VideoEvents.ENDED, callback, /* opt_capture */ true);
listenOnce(el, VideoEvents.ENDED, callback, {capture: true});
} else {
user().error(TAG, `Element with ID ${el.id} is not a media element ` +
'supported for automatic advancement.');
Expand Down Expand Up @@ -602,8 +604,8 @@ export class AmpStoryPage extends AMP.BaseElement {

/**
* Navigates to the next page in the story.
* @param {*} opt_isAutomaticAdvance Whether this navigation was caused by an
* automatic advancement after a timeout.
* @param {boolean} opt_isAutomaticAdvance Whether this navigation was caused
* by an automatic advancement after a timeout.
*/
next(opt_isAutomaticAdvance) {
this.switchTo_(
Expand Down
Loading