{"action":"created","comment":{"url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/comments/40732781","id":40732781,"diff_hunk":"@@ -0,0 +1,63 @@\n+/**\n+ * Created by pavel on 27.9.15.\n+ */\n+// Defining page objects.\n+\n+var startX = document.getElementById('resize-x');\n+var startY = document.getElementById('resize-y');\n+var sideSize = document.getElementById('resize-size');\n+var btnFwd = document.getElementById('resize-fwd');\n+\n+// Defining form variables.\n+\n+var condX = false;\n+var condY = false;\n+var condSide = false;\n+var IMAGE_SIDE = 582;\n+\n+\n+// Validating cropping starting point (axis X).\n+\n+startX.onchange = function() {\n+    if (+startX.value > -1 && +startX.value + +sideSize.value <= IMAGE_SIDE) {","path":"js/form-validation.js","position":22,"original_position":22,"commit_id":"83f2fbaa49957b949fba4d2559fee963b4021fe3","original_commit_id":"83f2fbaa49957b949fba4d2559fee963b4021fe3","user":{"login":"mokhov","id":357689,"avatar_url":"https://avatars.githubusercontent.com/u/357689?v=3","gravatar_id":"","url":"https://api.github.com/users/mokhov","html_url":"https://github.com/mokhov","followers_url":"https://api.github.com/users/mokhov/followers","following_url":"https://api.github.com/users/mokhov/following{/other_user}","gists_url":"https://api.github.com/users/mokhov/gists{/gist_id}","starred_url":"https://api.github.com/users/mokhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mokhov/subscriptions","organizations_url":"https://api.github.com/users/mokhov/orgs","repos_url":"https://api.github.com/users/mokhov/repos","events_url":"https://api.github.com/users/mokhov/events{/privacy}","received_events_url":"https://api.github.com/users/mokhov/received_events","type":"User","site_admin":false},"body":"Приведение типов через `+` – это норм, но повсеместное использование дурно пахнет (т.е создаётся ощущение перестраховки везде. Что тут можно сделать:\r\n1. Вынести в переменные\r\n2. Вынести в функции getter'ы, где явное приведение типов будет в одном месте\r\nДалее, нужно понимать зачем уместно ли приведение, например вот здесь:\r\n`+startX.value > -1`\r\nего делать бессмысленно в принципе, потому что:\r\n> При сравнении числа и строки, строка преобразуется в числовое значение. \r\n> Яваскрипт при этом получает значение числа из строкового литерала: \"123\" == 123.\r\nсправедливо и для операторов `<, >` например","created_at":"2015-09-29T21:31:53Z","updated_at":"2015-09-29T21:31:53Z","html_url":"https://github.com/js-htmlacademy/113953-keksogram/pull/1#discussion_r40732781","pull_request_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/comments/40732781"},"html":{"href":"https://github.com/js-htmlacademy/113953-keksogram/pull/1#discussion_r40732781"},"pull_request":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1","id":46242616,"html_url":"https://github.com/js-htmlacademy/113953-keksogram/pull/1","diff_url":"https://github.com/js-htmlacademy/113953-keksogram/pull/1.diff","patch_url":"https://github.com/js-htmlacademy/113953-keksogram/pull/1.patch","issue_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/1","number":1,"state":"open","locked":false,"title":"Домашнее задание №2 \"Знакомство с DOM\"","user":{"login":"lautsevich","id":196445,"avatar_url":"https://avatars.githubusercontent.com/u/196445?v=3","gravatar_id":"","url":"https://api.github.com/users/lautsevich","html_url":"https://github.com/lautsevich","followers_url":"https://api.github.com/users/lautsevich/followers","following_url":"https://api.github.com/users/lautsevich/following{/other_user}","gists_url":"https://api.github.com/users/lautsevich/gists{/gist_id}","starred_url":"https://api.github.com/users/lautsevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautsevich/subscriptions","organizations_url":"https://api.github.com/users/lautsevich/orgs","repos_url":"https://api.github.com/users/lautsevich/repos","events_url":"https://api.github.com/users/lautsevich/events{/privacy}","received_events_url":"https://api.github.com/users/lautsevich/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-29T07:01:42Z","updated_at":"2015-09-29T21:31:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5a535f3a929e8dfd7497456c4ee7f4f8f684d03","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1/commits","review_comments_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1/comments","review_comment_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/1/comments","statuses_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/statuses/83f2fbaa49957b949fba4d2559fee963b4021fe3","head":{"label":"lautsevich:master","ref":"master","sha":"83f2fbaa49957b949fba4d2559fee963b4021fe3","user":{"login":"lautsevich","id":196445,"avatar_url":"https://avatars.githubusercontent.com/u/196445?v=3","gravatar_id":"","url":"https://api.github.com/users/lautsevich","html_url":"https://github.com/lautsevich","followers_url":"https://api.github.com/users/lautsevich/followers","following_url":"https://api.github.com/users/lautsevich/following{/other_user}","gists_url":"https://api.github.com/users/lautsevich/gists{/gist_id}","starred_url":"https://api.github.com/users/lautsevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautsevich/subscriptions","organizations_url":"https://api.github.com/users/lautsevich/orgs","repos_url":"https://api.github.com/users/lautsevich/repos","events_url":"https://api.github.com/users/lautsevich/events{/privacy}","received_events_url":"https://api.github.com/users/lautsevich/received_events","type":"User","site_admin":false},"repo":{"id":42945694,"name":"113953-keksogram","full_name":"lautsevich/113953-keksogram","owner":{"login":"lautsevich","id":196445,"avatar_url":"https://avatars.githubusercontent.com/u/196445?v=3","gravatar_id":"","url":"https://api.github.com/users/lautsevich","html_url":"https://github.com/lautsevich","followers_url":"https://api.github.com/users/lautsevich/followers","following_url":"https://api.github.com/users/lautsevich/following{/other_user}","gists_url":"https://api.github.com/users/lautsevich/gists{/gist_id}","starred_url":"https://api.github.com/users/lautsevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautsevich/subscriptions","organizations_url":"https://api.github.com/users/lautsevich/orgs","repos_url":"https://api.github.com/users/lautsevich/repos","events_url":"https://api.github.com/users/lautsevich/events{/privacy}","received_events_url":"https://api.github.com/users/lautsevich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lautsevich/113953-keksogram","description":"Павел Ловцевич","fork":true,"url":"https://api.github.com/repos/lautsevich/113953-keksogram","forks_url":"https://api.github.com/repos/lautsevich/113953-keksogram/forks","keys_url":"https://api.github.com/repos/lautsevich/113953-keksogram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lautsevich/113953-keksogram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lautsevich/113953-keksogram/teams","hooks_url":"https://api.github.com/repos/lautsevich/113953-keksogram/hooks","issue_events_url":"https://api.github.com/repos/lautsevich/113953-keksogram/issues/events{/number}","events_url":"https://api.github.com/repos/lautsevich/113953-keksogram/events","assignees_url":"https://api.github.com/repos/lautsevich/113953-keksogram/assignees{/user}","branches_url":"https://api.github.com/repos/lautsevich/113953-keksogram/branches{/branch}","tags_url":"https://api.github.com/repos/lautsevich/113953-keksogram/tags","blobs_url":"https://api.github.com/repos/lautsevich/113953-keksogram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lautsevich/113953-keksogram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lautsevich/113953-keksogram/git/refs{/sha}","trees_url":"https://api.github.com/repos/lautsevich/113953-keksogram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lautsevich/113953-keksogram/statuses/{sha}","languages_url":"https://api.github.com/repos/lautsevich/113953-keksogram/languages","stargazers_url":"https://api.github.com/repos/lautsevich/113953-keksogram/stargazers","contributors_url":"https://api.github.com/repos/lautsevich/113953-keksogram/contributors","subscribers_url":"https://api.github.com/repos/lautsevich/113953-keksogram/subscribers","subscription_url":"https://api.github.com/repos/lautsevich/113953-keksogram/subscription","commits_url":"https://api.github.com/repos/lautsevich/113953-keksogram/commits{/sha}","git_commits_url":"https://api.github.com/repos/lautsevich/113953-keksogram/git/commits{/sha}","comments_url":"https://api.github.com/repos/lautsevich/113953-keksogram/comments{/number}","issue_comment_url":"https://api.github.com/repos/lautsevich/113953-keksogram/issues/comments{/number}","contents_url":"https://api.github.com/repos/lautsevich/113953-keksogram/contents/{+path}","compare_url":"https://api.github.com/repos/lautsevich/113953-keksogram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lautsevich/113953-keksogram/merges","archive_url":"https://api.github.com/repos/lautsevich/113953-keksogram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lautsevich/113953-keksogram/downloads","issues_url":"https://api.github.com/repos/lautsevich/113953-keksogram/issues{/number}","pulls_url":"https://api.github.com/repos/lautsevich/113953-keksogram/pulls{/number}","milestones_url":"https://api.github.com/repos/lautsevich/113953-keksogram/milestones{/number}","notifications_url":"https://api.github.com/repos/lautsevich/113953-keksogram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lautsevich/113953-keksogram/labels{/name}","releases_url":"https://api.github.com/repos/lautsevich/113953-keksogram/releases{/id}","created_at":"2015-09-22T16:18:29Z","updated_at":"2015-09-28T12:53:56Z","pushed_at":"2015-09-28T14:14:47Z","git_url":"git://github.com/lautsevich/113953-keksogram.git","ssh_url":"git@github.com:lautsevich/113953-keksogram.git","clone_url":"https://github.com/lautsevich/113953-keksogram.git","svn_url":"https://github.com/lautsevich/113953-keksogram","homepage":null,"size":2009,"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":"0a48f02411cd8d06a0d27779fab3aa0359ff7329","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":42878943,"name":"113953-keksogram","full_name":"js-htmlacademy/113953-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/113953-keksogram","description":"Павел Ловцевич","fork":false,"url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram","forks_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/forks","keys_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/teams","hooks_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/hooks","issue_events_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/events{/number}","events_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/events","assignees_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/assignees{/user}","branches_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/branches{/branch}","tags_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/tags","blobs_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/git/refs{/sha}","trees_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/statuses/{sha}","languages_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/languages","stargazers_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/stargazers","contributors_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/contributors","subscribers_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/subscribers","subscription_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/subscription","commits_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/commits{/sha}","git_commits_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/git/commits{/sha}","comments_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/comments{/number}","issue_comment_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/comments{/number}","contents_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/contents/{+path}","compare_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/merges","archive_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/downloads","issues_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues{/number}","pulls_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls{/number}","milestones_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/milestones{/number}","notifications_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/labels{/name}","releases_url":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/releases{/id}","created_at":"2015-09-21T16:31:34Z","updated_at":"2015-09-22T18:43:47Z","pushed_at":"2015-09-29T07:01:43Z","git_url":"git://github.com/js-htmlacademy/113953-keksogram.git","ssh_url":"git@github.com:js-htmlacademy/113953-keksogram.git","clone_url":"https://github.com/js-htmlacademy/113953-keksogram.git","svn_url":"https://github.com/js-htmlacademy/113953-keksogram","homepage":null,"size":2019,"stargazers_count":0,"watchers_count":0,"language":"CSS","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/113953-keksogram/pulls/1"},"html":{"href":"https://github.com/js-htmlacademy/113953-keksogram/pull/1"},"issue":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/1"},"comments":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/js-htmlacademy/113953-keksogram/statuses/83f2fbaa49957b949fba4d2559fee963b4021fe3"}}}}