{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/comments/60796182","id":60796182,"diff_hunk":"@@ -0,0 +1,97 @@\n+'use strict';\n+\n+var utilities = require('../utilities');\n+var imageObjectsArray = document.querySelectorAll('.photogallery-image > img');\n+var galleryPreview = document.querySelector('.overlay-gallery-preview');\n+var galleryContainer = document.querySelector('.overlay-gallery');\n+var previewNumber = galleryContainer.querySelector('.preview-number-current');\n+var totalPreviews = galleryContainer.querySelector('.preview-number-total');\n+var btnCloseGallery = galleryContainer.querySelector('.overlay-gallery-close');\n+var btnPrev = galleryContainer.querySelector('.overlay-gallery-control-left');\n+var btnNext = galleryContainer.querySelector('.overlay-gallery-control-right');\n+var btnDisabledClass = 'overlay-gallery-control--disabled';\n+\n+function Gallery() {\n+  var self = this;\n+  this.photos = [];\n+\n+  this.makeGalleryArray = function() {\n+    self.photos = Array.prototype.map.call(imageObjectsArray, function(image, i) {\n+      image.dataset.id = i;\n+      return image.getAttribute('src');\n+    });\n+  };\n+\n+  this.make = function() {\n+    self.makeGalleryArray();\n+    totalPreviews.textContent = self.photos.length;\n+    self.currentPhoto = galleryPreview.appendChild(new Image());\n+  };\n+\n+  this.show = function(currentNumber) {\n+    this.changePhoto(currentNumber);\n+\n+    btnCloseGallery.addEventListener('click', self.closeGallery);\n+    btnPrev.addEventListener('click', self.showPrevImage);\n+    btnNext.addEventListener('click', self.showNextImage);\n+    window.addEventListener('keydown', self.downEsc);\n+\n+    utilities.setBlockInvisible(galleryContainer, false);\n+  };\n+\n+  this.showPrevImage = function(evt) {\n+    evt.preventDefault();\n+    if (self.currentNumber > 0) {\n+      self.changePhoto(self.currentNumber - 1);\n+    }\n+  };\n+\n+  this.showNextImage = function(evt) {\n+    evt.preventDefault();\n+    if (self.currentNumber < self.photos.length - 1) {\n+      self.changePhoto(self.currentNumber + 1);\n+    }\n+  };\n+\n+  this.hide = function() {\n+    utilities.setBlockInvisible(galleryContainer, true);\n+\n+    btnPrev.removeEventListener('click', self.showPrevImage);\n+    btnNext.removeEventListener('click', self.showNextImage);\n+    btnCloseGallery.removeEventListener('click', self.closeGallery);\n+\n+    window.removeEventListener('keydown', self.downEsc);\n+  };\n+\n+  this.closeGallery = function(evt) {\n+    evt.preventDefault();\n+    self.hide();\n+  };\n+\n+  this.downEsc = function(evt) {\n+    if (evt.keyCode === 27) {\n+      self.hide();\n+    }\n+  };\n+\n+  this.changePhoto = function(currentNumber) {\n+    self.currentNumber = currentNumber;\n+    self.currentPhoto.src = self.photos[self.currentNumber];\n+\n+    btnPrev.classList.toggle(btnDisabledClass, self.currentNumber === 0);\n+    btnNext.classList.toggle(btnDisabledClass, self.currentNumber === self.photos.length - 1);\n+\n+    previewNumber.textContent = self.currentNumber + 1;\n+  };\n+\n+  this.clickPhotogallery = function(evt) {\n+    if (evt.target.tagName === 'IMG') {","path":"src/gallery/gallery.js","position":88,"original_position":88,"commit_id":"6acc02b48147818b88af6657fd280c077bb53f1d","original_commit_id":"6acc02b48147818b88af6657fd280c077bb53f1d","user":{"login":"isqua","id":529247,"avatar_url":"https://avatars.githubusercontent.com/u/529247?v=3","gravatar_id":"","url":"https://api.github.com/users/isqua","html_url":"https://github.com/isqua","followers_url":"https://api.github.com/users/isqua/followers","following_url":"https://api.github.com/users/isqua/following{/other_user}","gists_url":"https://api.github.com/users/isqua/gists{/gist_id}","starred_url":"https://api.github.com/users/isqua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isqua/subscriptions","organizations_url":"https://api.github.com/users/isqua/orgs","repos_url":"https://api.github.com/users/isqua/repos","events_url":"https://api.github.com/users/isqua/events{/privacy}","received_events_url":"https://api.github.com/users/isqua/received_events","type":"User","site_admin":false},"body":"Ну, грубо говоря, у каждой картинки будет число лайков, и иконка лайков будет вставлена через `img`:\r\n<img width=\"314\" alt=\"_ _\" src=\"https://cloud.githubusercontent.com/assets/529247/14753559/ddcb416e-08de-11e6-9b30-a2f42ba79278.png\">\r\n```jade\r\ndiv.photogallery-item\r\n  a.photogallery-image\r\n    img // который ты делаешь показывательным\r\n  .likes\r\n    img // иконка лайков, которую ты не добавляешь в галерею\r\n```\r\nДальше ты слушаешь клики на всём `photogallery`, и проверяешь, не на `img` ли нажали. А нажали на картинку с лайком, и у тебя откроется галерея, но что ты в ней покажешь и зачем она открылась?","created_at":"2016-04-22T20:10:15Z","updated_at":"2016-04-22T20:10:15Z","html_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17#discussion_r60796182","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/comments/60796182"},"html":{"href":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17#discussion_r60796182"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17","id":67426197,"html_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17","diff_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17.diff","patch_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/17","number":17,"state":"open","locked":false,"title":"Объект «Галерея», продолжение","user":{"login":"fyvfyv","id":3251438,"avatar_url":"https://avatars.githubusercontent.com/u/3251438?v=3","gravatar_id":"","url":"https://api.github.com/users/fyvfyv","html_url":"https://github.com/fyvfyv","followers_url":"https://api.github.com/users/fyvfyv/followers","following_url":"https://api.github.com/users/fyvfyv/following{/other_user}","gists_url":"https://api.github.com/users/fyvfyv/gists{/gist_id}","starred_url":"https://api.github.com/users/fyvfyv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyvfyv/subscriptions","organizations_url":"https://api.github.com/users/fyvfyv/orgs","repos_url":"https://api.github.com/users/fyvfyv/repos","events_url":"https://api.github.com/users/fyvfyv/events{/privacy}","received_events_url":"https://api.github.com/users/fyvfyv/received_events","type":"User","site_admin":false},"body":"\n\n--\n:boom: https://htmlacademy-javascript.github.io/42390-code-and-magick/17/","created_at":"2016-04-21T21:34:47Z","updated_at":"2016-04-22T20:10:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43955f8e7d6568fb06d6f74894b78db1f59d2ae4","assignee":{"login":"isqua","id":529247,"avatar_url":"https://avatars.githubusercontent.com/u/529247?v=3","gravatar_id":"","url":"https://api.github.com/users/isqua","html_url":"https://github.com/isqua","followers_url":"https://api.github.com/users/isqua/followers","following_url":"https://api.github.com/users/isqua/following{/other_user}","gists_url":"https://api.github.com/users/isqua/gists{/gist_id}","starred_url":"https://api.github.com/users/isqua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isqua/subscriptions","organizations_url":"https://api.github.com/users/isqua/orgs","repos_url":"https://api.github.com/users/isqua/repos","events_url":"https://api.github.com/users/isqua/events{/privacy}","received_events_url":"https://api.github.com/users/isqua/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/17/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/statuses/6acc02b48147818b88af6657fd280c077bb53f1d","head":{"label":"fyvfyv:module8-task2","ref":"module8-task2","sha":"6acc02b48147818b88af6657fd280c077bb53f1d","user":{"login":"fyvfyv","id":3251438,"avatar_url":"https://avatars.githubusercontent.com/u/3251438?v=3","gravatar_id":"","url":"https://api.github.com/users/fyvfyv","html_url":"https://github.com/fyvfyv","followers_url":"https://api.github.com/users/fyvfyv/followers","following_url":"https://api.github.com/users/fyvfyv/following{/other_user}","gists_url":"https://api.github.com/users/fyvfyv/gists{/gist_id}","starred_url":"https://api.github.com/users/fyvfyv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyvfyv/subscriptions","organizations_url":"https://api.github.com/users/fyvfyv/orgs","repos_url":"https://api.github.com/users/fyvfyv/repos","events_url":"https://api.github.com/users/fyvfyv/events{/privacy}","received_events_url":"https://api.github.com/users/fyvfyv/received_events","type":"User","site_admin":false},"repo":{"id":54500671,"name":"code-and-magick","full_name":"fyvfyv/code-and-magick","owner":{"login":"fyvfyv","id":3251438,"avatar_url":"https://avatars.githubusercontent.com/u/3251438?v=3","gravatar_id":"","url":"https://api.github.com/users/fyvfyv","html_url":"https://github.com/fyvfyv","followers_url":"https://api.github.com/users/fyvfyv/followers","following_url":"https://api.github.com/users/fyvfyv/following{/other_user}","gists_url":"https://api.github.com/users/fyvfyv/gists{/gist_id}","starred_url":"https://api.github.com/users/fyvfyv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyvfyv/subscriptions","organizations_url":"https://api.github.com/users/fyvfyv/orgs","repos_url":"https://api.github.com/users/fyvfyv/repos","events_url":"https://api.github.com/users/fyvfyv/events{/privacy}","received_events_url":"https://api.github.com/users/fyvfyv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fyvfyv/code-and-magick","description":"Олег Петров","fork":true,"url":"https://api.github.com/repos/fyvfyv/code-and-magick","forks_url":"https://api.github.com/repos/fyvfyv/code-and-magick/forks","keys_url":"https://api.github.com/repos/fyvfyv/code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fyvfyv/code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fyvfyv/code-and-magick/teams","hooks_url":"https://api.github.com/repos/fyvfyv/code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/fyvfyv/code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/fyvfyv/code-and-magick/events","assignees_url":"https://api.github.com/repos/fyvfyv/code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/fyvfyv/code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/fyvfyv/code-and-magick/tags","blobs_url":"https://api.github.com/repos/fyvfyv/code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fyvfyv/code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fyvfyv/code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/fyvfyv/code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fyvfyv/code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/fyvfyv/code-and-magick/languages","stargazers_url":"https://api.github.com/repos/fyvfyv/code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/fyvfyv/code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/fyvfyv/code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/fyvfyv/code-and-magick/subscription","commits_url":"https://api.github.com/repos/fyvfyv/code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/fyvfyv/code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/fyvfyv/code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/fyvfyv/code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/fyvfyv/code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/fyvfyv/code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fyvfyv/code-and-magick/merges","archive_url":"https://api.github.com/repos/fyvfyv/code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fyvfyv/code-and-magick/downloads","issues_url":"https://api.github.com/repos/fyvfyv/code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/fyvfyv/code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/fyvfyv/code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/fyvfyv/code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fyvfyv/code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/fyvfyv/code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/fyvfyv/code-and-magick/deployments","created_at":"2016-03-22T18:52:07Z","updated_at":"2016-04-11T20:31:58Z","pushed_at":"2016-04-22T19:52:13Z","git_url":"git://github.com/fyvfyv/code-and-magick.git","ssh_url":"git@github.com:fyvfyv/code-and-magick.git","clone_url":"https://github.com/fyvfyv/code-and-magick.git","svn_url":"https://github.com/fyvfyv/code-and-magick","homepage":null,"size":1095,"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":"7985aec261d86faaf554067c7453b5c7f3027d33","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":54500257,"name":"42390-code-and-magick","full_name":"htmlacademy-javascript/42390-code-and-magick","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/42390-code-and-magick","description":"Олег Петров","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick","forks_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/deployments","created_at":"2016-03-22T18:45:29Z","updated_at":"2016-04-11T20:52:13Z","pushed_at":"2016-04-22T19:57:25Z","git_url":"git://github.com/htmlacademy-javascript/42390-code-and-magick.git","ssh_url":"git@github.com:htmlacademy-javascript/42390-code-and-magick.git","clone_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick.git","svn_url":"https://github.com/htmlacademy-javascript/42390-code-and-magick","homepage":"https://github.com/fyvfyv/code-and-magick","size":1183,"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/42390-code-and-magick/pulls/17"},"html":{"href":"https://github.com/htmlacademy-javascript/42390-code-and-magick/pull/17"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/17"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/42390-code-and-magick/statuses/6acc02b48147818b88af6657fd280c077bb53f1d"}}}}