{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/comments/74912073","id":74912073,"diff_hunk":"@@ -81,6 +83,69 @@ window.form = (function() {\n     rating[i].addEventListener('change', validateForm);\n   }\n \n+  /**\n+   * Cookies\n+   */\n+\n+  /**\n+   * переменные для работы с cookies\n+   */\n+  var givenMark = reviewForm.elements['review-mark'].value;\n+  var enteredName = reviewFormNameField.value;\n+\n+\n+  var currentDate = new Date();\n+\n+  /**\n+   * получаю компоненты даты\n+   * для создания текущей даты с часами / секундами, равными 0:\n+   * таким образом последующие вычисления не будут содержать дробные величины\n+   */\n+  var currentYear = currentDate.getFullYear();\n+  var currentMonth = currentDate.getMonth();\n+  var currentDay = currentDate.getDay();\n+\n+  var today = new Date(currentYear, currentMonth, currentDay);\n+  var GraceHopperBirthday = new Date(currentYear, 11, 9);\n+  /**\n+   * кол-во мс в сутках\n+   */\n+  var DAY_IN_MS = 3600 * 24 * 1000;\n+\n+  /**\n+   * вычисляем, сколько дней в текущем году (год может быть високосным)\n+   */\n+  var currentYearDaysNumber = ( new Date(currentYear, 11, 31) - new Date(currentYear, 0, 0) ) / DAY_IN_MS;\n+\n+  /**\n+   * вычисляем кол-во дней, прошедших с момента указанной даты,\n+   * с последующей передачей вычисленного значения в функцию\n+   * в качестве параметра\n+   */\n+  var daysDiff = (today - GraceHopperBirthday) / DAY_IN_MS;\n+\n+  var daysNumber = getPassedDaysNumber(currentYearDaysNumber, daysDiff);\n+\n+  /**\n+   * Ограничиваем суммарное значение вычислений 1-м параметром\n+   * @param {Number} num1\n+   * @param  {Number} num2\n+   * @returns {Number}\n+   */\n+  function getPassedDaysNumber(num1, num2) {\n+    var sum = num1 + num2;\n+    return (sum > num1) ? num2 : sum;\n+  }\n+\n+  /**\n+   * сохраняем выбранные значения в cookies\n+   */\n+  browserCookies.set('review-mark', givenMark, {expires: daysNumber});\n+  browserCookies.set('review-name', enteredName, {expires: daysNumber});\n+\n+  reviewForm.elements['review-mark'].value = browserCookies.get('review-mark');\n+  reviewFormNameField.setAttribute('placeholder', browserCookies.get('review-name'));","path":"src/form.js","position":73,"original_position":73,"commit_id":"46f8cde036d0ec1c2e9b4c5d04559d5cac94096d","original_commit_id":"46f8cde036d0ec1c2e9b4c5d04559d5cac94096d","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":"А зачем вообще надо сохранять их, как думаешь?","created_at":"2016-08-16T10:41:18Z","updated_at":"2016-08-16T10:41:18Z","html_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8#discussion_r74912073","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/comments/74912073"},"html":{"href":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8#discussion_r74912073"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8","id":81449472,"html_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8","diff_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8.diff","patch_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/8","number":8,"state":"open","locked":false,"title":"Cookies","user":{"login":"CalledByThe4ire","id":10440575,"avatar_url":"https://avatars.githubusercontent.com/u/10440575?v=3","gravatar_id":"","url":"https://api.github.com/users/CalledByThe4ire","html_url":"https://github.com/CalledByThe4ire","followers_url":"https://api.github.com/users/CalledByThe4ire/followers","following_url":"https://api.github.com/users/CalledByThe4ire/following{/other_user}","gists_url":"https://api.github.com/users/CalledByThe4ire/gists{/gist_id}","starred_url":"https://api.github.com/users/CalledByThe4ire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CalledByThe4ire/subscriptions","organizations_url":"https://api.github.com/users/CalledByThe4ire/orgs","repos_url":"https://api.github.com/users/CalledByThe4ire/repos","events_url":"https://api.github.com/users/CalledByThe4ire/events{/privacy}","received_events_url":"https://api.github.com/users/CalledByThe4ire/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-16T10:36:41Z","updated_at":"2016-08-16T10:41:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f79251213fab435290a3738e27509938422aec7e","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},"assignees":[{"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/17243-code-and-magick/pulls/8/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/8/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/statuses/46f8cde036d0ec1c2e9b4c5d04559d5cac94096d","head":{"label":"CalledByThe4ire:module3-task3","ref":"module3-task3","sha":"46f8cde036d0ec1c2e9b4c5d04559d5cac94096d","user":{"login":"CalledByThe4ire","id":10440575,"avatar_url":"https://avatars.githubusercontent.com/u/10440575?v=3","gravatar_id":"","url":"https://api.github.com/users/CalledByThe4ire","html_url":"https://github.com/CalledByThe4ire","followers_url":"https://api.github.com/users/CalledByThe4ire/followers","following_url":"https://api.github.com/users/CalledByThe4ire/following{/other_user}","gists_url":"https://api.github.com/users/CalledByThe4ire/gists{/gist_id}","starred_url":"https://api.github.com/users/CalledByThe4ire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CalledByThe4ire/subscriptions","organizations_url":"https://api.github.com/users/CalledByThe4ire/orgs","repos_url":"https://api.github.com/users/CalledByThe4ire/repos","events_url":"https://api.github.com/users/CalledByThe4ire/events{/privacy}","received_events_url":"https://api.github.com/users/CalledByThe4ire/received_events","type":"User","site_admin":false},"repo":{"id":64783253,"name":"17243-code-and-magick","full_name":"CalledByThe4ire/17243-code-and-magick","owner":{"login":"CalledByThe4ire","id":10440575,"avatar_url":"https://avatars.githubusercontent.com/u/10440575?v=3","gravatar_id":"","url":"https://api.github.com/users/CalledByThe4ire","html_url":"https://github.com/CalledByThe4ire","followers_url":"https://api.github.com/users/CalledByThe4ire/followers","following_url":"https://api.github.com/users/CalledByThe4ire/following{/other_user}","gists_url":"https://api.github.com/users/CalledByThe4ire/gists{/gist_id}","starred_url":"https://api.github.com/users/CalledByThe4ire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CalledByThe4ire/subscriptions","organizations_url":"https://api.github.com/users/CalledByThe4ire/orgs","repos_url":"https://api.github.com/users/CalledByThe4ire/repos","events_url":"https://api.github.com/users/CalledByThe4ire/events{/privacy}","received_events_url":"https://api.github.com/users/CalledByThe4ire/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CalledByThe4ire/17243-code-and-magick","description":"Andrey Karamnoff","fork":true,"url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick","forks_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/forks","keys_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/teams","hooks_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/events","assignees_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/tags","blobs_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/languages","stargazers_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/subscription","commits_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/merges","archive_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/downloads","issues_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/CalledByThe4ire/17243-code-and-magick/deployments","created_at":"2016-08-02T18:45:43Z","updated_at":"2016-08-02T18:45:45Z","pushed_at":"2016-08-16T10:36:18Z","git_url":"git://github.com/CalledByThe4ire/17243-code-and-magick.git","ssh_url":"git@github.com:CalledByThe4ire/17243-code-and-magick.git","clone_url":"https://github.com/CalledByThe4ire/17243-code-and-magick.git","svn_url":"https://github.com/CalledByThe4ire/17243-code-and-magick","homepage":null,"size":1472,"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":"4f2fc2b12525b4c06eff0edac5df1c1956a67d58","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":64783218,"name":"17243-code-and-magick","full_name":"htmlacademy-javascript/17243-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/17243-code-and-magick","description":"Andrey Karamnoff","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick","forks_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/deployments","created_at":"2016-08-02T18:45:16Z","updated_at":"2016-08-02T21:08:17Z","pushed_at":"2016-08-16T10:36:41Z","git_url":"git://github.com/htmlacademy-javascript/17243-code-and-magick.git","ssh_url":"git@github.com:htmlacademy-javascript/17243-code-and-magick.git","clone_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick.git","svn_url":"https://github.com/htmlacademy-javascript/17243-code-and-magick","homepage":"https://github.com/CalledByThe4ire/17243-code-and-magick","size":1500,"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/17243-code-and-magick/pulls/8"},"html":{"href":"https://github.com/htmlacademy-javascript/17243-code-and-magick/pull/8"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/8"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/17243-code-and-magick/statuses/46f8cde036d0ec1c2e9b4c5d04559d5cac94096d"}}}}
{"actor":{"display_login":"isqua"}}