{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/comments/62506332","id":62506332,"diff_hunk":"@@ -0,0 +1,94 @@\n+'use strict';\n+\n+// /** Загруженный массив обьектов с сервера.*/\n+// /** @type {Array.<Object>} pictures */\n+// var pictures = require('./pictures');\n+// console.log(pictures.filteredPictures);\n+// /** @type {Array.<Object>} */\n+// var galleryPicturesList = [];\n+//\n+// /** @param {Array.<Object>} pictures */\n+// var savePicturesList = function(pictures) {\n+//   galleryPicturesList = pictures;\n+// };\n+\n+var picturesContainer = document.querySelector('.pictures');\n+var galleryContainer = document.querySelector('.gallery-overlay');\n+var galleryPicture = galleryContainer.querySelector('img');\n+\n+var picturesArray;\n+var selectedPicture;\n+// var KEYCODE = {\n+//   'ESC': 27\n+// };\n+\n+/** Начинает показ галереи с выбранной фотографии*/\n+var selectPicture = function(evt) {\n+  evt.preventDefault();\n+  var target = evt.target;\n+  picturesArray = Array.prototype.slice.call(picturesContainer.children);\n+  selectedPicture = picturesArray.indexOf(target.parentNode);\n+  galleryPicture.src = target.src;\n+  console.log(target.parentNode);\n+  console.dir(evt.target);\n+\n+  if (evt.target.parentNode.className === 'picture') {\n+    showGallery(selectedPicture);\n+  }\n+};\n+\n+picturesContainer.addEventListener('click', selectPicture);\n+\n+/** Показывает следующую фотографию*/\n+var _onPhotoClick = function(evt) {\n+  if (evt.target.classList.contains('gallery-overlay-image')) {\n+    ++selectedPicture;\n+    galleryPicture.src = picturesArray[selectedPicture].childNodes[1].src;\n+  }\n+};\n+\n+galleryContainer.addEventListener('click', _onPhotoClick);\n+\n+/** Вызывайте закрытие галереи по нажатию на Esc. */\n+var _onDocumentKeyDown = function(evt) {\n+  if ([27].indexOf(evt.keyCode) > -1) {\n+    evt.preventDefault();\n+    hideGallery();\n+  }\n+};\n+\n+galleryContainer.addEventListener('keydown', _onDocumentKeyDown);\n+\n+/**\n+* Вызывайте закрытие галереи по клику на оверлей вокруг фотографии.\n+* Удаляет обработчики событий.\n+*/\n+var _onOverlayClick = function(evt) {\n+  if (evt.target.classList.contains('gallery-overlay') ||\n+      evt.target.classList.contains('gallery-overlay-close')) {\n+    hideGallery();\n+  }\n+};\n+\n+galleryContainer.addEventListener('click', _onOverlayClick);\n+\n+/**\n+* Отображает галерею начиная с выбранный картинки\n+* @param {number} selectedPicture\n+*/\n+var showGallery = function() {\n+  galleryContainer.querySelector('.gallery-overlay-controls-like').textContent = selectedPicture.like;\n+  galleryContainer.querySelector('.gallery-overlay-controls-comments').textContent = selectedPicture.comments;\n+\n+  galleryContainer.classList.remove('invisible');\n+  console.dir(selectedPicture);\n+};\n+\n+/** Скрывает галерею */\n+var hideGallery = function() {\n+  galleryContainer.classList.add('invisible');\n+};\n+\n+module.exports = {\n+  selectPicture: selectPicture","path":"src/gallery.js","position":93,"original_position":93,"commit_id":"edf5ebaed8e0f98227218e59da3bbdb6061fa8b8","original_commit_id":"edf5ebaed8e0f98227218e59da3bbdb6061fa8b8","user":{"login":"juwain","id":928081,"avatar_url":"https://avatars.githubusercontent.com/u/928081?v=3","gravatar_id":"","url":"https://api.github.com/users/juwain","html_url":"https://github.com/juwain","followers_url":"https://api.github.com/users/juwain/followers","following_url":"https://api.github.com/users/juwain/following{/other_user}","gists_url":"https://api.github.com/users/juwain/gists{/gist_id}","starred_url":"https://api.github.com/users/juwain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juwain/subscriptions","organizations_url":"https://api.github.com/users/juwain/orgs","repos_url":"https://api.github.com/users/juwain/repos","events_url":"https://api.github.com/users/juwain/events{/privacy}","received_events_url":"https://api.github.com/users/juwain/received_events","type":"User","site_admin":false},"body":"В галерейка надо сделать финукцию, которая будет принимать набор дом-элементов картинок и уже всякие операции над ними творить: навешивать клики, рендерить показанную фотку в большом размере и т.д.","created_at":"2016-05-09T14:26:05Z","updated_at":"2016-05-09T14:26:05Z","html_url":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15#discussion_r62506332","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/comments/62506332"},"html":{"href":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15#discussion_r62506332"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15","id":69231009,"html_url":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15","diff_url":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15.diff","patch_url":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/15","number":15,"state":"open","locked":false,"title":"Объект «Галерея», начало","user":{"login":"perian","id":16835095,"avatar_url":"https://avatars.githubusercontent.com/u/16835095?v=3","gravatar_id":"","url":"https://api.github.com/users/perian","html_url":"https://github.com/perian","followers_url":"https://api.github.com/users/perian/followers","following_url":"https://api.github.com/users/perian/following{/other_user}","gists_url":"https://api.github.com/users/perian/gists{/gist_id}","starred_url":"https://api.github.com/users/perian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perian/subscriptions","organizations_url":"https://api.github.com/users/perian/orgs","repos_url":"https://api.github.com/users/perian/repos","events_url":"https://api.github.com/users/perian/events{/privacy}","received_events_url":"https://api.github.com/users/perian/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-05-07T02:55:47Z","updated_at":"2016-05-09T14:26:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1703176a2b4ce160efed958c8a950c842df4eb0c","assignee":{"login":"juwain","id":928081,"avatar_url":"https://avatars.githubusercontent.com/u/928081?v=3","gravatar_id":"","url":"https://api.github.com/users/juwain","html_url":"https://github.com/juwain","followers_url":"https://api.github.com/users/juwain/followers","following_url":"https://api.github.com/users/juwain/following{/other_user}","gists_url":"https://api.github.com/users/juwain/gists{/gist_id}","starred_url":"https://api.github.com/users/juwain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juwain/subscriptions","organizations_url":"https://api.github.com/users/juwain/orgs","repos_url":"https://api.github.com/users/juwain/repos","events_url":"https://api.github.com/users/juwain/events{/privacy}","received_events_url":"https://api.github.com/users/juwain/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/15/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/statuses/edf5ebaed8e0f98227218e59da3bbdb6061fa8b8","head":{"label":"perian:module7-task2","ref":"module7-task2","sha":"edf5ebaed8e0f98227218e59da3bbdb6061fa8b8","user":{"login":"perian","id":16835095,"avatar_url":"https://avatars.githubusercontent.com/u/16835095?v=3","gravatar_id":"","url":"https://api.github.com/users/perian","html_url":"https://github.com/perian","followers_url":"https://api.github.com/users/perian/followers","following_url":"https://api.github.com/users/perian/following{/other_user}","gists_url":"https://api.github.com/users/perian/gists{/gist_id}","starred_url":"https://api.github.com/users/perian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perian/subscriptions","organizations_url":"https://api.github.com/users/perian/orgs","repos_url":"https://api.github.com/users/perian/repos","events_url":"https://api.github.com/users/perian/events{/privacy}","received_events_url":"https://api.github.com/users/perian/received_events","type":"User","site_admin":false},"repo":{"id":54643459,"name":"11132-kekstagram","full_name":"perian/11132-kekstagram","owner":{"login":"perian","id":16835095,"avatar_url":"https://avatars.githubusercontent.com/u/16835095?v=3","gravatar_id":"","url":"https://api.github.com/users/perian","html_url":"https://github.com/perian","followers_url":"https://api.github.com/users/perian/followers","following_url":"https://api.github.com/users/perian/following{/other_user}","gists_url":"https://api.github.com/users/perian/gists{/gist_id}","starred_url":"https://api.github.com/users/perian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perian/subscriptions","organizations_url":"https://api.github.com/users/perian/orgs","repos_url":"https://api.github.com/users/perian/repos","events_url":"https://api.github.com/users/perian/events{/privacy}","received_events_url":"https://api.github.com/users/perian/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/perian/11132-kekstagram","description":"perian Дмитрий","fork":true,"url":"https://api.github.com/repos/perian/11132-kekstagram","forks_url":"https://api.github.com/repos/perian/11132-kekstagram/forks","keys_url":"https://api.github.com/repos/perian/11132-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/perian/11132-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/perian/11132-kekstagram/teams","hooks_url":"https://api.github.com/repos/perian/11132-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/perian/11132-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/perian/11132-kekstagram/events","assignees_url":"https://api.github.com/repos/perian/11132-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/perian/11132-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/perian/11132-kekstagram/tags","blobs_url":"https://api.github.com/repos/perian/11132-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/perian/11132-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/perian/11132-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/perian/11132-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/perian/11132-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/perian/11132-kekstagram/languages","stargazers_url":"https://api.github.com/repos/perian/11132-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/perian/11132-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/perian/11132-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/perian/11132-kekstagram/subscription","commits_url":"https://api.github.com/repos/perian/11132-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/perian/11132-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/perian/11132-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/perian/11132-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/perian/11132-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/perian/11132-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/perian/11132-kekstagram/merges","archive_url":"https://api.github.com/repos/perian/11132-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/perian/11132-kekstagram/downloads","issues_url":"https://api.github.com/repos/perian/11132-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/perian/11132-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/perian/11132-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/perian/11132-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/perian/11132-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/perian/11132-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/perian/11132-kekstagram/deployments","created_at":"2016-03-24T13:20:58Z","updated_at":"2016-04-01T12:15:59Z","pushed_at":"2016-05-08T17:14:48Z","git_url":"git://github.com/perian/11132-kekstagram.git","ssh_url":"git@github.com:perian/11132-kekstagram.git","clone_url":"https://github.com/perian/11132-kekstagram.git","svn_url":"https://github.com/perian/11132-kekstagram","homepage":null,"size":3791,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htmlacademy-javascript:master","ref":"master","sha":"21c256473fbbf4141cbff9d2121e4b0a500ba8fd","user":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"repo":{"id":54642721,"name":"11132-kekstagram","full_name":"htmlacademy-javascript/11132-kekstagram","owner":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htmlacademy-javascript/11132-kekstagram","description":"perian Дмитрий","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram","forks_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/deployments","created_at":"2016-03-24T13:09:48Z","updated_at":"2016-03-24T14:16:40Z","pushed_at":"2016-05-08T17:14:49Z","git_url":"git://github.com/htmlacademy-javascript/11132-kekstagram.git","ssh_url":"git@github.com:htmlacademy-javascript/11132-kekstagram.git","clone_url":"https://github.com/htmlacademy-javascript/11132-kekstagram.git","svn_url":"https://github.com/htmlacademy-javascript/11132-kekstagram","homepage":"https://github.com/perian/11132-kekstagram","size":3811,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15"},"html":{"href":"https://github.com/htmlacademy-javascript/11132-kekstagram/pull/15"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/15"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/11132-kekstagram/statuses/edf5ebaed8e0f98227218e59da3bbdb6061fa8b8"}}}}