{"action":"created","comment":{"url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/comments/201062821","pull_request_review_id":135491256,"id":201062821,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTA2MjgyMQ==","diff_hunk":"@@ -1,53 +1,34 @@\n 'use strict';\n-/***********************************************************\n-      Code below is where I am now\n-      - Three different functions, one for each character\n-************************************************************\n-//function to show / hide peter griffin \n-function togglePeter(){\n-    const peter = document.getElementById('peter');\n-    peter.classList.toggle('isHidden');\n-    \n-}\n-const pg_btn = document.getElementById('pg_btn');\n-pg_btn.addEventListener('click', togglePeter);\n-\n-//function to show / hide Chris griffin \n-function toggleChris(){\n-    \n-    const chris = document.getElementById('chris');\n-    chris.classList.toggle('isHidden');\n-    \n-}\n-const cg_btn = document.getElementById('cg_btn');\n-cg_btn.addEventListener('click', toggleChris);\n-\n-//function to show / hide Brian griffin \n-function toggleBrian(){\n-    \n-    const brian = document.getElementById('brian');\n-        brian.classList.toggle('isHidden');\n-}\n-const bg_btn = document.getElementById('bg_btn');\n-bg_btn.addEventListener('click', toggleBrian);\n-\n-/************************************************************\n-      Code below is where I want to go\n-      - single function to show/hide all character info\n-*************************************************************/\n-\n-//This code loops through all charinfo divs and toggles isHidden. However it does it to all three at the same time.\n-//Need to figure out how to use nextSibling (or something similar).\n \n //reference for <h2> that I want to use as a button\n const button = document.getElementsByClassName(\"charHead\");\n for (var i = 0; i < button.length; i++) {\n       button[i].addEventListener('click', toggleDisplay, false);\n    }\n \n+//function to show / hide image and paragraph for each character\n function toggleDisplay(){\n-      let charInfo = document.getElementsByClassName('charInfo');\n-      for(var i = 0; i < charInfo.length; i++){\n-        charInfo[i].classList.toggle('isHidden');\n-      }\n+    const charInfo = document.getElementsByClassName('charInfo');\n+    const btn_id = this.id;\n+    \n+    for(var i = 0; i < charInfo.length; i++){","path":"familyGuy_practice_REV/js/code_rev.js","position":57,"original_position":57,"commit_id":"1688d238a603608e453453b5817a8f0c528ce3ef","original_commit_id":"1688d238a603608e453453b5817a8f0c528ce3ef","user":{"login":"scheul93","id":33579665,"node_id":"MDQ6VXNlcjMzNTc5NjY1","avatar_url":"https://avatars0.githubusercontent.com/u/33579665?v=4","gravatar_id":"","url":"https://api.github.com/users/scheul93","html_url":"https://github.com/scheul93","followers_url":"https://api.github.com/users/scheul93/followers","following_url":"https://api.github.com/users/scheul93/following{/other_user}","gists_url":"https://api.github.com/users/scheul93/gists{/gist_id}","starred_url":"https://api.github.com/users/scheul93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scheul93/subscriptions","organizations_url":"https://api.github.com/users/scheul93/orgs","repos_url":"https://api.github.com/users/scheul93/repos","events_url":"https://api.github.com/users/scheul93/events{/privacy}","received_events_url":"https://api.github.com/users/scheul93/received_events","type":"User","site_admin":false},"body":"You could also do \r\n```\r\nfor(var i = 0; i < charInfo.length; i++) {\r\n   const el = document.getElementById(charInfo[i].id);\r\n   el.classList.toggle('isHidden', btn_id !== this.id)\r\n}\r\n```\r\nThis would loop through all your characters, get the dom element. If the element.id does NOT equal btn id, then add the isHidden class. Else, remove it.\r\n(My pseduo coding might be slightly off)","created_at":"2018-07-09T16:17:19Z","updated_at":"2018-07-09T16:17:20Z","html_url":"https://github.com/agoldman12/Family-Guy-REV/pull/8#discussion_r201062821","pull_request_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/comments/201062821"},"html":{"href":"https://github.com/agoldman12/Family-Guy-REV/pull/8#discussion_r201062821"},"pull_request":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8","id":197279469,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3Mjc5NDY5","html_url":"https://github.com/agoldman12/Family-Guy-REV/pull/8","diff_url":"https://github.com/agoldman12/Family-Guy-REV/pull/8.diff","patch_url":"https://github.com/agoldman12/Family-Guy-REV/pull/8.patch","issue_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/8","number":8,"state":"open","locked":false,"title":"classList.toggle + switch statement","user":{"login":"agoldman12","id":6231676,"node_id":"MDQ6VXNlcjYyMzE2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/6231676?v=4","gravatar_id":"","url":"https://api.github.com/users/agoldman12","html_url":"https://github.com/agoldman12","followers_url":"https://api.github.com/users/agoldman12/followers","following_url":"https://api.github.com/users/agoldman12/following{/other_user}","gists_url":"https://api.github.com/users/agoldman12/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldman12/subscriptions","organizations_url":"https://api.github.com/users/agoldman12/orgs","repos_url":"https://api.github.com/users/agoldman12/repos","events_url":"https://api.github.com/users/agoldman12/events{/privacy}","received_events_url":"https://api.github.com/users/agoldman12/received_events","type":"User","site_admin":false},"body":"Now I am using classList.toggle() and a switch statement to control which \"charInfo\" div is shown. I am passing the ID of the button that was clicked into the Switch statement and checking to see if it matches the button ID in one of the three 'cases'. If it does, it gets a reference, by ID, to the div with the information about that character and then toggles the class 'isHidden' for that div. ","created_at":"2018-06-26T01:43:16Z","updated_at":"2018-07-09T16:17:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e14f3b92d8a788fb84a226897471b6251fb8cbd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8/commits","review_comments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8/comments","review_comment_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/comments{/number}","comments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/8/comments","statuses_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/statuses/1688d238a603608e453453b5817a8f0c528ce3ef","head":{"label":"agoldman12:js-edits","ref":"js-edits","sha":"1688d238a603608e453453b5817a8f0c528ce3ef","user":{"login":"agoldman12","id":6231676,"node_id":"MDQ6VXNlcjYyMzE2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/6231676?v=4","gravatar_id":"","url":"https://api.github.com/users/agoldman12","html_url":"https://github.com/agoldman12","followers_url":"https://api.github.com/users/agoldman12/followers","following_url":"https://api.github.com/users/agoldman12/following{/other_user}","gists_url":"https://api.github.com/users/agoldman12/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldman12/subscriptions","organizations_url":"https://api.github.com/users/agoldman12/orgs","repos_url":"https://api.github.com/users/agoldman12/repos","events_url":"https://api.github.com/users/agoldman12/events{/privacy}","received_events_url":"https://api.github.com/users/agoldman12/received_events","type":"User","site_admin":false},"repo":{"id":137483933,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0ODM5MzM=","name":"Family-Guy-REV","full_name":"agoldman12/Family-Guy-REV","owner":{"login":"agoldman12","id":6231676,"node_id":"MDQ6VXNlcjYyMzE2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/6231676?v=4","gravatar_id":"","url":"https://api.github.com/users/agoldman12","html_url":"https://github.com/agoldman12","followers_url":"https://api.github.com/users/agoldman12/followers","following_url":"https://api.github.com/users/agoldman12/following{/other_user}","gists_url":"https://api.github.com/users/agoldman12/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldman12/subscriptions","organizations_url":"https://api.github.com/users/agoldman12/orgs","repos_url":"https://api.github.com/users/agoldman12/repos","events_url":"https://api.github.com/users/agoldman12/events{/privacy}","received_events_url":"https://api.github.com/users/agoldman12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/agoldman12/Family-Guy-REV","description":"When you click on a character's name, information about that character appears.","fork":false,"url":"https://api.github.com/repos/agoldman12/Family-Guy-REV","forks_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/forks","keys_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/teams","hooks_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/hooks","issue_events_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/events{/number}","events_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/events","assignees_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/assignees{/user}","branches_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/branches{/branch}","tags_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/tags","blobs_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/refs{/sha}","trees_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/statuses/{sha}","languages_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/languages","stargazers_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/stargazers","contributors_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/contributors","subscribers_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/subscribers","subscription_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/subscription","commits_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/commits{/sha}","git_commits_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/commits{/sha}","comments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/comments{/number}","issue_comment_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/comments{/number}","contents_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/contents/{+path}","compare_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/merges","archive_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/downloads","issues_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues{/number}","pulls_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls{/number}","milestones_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/milestones{/number}","notifications_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/labels{/name}","releases_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/releases{/id}","deployments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/deployments","created_at":"2018-06-15T12:16:42Z","updated_at":"2018-06-26T01:31:40Z","pushed_at":"2018-06-30T20:43:39Z","git_url":"git://github.com/agoldman12/Family-Guy-REV.git","ssh_url":"git@github.com:agoldman12/Family-Guy-REV.git","clone_url":"https://github.com/agoldman12/Family-Guy-REV.git","svn_url":"https://github.com/agoldman12/Family-Guy-REV","homepage":null,"size":335,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"agoldman12:master","ref":"master","sha":"bf613ea5302d1c2f3c013f5ce38dc0135d8764df","user":{"login":"agoldman12","id":6231676,"node_id":"MDQ6VXNlcjYyMzE2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/6231676?v=4","gravatar_id":"","url":"https://api.github.com/users/agoldman12","html_url":"https://github.com/agoldman12","followers_url":"https://api.github.com/users/agoldman12/followers","following_url":"https://api.github.com/users/agoldman12/following{/other_user}","gists_url":"https://api.github.com/users/agoldman12/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldman12/subscriptions","organizations_url":"https://api.github.com/users/agoldman12/orgs","repos_url":"https://api.github.com/users/agoldman12/repos","events_url":"https://api.github.com/users/agoldman12/events{/privacy}","received_events_url":"https://api.github.com/users/agoldman12/received_events","type":"User","site_admin":false},"repo":{"id":137483933,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0ODM5MzM=","name":"Family-Guy-REV","full_name":"agoldman12/Family-Guy-REV","owner":{"login":"agoldman12","id":6231676,"node_id":"MDQ6VXNlcjYyMzE2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/6231676?v=4","gravatar_id":"","url":"https://api.github.com/users/agoldman12","html_url":"https://github.com/agoldman12","followers_url":"https://api.github.com/users/agoldman12/followers","following_url":"https://api.github.com/users/agoldman12/following{/other_user}","gists_url":"https://api.github.com/users/agoldman12/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldman12/subscriptions","organizations_url":"https://api.github.com/users/agoldman12/orgs","repos_url":"https://api.github.com/users/agoldman12/repos","events_url":"https://api.github.com/users/agoldman12/events{/privacy}","received_events_url":"https://api.github.com/users/agoldman12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/agoldman12/Family-Guy-REV","description":"When you click on a character's name, information about that character appears.","fork":false,"url":"https://api.github.com/repos/agoldman12/Family-Guy-REV","forks_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/forks","keys_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/teams","hooks_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/hooks","issue_events_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/events{/number}","events_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/events","assignees_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/assignees{/user}","branches_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/branches{/branch}","tags_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/tags","blobs_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/refs{/sha}","trees_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/statuses/{sha}","languages_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/languages","stargazers_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/stargazers","contributors_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/contributors","subscribers_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/subscribers","subscription_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/subscription","commits_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/commits{/sha}","git_commits_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/git/commits{/sha}","comments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/comments{/number}","issue_comment_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/comments{/number}","contents_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/contents/{+path}","compare_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/merges","archive_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/downloads","issues_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues{/number}","pulls_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls{/number}","milestones_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/milestones{/number}","notifications_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/labels{/name}","releases_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/releases{/id}","deployments_url":"https://api.github.com/repos/agoldman12/Family-Guy-REV/deployments","created_at":"2018-06-15T12:16:42Z","updated_at":"2018-06-26T01:31:40Z","pushed_at":"2018-06-30T20:43:39Z","git_url":"git://github.com/agoldman12/Family-Guy-REV.git","ssh_url":"git@github.com:agoldman12/Family-Guy-REV.git","clone_url":"https://github.com/agoldman12/Family-Guy-REV.git","svn_url":"https://github.com/agoldman12/Family-Guy-REV","homepage":null,"size":335,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8"},"html":{"href":"https://github.com/agoldman12/Family-Guy-REV/pull/8"},"issue":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/8"},"comments":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/agoldman12/Family-Guy-REV/statuses/1688d238a603608e453453b5817a8f0c528ce3ef"}},"author_association":"OWNER"}}
{"actor":{"display_login":"scheul93"}}