{"action":"created","comment":{"url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments/68322760","id":68322760,"diff_hunk":"@@ -1,57 +1,121 @@\n-function addRow(Artist, Title, Duration) {\n-    $('#results').append('<tr><td><button type=\"button\" class=\"btn btn-xs btn-success\">' +\n-        '<span class=\"glyphicon glyphicon-play\" aria-hidden=\"true\"></span></button> ' +\n-        '<button type=\"button\" class=\"btn btn-xs btn-danger\" onclick=\"DeleteSongFunction(this)\"> ' +\n-        '<span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span></button></td>' +\n-        '<td>' + Artist + ' </td><td>' + Title + ' </td><td>' + Duration + ' </td></tr>');\n-}\n-\n-function addRowArray(Artist, Title, Duration) {\n-\n-    for (var i = 0; i < Title.length; i++) {\n-        $('#results').append('<tr><td><button type=\"button\" class=\"btn btn-xs btn-success\">' +\n-            '<span class=\"glyphicon glyphicon-play\" aria-hidden=\"true\"></span></button> ' +\n-            '<button type=\"button\" class=\"btn btn-xs btn-danger\" onclick=\"DeleteSongFunction(this)\"> ' +\n-            '<span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span></button></td>' +\n-            '<td>' + Artist[i] + ' </td><td>' + Title[i] + ' </td><td>' + Duration[i] + ' </td></tr>');\n-    }\n+function addRow(Artist, Title, Duration, Id) {\n+    $(\"#results\").append(\"<tr><td><button type='button' class='btn btn-xs btn-success'>\" +\n+        \"<span class='glyphicon glyphicon-play'aria-hidden='true'></span></button>\" +\n+        \"<button type='button' class='btn btn-xs btn-danger' onclick='DeleteSongFunction(this,\" + Id + \")'>\" +\n+        \"<span class='glyphicon glyphicon-remove'aria-hidden='true'></span></button>\" +\n+        \"</td><td>\" + Artist + \"</td><td>\" + Title + \"</td><td>\" + Duration + \"</td></tr>\");\n }\n \n function clearAll() {\n     $(\"#results\").find(\"tr:not(:first)\").remove();\n }\n \n-function DeleteSongFunction(o) {\n-    var p = o.parentNode.parentNode;\n-    p.parentNode.removeChild(p);\n-    //Write: Send request for deleting song to server\n-}\n-\n function clearAllPlaylists() {\n     $(\"#playlists\").find(\"li:not(:first)\").remove();\n }\n \n-function addPlaylist(Name) {\n-    if (Name == \"\") {\n+function addPlaylist(Name, Id) {\n+    if (Name === \"\") {\n         Name = \"Untitled\";\n     }\n     if (Name.length > 20) {\n         Name = Name.substr(0, 20); //Trimming long line\n     }\n-    $('#playlists').append(' <li ><a href=\"#\" data-value=\"' + Name + '\">' + Name + '</a></li>');\n+    $(\"#playlists\").append(\"<li id='\" + Id + \"'><a href='#' data-value='\" + Name + \"'>\" + Name + \"</a></li>\");\n }\n \n-function dummy() { //Only for demonstration, delete after merging with ajax\n-    var min = 2;\n-    var max = 15;\n-    var rand = min + Math.random() * (max - min)\n-    rand = Math.round(rand);\n-    clearAll();\n-    for (var i = 0; i < rand; i++) {\n-        addRow(\"test data\", \"test data\", \"2:22\");\n-    }\n+function ajaxDeleteSong(Delete) {\n+    var header = $(\"meta[name='_csrf_header']\").attr(\"content\");\n+    var token = $(\"meta[name='_csrf']\").attr(\"content\");\n+    $.ajax({\n+        type: \"POST\",\n+        url: \"/deleteSong\",\n+        data: \"deleteID=\" + Delete,\n+        beforeSend: function (xhr) {\n+            xhr.setRequestHeader(header, token);\n+        },\n+        success: function () {\n+            console.log(\"Request to delete was submitted successfully\");\n+        },\n+        error: function () {\n+            alert(\"Error while request..\");\n+        }\n+    });\n }\n \n+function DeleteSongFunction(o, Id) {\n+    var p = o.parentNode.parentNode;\n+    p.parentNode.removeChild(p);\n+    ajaxDeleteSong(Id);\n+}\n+\n+function ajaxGetPlaylist(Play) {\n+    $.ajax({\n+        type: \"GET\",\n+        url: \"/getPlayList\",\n+        dataType: \"json\",\n+        data: \"playlistID=\" + Play,\n+        success: function (response) {","path":"application/src/main/webapp/resources/js/mainpage.js","position":93,"original_position":93,"commit_id":"c31109832f12ed669cd8cca4d2d08083b8fd1915","original_commit_id":"c31109832f12ed669cd8cca4d2d08083b8fd1915","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Expected method shorthand.](https://www.codacy.com/app/12fthofmay/music-for-all-application/file/2830362584/issues/source?bid=3377915&fileBranchId=3378464#l58)","created_at":"2016-06-23T21:57:20Z","updated_at":"2016-06-23T21:57:20Z","html_url":"https://github.com/music-for-all/music-for-all-application/pull/15#discussion_r68322760","pull_request_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments/68322760"},"html":{"href":"https://github.com/music-for-all/music-for-all-application/pull/15#discussion_r68322760"},"pull_request":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15","id":75005208,"html_url":"https://github.com/music-for-all/music-for-all-application/pull/15","diff_url":"https://github.com/music-for-all/music-for-all-application/pull/15.diff","patch_url":"https://github.com/music-for-all/music-for-all-application/pull/15.patch","issue_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/15","number":15,"state":"open","locked":false,"title":"Ajax & controller","user":{"login":"Slunger","id":9449200,"avatar_url":"https://avatars.githubusercontent.com/u/9449200?v=3","gravatar_id":"","url":"https://api.github.com/users/Slunger","html_url":"https://github.com/Slunger","followers_url":"https://api.github.com/users/Slunger/followers","following_url":"https://api.github.com/users/Slunger/following{/other_user}","gists_url":"https://api.github.com/users/Slunger/gists{/gist_id}","starred_url":"https://api.github.com/users/Slunger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Slunger/subscriptions","organizations_url":"https://api.github.com/users/Slunger/orgs","repos_url":"https://api.github.com/users/Slunger/repos","events_url":"https://api.github.com/users/Slunger/events{/privacy}","received_events_url":"https://api.github.com/users/Slunger/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-23T18:38:52Z","updated_at":"2016-06-23T21:57:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15/commits","review_comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15/comments","review_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments{/number}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/15/comments","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/c31109832f12ed669cd8cca4d2d08083b8fd1915","head":{"label":"music-for-all:ajax_&_controller","ref":"ajax_&_controller","sha":"c31109832f12ed669cd8cca4d2d08083b8fd1915","user":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"repo":{"id":60590888,"name":"music-for-all-application","full_name":"music-for-all/music-for-all-application","owner":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/music-for-all/music-for-all-application","description":"","fork":false,"url":"https://api.github.com/repos/music-for-all/music-for-all-application","forks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/forks","keys_url":"https://api.github.com/repos/music-for-all/music-for-all-application/keys{/key_id}","collaborators_url":"https://api.github.com/repos/music-for-all/music-for-all-application/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/music-for-all/music-for-all-application/teams","hooks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/hooks","issue_events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/events{/number}","events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/events","assignees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/assignees{/user}","branches_url":"https://api.github.com/repos/music-for-all/music-for-all-application/branches{/branch}","tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/tags","blobs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/refs{/sha}","trees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/trees{/sha}","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/{sha}","languages_url":"https://api.github.com/repos/music-for-all/music-for-all-application/languages","stargazers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/stargazers","contributors_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contributors","subscribers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscribers","subscription_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscription","commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/commits{/sha}","git_commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/commits{/sha}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/comments{/number}","issue_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/comments{/number}","contents_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contents/{+path}","compare_url":"https://api.github.com/repos/music-for-all/music-for-all-application/compare/{base}...{head}","merges_url":"https://api.github.com/repos/music-for-all/music-for-all-application/merges","archive_url":"https://api.github.com/repos/music-for-all/music-for-all-application/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/music-for-all/music-for-all-application/downloads","issues_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues{/number}","pulls_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls{/number}","milestones_url":"https://api.github.com/repos/music-for-all/music-for-all-application/milestones{/number}","notifications_url":"https://api.github.com/repos/music-for-all/music-for-all-application/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/music-for-all/music-for-all-application/labels{/name}","releases_url":"https://api.github.com/repos/music-for-all/music-for-all-application/releases{/id}","deployments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/deployments","created_at":"2016-06-07T07:13:41Z","updated_at":"2016-06-18T13:29:34Z","pushed_at":"2016-06-23T21:55:41Z","git_url":"git://github.com/music-for-all/music-for-all-application.git","ssh_url":"git@github.com:music-for-all/music-for-all-application.git","clone_url":"https://github.com/music-for-all/music-for-all-application.git","svn_url":"https://github.com/music-for-all/music-for-all-application","homepage":null,"size":1088,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"music-for-all:master","ref":"master","sha":"87f9761481a035d11e4d6ec0410989207c091913","user":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"repo":{"id":60590888,"name":"music-for-all-application","full_name":"music-for-all/music-for-all-application","owner":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/music-for-all/music-for-all-application","description":"","fork":false,"url":"https://api.github.com/repos/music-for-all/music-for-all-application","forks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/forks","keys_url":"https://api.github.com/repos/music-for-all/music-for-all-application/keys{/key_id}","collaborators_url":"https://api.github.com/repos/music-for-all/music-for-all-application/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/music-for-all/music-for-all-application/teams","hooks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/hooks","issue_events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/events{/number}","events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/events","assignees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/assignees{/user}","branches_url":"https://api.github.com/repos/music-for-all/music-for-all-application/branches{/branch}","tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/tags","blobs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/refs{/sha}","trees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/trees{/sha}","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/{sha}","languages_url":"https://api.github.com/repos/music-for-all/music-for-all-application/languages","stargazers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/stargazers","contributors_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contributors","subscribers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscribers","subscription_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscription","commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/commits{/sha}","git_commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/commits{/sha}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/comments{/number}","issue_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/comments{/number}","contents_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contents/{+path}","compare_url":"https://api.github.com/repos/music-for-all/music-for-all-application/compare/{base}...{head}","merges_url":"https://api.github.com/repos/music-for-all/music-for-all-application/merges","archive_url":"https://api.github.com/repos/music-for-all/music-for-all-application/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/music-for-all/music-for-all-application/downloads","issues_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues{/number}","pulls_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls{/number}","milestones_url":"https://api.github.com/repos/music-for-all/music-for-all-application/milestones{/number}","notifications_url":"https://api.github.com/repos/music-for-all/music-for-all-application/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/music-for-all/music-for-all-application/labels{/name}","releases_url":"https://api.github.com/repos/music-for-all/music-for-all-application/releases{/id}","deployments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/deployments","created_at":"2016-06-07T07:13:41Z","updated_at":"2016-06-18T13:29:34Z","pushed_at":"2016-06-23T21:55:41Z","git_url":"git://github.com/music-for-all/music-for-all-application.git","ssh_url":"git@github.com:music-for-all/music-for-all-application.git","clone_url":"https://github.com/music-for-all/music-for-all-application.git","svn_url":"https://github.com/music-for-all/music-for-all-application","homepage":null,"size":1088,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15"},"html":{"href":"https://github.com/music-for-all/music-for-all-application/pull/15"},"issue":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/15"},"comments":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/c31109832f12ed669cd8cca4d2d08083b8fd1915"}}}}
{"actor":{"display_login":"codacy-bot"}}