{"action":"created","comment":{"url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/comments/179815476","pull_request_review_id":110129999,"id":179815476,"diff_hunk":"@@ -0,0 +1,129 @@\n+var $ = require('streamhub-sdk/jquery');\n+var debug = require('debug');\n+var inherits = require('inherits');\n+var template = require('hgn!streamhub-sdk/content/templates/call-to-action-bar');\n+var actionTemplate = require('hgn!streamhub-sdk/content/templates/call-to-action');\n+var util = require('streamhub-sdk/util');\n+var View = require('streamhub-sdk/view');\n+\n+'use strict';\n+\n+var TOTAL_BAR_MARGIN = 40;\n+var SPACE_BETWEEN_CTAS = 7;\n+var ADDITIONAL_CTA_WIDTH = 36;\n+var CTA_WIDTH = 125;\n+var EFFECTIVE_CTA_WIDTH = CTA_WIDTH + SPACE_BETWEEN_CTAS;\n+\n+/**\n+ * A view that displays a content item's header.\n+ * Includes the avatar, content byline, and source-type logo\n+ * @param opts {Object} A set of options to config the view with\n+ * @param opts.el {HTMLElement} The element in which to render the streamed content\n+ * @param opts.content {Content} The content instance with which to display its header\n+ * @exports streamhub-sdk/views/content-header-view\n+ * @constructor\n+ */\n+var CallToActionBar = function (opts) {\n+  opts = opts || {};\n+  View.call(this, opts);\n+  window.addEventListener('resize', this.render.bind(this));\n+};\n+inherits(CallToActionBar, View);\n+\n+CallToActionBar.prototype.template = template;\n+CallToActionBar.prototype.elTag = 'section';\n+CallToActionBar.prototype.elClass = 'call-to-action-bar';\n+CallToActionBar.prototype.showClass = 'show';\n+CallToActionBar.prototype.popoverSelector = '.call-to-action-popover';\n+CallToActionBar.prototype.buttonIconSelector = '.button-icon';\n+CallToActionBar.prototype.buttonSelector = '.additional-call-to-action-button';\n+CallToActionBar.prototype.buttonClosedClass = 'closed';\n+CallToActionBar.prototype.buttonOpenClass = 'open';\n+CallToActionBar.prototype.contentAttr = 'data-content-id';\n+CallToActionBar.prototype.insightsVerb = 'CustomCtaButtonClick';\n+\n+CallToActionBar.prototype.events = View.prototype.events.extended({}, function (events) {\n+  events['click ' + this.buttonSelector] = this.onButtonClick.bind(this);\n+  events['keyup ' + this.buttonSelector] = this.onButtonClick.bind(this);\n+  events['click a'] = this.onAnchorClick.bind(this);\n+});\n+\n+CallToActionBar.prototype.render = function () {\n+  this.additionalContext = {};\n+\n+  if (!this.opts.content.links.cta || this.opts.content.links.cta.length === 0) {\n+    return;\n+  }\n+\n+  this.additionalContext.ctas = this.opts.content.links.cta.slice();\n+\n+  var parentContentCardEl = this.el.parentElement || document.querySelector('[data-content-id=\"' + this.opts.content.id + '\"]');\n+  var numOfCtas = this.additionalContext.ctas.length;\n+\n+  if (parentContentCardEl) {\n+    var totalWidth = parentContentCardEl.offsetWidth;\n+    var usableWidth = totalWidth - TOTAL_BAR_MARGIN;\n+    var usableSlots = Math.floor(usableWidth / EFFECTIVE_CTA_WIDTH);\n+\n+    this.additionalContext.additionalCTAs = false;\n+\n+    var usedSlots = usableSlots >= numOfCtas ? numOfCtas : usableSlots;\n+    var unusedSlots = usableSlots - usedSlots;\n+\n+    if (numOfCtas > usableSlots) {\n+      var extraSpaceAfterCtasAdded = usableWidth - ((usedSlots * EFFECTIVE_CTA_WIDTH));\n+      if (extraSpaceAfterCtasAdded < ADDITIONAL_CTA_WIDTH) {\n+        usedSlots -= 1;\n+      }\n+      this.additionalContext.additionalCTAs = true;\n+      this.additionalContext.width = (usedSlots * EFFECTIVE_CTA_WIDTH) + ADDITIONAL_CTA_WIDTH;\n+    } else {\n+      this.additionalContext.width = (usedSlots * EFFECTIVE_CTA_WIDTH) - SPACE_BETWEEN_CTAS;\n+    }\n+\n+    this.additionalContext.mainCTAs = this.additionalContext.ctas.splice(0, usedSlots);\n+  }\n+\n+  View.prototype.render.call(this);\n+};\n+\n+CallToActionBar.prototype.onButtonClick = function (e) {\n+  if (e.keyCode === 37 || e.keyCode === 39 || !e.keyCode) {\n+    this.togglePopover();\n+  }\n+};\n+\n+CallToActionBar.prototype.onAnchorClick = function (e) {\n+  if (e.keyCode === 37 || e.keyCode === 39 || !e.keyCode) {\n+    e.preventDefault();\n+    this.$el.trigger('insights:local', { type: this.insightsVerb });\n+    var url = e.target.href;\n+    window.open(url, \"_blank\");\n+  }\n+  return false;\n+}\n+\n+CallToActionBar.prototype.togglePopover = function () {\n+  var popover = this.el.querySelector(this.popoverSelector);\n+  var popoverVisible = popover.className.indexOf(this.showClass) >= 0;\n+  popoverVisible ?\n+    popover.className = popover.className.replace(' ' + this.showClass, '') :\n+    popover.className += ' ' + this.showClass;\n+\n+  var button = this.el.querySelector(this.buttonIconSelector);\n+  button.className = button.className.indexOf(this.buttonOpenClass) >= 0 ?","path":"src/content/views/call-to-action-bar-view.js","position":114,"original_position":114,"commit_id":"20c5d98e4243db654d0f3fc1348c8b5b09511663","original_commit_id":"20c5d98e4243db654d0f3fc1348c8b5b09511663","user":{"login":"markdoten","id":521957,"avatar_url":"https://avatars3.githubusercontent.com/u/521957?v=4","gravatar_id":"","url":"https://api.github.com/users/markdoten","html_url":"https://github.com/markdoten","followers_url":"https://api.github.com/users/markdoten/followers","following_url":"https://api.github.com/users/markdoten/following{/other_user}","gists_url":"https://api.github.com/users/markdoten/gists{/gist_id}","starred_url":"https://api.github.com/users/markdoten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markdoten/subscriptions","organizations_url":"https://api.github.com/users/markdoten/orgs","repos_url":"https://api.github.com/users/markdoten/repos","events_url":"https://api.github.com/users/markdoten/events{/privacy}","received_events_url":"https://api.github.com/users/markdoten/received_events","type":"User","site_admin":false},"body":"jQuery `toggleClass`","created_at":"2018-04-06T16:51:23Z","updated_at":"2018-04-06T16:57:07Z","html_url":"https://github.com/Livefyre/streamhub-sdk/pull/472#discussion_r179815476","pull_request_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/comments/179815476"},"html":{"href":"https://github.com/Livefyre/streamhub-sdk/pull/472#discussion_r179815476"},"pull_request":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472"}}},"pull_request":{"url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472","id":179551251,"html_url":"https://github.com/Livefyre/streamhub-sdk/pull/472","diff_url":"https://github.com/Livefyre/streamhub-sdk/pull/472.diff","patch_url":"https://github.com/Livefyre/streamhub-sdk/pull/472.patch","issue_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/472","number":472,"state":"open","locked":false,"title":"CTA For Card View, FYR-4570, FYR-6002, FYR-5987","user":{"login":"joseph-ross-work","id":3974683,"avatar_url":"https://avatars0.githubusercontent.com/u/3974683?v=4","gravatar_id":"","url":"https://api.github.com/users/joseph-ross-work","html_url":"https://github.com/joseph-ross-work","followers_url":"https://api.github.com/users/joseph-ross-work/followers","following_url":"https://api.github.com/users/joseph-ross-work/following{/other_user}","gists_url":"https://api.github.com/users/joseph-ross-work/gists{/gist_id}","starred_url":"https://api.github.com/users/joseph-ross-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseph-ross-work/subscriptions","organizations_url":"https://api.github.com/users/joseph-ross-work/orgs","repos_url":"https://api.github.com/users/joseph-ross-work/repos","events_url":"https://api.github.com/users/joseph-ross-work/events{/privacy}","received_events_url":"https://api.github.com/users/joseph-ross-work/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-05T01:18:10Z","updated_at":"2018-04-06T16:57:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5671722ca168ca43b5c0aff968a1d3cf079cb22","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472/commits","review_comments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472/comments","review_comment_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/472/comments","statuses_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/statuses/20c5d98e4243db654d0f3fc1348c8b5b09511663","head":{"label":"Livefyre:FYR-6002","ref":"FYR-6002","sha":"20c5d98e4243db654d0f3fc1348c8b5b09511663","user":{"login":"Livefyre","id":404382,"avatar_url":"https://avatars3.githubusercontent.com/u/404382?v=4","gravatar_id":"","url":"https://api.github.com/users/Livefyre","html_url":"https://github.com/Livefyre","followers_url":"https://api.github.com/users/Livefyre/followers","following_url":"https://api.github.com/users/Livefyre/following{/other_user}","gists_url":"https://api.github.com/users/Livefyre/gists{/gist_id}","starred_url":"https://api.github.com/users/Livefyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livefyre/subscriptions","organizations_url":"https://api.github.com/users/Livefyre/orgs","repos_url":"https://api.github.com/users/Livefyre/repos","events_url":"https://api.github.com/users/Livefyre/events{/privacy}","received_events_url":"https://api.github.com/users/Livefyre/received_events","type":"Organization","site_admin":false},"repo":{"id":8787298,"name":"streamhub-sdk","full_name":"Livefyre/streamhub-sdk","owner":{"login":"Livefyre","id":404382,"avatar_url":"https://avatars3.githubusercontent.com/u/404382?v=4","gravatar_id":"","url":"https://api.github.com/users/Livefyre","html_url":"https://github.com/Livefyre","followers_url":"https://api.github.com/users/Livefyre/followers","following_url":"https://api.github.com/users/Livefyre/following{/other_user}","gists_url":"https://api.github.com/users/Livefyre/gists{/gist_id}","starred_url":"https://api.github.com/users/Livefyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livefyre/subscriptions","organizations_url":"https://api.github.com/users/Livefyre/orgs","repos_url":"https://api.github.com/users/Livefyre/repos","events_url":"https://api.github.com/users/Livefyre/events{/privacy}","received_events_url":"https://api.github.com/users/Livefyre/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Livefyre/streamhub-sdk","description":"Build embeddable webapps with Livefyre StreamHub","fork":false,"url":"https://api.github.com/repos/Livefyre/streamhub-sdk","forks_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/forks","keys_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/teams","hooks_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/hooks","issue_events_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/events","assignees_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/tags","blobs_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/languages","stargazers_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/stargazers","contributors_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/contributors","subscribers_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/subscribers","subscription_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/subscription","commits_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/merges","archive_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/downloads","issues_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/deployments","created_at":"2013-03-14T23:01:09Z","updated_at":"2018-04-06T02:46:26Z","pushed_at":"2018-04-06T16:15:55Z","git_url":"git://github.com/Livefyre/streamhub-sdk.git","ssh_url":"git@github.com:Livefyre/streamhub-sdk.git","clone_url":"https://github.com/Livefyre/streamhub-sdk.git","svn_url":"https://github.com/Livefyre/streamhub-sdk","homepage":"","size":7099,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":13,"open_issues":6,"watchers":26,"default_branch":"master"}},"base":{"label":"Livefyre:master","ref":"master","sha":"a0933ae5b6283af8adc00d8a75b059d0f9035863","user":{"login":"Livefyre","id":404382,"avatar_url":"https://avatars3.githubusercontent.com/u/404382?v=4","gravatar_id":"","url":"https://api.github.com/users/Livefyre","html_url":"https://github.com/Livefyre","followers_url":"https://api.github.com/users/Livefyre/followers","following_url":"https://api.github.com/users/Livefyre/following{/other_user}","gists_url":"https://api.github.com/users/Livefyre/gists{/gist_id}","starred_url":"https://api.github.com/users/Livefyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livefyre/subscriptions","organizations_url":"https://api.github.com/users/Livefyre/orgs","repos_url":"https://api.github.com/users/Livefyre/repos","events_url":"https://api.github.com/users/Livefyre/events{/privacy}","received_events_url":"https://api.github.com/users/Livefyre/received_events","type":"Organization","site_admin":false},"repo":{"id":8787298,"name":"streamhub-sdk","full_name":"Livefyre/streamhub-sdk","owner":{"login":"Livefyre","id":404382,"avatar_url":"https://avatars3.githubusercontent.com/u/404382?v=4","gravatar_id":"","url":"https://api.github.com/users/Livefyre","html_url":"https://github.com/Livefyre","followers_url":"https://api.github.com/users/Livefyre/followers","following_url":"https://api.github.com/users/Livefyre/following{/other_user}","gists_url":"https://api.github.com/users/Livefyre/gists{/gist_id}","starred_url":"https://api.github.com/users/Livefyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livefyre/subscriptions","organizations_url":"https://api.github.com/users/Livefyre/orgs","repos_url":"https://api.github.com/users/Livefyre/repos","events_url":"https://api.github.com/users/Livefyre/events{/privacy}","received_events_url":"https://api.github.com/users/Livefyre/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Livefyre/streamhub-sdk","description":"Build embeddable webapps with Livefyre StreamHub","fork":false,"url":"https://api.github.com/repos/Livefyre/streamhub-sdk","forks_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/forks","keys_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/teams","hooks_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/hooks","issue_events_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/events","assignees_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/tags","blobs_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/languages","stargazers_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/stargazers","contributors_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/contributors","subscribers_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/subscribers","subscription_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/subscription","commits_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/merges","archive_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/downloads","issues_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Livefyre/streamhub-sdk/deployments","created_at":"2013-03-14T23:01:09Z","updated_at":"2018-04-06T02:46:26Z","pushed_at":"2018-04-06T16:15:55Z","git_url":"git://github.com/Livefyre/streamhub-sdk.git","ssh_url":"git@github.com:Livefyre/streamhub-sdk.git","clone_url":"https://github.com/Livefyre/streamhub-sdk.git","svn_url":"https://github.com/Livefyre/streamhub-sdk","homepage":"","size":7099,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":13,"open_issues":6,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472"},"html":{"href":"https://github.com/Livefyre/streamhub-sdk/pull/472"},"issue":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/472"},"comments":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/issues/472/comments"},"review_comments":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472/comments"},"review_comment":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/pulls/472/commits"},"statuses":{"href":"https://api.github.com/repos/Livefyre/streamhub-sdk/statuses/20c5d98e4243db654d0f3fc1348c8b5b09511663"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"markdoten"}}