{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments/30180717","id":30180717,"diff_hunk":"@@ -0,0 +1,177 @@\n+/* ==========================================================================\n+   Youtube Initialization\n+   Used on at least `/the-bureau/`.\n+   ========================================================================== */\n+\n+'use strict';\n+\n+var $ = require( 'jquery' );\n+\n+function init() {\n+  return $( '.youtube-player_container' ).createYoutube();\n+}\n+\n+// Youtube constructor.\n+// @param element {Element} DOM Element.\n+// @param options {Object} Object used to customize Youtube.\n+// Returns {Object} An Youtube instance.\n+function Youtube( element, options ) {\n+  this.$element = $( element );\n+  this.options = $.extend( true, {}, this.defaults, options );\n+  this.init();\n+}\n+\n+// Youtube methods and shared properties\n+Youtube.prototype = {\n+\n+  constructor: Youtube,\n+\n+  defaults: {\n+     playerOptions : {\n+          height: '410',\n+          width: '640',\n+          videoId: 'en0Iq8II4fA',\n+          playerVars: { \n+              'autoplay': 1, \n+              'suggestedQuality': 'highres'\n+          },\n+          events: {\n+              'onReady': $.noop,\n+              'onStateChange': $.noop\n+          }\n+      },\n+      playerInitialized : false\n+  },\n+\n+  _bindAll: function() { \n+    var self = this;\n+    var proxy = $.proxy;\n+\n+    // TODO: Swap this out for Function.bind\n+    // and Object.keys. \n+    $.each( this, function( key, _function ){\n+        if ( $.isFunction( _function ) ) {\n+            self[key] = proxy( _function, self );\n+        }\n+    });\n+  },\n+\n+  _embedScript: function() {\n+      window.onYouTubeIframeAPIReady = this.initPlayer;\n+\n+      var tag = document.createElement('script');\n+      tag.src = \"http://www.youtube.com/iframe_api\";\n+      var firstScriptTag = document.getElementsByTagName('script')[0];\n+      firstScriptTag.parentNode.insertBefore( tag, firstScriptTag );\n+\n+      return this;\n+  },\n+\n+  init: function() {\n+      this._bindAll();\n+      this.initUI();\n+\n+      var youtubeEvents = this.defaults.playerOptions.events;\n+      youtubeEvents.onReady = this.onPlayerReady;\n+      youtubeEvents.onStateChange = this.onPlayerStateChange;\n+\n+      return this;\n+  },\n+\n+  initUI: function() {\n+      var ui = this.$element;\n+      ui.on( 'click', '.youtube-player_play-btn', this.play );\n+      ui.on( 'click', '.youtube-player_close-btn', this.close );\n+\n+      return this;\n+  },\n+\n+  destroy: function() {\n+      var self = this;\n+      this.$element.remove();\n+\n+      $.each( this, function( key, _function ){\n+        delete  this[key];\n+      }, this );\n+      \n+      return this;\n+  },\n+\n+  initPlayer: function() {\n+      if ( window.YT && window.YT.Player ) {\n+          new YT.Player( 'youtube-player', this.defaults.playerOptions );\n+          this.playerInitialized = true;\n+      } else {\n+          this._embedScript();\n+      }\n+\n+      return this;\n+  },\n+\n+  onPlayerStateChange: function( event ) {\n+      if ( event.data == YT.PlayerState.ENDED ) {\n+          this.$element.removeClass(  'yt-playing' );\n+      }\n+\n+      return this;\n+  },\n+\n+  onPlayerReady: function( params ) {\n+      if ( params && params.target ) {\n+          this.player = params.target;\n+      }\n+  },\n+\n+  play: function( e ) {\n+      e.preventDefault();\n+\n+      if( this.playerInitialized ) {\n+          this.player.seekTo( 0 );","path":"src/static/js/modules/youtube.js","position":129,"original_position":129,"commit_id":"89420a2eb084954d93ff2f910b2cf2400b10cf43","original_commit_id":"89420a2eb084954d93ff2f910b2cf2400b10cf43","user":{"login":"jimmynotjim","id":1280430,"avatar_url":"https://avatars.githubusercontent.com/u/1280430?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmynotjim","html_url":"https://github.com/jimmynotjim","followers_url":"https://api.github.com/users/jimmynotjim/followers","following_url":"https://api.github.com/users/jimmynotjim/following{/other_user}","gists_url":"https://api.github.com/users/jimmynotjim/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmynotjim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmynotjim/subscriptions","organizations_url":"https://api.github.com/users/jimmynotjim/orgs","repos_url":"https://api.github.com/users/jimmynotjim/repos","events_url":"https://api.github.com/users/jimmynotjim/events{/privacy}","received_events_url":"https://api.github.com/users/jimmynotjim/received_events","type":"User","site_admin":false},"body":"Ah ok, that makes sense.","created_at":"2015-05-12T21:08:42Z","updated_at":"2015-05-12T21:08:42Z","html_url":"https://github.com/cfpb/cfgov-refresh/pull/528#discussion_r30180717","pull_request_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528","_links":{"self":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments/30180717"},"html":{"href":"https://github.com/cfpb/cfgov-refresh/pull/528#discussion_r30180717"},"pull_request":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528"}}},"pull_request":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528","id":35229771,"html_url":"https://github.com/cfpb/cfgov-refresh/pull/528","diff_url":"https://github.com/cfpb/cfgov-refresh/pull/528.diff","patch_url":"https://github.com/cfpb/cfgov-refresh/pull/528.patch","issue_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/528","number":528,"state":"open","locked":false,"title":"DF-1806 About-Us Video","user":{"login":"sebworks","id":1696212,"avatar_url":"https://avatars.githubusercontent.com/u/1696212?v=3","gravatar_id":"","url":"https://api.github.com/users/sebworks","html_url":"https://github.com/sebworks","followers_url":"https://api.github.com/users/sebworks/followers","following_url":"https://api.github.com/users/sebworks/following{/other_user}","gists_url":"https://api.github.com/users/sebworks/gists{/gist_id}","starred_url":"https://api.github.com/users/sebworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebworks/subscriptions","organizations_url":"https://api.github.com/users/sebworks/orgs","repos_url":"https://api.github.com/users/sebworks/repos","events_url":"https://api.github.com/users/sebworks/events{/privacy}","received_events_url":"https://api.github.com/users/sebworks/received_events","type":"User","site_admin":false},"body":"DF-1806 About Us Video\r\n\r\n## Changes\r\n- Updated  ' _includes/macros.html' to add youtube macro and allow share macro to accept additional classes.\r\n- Updated  ' static/css/bureau.less' to add styles to for About-Us video.\r\n- Updated 'src/static/js/routes/common.js' to initialize youtube.js.\r\n- Updated 'the-bureau/index.html' to add hero block and call youtube macro.\r\n- Added 'src/static/js/modules/youtube.js' to use Youtube api.\r\n- Added ' static/img/youtube-play-btn.png' to provide image for playing youtube video.\r\n\r\n## Notes\r\n- There is a lot of markup and breakpoints.  Room for improvement and optimizations.\r\n- Implementation of background color on share icons isn't ideal.\r\n\r\n## Test\r\n- Navigate to http://localhost:7000/the-bureau/ and click 'play icon'\r\n- Video should begin to play\r\n- Click 'close' button and you should return to original state.\r\n\r\n## Review\r\n \r\n- @jimmynotjim  \r\n- @anselmbradford \r\n- @Scotchester  \r\n- @KimberlyMunoz \r\n\r\n## Screenshots\r\nMobile\r\n![screen shot 2015-05-12 at 10 00 54 am](https://cloud.githubusercontent.com/assets/1696212/7588908/d6c6b31a-f88d-11e4-97d2-ab59fa355c8d.png)\r\n\r\nTablet\r\n![screen shot 2015-05-12 at 10 00 45 am](https://cloud.githubusercontent.com/assets/1696212/7588906/d6c51aa0-f88d-11e4-8086-f0012c3ed70f.png)\r\n\r\nDesktop\r\n![screen shot 2015-05-12 at 10 00 31 am](https://cloud.githubusercontent.com/assets/1696212/7588907/d6c53daa-f88d-11e4-805e-030ef69adcf7.png)\r\n\r\nMobile\r\n![screen shot 2015-05-12 at 10 04 58 am](https://cloud.githubusercontent.com/assets/1696212/7589026/696f0cd0-f88e-11e4-9c74-0cf45655e71b.png)\r\n\r\nTablet\r\n![screen shot 2015-05-12 at 10 04 25 am](https://cloud.githubusercontent.com/assets/1696212/7589027/697078ea-f88e-11e4-9562-d005f5775184.png)\r\n\r\nDesktop\r\n![screen shot 2015-05-12 at 10 04 13 am](https://cloud.githubusercontent.com/assets/1696212/7589029/6971e040-f88e-11e4-84ea-7aa21401db19.png)\r\n","created_at":"2015-05-12T14:08:09Z","updated_at":"2015-05-12T21:08:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a1e054f9914bb8077b9590357fdf592312aed8f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528/commits","review_comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528/comments","review_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/528/comments","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/89420a2eb084954d93ff2f910b2cf2400b10cf43","head":{"label":"cfpb:DF-1806_About_Us_video","ref":"DF-1806_About_Us_video","sha":"89420a2eb084954d93ff2f910b2cf2400b10cf43","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"In-progress redesign of the consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","created_at":"2014-04-16T19:22:03Z","updated_at":"2015-05-08T20:15:07Z","pushed_at":"2015-05-12T21:00:41Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"","size":91079,"stargazers_count":7,"watchers_count":7,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":68,"forks":14,"open_issues":68,"watchers":7,"default_branch":"flapjack"}},"base":{"label":"cfpb:flapjack","ref":"flapjack","sha":"8d6f1cffce05a61be51bfd3f656351f86b36eab7","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"In-progress redesign of the consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","created_at":"2014-04-16T19:22:03Z","updated_at":"2015-05-08T20:15:07Z","pushed_at":"2015-05-12T21:00:41Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"","size":91079,"stargazers_count":7,"watchers_count":7,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":68,"forks":14,"open_issues":68,"watchers":7,"default_branch":"flapjack"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528"},"html":{"href":"https://github.com/cfpb/cfgov-refresh/pull/528"},"issue":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/528"},"comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/528/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/528/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/89420a2eb084954d93ff2f910b2cf2400b10cf43"}}}}