{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/50326834","id":50326834,"diff_hunk":"@@ -0,0 +1,265 @@\n+const ALLOW_WILDCARD = '.*';\n+const DEFAULT_MESSAGE_NAMESPACE = '.postMessage';\n+const DEFAULT_POSTMESSAGE_OPTIONS = {\n+  targetOrigin: '*',\n+};\n+const RE_HAS_NAMESPACE = /\\..+$/;\n+\n+let allowedOrigins = [ALLOW_WILDCARD];\n+let re_postMessageAllowedOrigin = compileOriginRegExp(allowedOrigins);\n+let messageNamespaces = [DEFAULT_MESSAGE_NAMESPACE];\n+let re_messageNamespaces = compileNamespaceRegExp(messageNamespaces);\n+let proxies = {};\n+let listening = false;\n+\n+function receiveMessage(e) {\n+  if (e.origin !== global.location.origin &&\n+      !re_postMessageAllowedOrigin.test(e.origin)\n+      && e.origin !== 'null') {\n+    return;\n+  }\n+\n+  try {\n+    let message = JSON.parse(e.data);\n+    let type = message.type;\n+\n+    // Namespace doesn't match, ignore\n+    if (!re_messageNamespaces.test(type)) {\n+      return;\n+    }\n+\n+    let namespace = type.split('.', 2)[1];\n+\n+    if (proxies[namespace]) {\n+      const proxyWith = proxies[namespace];\n+\n+      proxyWith.targets.forEach(function(target) {\n+        frames.postMessage(target, type, message.data, message.options);\n+      });\n+    }\n+\n+    const customEvent = new CustomEvent(type, {detail: message.data});\n+    customEvent.source = e.source;\n+\n+    global.dispatchEvent(customEvent);\n+  } catch (x) {}\n+}\n+\n+function _addEventListener(type, handler, useCapture) {\n+  if (global.addEventListener) {\n+    global.addEventListener(type, handler, useCapture);\n+  } else if (global.attachEvent) {\n+    global.attachEvent(`on${type}`, handler);\n+  }\n+}\n+\n+function _removeEventListener(type, handler, useCapture) {\n+  if (global.removeEventListener) {\n+    global.removeEventListener(type, handler);\n+  } else if (global.detachEvent) {\n+    global.attachEvent(`on${type}`, handler);\n+  }\n+}\n+\n+\n+function compileOriginRegExp(origins) {\n+  return new RegExp('^http(s)?:\\\\/\\\\/' + origins.join('|') + '$', 'i');\n+}\n+\n+function compileNamespaceRegExp(namespaces) {\n+  return new RegExp('\\\\.(?:' + namespaces.join('|') + ')$')\n+}\n+\n+function isWildcard(origin) {\n+  return /\\*/.test(origin);\n+}\n+\n+\n+/** @module frames */\n+/* @example\n+ * // parent window\n+ * // frames.listen('dfp')\n+ * // frames.receiveMessageOnce('init.dfp', callback)\n+ * @example\n+ * // iframe\n+ * // frames.postMessage(window.parent, 'init.dfp', data);\n+ */\n+const frames = {\n+  /*\n+   * Send a message to another window.\n+   * param {Window} target The frame to deliver the message to.\n+   * param {String} type The message type. (if it doesn't include a namespace\n+      the default namespace will be used)\n+   * param {Object} data The data to send.\n+   * param {Object} options The `postMessage` options.\n+   * param {String} options.targetOrigin Specifies what the origin of\n+      otherWindow must be for the event to be dispatched.\n+   */\n+  postMessage: function (target, type, data, options) {\n+    if (!RE_HAS_NAMESPACE.test(type)) {\n+      type += DEFAULT_MESSAGE_NAMESPACE;\n+    }\n+\n+    options = options || {};\n+    for (let key in DEFAULT_POSTMESSAGE_OPTIONS) {\n+      if (!options.hasOwnProperty(key)) {\n+        options[key] = DEFAULT_POSTMESSAGE_OPTIONS[key];\n+      }\n+    }\n+\n+    target.postMessage(JSON.stringify({\n+      type: type,\n+      data: data,\n+      options: options,\n+    }), options.targetOrigin);\n+  },\n+\n+  /*\n+   * Receive a message from another window.\n+   * param {Window} [source] The frame to that send the message.\n+   * param {String} type The message type. (if it doesn't include a namespace\n+      the default namespace will be used)\n+   * param {Function} callback The callback to invoke upon retrieval.\n+   * param {Object} [context=this] The context the callback is invoked with.\n+   * returns {Object} The listener.\n+   */\n+  receiveMessage: function (source, type, callback, context) {\n+    if (typeof source === 'string') {\n+      context = callback;\n+      callback = type;\n+      type = source;\n+      source = null;\n+    }\n+\n+    context = context || this;\n+\n+    let scoped = function(e) {\n+      if (source &&\n+          source !== e.source &&\n+          source.contentWindow !== e.source) {\n+        return;\n+      }\n+\n+      callback.apply(context, arguments);\n+    };\n+\n+    _addEventListener(type, scoped);\n+\n+    return {\n+      off: function() { _removeEventListener(type, scoped); }\n+    };\n+  },\n+\n+","path":"assets/js/frames.es6.js","position":153,"original_position":153,"commit_id":"d6e4d77747fb4f765aa0d72aff30d61e8bc34a5b","original_commit_id":"d6e4d77747fb4f765aa0d72aff30d61e8bc34a5b","user":{"login":"ajacksified","id":175515,"avatar_url":"https://avatars.githubusercontent.com/u/175515?v=3","gravatar_id":"","url":"https://api.github.com/users/ajacksified","html_url":"https://github.com/ajacksified","followers_url":"https://api.github.com/users/ajacksified/followers","following_url":"https://api.github.com/users/ajacksified/following{/other_user}","gists_url":"https://api.github.com/users/ajacksified/gists{/gist_id}","starred_url":"https://api.github.com/users/ajacksified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajacksified/subscriptions","organizations_url":"https://api.github.com/users/ajacksified/orgs","repos_url":"https://api.github.com/users/ajacksified/repos","events_url":"https://api.github.com/users/ajacksified/events{/privacy}","received_events_url":"https://api.github.com/users/ajacksified/received_events","type":"User","site_admin":false},"body":"extra newlines :scream: ","created_at":"2016-01-20T22:03:20Z","updated_at":"2016-01-20T22:03:20Z","html_url":"https://github.com/reddit/reddit-mobile/pull/446#discussion_r50326834","pull_request_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/50326834"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/446#discussion_r50326834"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446","id":56117749,"html_url":"https://github.com/reddit/reddit-mobile/pull/446","diff_url":"https://github.com/reddit/reddit-mobile/pull/446.diff","patch_url":"https://github.com/reddit/reddit-mobile/pull/446.patch","issue_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/446","number":446,"state":"open","locked":false,"title":"GTM: Pass origin and subreddit as data layer variables","user":{"login":"dwick","id":823747,"avatar_url":"https://avatars.githubusercontent.com/u/823747?v=3","gravatar_id":"","url":"https://api.github.com/users/dwick","html_url":"https://github.com/dwick","followers_url":"https://api.github.com/users/dwick/followers","following_url":"https://api.github.com/users/dwick/following{/other_user}","gists_url":"https://api.github.com/users/dwick/gists{/gist_id}","starred_url":"https://api.github.com/users/dwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwick/subscriptions","organizations_url":"https://api.github.com/users/dwick/orgs","repos_url":"https://api.github.com/users/dwick/repos","events_url":"https://api.github.com/users/dwick/events{/privacy}","received_events_url":"https://api.github.com/users/dwick/received_events","type":"User","site_admin":false},"body":":eyeglasses: @ajacksified \r\n\r\nsee ref: https://github.com/reddit/reddit-public/commit/bfd953c1db9d4b24e76a008565186efce782778b\r\n\r\nthis info is needed by comscore.","created_at":"2016-01-15T01:00:03Z","updated_at":"2016-01-20T22:03:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f365eef44c4f57980475c9c9173875d83bcef44f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446/comments","review_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/446/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/d6e4d77747fb4f765aa0d72aff30d61e8bc34a5b","head":{"label":"dwick:gtm-data-layer","ref":"gtm-data-layer","sha":"d6e4d77747fb4f765aa0d72aff30d61e8bc34a5b","user":{"login":"dwick","id":823747,"avatar_url":"https://avatars.githubusercontent.com/u/823747?v=3","gravatar_id":"","url":"https://api.github.com/users/dwick","html_url":"https://github.com/dwick","followers_url":"https://api.github.com/users/dwick/followers","following_url":"https://api.github.com/users/dwick/following{/other_user}","gists_url":"https://api.github.com/users/dwick/gists{/gist_id}","starred_url":"https://api.github.com/users/dwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwick/subscriptions","organizations_url":"https://api.github.com/users/dwick/orgs","repos_url":"https://api.github.com/users/dwick/repos","events_url":"https://api.github.com/users/dwick/events{/privacy}","received_events_url":"https://api.github.com/users/dwick/received_events","type":"User","site_admin":false},"repo":{"id":36387382,"name":"reddit-mobile","full_name":"dwick/reddit-mobile","owner":{"login":"dwick","id":823747,"avatar_url":"https://avatars.githubusercontent.com/u/823747?v=3","gravatar_id":"","url":"https://api.github.com/users/dwick","html_url":"https://github.com/dwick","followers_url":"https://api.github.com/users/dwick/followers","following_url":"https://api.github.com/users/dwick/following{/other_user}","gists_url":"https://api.github.com/users/dwick/gists{/gist_id}","starred_url":"https://api.github.com/users/dwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwick/subscriptions","organizations_url":"https://api.github.com/users/dwick/orgs","repos_url":"https://api.github.com/users/dwick/repos","events_url":"https://api.github.com/users/dwick/events{/privacy}","received_events_url":"https://api.github.com/users/dwick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dwick/reddit-mobile","description":"","fork":true,"url":"https://api.github.com/repos/dwick/reddit-mobile","forks_url":"https://api.github.com/repos/dwick/reddit-mobile/forks","keys_url":"https://api.github.com/repos/dwick/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwick/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwick/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/dwick/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/dwick/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/dwick/reddit-mobile/events","assignees_url":"https://api.github.com/repos/dwick/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/dwick/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/dwick/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/dwick/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwick/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwick/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwick/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwick/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/dwick/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/dwick/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/dwick/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/dwick/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/dwick/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/dwick/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwick/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwick/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwick/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwick/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/dwick/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwick/reddit-mobile/merges","archive_url":"https://api.github.com/repos/dwick/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwick/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/dwick/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/dwick/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/dwick/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/dwick/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwick/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/dwick/reddit-mobile/releases{/id}","created_at":"2015-05-27T18:32:07Z","updated_at":"2015-05-27T18:32:07Z","pushed_at":"2016-01-20T21:45:49Z","git_url":"git://github.com/dwick/reddit-mobile.git","ssh_url":"git@github.com:dwick/reddit-mobile.git","clone_url":"https://github.com/dwick/reddit-mobile.git","svn_url":"https://github.com/dwick/reddit-mobile","homepage":null,"size":2723,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"reddit:master","ref":"master","sha":"62418b3dfff2eb3b8ed5e9681e4bc51f0bde4c17","user":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":23087554,"name":"reddit-mobile","full_name":"reddit/reddit-mobile","owner":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reddit/reddit-mobile","description":"","fork":false,"url":"https://api.github.com/repos/reddit/reddit-mobile","forks_url":"https://api.github.com/repos/reddit/reddit-mobile/forks","keys_url":"https://api.github.com/repos/reddit/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/reddit/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/reddit-mobile/events","assignees_url":"https://api.github.com/repos/reddit/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/reddit/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/reddit/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/reddit/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/reddit/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/reddit/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/reddit-mobile/merges","archive_url":"https://api.github.com/repos/reddit/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/reddit/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/reddit/reddit-mobile/releases{/id}","created_at":"2014-08-18T21:42:05Z","updated_at":"2016-01-17T19:45:47Z","pushed_at":"2016-01-20T22:03:17Z","git_url":"git://github.com/reddit/reddit-mobile.git","ssh_url":"git@github.com:reddit/reddit-mobile.git","clone_url":"https://github.com/reddit/reddit-mobile.git","svn_url":"https://github.com/reddit/reddit-mobile","homepage":null,"size":6294,"stargazers_count":669,"watchers_count":669,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":98,"mirror_url":null,"open_issues_count":17,"forks":98,"open_issues":17,"watchers":669,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/446"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/446"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-mobile/statuses/d6e4d77747fb4f765aa0d72aff30d61e8bc34a5b"}}}}