{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/193197924","pull_request_review_id":126122696,"id":193197924,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzE5NzkyNA==","diff_hunk":"@@ -0,0 +1,131 @@\n+/**\n+ * Copyright 2018 The AMP HTML Authors. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS-IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * @fileoverview Embeds the Google Docs viewer\n+ *\n+ * Example:\n+ * <code>\n+ * <amp-drive-viewer\n+ *   layout=\"fixed-height\"\n+ *   src=\"https://www.example.com/my-document.pdf\"\n+ *   height=\"600\">\n+ * </amp-drive-viewer>\n+ * </code>\n+ */\n+\n+import {isExperimentOn} from '../../../src/experiments';\n+import {isLayoutSizeDefined} from '../../../src/layout';\n+import {removeElement} from '../../../src/dom';\n+import {user} from '../../../src/log';\n+\n+export const TAG = 'amp-drive-viewer';\n+\n+const ATTRIBUTES_TO_PROPAGATE = [\n+  'alt',\n+  'title',\n+];\n+\n+const GOOGLE_DOCS_EMBED_RE = /^https?:\\/\\/docs\\.google\\.com.+\\/pub.*\\??/;\n+\n+export class AmpDriveViewer extends AMP.BaseElement {\n+\n+  /** @param {!AmpElement} element */\n+  constructor(element) {\n+    super(element);\n+\n+    /** @private {?Element} */\n+    this.iframe_ = null;\n+  }\n+\n+  /**\n+   * Prefetches and preconnects URLs related to the viewer.\n+   * @param {boolean=} opt_onLayout\n+   * @override\n+   */\n+  preconnectCallback(opt_onLayout) {\n+    this.preconnect.url('https://docs.google.com', opt_onLayout);\n+  }\n+\n+  /** @override */\n+  renderOutsideViewport() {\n+    return false;\n+  }\n+\n+  /** @override */\n+  isLayoutSupported(layout) {\n+    return isLayoutSizeDefined(layout);\n+  }\n+\n+  /** @override */\n+  buildCallback() {\n+    user().assert(\n+        isExperimentOn(this.win, TAG), `Experiment ${TAG} is disabled`);\n+    user().assert(\n+        this.element.getAttribute('src'),\n+        'The src attribute is required for <amp-drive-viewer> %s',\n+        this.element);\n+  }\n+\n+  /** @override */\n+  layoutCallback() {\n+    const iframe = this.element.ownerDocument.createElement('iframe');\n+    this.iframe_ = iframe;\n+\n+    iframe.setAttribute('frameborder', '0');\n+    this.propagateAttributes(ATTRIBUTES_TO_PROPAGATE, iframe);\n+\n+    iframe.src = this.getSrc_(this.element.getAttribute('src'));\n+\n+    this.applyFillContent(iframe);\n+    this.element.appendChild(iframe);\n+    return this.loadPromise(iframe);\n+  }\n+\n+  /**\n+   * Get the iframe source. Google Docs are special cased since they display\n+   * using their own embed URL.\n+   * @param {string} documentUrl\n+   * @return {string} A URL to display a document using the Google Drive viewer.\n+   */\n+  getSrc_(documentUrl) {\n+    if (documentUrl.match(GOOGLE_DOCS_EMBED_RE)) {","path":"extensions/amp-drive-viewer/0.1/amp-drive-viewer.js","position":105,"original_position":105,"commit_id":"14594313798543ff1db520f7046ae2a213a47fd0","original_commit_id":"14594313798543ff1db520f7046ae2a213a47fd0","user":{"login":"aghassemi","id":2099009,"node_id":"MDQ6VXNlcjIwOTkwMDk=","avatar_url":"https://avatars3.githubusercontent.com/u/2099009?v=4","gravatar_id":"","url":"https://api.github.com/users/aghassemi","html_url":"https://github.com/aghassemi","followers_url":"https://api.github.com/users/aghassemi/followers","following_url":"https://api.github.com/users/aghassemi/following{/other_user}","gists_url":"https://api.github.com/users/aghassemi/gists{/gist_id}","starred_url":"https://api.github.com/users/aghassemi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aghassemi/subscriptions","organizations_url":"https://api.github.com/users/aghassemi/orgs","repos_url":"https://api.github.com/users/aghassemi/repos","events_url":"https://api.github.com/users/aghassemi/events{/privacy}","received_events_url":"https://api.github.com/users/aghassemi/received_events","type":"User","site_admin":false},"body":"What happens if `src` is an actual Google Docs Url? (without the embed part. like just https://docs.google.com/document/d/234234) \r\nWould be nice if that works as well.","created_at":"2018-06-05T19:45:09Z","updated_at":"2018-06-05T19:49:16Z","html_url":"https://github.com/ampproject/amphtml/pull/15824#discussion_r193197924","pull_request_url":"https://api.github.com/repos/ampproject/amphtml/pulls/15824","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/193197924"},"html":{"href":"https://github.com/ampproject/amphtml/pull/15824#discussion_r193197924"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/15824"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/15824","id":192567068,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNTY3MDY4","html_url":"https://github.com/ampproject/amphtml/pull/15824","diff_url":"https://github.com/ampproject/amphtml/pull/15824.diff","patch_url":"https://github.com/ampproject/amphtml/pull/15824.patch","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/15824","number":15824,"state":"open","locked":false,"title":"✨Create amp-drive-viewer behind experiment","user":{"login":"cvializ","id":2363700,"node_id":"MDQ6VXNlcjIzNjM3MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/2363700?v=4","gravatar_id":"","url":"https://api.github.com/users/cvializ","html_url":"https://github.com/cvializ","followers_url":"https://api.github.com/users/cvializ/followers","following_url":"https://api.github.com/users/cvializ/following{/other_user}","gists_url":"https://api.github.com/users/cvializ/gists{/gist_id}","starred_url":"https://api.github.com/users/cvializ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvializ/subscriptions","organizations_url":"https://api.github.com/users/cvializ/orgs","repos_url":"https://api.github.com/users/cvializ/repos","events_url":"https://api.github.com/users/cvializ/events{/privacy}","received_events_url":"https://api.github.com/users/cvializ/received_events","type":"User","site_admin":false},"body":"Related to the conversation on #15775 \r\n\r\nI discovered it not only loads Drive documents and PDFs, but also `.doc` and `.xls` and probably more formats.\r\n\r\nName open to (much) debate ; )","created_at":"2018-06-05T01:17:00Z","updated_at":"2018-06-05T19:49:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[{"login":"nainar","id":7919520,"node_id":"MDQ6VXNlcjc5MTk1MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/7919520?v=4","gravatar_id":"","url":"https://api.github.com/users/nainar","html_url":"https://github.com/nainar","followers_url":"https://api.github.com/users/nainar/followers","following_url":"https://api.github.com/users/nainar/following{/other_user}","gists_url":"https://api.github.com/users/nainar/gists{/gist_id}","starred_url":"https://api.github.com/users/nainar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nainar/subscriptions","organizations_url":"https://api.github.com/users/nainar/orgs","repos_url":"https://api.github.com/users/nainar/repos","events_url":"https://api.github.com/users/nainar/events{/privacy}","received_events_url":"https://api.github.com/users/nainar/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":596633554,"node_id":"MDU6TGFiZWw1OTY2MzM1NTQ=","url":"https://api.github.com/repos/ampproject/amphtml/labels/cla:%20yes","name":"cla: yes","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amphtml/pulls/15824/commits","review_comments_url":"https://api.github.com/repos/ampproject/amphtml/pulls/15824/comments","review_comment_url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/15824/comments","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/14594313798543ff1db520f7046ae2a213a47fd0","head":{"label":"cvializ:feature/amp-pdf","ref":"feature/amp-pdf","sha":"14594313798543ff1db520f7046ae2a213a47fd0","user":{"login":"cvializ","id":2363700,"node_id":"MDQ6VXNlcjIzNjM3MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/2363700?v=4","gravatar_id":"","url":"https://api.github.com/users/cvializ","html_url":"https://github.com/cvializ","followers_url":"https://api.github.com/users/cvializ/followers","following_url":"https://api.github.com/users/cvializ/following{/other_user}","gists_url":"https://api.github.com/users/cvializ/gists{/gist_id}","starred_url":"https://api.github.com/users/cvializ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvializ/subscriptions","organizations_url":"https://api.github.com/users/cvializ/orgs","repos_url":"https://api.github.com/users/cvializ/repos","events_url":"https://api.github.com/users/cvializ/events{/privacy}","received_events_url":"https://api.github.com/users/cvializ/received_events","type":"User","site_admin":false},"repo":{"id":81481773,"node_id":"MDEwOlJlcG9zaXRvcnk4MTQ4MTc3Mw==","name":"amphtml","full_name":"cvializ/amphtml","owner":{"login":"cvializ","id":2363700,"node_id":"MDQ6VXNlcjIzNjM3MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/2363700?v=4","gravatar_id":"","url":"https://api.github.com/users/cvializ","html_url":"https://github.com/cvializ","followers_url":"https://api.github.com/users/cvializ/followers","following_url":"https://api.github.com/users/cvializ/following{/other_user}","gists_url":"https://api.github.com/users/cvializ/gists{/gist_id}","starred_url":"https://api.github.com/users/cvializ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvializ/subscriptions","organizations_url":"https://api.github.com/users/cvializ/orgs","repos_url":"https://api.github.com/users/cvializ/repos","events_url":"https://api.github.com/users/cvializ/events{/privacy}","received_events_url":"https://api.github.com/users/cvializ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cvializ/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":true,"url":"https://api.github.com/repos/cvializ/amphtml","forks_url":"https://api.github.com/repos/cvializ/amphtml/forks","keys_url":"https://api.github.com/repos/cvializ/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvializ/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvializ/amphtml/teams","hooks_url":"https://api.github.com/repos/cvializ/amphtml/hooks","issue_events_url":"https://api.github.com/repos/cvializ/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/cvializ/amphtml/events","assignees_url":"https://api.github.com/repos/cvializ/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/cvializ/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/cvializ/amphtml/tags","blobs_url":"https://api.github.com/repos/cvializ/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvializ/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvializ/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvializ/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvializ/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/cvializ/amphtml/languages","stargazers_url":"https://api.github.com/repos/cvializ/amphtml/stargazers","contributors_url":"https://api.github.com/repos/cvializ/amphtml/contributors","subscribers_url":"https://api.github.com/repos/cvializ/amphtml/subscribers","subscription_url":"https://api.github.com/repos/cvializ/amphtml/subscription","commits_url":"https://api.github.com/repos/cvializ/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvializ/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvializ/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvializ/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvializ/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/cvializ/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvializ/amphtml/merges","archive_url":"https://api.github.com/repos/cvializ/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvializ/amphtml/downloads","issues_url":"https://api.github.com/repos/cvializ/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/cvializ/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/cvializ/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/cvializ/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvializ/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/cvializ/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/cvializ/amphtml/deployments","created_at":"2017-02-09T18:32:30Z","updated_at":"2018-04-18T19:55:57Z","pushed_at":"2018-06-05T01:16:26Z","git_url":"git://github.com/cvializ/amphtml.git","ssh_url":"git@github.com:cvializ/amphtml.git","clone_url":"https://github.com/cvializ/amphtml.git","svn_url":"https://github.com/cvializ/amphtml","homepage":"https://ampproject.org","size":447153,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ampproject:master","ref":"master","sha":"25c220a5e355caae5b388bcd3976e5816fedbf72","user":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":41766002,"node_id":"MDEwOlJlcG9zaXRvcnk0MTc2NjAwMg==","name":"amphtml","full_name":"ampproject/amphtml","owner":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ampproject/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":false,"url":"https://api.github.com/repos/ampproject/amphtml","forks_url":"https://api.github.com/repos/ampproject/amphtml/forks","keys_url":"https://api.github.com/repos/ampproject/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amphtml/teams","hooks_url":"https://api.github.com/repos/ampproject/amphtml/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amphtml/events","assignees_url":"https://api.github.com/repos/ampproject/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amphtml/tags","blobs_url":"https://api.github.com/repos/ampproject/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amphtml/languages","stargazers_url":"https://api.github.com/repos/ampproject/amphtml/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amphtml/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amphtml/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amphtml/subscription","commits_url":"https://api.github.com/repos/ampproject/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amphtml/merges","archive_url":"https://api.github.com/repos/ampproject/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amphtml/downloads","issues_url":"https://api.github.com/repos/ampproject/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amphtml/deployments","created_at":"2015-09-01T22:10:53Z","updated_at":"2018-06-05T18:33:08Z","pushed_at":"2018-06-05T19:42:02Z","git_url":"git://github.com/ampproject/amphtml.git","ssh_url":"git@github.com:ampproject/amphtml.git","clone_url":"https://github.com/ampproject/amphtml.git","svn_url":"https://github.com/ampproject/amphtml","homepage":"https://www.ampproject.org","size":447092,"stargazers_count":11652,"watchers_count":11652,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2424,"mirror_url":null,"archived":false,"open_issues_count":1276,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2424,"open_issues":1276,"watchers":11652,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/15824"},"html":{"href":"https://github.com/ampproject/amphtml/pull/15824"},"issue":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/15824"},"comments":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/15824/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/15824/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/15824/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amphtml/statuses/14594313798543ff1db520f7046ae2a213a47fd0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"aghassemi"}}