{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/47258932","id":47258932,"diff_hunk":"@@ -0,0 +1,231 @@\n+/**\n+ * Copyright 2015 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 {assertHttpsUrl} from '../../../src/url';\n+\n+import {Util} from './util';\n+\n+// Popup options\n+const POP = 'status=no,resizable=yes,scrollbars=yes,' +\n+  'personalbar=no,directories=no,location=no,toolbar=no,' +\n+  'menubar=no,width=900,height=500,left=0,top=0';\n+\n+/*\n+ * Pinterest Pin Widget\n+ * @attr data-url: the source url for the Pin\n+ **/\n+export class PinWidget {\n+\n+  constructor(rootElement) {\n+    AMP.assert(rootElement.getAttribute('data-url'),\n+      'The data-url attribute is required for Pin widgets');\n+    this.element = rootElement;\n+  }\n+\n+  /*\n+   * Override the default href click handling to log and open popup\n+   * @param {Event} evt: the HTML event object\n+   **/\n+  handleClick(evt) {\n+    evt.preventDefault();\n+    const el = evt.target;\n+    const shouldPop = el.getAttribute('data-pin-pop') || false;\n+    const href = el.getAttribute('data-pin-href');\n+    const log = el.getAttribute('data-pin-log');\n+    if (href) {\n+      if (shouldPop) {\n+        window.open(href, '_pinit', POP);\n+      } else {\n+        window.open(`${href}?amp=1&guid=${Util.guid}`, '_blank');\n+      }\n+    }\n+    if (log) {\n+      Util.log('&type=' + log);\n+    }\n+  }\n+\n+  fetchPin() {\n+    const baseUrl = 'https://widgets.pinterest.com/v3/pidgets/pins/info/?';\n+    const query = `pin_ids=${this.pinId}&sub=www&base_scheme=https`;\n+    return Util.fetch(baseUrl + query)\n+      .then(response => {\n+        try {\n+          return response.data[0];\n+        } catch (e) { return null; }\n+      });\n+  }\n+\n+  renderPin(pin) {\n+    // start setting our class name\n+    let className = '-amp-pinterest-embed-pin';\n+    let imgUrl = assertHttpsUrl(pin.images['237x'].url);\n+\n+    // large widgets may come later\n+    if (this.width === 'medium' || this.width === 'large') {\n+      className = className + '-medium';\n+      imgUrl = imgUrl.replace(/237/, '345');\n+      Util.log('&type=pidget&pin_count_medium=1');","path":"extensions/amp-pinterest/0.1/pin-widget.js","position":80,"original_position":80,"commit_id":"c65920e0a9acd821456fcb32e1368dcbec1f432b","original_commit_id":"c65920e0a9acd821456fcb32e1368dcbec1f432b","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":"So, this tracking is done without user action? /cc @cramforce ","created_at":"2015-12-10T17:49:13Z","updated_at":"2015-12-10T17:49:13Z","html_url":"https://github.com/ampproject/amphtml/pull/1119#discussion_r47258932","pull_request_url":"https://api.github.com/repos/ampproject/amphtml/pulls/1119","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/47258932"},"html":{"href":"https://github.com/ampproject/amphtml/pull/1119#discussion_r47258932"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/1119"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/1119","id":53190379,"html_url":"https://github.com/ampproject/amphtml/pull/1119","diff_url":"https://github.com/ampproject/amphtml/pull/1119.diff","patch_url":"https://github.com/ampproject/amphtml/pull/1119.patch","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/1119","number":1119,"state":"open","locked":false,"title":"Reformat architecture and add follow button","user":{"login":"zackargyle","id":3934294,"avatar_url":"https://avatars.githubusercontent.com/u/3934294?v=3","gravatar_id":"","url":"https://api.github.com/users/zackargyle","html_url":"https://github.com/zackargyle","followers_url":"https://api.github.com/users/zackargyle/followers","following_url":"https://api.github.com/users/zackargyle/following{/other_user}","gists_url":"https://api.github.com/users/zackargyle/gists{/gist_id}","starred_url":"https://api.github.com/users/zackargyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackargyle/subscriptions","organizations_url":"https://api.github.com/users/zackargyle/orgs","repos_url":"https://api.github.com/users/zackargyle/repos","events_url":"https://api.github.com/users/zackargyle/events{/privacy}","received_events_url":"https://api.github.com/users/zackargyle/received_events","type":"User","site_admin":false},"body":"This PR is really big, but essentially does 2 things:\r\n\r\n1. Restructure the file architecture to utilize es6 modules.\r\n    - Created pinit-button.js that contains the rendering of Pin It buttons\r\n    - Created util.js that contains cross module helper methods\r\n    - Simplified amp-pinterest.js significantly to just offload to the appropriate component\r\n    - Added documentation\r\n2. Added follow-button.js\r\n\r\nThis is much cleaner within the structure of new ES6 features.\r\n@jparise @kentbrew ","created_at":"2015-12-09T22:50:05Z","updated_at":"2015-12-10T17:49:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"928c61e35eacc216c045c38af606a9a913346ff7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amphtml/pulls/1119/commits","review_comments_url":"https://api.github.com/repos/ampproject/amphtml/pulls/1119/comments","review_comment_url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/1119/comments","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/c65920e0a9acd821456fcb32e1368dcbec1f432b","head":{"label":"zackargyle:arch-and-follow","ref":"arch-and-follow","sha":"c65920e0a9acd821456fcb32e1368dcbec1f432b","user":{"login":"zackargyle","id":3934294,"avatar_url":"https://avatars.githubusercontent.com/u/3934294?v=3","gravatar_id":"","url":"https://api.github.com/users/zackargyle","html_url":"https://github.com/zackargyle","followers_url":"https://api.github.com/users/zackargyle/followers","following_url":"https://api.github.com/users/zackargyle/following{/other_user}","gists_url":"https://api.github.com/users/zackargyle/gists{/gist_id}","starred_url":"https://api.github.com/users/zackargyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackargyle/subscriptions","organizations_url":"https://api.github.com/users/zackargyle/orgs","repos_url":"https://api.github.com/users/zackargyle/repos","events_url":"https://api.github.com/users/zackargyle/events{/privacy}","received_events_url":"https://api.github.com/users/zackargyle/received_events","type":"User","site_admin":false},"repo":{"id":47635648,"name":"amphtml","full_name":"zackargyle/amphtml","owner":{"login":"zackargyle","id":3934294,"avatar_url":"https://avatars.githubusercontent.com/u/3934294?v=3","gravatar_id":"","url":"https://api.github.com/users/zackargyle","html_url":"https://github.com/zackargyle","followers_url":"https://api.github.com/users/zackargyle/followers","following_url":"https://api.github.com/users/zackargyle/following{/other_user}","gists_url":"https://api.github.com/users/zackargyle/gists{/gist_id}","starred_url":"https://api.github.com/users/zackargyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackargyle/subscriptions","organizations_url":"https://api.github.com/users/zackargyle/orgs","repos_url":"https://api.github.com/users/zackargyle/repos","events_url":"https://api.github.com/users/zackargyle/events{/privacy}","received_events_url":"https://api.github.com/users/zackargyle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zackargyle/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":true,"url":"https://api.github.com/repos/zackargyle/amphtml","forks_url":"https://api.github.com/repos/zackargyle/amphtml/forks","keys_url":"https://api.github.com/repos/zackargyle/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zackargyle/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zackargyle/amphtml/teams","hooks_url":"https://api.github.com/repos/zackargyle/amphtml/hooks","issue_events_url":"https://api.github.com/repos/zackargyle/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/zackargyle/amphtml/events","assignees_url":"https://api.github.com/repos/zackargyle/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/zackargyle/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/zackargyle/amphtml/tags","blobs_url":"https://api.github.com/repos/zackargyle/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zackargyle/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zackargyle/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/zackargyle/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zackargyle/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/zackargyle/amphtml/languages","stargazers_url":"https://api.github.com/repos/zackargyle/amphtml/stargazers","contributors_url":"https://api.github.com/repos/zackargyle/amphtml/contributors","subscribers_url":"https://api.github.com/repos/zackargyle/amphtml/subscribers","subscription_url":"https://api.github.com/repos/zackargyle/amphtml/subscription","commits_url":"https://api.github.com/repos/zackargyle/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/zackargyle/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/zackargyle/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/zackargyle/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/zackargyle/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/zackargyle/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zackargyle/amphtml/merges","archive_url":"https://api.github.com/repos/zackargyle/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zackargyle/amphtml/downloads","issues_url":"https://api.github.com/repos/zackargyle/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/zackargyle/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/zackargyle/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/zackargyle/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zackargyle/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/zackargyle/amphtml/releases{/id}","created_at":"2015-12-08T16:49:20Z","updated_at":"2015-12-08T16:49:22Z","pushed_at":"2015-12-10T01:25:15Z","git_url":"git://github.com/zackargyle/amphtml.git","ssh_url":"git@github.com:zackargyle/amphtml.git","clone_url":"https://github.com/zackargyle/amphtml.git","svn_url":"https://github.com/zackargyle/amphtml","homepage":"https://ampproject.org","size":13748,"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":"1277d038cc944e6e29ca28e99ddf3bc2f6f8f51f","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}","created_at":"2015-09-01T22:10:53Z","updated_at":"2015-12-10T17:44:00Z","pushed_at":"2015-12-10T17:40:43Z","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":14993,"stargazers_count":4918,"watchers_count":4918,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":469,"mirror_url":null,"open_issues_count":168,"forks":469,"open_issues":168,"watchers":4918,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/1119"},"html":{"href":"https://github.com/ampproject/amphtml/pull/1119"},"issue":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/1119"},"comments":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/1119/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/1119/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/1119/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amphtml/statuses/c65920e0a9acd821456fcb32e1368dcbec1f432b"}}}}