{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/comments/77303950","id":77303950,"diff_hunk":"@@ -1,53 +1,66 @@\n 'use strict';\n \n-(function() {\n-  var gallery = require('./gallery.js');\n+var gallery = require('./gallery.js');\n+var elementToClone;\n+var templateElement = document.querySelector('template');\n \n-  var elementToClone;\n-  var templateElement = document.querySelector('template');\n+if ('content' in templateElement) {\n+  elementToClone = templateElement.content.querySelector('.picture');\n+} else {\n+  elementToClone = templateElement.querySelector('.picture');\n+}\n \n-  if ('content' in templateElement) {\n-    elementToClone = templateElement.content.querySelector('.picture');\n-  } else {\n-    elementToClone = templateElement.querySelector('.picture');\n-  }\n+var Picture = function(response, index) {\n+  var that = this;\n+  this.element = elementToClone.cloneNode(true);\n+  var image = this.element.querySelector('img');\n \n-  module.exports = function getPictureElement(response, container, index) {\n+  this.setup(response);\n+  this.load(image, that);\n \n-    var element = elementToClone.cloneNode(true);\n-\n-    container.appendChild(element);\n-    element.querySelector('.picture-comments').textContent = response.likes;\n-    element.querySelector('.picture-likes').textContent = response.comments;\n+  that.element.onclick = function(event) {\n+    event.preventDefault();\n+    gallery.show(index);\n+  };\n \n-    var newImage = new Image();\n-    var image = element.querySelector('img');\n-    var imageLoadTimeout;\n-    newImage.src = response.url;\n+  Picture.prototype.remove = function() {\n+    that.element.onclick = null;\n+  };\n+};\n \n-    newImage.onload = function(evt) {\n-      clearTimeout(imageLoadTimeout);\n-      image.width = '182';\n-      image.height = '182';\n-      image.src = evt.target.src;\n-    };\n+Picture.prototype = {};\n \n-    newImage.onerror = function() {\n-      element.classList.add('picture-load-failure');\n-    };\n+Picture.prototype.setup = function(response) {\n+  this.data = response;","path":"src/picture.js","position":62,"original_position":62,"commit_id":"70836dc1c42fee94df9499b8129e24c9b2232c04","original_commit_id":"70836dc1c42fee94df9499b8129e24c9b2232c04","user":{"login":"panban","id":8193640,"avatar_url":"https://avatars.githubusercontent.com/u/8193640?v=3","gravatar_id":"","url":"https://api.github.com/users/panban","html_url":"https://github.com/panban","followers_url":"https://api.github.com/users/panban/followers","following_url":"https://api.github.com/users/panban/following{/other_user}","gists_url":"https://api.github.com/users/panban/gists{/gist_id}","starred_url":"https://api.github.com/users/panban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panban/subscriptions","organizations_url":"https://api.github.com/users/panban/orgs","repos_url":"https://api.github.com/users/panban/repos","events_url":"https://api.github.com/users/panban/events{/privacy}","received_events_url":"https://api.github.com/users/panban/received_events","type":"User","site_admin":false},"body":"this.data = response - нужно писать в конструкторе. Иначе логика размазывается по методам класса, а это не хорошо","created_at":"2016-09-02T07:26:18Z","updated_at":"2016-09-02T07:26:18Z","html_url":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12#discussion_r77303950","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/comments/77303950"},"html":{"href":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12#discussion_r77303950"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12","id":83483186,"html_url":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12","diff_url":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12.diff","patch_url":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/12","number":12,"state":"open","locked":false,"title":"Второй класс","user":{"login":"ProkhorovStanislav","id":16772880,"avatar_url":"https://avatars.githubusercontent.com/u/16772880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProkhorovStanislav","html_url":"https://github.com/ProkhorovStanislav","followers_url":"https://api.github.com/users/ProkhorovStanislav/followers","following_url":"https://api.github.com/users/ProkhorovStanislav/following{/other_user}","gists_url":"https://api.github.com/users/ProkhorovStanislav/gists{/gist_id}","starred_url":"https://api.github.com/users/ProkhorovStanislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProkhorovStanislav/subscriptions","organizations_url":"https://api.github.com/users/ProkhorovStanislav/orgs","repos_url":"https://api.github.com/users/ProkhorovStanislav/repos","events_url":"https://api.github.com/users/ProkhorovStanislav/events{/privacy}","received_events_url":"https://api.github.com/users/ProkhorovStanislav/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-31T16:12:12Z","updated_at":"2016-09-02T07:26:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6179960934bbe7621ef41cc086aab57d010cbb6f","assignee":{"login":"panban","id":8193640,"avatar_url":"https://avatars.githubusercontent.com/u/8193640?v=3","gravatar_id":"","url":"https://api.github.com/users/panban","html_url":"https://github.com/panban","followers_url":"https://api.github.com/users/panban/followers","following_url":"https://api.github.com/users/panban/following{/other_user}","gists_url":"https://api.github.com/users/panban/gists{/gist_id}","starred_url":"https://api.github.com/users/panban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panban/subscriptions","organizations_url":"https://api.github.com/users/panban/orgs","repos_url":"https://api.github.com/users/panban/repos","events_url":"https://api.github.com/users/panban/events{/privacy}","received_events_url":"https://api.github.com/users/panban/received_events","type":"User","site_admin":false},"assignees":[{"login":"panban","id":8193640,"avatar_url":"https://avatars.githubusercontent.com/u/8193640?v=3","gravatar_id":"","url":"https://api.github.com/users/panban","html_url":"https://github.com/panban","followers_url":"https://api.github.com/users/panban/followers","following_url":"https://api.github.com/users/panban/following{/other_user}","gists_url":"https://api.github.com/users/panban/gists{/gist_id}","starred_url":"https://api.github.com/users/panban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panban/subscriptions","organizations_url":"https://api.github.com/users/panban/orgs","repos_url":"https://api.github.com/users/panban/repos","events_url":"https://api.github.com/users/panban/events{/privacy}","received_events_url":"https://api.github.com/users/panban/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/12/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/statuses/70836dc1c42fee94df9499b8129e24c9b2232c04","head":{"label":"ProkhorovStanislav:module6-task2","ref":"module6-task2","sha":"70836dc1c42fee94df9499b8129e24c9b2232c04","user":{"login":"ProkhorovStanislav","id":16772880,"avatar_url":"https://avatars.githubusercontent.com/u/16772880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProkhorovStanislav","html_url":"https://github.com/ProkhorovStanislav","followers_url":"https://api.github.com/users/ProkhorovStanislav/followers","following_url":"https://api.github.com/users/ProkhorovStanislav/following{/other_user}","gists_url":"https://api.github.com/users/ProkhorovStanislav/gists{/gist_id}","starred_url":"https://api.github.com/users/ProkhorovStanislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProkhorovStanislav/subscriptions","organizations_url":"https://api.github.com/users/ProkhorovStanislav/orgs","repos_url":"https://api.github.com/users/ProkhorovStanislav/repos","events_url":"https://api.github.com/users/ProkhorovStanislav/events{/privacy}","received_events_url":"https://api.github.com/users/ProkhorovStanislav/received_events","type":"User","site_admin":false},"repo":{"id":64865409,"name":"106983-kekstagram","full_name":"ProkhorovStanislav/106983-kekstagram","owner":{"login":"ProkhorovStanislav","id":16772880,"avatar_url":"https://avatars.githubusercontent.com/u/16772880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProkhorovStanislav","html_url":"https://github.com/ProkhorovStanislav","followers_url":"https://api.github.com/users/ProkhorovStanislav/followers","following_url":"https://api.github.com/users/ProkhorovStanislav/following{/other_user}","gists_url":"https://api.github.com/users/ProkhorovStanislav/gists{/gist_id}","starred_url":"https://api.github.com/users/ProkhorovStanislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProkhorovStanislav/subscriptions","organizations_url":"https://api.github.com/users/ProkhorovStanislav/orgs","repos_url":"https://api.github.com/users/ProkhorovStanislav/repos","events_url":"https://api.github.com/users/ProkhorovStanislav/events{/privacy}","received_events_url":"https://api.github.com/users/ProkhorovStanislav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ProkhorovStanislav/106983-kekstagram","description":"Станислав Прохоров","fork":true,"url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram","forks_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/forks","keys_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/teams","hooks_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/events","assignees_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/tags","blobs_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/languages","stargazers_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/subscription","commits_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/merges","archive_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/downloads","issues_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/ProkhorovStanislav/106983-kekstagram/deployments","created_at":"2016-08-03T17:29:30Z","updated_at":"2016-08-03T17:29:32Z","pushed_at":"2016-09-02T06:39:45Z","git_url":"git://github.com/ProkhorovStanislav/106983-kekstagram.git","ssh_url":"git@github.com:ProkhorovStanislav/106983-kekstagram.git","clone_url":"https://github.com/ProkhorovStanislav/106983-kekstagram.git","svn_url":"https://github.com/ProkhorovStanislav/106983-kekstagram","homepage":null,"size":4538,"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":"03bf159becb43aad232ef145782451f20dfa2690","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":64821543,"name":"106983-kekstagram","full_name":"htmlacademy-javascript/106983-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/106983-kekstagram","description":"Станислав Прохоров","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram","forks_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/deployments","created_at":"2016-08-03T06:35:10Z","updated_at":"2016-08-03T17:47:04Z","pushed_at":"2016-09-02T06:39:45Z","git_url":"git://github.com/htmlacademy-javascript/106983-kekstagram.git","ssh_url":"git@github.com:htmlacademy-javascript/106983-kekstagram.git","clone_url":"https://github.com/htmlacademy-javascript/106983-kekstagram.git","svn_url":"https://github.com/htmlacademy-javascript/106983-kekstagram","homepage":"https://github.com/ProkhorovStanislav/106983-kekstagram","size":4557,"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/106983-kekstagram/pulls/12"},"html":{"href":"https://github.com/htmlacademy-javascript/106983-kekstagram/pull/12"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/12"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/106983-kekstagram/statuses/70836dc1c42fee94df9499b8129e24c9b2232c04"}}}}
{"actor":{"display_login":"panban"}}