{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/comments/178453221","pull_request_review_id":108514134,"id":178453221,"diff_hunk":"@@ -0,0 +1,77 @@\n+const Keys = {\n+  ALT: `Alt`,\n+  LEFT_ARROW: `ArrowLeft`,\n+  RIGHT_ARROW: `ArrowRight`\n+};\n+\n+const DEFAULT_SCREEN_INDEX = 0;\n+const mainElement = document.querySelector(`main.central`);\n+\n+let screenIndex = DEFAULT_SCREEN_INDEX;\n+let map = {};\n+\n+const screenTemplates = document.querySelectorAll(`template`);\n+const contentOfScreenTemplates = Array.from(screenTemplates).map((template) => template.content);\n+\n+/**\n+ * Change index of screen to th new one and render screen with new index\n+ *\n+ * @param {number} newScreenIndex\n+ * **/\n+const switchScreen = (newScreenIndex) => {\n+  if ((newScreenIndex < 0) || (newScreenIndex >= contentOfScreenTemplates.length)) {\n+    return;\n+  }\n+\n+  screenIndex = newScreenIndex;\n+  const screenElement = contentOfScreenTemplates[screenIndex].cloneNode(true);\n+  while (mainElement.hasChildNodes()) {\n+    mainElement.removeChild(mainElement.lastChild);\n+  }\n+  mainElement.appendChild(screenElement);\n+};\n+\n+/**\n+ * Keydown event handler\n+ *\n+ * @param {KeyboardEvent} evt\n+ * **/\n+const onSwitchScreenKeydown = (evt) => {\n+  evt = evt || event; // to deal with IE\n+  if (Object.values(Keys).indexOf(evt.key) === -1) {","path":"js/main.js","position":41,"original_position":41,"commit_id":"4ea56091c6c33a035d770730f0b4c611031448a8","original_commit_id":"4ea56091c6c33a035d770730f0b4c611031448a8","user":{"login":"ssnikiforov","id":20687133,"avatar_url":"https://avatars3.githubusercontent.com/u/20687133?v=4","gravatar_id":"","url":"https://api.github.com/users/ssnikiforov","html_url":"https://github.com/ssnikiforov","followers_url":"https://api.github.com/users/ssnikiforov/followers","following_url":"https://api.github.com/users/ssnikiforov/following{/other_user}","gists_url":"https://api.github.com/users/ssnikiforov/gists{/gist_id}","starred_url":"https://api.github.com/users/ssnikiforov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssnikiforov/subscriptions","organizations_url":"https://api.github.com/users/ssnikiforov/orgs","repos_url":"https://api.github.com/users/ssnikiforov/repos","events_url":"https://api.github.com/users/ssnikiforov/events{/privacy}","received_events_url":"https://api.github.com/users/ssnikiforov/received_events","type":"User","site_admin":false},"body":"> Правильно проверять те ключи, которые нам нужны и выполнять действие.\r\nЯ попытался следовать принципу fail fast :)","created_at":"2018-04-01T09:48:34Z","updated_at":"2018-04-01T09:48:34Z","html_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2#discussion_r178453221","pull_request_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/comments/178453221"},"html":{"href":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2#discussion_r178453221"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2"}},"in_reply_to_id":178434520},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2","id":178083022,"html_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2","diff_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2.diff","patch_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2.patch","issue_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/2","number":2,"state":"open","locked":false,"title":"Начинаем программировать","user":{"login":"ssnikiforov","id":20687133,"avatar_url":"https://avatars3.githubusercontent.com/u/20687133?v=4","gravatar_id":"","url":"https://api.github.com/users/ssnikiforov","html_url":"https://github.com/ssnikiforov","followers_url":"https://api.github.com/users/ssnikiforov/followers","following_url":"https://api.github.com/users/ssnikiforov/following{/other_user}","gists_url":"https://api.github.com/users/ssnikiforov/gists{/gist_id}","starred_url":"https://api.github.com/users/ssnikiforov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssnikiforov/subscriptions","organizations_url":"https://api.github.com/users/ssnikiforov/orgs","repos_url":"https://api.github.com/users/ssnikiforov/repos","events_url":"https://api.github.com/users/ssnikiforov/events{/privacy}","received_events_url":"https://api.github.com/users/ssnikiforov/received_events","type":"User","site_admin":false},"body":"\n\n---\n:mortar_board: [Начинаем программировать](https://up.htmlacademy.ru/ecmascript/4/user/165513/tasks/3)\n\n:boom: https://htmlacademy-ecmascript.github.io/165513-pixel-hunter/2/","created_at":"2018-03-28T15:47:41Z","updated_at":"2018-04-01T09:48:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d590ca0b73d243920d6f128548fd12074e260b07","assignee":{"login":"nicksp","id":579331,"avatar_url":"https://avatars2.githubusercontent.com/u/579331?v=4","gravatar_id":"","url":"https://api.github.com/users/nicksp","html_url":"https://github.com/nicksp","followers_url":"https://api.github.com/users/nicksp/followers","following_url":"https://api.github.com/users/nicksp/following{/other_user}","gists_url":"https://api.github.com/users/nicksp/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksp/subscriptions","organizations_url":"https://api.github.com/users/nicksp/orgs","repos_url":"https://api.github.com/users/nicksp/repos","events_url":"https://api.github.com/users/nicksp/events{/privacy}","received_events_url":"https://api.github.com/users/nicksp/received_events","type":"User","site_admin":false},"assignees":[{"login":"nicksp","id":579331,"avatar_url":"https://avatars2.githubusercontent.com/u/579331?v=4","gravatar_id":"","url":"https://api.github.com/users/nicksp","html_url":"https://github.com/nicksp","followers_url":"https://api.github.com/users/nicksp/followers","following_url":"https://api.github.com/users/nicksp/following{/other_user}","gists_url":"https://api.github.com/users/nicksp/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksp/subscriptions","organizations_url":"https://api.github.com/users/nicksp/orgs","repos_url":"https://api.github.com/users/nicksp/repos","events_url":"https://api.github.com/users/nicksp/events{/privacy}","received_events_url":"https://api.github.com/users/nicksp/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/2/comments","statuses_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/statuses/4ea56091c6c33a035d770730f0b4c611031448a8","head":{"label":"ssnikiforov:module1-task2","ref":"module1-task2","sha":"4ea56091c6c33a035d770730f0b4c611031448a8","user":{"login":"ssnikiforov","id":20687133,"avatar_url":"https://avatars3.githubusercontent.com/u/20687133?v=4","gravatar_id":"","url":"https://api.github.com/users/ssnikiforov","html_url":"https://github.com/ssnikiforov","followers_url":"https://api.github.com/users/ssnikiforov/followers","following_url":"https://api.github.com/users/ssnikiforov/following{/other_user}","gists_url":"https://api.github.com/users/ssnikiforov/gists{/gist_id}","starred_url":"https://api.github.com/users/ssnikiforov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssnikiforov/subscriptions","organizations_url":"https://api.github.com/users/ssnikiforov/orgs","repos_url":"https://api.github.com/users/ssnikiforov/repos","events_url":"https://api.github.com/users/ssnikiforov/events{/privacy}","received_events_url":"https://api.github.com/users/ssnikiforov/received_events","type":"User","site_admin":false},"repo":{"id":126873071,"name":"165513-pixel-hunter","full_name":"ssnikiforov/165513-pixel-hunter","owner":{"login":"ssnikiforov","id":20687133,"avatar_url":"https://avatars3.githubusercontent.com/u/20687133?v=4","gravatar_id":"","url":"https://api.github.com/users/ssnikiforov","html_url":"https://github.com/ssnikiforov","followers_url":"https://api.github.com/users/ssnikiforov/followers","following_url":"https://api.github.com/users/ssnikiforov/following{/other_user}","gists_url":"https://api.github.com/users/ssnikiforov/gists{/gist_id}","starred_url":"https://api.github.com/users/ssnikiforov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssnikiforov/subscriptions","organizations_url":"https://api.github.com/users/ssnikiforov/orgs","repos_url":"https://api.github.com/users/ssnikiforov/repos","events_url":"https://api.github.com/users/ssnikiforov/events{/privacy}","received_events_url":"https://api.github.com/users/ssnikiforov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssnikiforov/165513-pixel-hunter","description":"Stepan Nikiforov","fork":true,"url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter","forks_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/forks","keys_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/teams","hooks_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/hooks","issue_events_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/issues/events{/number}","events_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/events","assignees_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/assignees{/user}","branches_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/branches{/branch}","tags_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/tags","blobs_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/statuses/{sha}","languages_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/languages","stargazers_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/stargazers","contributors_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/contributors","subscribers_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/subscribers","subscription_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/subscription","commits_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/contents/{+path}","compare_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/merges","archive_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/downloads","issues_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/issues{/number}","pulls_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/pulls{/number}","milestones_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/milestones{/number}","notifications_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/labels{/name}","releases_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/releases{/id}","deployments_url":"https://api.github.com/repos/ssnikiforov/165513-pixel-hunter/deployments","created_at":"2018-03-26T18:34:09Z","updated_at":"2018-03-26T18:34:11Z","pushed_at":"2018-03-30T15:04:10Z","git_url":"git://github.com/ssnikiforov/165513-pixel-hunter.git","ssh_url":"git@github.com:ssnikiforov/165513-pixel-hunter.git","clone_url":"https://github.com/ssnikiforov/165513-pixel-hunter.git","svn_url":"https://github.com/ssnikiforov/165513-pixel-hunter","homepage":null,"size":619,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htmlacademy-ecmascript:master","ref":"master","sha":"44003d18f228da811bdd67f3e18a69a79d6969d0","user":{"login":"htmlacademy-ecmascript","id":22890904,"avatar_url":"https://avatars2.githubusercontent.com/u/22890904?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-ecmascript","html_url":"https://github.com/htmlacademy-ecmascript","followers_url":"https://api.github.com/users/htmlacademy-ecmascript/followers","following_url":"https://api.github.com/users/htmlacademy-ecmascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-ecmascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-ecmascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-ecmascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-ecmascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-ecmascript/repos","events_url":"https://api.github.com/users/htmlacademy-ecmascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-ecmascript/received_events","type":"Organization","site_admin":false},"repo":{"id":126873010,"name":"165513-pixel-hunter","full_name":"htmlacademy-ecmascript/165513-pixel-hunter","owner":{"login":"htmlacademy-ecmascript","id":22890904,"avatar_url":"https://avatars2.githubusercontent.com/u/22890904?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-ecmascript","html_url":"https://github.com/htmlacademy-ecmascript","followers_url":"https://api.github.com/users/htmlacademy-ecmascript/followers","following_url":"https://api.github.com/users/htmlacademy-ecmascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-ecmascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-ecmascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-ecmascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-ecmascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-ecmascript/repos","events_url":"https://api.github.com/users/htmlacademy-ecmascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-ecmascript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter","description":"Stepan Nikiforov","fork":false,"url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter","forks_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/forks","keys_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/teams","hooks_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/events","assignees_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/tags","blobs_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/subscription","commits_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/merges","archive_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/downloads","issues_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/deployments","created_at":"2018-03-26T18:33:45Z","updated_at":"2018-03-26T18:49:18Z","pushed_at":"2018-03-31T14:03:25Z","git_url":"git://github.com/htmlacademy-ecmascript/165513-pixel-hunter.git","ssh_url":"git@github.com:htmlacademy-ecmascript/165513-pixel-hunter.git","clone_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter.git","svn_url":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter","homepage":"https://github.com/ssnikiforov/165513-pixel-hunter","size":615,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2"},"html":{"href":"https://github.com/htmlacademy-ecmascript/165513-pixel-hunter/pull/2"},"issue":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/2"},"comments":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-ecmascript/165513-pixel-hunter/statuses/4ea56091c6c33a035d770730f0b4c611031448a8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ssnikiforov"}}