{"action":"created","comment":{"url":"https://api.github.com/repos/advanced-js/mashup/pulls/comments/55148516","id":55148516,"diff_hunk":"@@ -0,0 +1,144 @@\n+// Leave this in so, I can cut and past the URL to the browse\n+// http://content.guardianapis.com/search?q=Mammal&order-by=relevance&page-size=50&show-fields=thumbnail%2Cbyline&show-blocks=body&api-key=2700505f-b667-4f0a-adc0-b024f02abe57\n+\n+var Url = function(title) {\n+    this.endpoint = 'http://content.guardianapis.com/search';\n+    this.query = 'q=' + title;\n+    this.orderBy = 'order-by=relevance';\n+    this.pageSize = 'page-size=50';\n+    this.showFields = 'show-fields=' + escape('thumbnail,byline');\n+    this.showBlocks = 'show-blocks=body';\n+    this.apiKey = 'api-key=2700505f-b667-4f0a-adc0-b024f02abe57';\n+};\n+\n+Url.prototype.fullUrl = function() {\n+    var url = this.endpoint + '?' + this.query + '&' + this.orderBy + '&' + this.pageSize;\n+    url += '&' + this.showFields + '&' + this.showBlocks + '&' + this.apiKey;\n+    return url;\n+};\n+\n+var Category = function(title) {\n+    this.title = title;\n+    this.elementId = title.toLowerCase();\n+    this.selectorId = '#' + this.elementId;\n+    this.newsElementId = this.elementId + 'news';\n+    this.newsSelectorId = '#' + this.newsElementId;\n+    this.closeElementId = this.elementId + 'close';\n+    this.closeSelectorId = '#' + this.closeElementId;\n+    var url = new Url(title);\n+    this.url = url.fullUrl();\n+};\n+\n+Category.prototype.genHtml = function() {\n+    var htmlString = '<div class=\"category\">';\n+    htmlString += '<span class=\"open\" id=\"' + this.elementId + '\">' + this.title + '</span>';\n+    htmlString += '<span class=\"close\" id=\"' + this.closeElementId + '\">X</span></div>';\n+    htmlString +='<section id=\"' + this.newsElementId + '\"></section>';\n+    return htmlString;\n+};\n+\n+var ArticleDate = function(dateString) {\n+    this.date = new Date(dateString)\n+};\n+\n+ArticleDate.prototype.toArticleDateString = function() {\n+    return((this.date.getMonth() + 1) + '/' + this.date.getDate() + '/' + this.date.getFullYear());\n+};\n+\n+var Article = function(article) {\n+    this.article = article;\n+};\n+\n+Article.prototype.valid = function() {\n+    return (this.article.fields !== undefined && this.article.fields.thumbnail !== undefined);\n+};\n+\n+Article.prototype.byLine = function() {\n+    var byLine = this.article.fields.byline;\n+    if ( byLine === undefined ) {","path":"mashup.js","position":58,"original_position":58,"commit_id":"9f63e512b5890c7f524b97c984135624b043b988","original_commit_id":"9f63e512b5890c7f524b97c984135624b043b988","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"body":"I would just do `if (!byLine)`, which would handle empty strings too.","created_at":"2016-03-06T21:21:56Z","updated_at":"2016-03-06T21:21:56Z","html_url":"https://github.com/advanced-js/mashup/pull/42#discussion_r55148516","pull_request_url":"https://api.github.com/repos/advanced-js/mashup/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/comments/55148516"},"html":{"href":"https://github.com/advanced-js/mashup/pull/42#discussion_r55148516"},"pull_request":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/advanced-js/mashup/pulls/42","id":61343044,"html_url":"https://github.com/advanced-js/mashup/pull/42","diff_url":"https://github.com/advanced-js/mashup/pull/42.diff","patch_url":"https://github.com/advanced-js/mashup/pull/42.patch","issue_url":"https://api.github.com/repos/advanced-js/mashup/issues/42","number":42,"state":"open","locked":false,"title":"Mashup Homework","user":{"login":"bluemittens505","id":12704735,"avatar_url":"https://avatars.githubusercontent.com/u/12704735?v=3","gravatar_id":"","url":"https://api.github.com/users/bluemittens505","html_url":"https://github.com/bluemittens505","followers_url":"https://api.github.com/users/bluemittens505/followers","following_url":"https://api.github.com/users/bluemittens505/following{/other_user}","gists_url":"https://api.github.com/users/bluemittens505/gists{/gist_id}","starred_url":"https://api.github.com/users/bluemittens505/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluemittens505/subscriptions","organizations_url":"https://api.github.com/users/bluemittens505/orgs","repos_url":"https://api.github.com/users/bluemittens505/repos","events_url":"https://api.github.com/users/bluemittens505/events{/privacy}","received_events_url":"https://api.github.com/users/bluemittens505/received_events","type":"User","site_admin":false},"body":"Refactored and styled.","created_at":"2016-03-02T02:37:05Z","updated_at":"2016-03-06T21:21:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/advanced-js/mashup/pulls/42/commits","review_comments_url":"https://api.github.com/repos/advanced-js/mashup/pulls/42/comments","review_comment_url":"https://api.github.com/repos/advanced-js/mashup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/advanced-js/mashup/issues/42/comments","statuses_url":"https://api.github.com/repos/advanced-js/mashup/statuses/9f63e512b5890c7f524b97c984135624b043b988","head":{"label":"bluemittens505:gh-pages","ref":"gh-pages","sha":"9f63e512b5890c7f524b97c984135624b043b988","user":{"login":"bluemittens505","id":12704735,"avatar_url":"https://avatars.githubusercontent.com/u/12704735?v=3","gravatar_id":"","url":"https://api.github.com/users/bluemittens505","html_url":"https://github.com/bluemittens505","followers_url":"https://api.github.com/users/bluemittens505/followers","following_url":"https://api.github.com/users/bluemittens505/following{/other_user}","gists_url":"https://api.github.com/users/bluemittens505/gists{/gist_id}","starred_url":"https://api.github.com/users/bluemittens505/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluemittens505/subscriptions","organizations_url":"https://api.github.com/users/bluemittens505/orgs","repos_url":"https://api.github.com/users/bluemittens505/repos","events_url":"https://api.github.com/users/bluemittens505/events{/privacy}","received_events_url":"https://api.github.com/users/bluemittens505/received_events","type":"User","site_admin":false},"repo":{"id":52684819,"name":"mashup","full_name":"bluemittens505/mashup","owner":{"login":"bluemittens505","id":12704735,"avatar_url":"https://avatars.githubusercontent.com/u/12704735?v=3","gravatar_id":"","url":"https://api.github.com/users/bluemittens505","html_url":"https://github.com/bluemittens505","followers_url":"https://api.github.com/users/bluemittens505/followers","following_url":"https://api.github.com/users/bluemittens505/following{/other_user}","gists_url":"https://api.github.com/users/bluemittens505/gists{/gist_id}","starred_url":"https://api.github.com/users/bluemittens505/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluemittens505/subscriptions","organizations_url":"https://api.github.com/users/bluemittens505/orgs","repos_url":"https://api.github.com/users/bluemittens505/repos","events_url":"https://api.github.com/users/bluemittens505/events{/privacy}","received_events_url":"https://api.github.com/users/bluemittens505/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluemittens505/mashup","description":"mashup project","fork":true,"url":"https://api.github.com/repos/bluemittens505/mashup","forks_url":"https://api.github.com/repos/bluemittens505/mashup/forks","keys_url":"https://api.github.com/repos/bluemittens505/mashup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluemittens505/mashup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluemittens505/mashup/teams","hooks_url":"https://api.github.com/repos/bluemittens505/mashup/hooks","issue_events_url":"https://api.github.com/repos/bluemittens505/mashup/issues/events{/number}","events_url":"https://api.github.com/repos/bluemittens505/mashup/events","assignees_url":"https://api.github.com/repos/bluemittens505/mashup/assignees{/user}","branches_url":"https://api.github.com/repos/bluemittens505/mashup/branches{/branch}","tags_url":"https://api.github.com/repos/bluemittens505/mashup/tags","blobs_url":"https://api.github.com/repos/bluemittens505/mashup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluemittens505/mashup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluemittens505/mashup/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluemittens505/mashup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluemittens505/mashup/statuses/{sha}","languages_url":"https://api.github.com/repos/bluemittens505/mashup/languages","stargazers_url":"https://api.github.com/repos/bluemittens505/mashup/stargazers","contributors_url":"https://api.github.com/repos/bluemittens505/mashup/contributors","subscribers_url":"https://api.github.com/repos/bluemittens505/mashup/subscribers","subscription_url":"https://api.github.com/repos/bluemittens505/mashup/subscription","commits_url":"https://api.github.com/repos/bluemittens505/mashup/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluemittens505/mashup/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluemittens505/mashup/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluemittens505/mashup/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluemittens505/mashup/contents/{+path}","compare_url":"https://api.github.com/repos/bluemittens505/mashup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluemittens505/mashup/merges","archive_url":"https://api.github.com/repos/bluemittens505/mashup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluemittens505/mashup/downloads","issues_url":"https://api.github.com/repos/bluemittens505/mashup/issues{/number}","pulls_url":"https://api.github.com/repos/bluemittens505/mashup/pulls{/number}","milestones_url":"https://api.github.com/repos/bluemittens505/mashup/milestones{/number}","notifications_url":"https://api.github.com/repos/bluemittens505/mashup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluemittens505/mashup/labels{/name}","releases_url":"https://api.github.com/repos/bluemittens505/mashup/releases{/id}","deployments_url":"https://api.github.com/repos/bluemittens505/mashup/deployments","created_at":"2016-02-27T19:31:40Z","updated_at":"2016-02-27T19:31:41Z","pushed_at":"2016-03-02T02:33:02Z","git_url":"git://github.com/bluemittens505/mashup.git","ssh_url":"git@github.com:bluemittens505/mashup.git","clone_url":"https://github.com/bluemittens505/mashup.git","svn_url":"https://github.com/bluemittens505/mashup","homepage":"","size":21,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"advanced-js:gh-pages","ref":"gh-pages","sha":"1181b489915cc6243221ebf380c04f807c86afc7","user":{"login":"advanced-js","id":7143770,"avatar_url":"https://avatars.githubusercontent.com/u/7143770?v=3","gravatar_id":"","url":"https://api.github.com/users/advanced-js","html_url":"https://github.com/advanced-js","followers_url":"https://api.github.com/users/advanced-js/followers","following_url":"https://api.github.com/users/advanced-js/following{/other_user}","gists_url":"https://api.github.com/users/advanced-js/gists{/gist_id}","starred_url":"https://api.github.com/users/advanced-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advanced-js/subscriptions","organizations_url":"https://api.github.com/users/advanced-js/orgs","repos_url":"https://api.github.com/users/advanced-js/repos","events_url":"https://api.github.com/users/advanced-js/events{/privacy}","received_events_url":"https://api.github.com/users/advanced-js/received_events","type":"Organization","site_admin":false},"repo":{"id":18479605,"name":"mashup","full_name":"advanced-js/mashup","owner":{"login":"advanced-js","id":7143770,"avatar_url":"https://avatars.githubusercontent.com/u/7143770?v=3","gravatar_id":"","url":"https://api.github.com/users/advanced-js","html_url":"https://github.com/advanced-js","followers_url":"https://api.github.com/users/advanced-js/followers","following_url":"https://api.github.com/users/advanced-js/following{/other_user}","gists_url":"https://api.github.com/users/advanced-js/gists{/gist_id}","starred_url":"https://api.github.com/users/advanced-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advanced-js/subscriptions","organizations_url":"https://api.github.com/users/advanced-js/orgs","repos_url":"https://api.github.com/users/advanced-js/repos","events_url":"https://api.github.com/users/advanced-js/events{/privacy}","received_events_url":"https://api.github.com/users/advanced-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/advanced-js/mashup","description":"mashup project","fork":false,"url":"https://api.github.com/repos/advanced-js/mashup","forks_url":"https://api.github.com/repos/advanced-js/mashup/forks","keys_url":"https://api.github.com/repos/advanced-js/mashup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/advanced-js/mashup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/advanced-js/mashup/teams","hooks_url":"https://api.github.com/repos/advanced-js/mashup/hooks","issue_events_url":"https://api.github.com/repos/advanced-js/mashup/issues/events{/number}","events_url":"https://api.github.com/repos/advanced-js/mashup/events","assignees_url":"https://api.github.com/repos/advanced-js/mashup/assignees{/user}","branches_url":"https://api.github.com/repos/advanced-js/mashup/branches{/branch}","tags_url":"https://api.github.com/repos/advanced-js/mashup/tags","blobs_url":"https://api.github.com/repos/advanced-js/mashup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/advanced-js/mashup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/advanced-js/mashup/git/refs{/sha}","trees_url":"https://api.github.com/repos/advanced-js/mashup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/advanced-js/mashup/statuses/{sha}","languages_url":"https://api.github.com/repos/advanced-js/mashup/languages","stargazers_url":"https://api.github.com/repos/advanced-js/mashup/stargazers","contributors_url":"https://api.github.com/repos/advanced-js/mashup/contributors","subscribers_url":"https://api.github.com/repos/advanced-js/mashup/subscribers","subscription_url":"https://api.github.com/repos/advanced-js/mashup/subscription","commits_url":"https://api.github.com/repos/advanced-js/mashup/commits{/sha}","git_commits_url":"https://api.github.com/repos/advanced-js/mashup/git/commits{/sha}","comments_url":"https://api.github.com/repos/advanced-js/mashup/comments{/number}","issue_comment_url":"https://api.github.com/repos/advanced-js/mashup/issues/comments{/number}","contents_url":"https://api.github.com/repos/advanced-js/mashup/contents/{+path}","compare_url":"https://api.github.com/repos/advanced-js/mashup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/advanced-js/mashup/merges","archive_url":"https://api.github.com/repos/advanced-js/mashup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/advanced-js/mashup/downloads","issues_url":"https://api.github.com/repos/advanced-js/mashup/issues{/number}","pulls_url":"https://api.github.com/repos/advanced-js/mashup/pulls{/number}","milestones_url":"https://api.github.com/repos/advanced-js/mashup/milestones{/number}","notifications_url":"https://api.github.com/repos/advanced-js/mashup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/advanced-js/mashup/labels{/name}","releases_url":"https://api.github.com/repos/advanced-js/mashup/releases{/id}","deployments_url":"https://api.github.com/repos/advanced-js/mashup/deployments","created_at":"2014-04-06T00:20:07Z","updated_at":"2016-02-29T04:36:53Z","pushed_at":"2016-03-06T21:14:33Z","git_url":"git://github.com/advanced-js/mashup.git","ssh_url":"git@github.com:advanced-js/mashup.git","clone_url":"https://github.com/advanced-js/mashup.git","svn_url":"https://github.com/advanced-js/mashup","homepage":"","size":9989,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"open_issues_count":3,"forks":42,"open_issues":3,"watchers":2,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/42"},"html":{"href":"https://github.com/advanced-js/mashup/pull/42"},"issue":{"href":"https://api.github.com/repos/advanced-js/mashup/issues/42"},"comments":{"href":"https://api.github.com/repos/advanced-js/mashup/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/advanced-js/mashup/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/advanced-js/mashup/statuses/9f63e512b5890c7f524b97c984135624b043b988"}}}}