{"action":"created","comment":{"url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/comments/40415484","id":40415484,"diff_hunk":"@@ -0,0 +1,58 @@\n+// скрываем фильтры, добавляя класс hidden\n+\n+function filterHidden(){\n+\tdocument.querySelector('.filters').classList.add('hidden');\n+};\n+\n+filterHidden();\n+\n+// функция показа фильтров (удаление класса hidden)\n+\n+function filterShow(){\n+\tdocument.querySelector('.filters').classList.remove('hidden');\n+};\n+\n+(function(){\n+\n+\tvar picturesContainer = document.querySelector('.pictures');\t\t\t\t// записываем в переменную элемент, в который будем помещать img\n+\tvar pictureTemplate = document.getElementById('picture-template');\t\t\t// записываем в переменную конструкцию, которая будет шаблоном для вывода img\n+\tvar IMAGE_FAILURE_TIMEOUT = 10000;\t\t\t\t\t\t\t\t\t\t\t// устанавливаем максимальное количество времени для загрузки img с сервера\n+\n+\tvar picturesFragment = document.createDocumentFragment();\t\t\t\t\t// записываем в fragment множество элементов для последующего добавления в DOM (ускоряет производительность)\n+\n+\tpictures.forEach(function(picture, i) {\t\t\t\t\t\t\t\t\t\t\t// итерируемся по объектам массива pictures через forEach\n+\t\tvar newPictureElement = pictureTemplate.content.children[0].cloneNode(true);\t\t\t\t// клонируем первый элемент шаблона вместе с вложенными элементами, за что отвечает cloneNode(true);\n+\n+\t    newPictureElement.querySelector('.picture-comments').textContent = picture['comments'];\t\t// в элемент шаблона .picture-comments добавляем соответствуюющее значение из объекта массива pictures\n+\t    newPictureElement.querySelector('.picture-likes').textContent = picture['likes'];\t\t\t// в элемент шаблона .picture-likes добавляем соответствуюющее значение из объекта массива pictures\n+\n+\t    picturesFragment.appendChild(newPictureElement);\t\t\t\t\t\t\t\t\t\t\t// добавляем в picturesFragment новые эелементы\n+\n+\t    if (picture['url']) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t// если элемент объекта имеет url \n+\t    \tvar newPicture = new Image();\t\t\t\t\t\t\t\t\t\t\t// создаем новый объект Image\n+\t    \tnewPicture.src = picture['url'];\t\t\t\t\t\t\t\t\t\t// присваиваем url новому объекту\n+\t    \tvar oldPicture = newPictureElement.querySelector('img');\t\t\t\t// находим старый элемент img и присваиваем переменной\n+\n+\t\t    var imageLoadTimeout = setTimeout(function() {\t\t\t\t\t\t\t// устанавливаем тайм-аут для загрузки img\n+\t\t    \tnewPictureElement.classList.add('picture-load-failure');\t\t\t// если в течении 10 сек img не загрузится, то присваиваем ей класс .picture-load-failure\n+\t\t    }, IMAGE_FAILURE_TIMEOUT);\n+\t    \t\n+\t    \tnewPicture.onload = function() {\t\t\t\t\t\t\t\t\t\t// по загрузке изображения выполняем: \n+\t    \t\tnewPictureElement.replaceChild(newPicture,oldPicture);\t\t\t\t// заменяем старый img новым img\n+\t    \t\tnewPicture.style.height = '182px';","path":"js/pictures.js","position":42,"original_position":42,"commit_id":"4d574321de1191771c1beb6b3faae3ed68021b77","original_commit_id":"4d574321de1191771c1beb6b3faae3ed68021b77","user":{"login":"sslava","id":192787,"avatar_url":"https://avatars.githubusercontent.com/u/192787?v=3","gravatar_id":"","url":"https://api.github.com/users/sslava","html_url":"https://github.com/sslava","followers_url":"https://api.github.com/users/sslava/followers","following_url":"https://api.github.com/users/sslava/following{/other_user}","gists_url":"https://api.github.com/users/sslava/gists{/gist_id}","starred_url":"https://api.github.com/users/sslava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sslava/subscriptions","organizations_url":"https://api.github.com/users/sslava/orgs","repos_url":"https://api.github.com/users/sslava/repos","events_url":"https://api.github.com/users/sslava/events{/privacy}","received_events_url":"https://api.github.com/users/sslava/received_events","type":"User","site_admin":false},"body":"Попридиаюсь: наверно лучше сначала просетить стили а потом реплэйсить элемент.","created_at":"2015-09-25T09:59:58Z","updated_at":"2015-09-25T09:59:58Z","html_url":"https://github.com/js-htmlacademy/113758-keksogram/pull/3#discussion_r40415484","pull_request_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/comments/40415484"},"html":{"href":"https://github.com/js-htmlacademy/113758-keksogram/pull/3#discussion_r40415484"},"pull_request":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3","id":45992549,"html_url":"https://github.com/js-htmlacademy/113758-keksogram/pull/3","diff_url":"https://github.com/js-htmlacademy/113758-keksogram/pull/3.diff","patch_url":"https://github.com/js-htmlacademy/113758-keksogram/pull/3.patch","issue_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/3","number":3,"state":"open","locked":false,"title":"Pull request - second task (js template)","user":{"login":"norzserge","id":10448914,"avatar_url":"https://avatars.githubusercontent.com/u/10448914?v=3","gravatar_id":"","url":"https://api.github.com/users/norzserge","html_url":"https://github.com/norzserge","followers_url":"https://api.github.com/users/norzserge/followers","following_url":"https://api.github.com/users/norzserge/following{/other_user}","gists_url":"https://api.github.com/users/norzserge/gists{/gist_id}","starred_url":"https://api.github.com/users/norzserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norzserge/subscriptions","organizations_url":"https://api.github.com/users/norzserge/orgs","repos_url":"https://api.github.com/users/norzserge/repos","events_url":"https://api.github.com/users/norzserge/events{/privacy}","received_events_url":"https://api.github.com/users/norzserge/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-09-25T09:27:21Z","updated_at":"2015-09-25T09:59:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68164caf112b24bf2d653a2062617ef0f235326a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3/commits","review_comments_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3/comments","review_comment_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/3/comments","statuses_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/statuses/4d574321de1191771c1beb6b3faae3ed68021b77","head":{"label":"norzserge:master","ref":"master","sha":"4d574321de1191771c1beb6b3faae3ed68021b77","user":{"login":"norzserge","id":10448914,"avatar_url":"https://avatars.githubusercontent.com/u/10448914?v=3","gravatar_id":"","url":"https://api.github.com/users/norzserge","html_url":"https://github.com/norzserge","followers_url":"https://api.github.com/users/norzserge/followers","following_url":"https://api.github.com/users/norzserge/following{/other_user}","gists_url":"https://api.github.com/users/norzserge/gists{/gist_id}","starred_url":"https://api.github.com/users/norzserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norzserge/subscriptions","organizations_url":"https://api.github.com/users/norzserge/orgs","repos_url":"https://api.github.com/users/norzserge/repos","events_url":"https://api.github.com/users/norzserge/events{/privacy}","received_events_url":"https://api.github.com/users/norzserge/received_events","type":"User","site_admin":false},"repo":{"id":42745248,"name":"113758-keksogram","full_name":"norzserge/113758-keksogram","owner":{"login":"norzserge","id":10448914,"avatar_url":"https://avatars.githubusercontent.com/u/10448914?v=3","gravatar_id":"","url":"https://api.github.com/users/norzserge","html_url":"https://github.com/norzserge","followers_url":"https://api.github.com/users/norzserge/followers","following_url":"https://api.github.com/users/norzserge/following{/other_user}","gists_url":"https://api.github.com/users/norzserge/gists{/gist_id}","starred_url":"https://api.github.com/users/norzserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norzserge/subscriptions","organizations_url":"https://api.github.com/users/norzserge/orgs","repos_url":"https://api.github.com/users/norzserge/repos","events_url":"https://api.github.com/users/norzserge/events{/privacy}","received_events_url":"https://api.github.com/users/norzserge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/norzserge/113758-keksogram","description":"Сергей Метельский","fork":true,"url":"https://api.github.com/repos/norzserge/113758-keksogram","forks_url":"https://api.github.com/repos/norzserge/113758-keksogram/forks","keys_url":"https://api.github.com/repos/norzserge/113758-keksogram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/norzserge/113758-keksogram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/norzserge/113758-keksogram/teams","hooks_url":"https://api.github.com/repos/norzserge/113758-keksogram/hooks","issue_events_url":"https://api.github.com/repos/norzserge/113758-keksogram/issues/events{/number}","events_url":"https://api.github.com/repos/norzserge/113758-keksogram/events","assignees_url":"https://api.github.com/repos/norzserge/113758-keksogram/assignees{/user}","branches_url":"https://api.github.com/repos/norzserge/113758-keksogram/branches{/branch}","tags_url":"https://api.github.com/repos/norzserge/113758-keksogram/tags","blobs_url":"https://api.github.com/repos/norzserge/113758-keksogram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/norzserge/113758-keksogram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/norzserge/113758-keksogram/git/refs{/sha}","trees_url":"https://api.github.com/repos/norzserge/113758-keksogram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/norzserge/113758-keksogram/statuses/{sha}","languages_url":"https://api.github.com/repos/norzserge/113758-keksogram/languages","stargazers_url":"https://api.github.com/repos/norzserge/113758-keksogram/stargazers","contributors_url":"https://api.github.com/repos/norzserge/113758-keksogram/contributors","subscribers_url":"https://api.github.com/repos/norzserge/113758-keksogram/subscribers","subscription_url":"https://api.github.com/repos/norzserge/113758-keksogram/subscription","commits_url":"https://api.github.com/repos/norzserge/113758-keksogram/commits{/sha}","git_commits_url":"https://api.github.com/repos/norzserge/113758-keksogram/git/commits{/sha}","comments_url":"https://api.github.com/repos/norzserge/113758-keksogram/comments{/number}","issue_comment_url":"https://api.github.com/repos/norzserge/113758-keksogram/issues/comments{/number}","contents_url":"https://api.github.com/repos/norzserge/113758-keksogram/contents/{+path}","compare_url":"https://api.github.com/repos/norzserge/113758-keksogram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/norzserge/113758-keksogram/merges","archive_url":"https://api.github.com/repos/norzserge/113758-keksogram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/norzserge/113758-keksogram/downloads","issues_url":"https://api.github.com/repos/norzserge/113758-keksogram/issues{/number}","pulls_url":"https://api.github.com/repos/norzserge/113758-keksogram/pulls{/number}","milestones_url":"https://api.github.com/repos/norzserge/113758-keksogram/milestones{/number}","notifications_url":"https://api.github.com/repos/norzserge/113758-keksogram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/norzserge/113758-keksogram/labels{/name}","releases_url":"https://api.github.com/repos/norzserge/113758-keksogram/releases{/id}","created_at":"2015-09-18T20:19:39Z","updated_at":"2015-09-22T08:55:58Z","pushed_at":"2015-09-25T09:25:56Z","git_url":"git://github.com/norzserge/113758-keksogram.git","ssh_url":"git@github.com:norzserge/113758-keksogram.git","clone_url":"https://github.com/norzserge/113758-keksogram.git","svn_url":"https://github.com/norzserge/113758-keksogram","homepage":null,"size":0,"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":"js-htmlacademy:master","ref":"master","sha":"88229c6000e9156f959b8cca99e90b9602f893f5","user":{"login":"js-htmlacademy","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/js-htmlacademy","html_url":"https://github.com/js-htmlacademy","followers_url":"https://api.github.com/users/js-htmlacademy/followers","following_url":"https://api.github.com/users/js-htmlacademy/following{/other_user}","gists_url":"https://api.github.com/users/js-htmlacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/js-htmlacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/js-htmlacademy/subscriptions","organizations_url":"https://api.github.com/users/js-htmlacademy/orgs","repos_url":"https://api.github.com/users/js-htmlacademy/repos","events_url":"https://api.github.com/users/js-htmlacademy/events{/privacy}","received_events_url":"https://api.github.com/users/js-htmlacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":42745210,"name":"113758-keksogram","full_name":"js-htmlacademy/113758-keksogram","owner":{"login":"js-htmlacademy","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/js-htmlacademy","html_url":"https://github.com/js-htmlacademy","followers_url":"https://api.github.com/users/js-htmlacademy/followers","following_url":"https://api.github.com/users/js-htmlacademy/following{/other_user}","gists_url":"https://api.github.com/users/js-htmlacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/js-htmlacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/js-htmlacademy/subscriptions","organizations_url":"https://api.github.com/users/js-htmlacademy/orgs","repos_url":"https://api.github.com/users/js-htmlacademy/repos","events_url":"https://api.github.com/users/js-htmlacademy/events{/privacy}","received_events_url":"https://api.github.com/users/js-htmlacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/js-htmlacademy/113758-keksogram","description":"Сергей Метельский","fork":false,"url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram","forks_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/forks","keys_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/teams","hooks_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/hooks","issue_events_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/events{/number}","events_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/events","assignees_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/assignees{/user}","branches_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/branches{/branch}","tags_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/tags","blobs_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/git/refs{/sha}","trees_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/statuses/{sha}","languages_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/languages","stargazers_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/stargazers","contributors_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/contributors","subscribers_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/subscribers","subscription_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/subscription","commits_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/commits{/sha}","git_commits_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/git/commits{/sha}","comments_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/comments{/number}","issue_comment_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/comments{/number}","contents_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/contents/{+path}","compare_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/merges","archive_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/downloads","issues_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues{/number}","pulls_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls{/number}","milestones_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/milestones{/number}","notifications_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/labels{/name}","releases_url":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/releases{/id}","created_at":"2015-09-18T20:18:42Z","updated_at":"2015-09-22T10:17:52Z","pushed_at":"2015-09-25T09:27:22Z","git_url":"git://github.com/js-htmlacademy/113758-keksogram.git","ssh_url":"git@github.com:js-htmlacademy/113758-keksogram.git","clone_url":"https://github.com/js-htmlacademy/113758-keksogram.git","svn_url":"https://github.com/js-htmlacademy/113758-keksogram","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"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/js-htmlacademy/113758-keksogram/pulls/3"},"html":{"href":"https://github.com/js-htmlacademy/113758-keksogram/pull/3"},"issue":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/3"},"comments":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/js-htmlacademy/113758-keksogram/statuses/4d574321de1191771c1beb6b3faae3ed68021b77"}}}}