{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/55449608","id":55449608,"diff_hunk":"@@ -0,0 +1,163 @@\n+/**\n+ * Copyright 2016 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+import {Layout} from '../../../src/layout';\n+import {assert} from '../../../src/asserts';\n+import {isExperimentOn} from '../../../src/experiments';\n+import {log} from '../../../src/log';\n+\n+/** @const */\n+const EXPERIMENT = 'amp-sidebar';\n+\n+/** @const */\n+const TAG = 'AmpSidebar';\n+\n+const WHITELIST_ = ['AMP-ACCORDION', 'AMP-FIT-TEXT', 'AMP-IMG'];\n+\n+class AmpSidebar extends AMP.BaseElement {\n+\n+  /** @override */\n+  isLayoutSupported(layout) {\n+    return layout == Layout.CONTAINER;\n+  }\n+\n+  /** @override */\n+  buildCallback() {\n+    /** @const @private {boolean} */\n+    this.isExperimentOn_ = isExperimentOn(this.getWin(), EXPERIMENT);\n+\n+    /** @private @const {!Element} */\n+    this.documentElement_ = this.getWin().document.documentElement;\n+\n+    /** @private @const {string} */\n+    this.direction_ = this.element.getAttribute('direction');\n+\n+    /** @private @const {boolean} */\n+    this.hasMask_ = false;\n+\n+    if (this.direction_ != 'left' && this.direction_ != 'right') {\n+      this.element.setAttribute('direction', 'left');\n+    }\n+\n+    if (!this.isExperimentOn_) {\n+      log.warn(TAG, `Experiment ${EXPERIMENT} disabled`);\n+      return;\n+    }\n+    if (!this.checkWhitelist_()) {\n+      return;\n+    }\n+\n+    if (this.documentElement_.classList.contains('amp-sidebar-open')) {\n+      // Create the mask if the sidebar is rendered in open mode.\n+      this.createMask_();\n+    }\n+\n+    this.documentElement_.addEventListener('keydown', event => {","path":"extensions/amp-sidebar/0.1/amp-sidebar.js","position":68,"original_position":68,"commit_id":"f0e3ece08871380a364c2131f00eb844d2ce583d","original_commit_id":"1dc7c934a7c3244b6aa489c11d5909c51ce1967b","user":{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false},"body":"Also need to support history back button, like in lightbox.","created_at":"2016-03-08T23:45:57Z","updated_at":"2016-03-08T23:45:57Z","html_url":"https://github.com/ampproject/amphtml/pull/2461#discussion_r55449608","pull_request_url":"https://api.github.com/repos/ampproject/amphtml/pulls/2461","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/55449608"},"html":{"href":"https://github.com/ampproject/amphtml/pull/2461#discussion_r55449608"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/2461"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/2461","id":61804473,"html_url":"https://github.com/ampproject/amphtml/pull/2461","diff_url":"https://github.com/ampproject/amphtml/pull/2461.diff","patch_url":"https://github.com/ampproject/amphtml/pull/2461.patch","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/2461","number":2461,"state":"open","locked":false,"title":"amp-sidebar","user":{"login":"sriramkrish85","id":1037311,"avatar_url":"https://avatars.githubusercontent.com/u/1037311?v=3","gravatar_id":"","url":"https://api.github.com/users/sriramkrish85","html_url":"https://github.com/sriramkrish85","followers_url":"https://api.github.com/users/sriramkrish85/followers","following_url":"https://api.github.com/users/sriramkrish85/following{/other_user}","gists_url":"https://api.github.com/users/sriramkrish85/gists{/gist_id}","starred_url":"https://api.github.com/users/sriramkrish85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sriramkrish85/subscriptions","organizations_url":"https://api.github.com/users/sriramkrish85/orgs","repos_url":"https://api.github.com/users/sriramkrish85/repos","events_url":"https://api.github.com/users/sriramkrish85/events{/privacy}","received_events_url":"https://api.github.com/users/sriramkrish85/received_events","type":"User","site_admin":false},"body":"https://github.com/ampproject/amphtml/issues/2302","created_at":"2016-03-05T07:23:02Z","updated_at":"2016-03-08T23:45:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9e0b2fce9173688e86fa8ccd530043a4d7bddf4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amphtml/pulls/2461/commits","review_comments_url":"https://api.github.com/repos/ampproject/amphtml/pulls/2461/comments","review_comment_url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/2461/comments","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/f0e3ece08871380a364c2131f00eb844d2ce583d","head":{"label":"sriramkrish85:sidebar","ref":"sidebar","sha":"f0e3ece08871380a364c2131f00eb844d2ce583d","user":{"login":"sriramkrish85","id":1037311,"avatar_url":"https://avatars.githubusercontent.com/u/1037311?v=3","gravatar_id":"","url":"https://api.github.com/users/sriramkrish85","html_url":"https://github.com/sriramkrish85","followers_url":"https://api.github.com/users/sriramkrish85/followers","following_url":"https://api.github.com/users/sriramkrish85/following{/other_user}","gists_url":"https://api.github.com/users/sriramkrish85/gists{/gist_id}","starred_url":"https://api.github.com/users/sriramkrish85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sriramkrish85/subscriptions","organizations_url":"https://api.github.com/users/sriramkrish85/orgs","repos_url":"https://api.github.com/users/sriramkrish85/repos","events_url":"https://api.github.com/users/sriramkrish85/events{/privacy}","received_events_url":"https://api.github.com/users/sriramkrish85/received_events","type":"User","site_admin":false},"repo":{"id":44337813,"name":"amphtml","full_name":"sriramkrish85/amphtml","owner":{"login":"sriramkrish85","id":1037311,"avatar_url":"https://avatars.githubusercontent.com/u/1037311?v=3","gravatar_id":"","url":"https://api.github.com/users/sriramkrish85","html_url":"https://github.com/sriramkrish85","followers_url":"https://api.github.com/users/sriramkrish85/followers","following_url":"https://api.github.com/users/sriramkrish85/following{/other_user}","gists_url":"https://api.github.com/users/sriramkrish85/gists{/gist_id}","starred_url":"https://api.github.com/users/sriramkrish85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sriramkrish85/subscriptions","organizations_url":"https://api.github.com/users/sriramkrish85/orgs","repos_url":"https://api.github.com/users/sriramkrish85/repos","events_url":"https://api.github.com/users/sriramkrish85/events{/privacy}","received_events_url":"https://api.github.com/users/sriramkrish85/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sriramkrish85/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":true,"url":"https://api.github.com/repos/sriramkrish85/amphtml","forks_url":"https://api.github.com/repos/sriramkrish85/amphtml/forks","keys_url":"https://api.github.com/repos/sriramkrish85/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sriramkrish85/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sriramkrish85/amphtml/teams","hooks_url":"https://api.github.com/repos/sriramkrish85/amphtml/hooks","issue_events_url":"https://api.github.com/repos/sriramkrish85/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/sriramkrish85/amphtml/events","assignees_url":"https://api.github.com/repos/sriramkrish85/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/sriramkrish85/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/sriramkrish85/amphtml/tags","blobs_url":"https://api.github.com/repos/sriramkrish85/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sriramkrish85/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sriramkrish85/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/sriramkrish85/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sriramkrish85/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/sriramkrish85/amphtml/languages","stargazers_url":"https://api.github.com/repos/sriramkrish85/amphtml/stargazers","contributors_url":"https://api.github.com/repos/sriramkrish85/amphtml/contributors","subscribers_url":"https://api.github.com/repos/sriramkrish85/amphtml/subscribers","subscription_url":"https://api.github.com/repos/sriramkrish85/amphtml/subscription","commits_url":"https://api.github.com/repos/sriramkrish85/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/sriramkrish85/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/sriramkrish85/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/sriramkrish85/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/sriramkrish85/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/sriramkrish85/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sriramkrish85/amphtml/merges","archive_url":"https://api.github.com/repos/sriramkrish85/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sriramkrish85/amphtml/downloads","issues_url":"https://api.github.com/repos/sriramkrish85/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/sriramkrish85/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/sriramkrish85/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/sriramkrish85/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sriramkrish85/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/sriramkrish85/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/sriramkrish85/amphtml/deployments","created_at":"2015-10-15T18:39:52Z","updated_at":"2016-01-13T02:54:37Z","pushed_at":"2016-03-08T23:41:50Z","git_url":"git://github.com/sriramkrish85/amphtml.git","ssh_url":"git@github.com:sriramkrish85/amphtml.git","clone_url":"https://github.com/sriramkrish85/amphtml.git","svn_url":"https://github.com/sriramkrish85/amphtml","homepage":"https://ampproject.org","size":30740,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ampproject:master","ref":"master","sha":"675e8586dc2ddce7ad60336b6009b892a22a15bd","user":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","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,"name":"amphtml","full_name":"ampproject/amphtml","owner":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","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":"2016-03-08T22:54:48Z","pushed_at":"2016-03-08T23:41:51Z","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://ampproject.org","size":36147,"stargazers_count":6683,"watchers_count":6683,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":809,"mirror_url":null,"open_issues_count":353,"forks":809,"open_issues":353,"watchers":6683,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/2461"},"html":{"href":"https://github.com/ampproject/amphtml/pull/2461"},"issue":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/2461"},"comments":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/2461/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/2461/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/2461/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amphtml/statuses/f0e3ece08871380a364c2131f00eb844d2ce583d"}}}}