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

Prototype: Quick, dirty implementation of ad lightboxes #7934

Merged
merged 9 commits into from
Mar 3, 2017

Conversation

alanorozco
Copy link
Member

@alanorozco alanorozco commented Mar 2, 2017

This is not production ready.

This PR corresponds to an in-progress prototype. Using an amp-lightbox in an ad will not pass validation and will not function properly under normal circumstances.

Guarded under amp-lightbox-a4a-proto experiment.

/cc @jasti

Future work

  • Move iframe resizing logic out of the amp-lightbox module.
  • Implement amp-ad-banner extension (design pending).
  • Test fully for scrolling position/use viewport service.
  • Unit tests. The current lightbox implementation does not include any automated tests.

@alanorozco alanorozco requested a review from lannka March 2, 2017 21:50
@@ -0,0 +1,103 @@
<!doctype html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add copyright section

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<html ⚡>
<head>
<meta charset="utf-8">
<title>AMP #0</title>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update title

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

properly under normal circumstances.
-->

<amp-ad-banner layout="fill">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corresponding <script async custom-element="amp-app-banner" src="https://cdn.ampproject.org/v0/amp-app-banner-0.1.js"></script> is not there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amp-ad-banner is unimplemented, so it's not needed. The document is not supposed to validate :)

// fallback.
const iframeDoc = iframe.contentDocument;
const iframeBody = iframeDoc.body;
const adBannerRoot =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this has to be a direct child, use childElementByTag from dom.js

return;
}

if (!isExperimentOn(this.getAmpDoc().win, A4A_PROTOTYPE_EXPERIMENT)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this up before the isInMainDocument to make the experiment completely side-effect free.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return;
}

if (!isExperimentOn(this.getAmpDoc().win, A4A_PROTOTYPE_EXPERIMENT)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And done.

@aghassemi aghassemi merged commit d891043 into ampproject:master Mar 3, 2017
@alanorozco alanorozco deleted the ad-lightbox-proto branch March 13, 2017 00:08
kmh287 pushed a commit to kmh287/amphtml that referenced this pull request Mar 13, 2017
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants