{"action":"created","comment":{"url":"https://api.github.com/repos/breebros/favswap/pulls/comments/28713590","id":28713590,"diff_hunk":"@@ -0,0 +1,72 @@\n+var timeout;\n+\n+\n+//Functions triggered by html\n+var searchAction = function(){\n+\tif(timeout){ window.clearTimeout(timeout)}\n+\ttimeout = setTimeout(function() {\n+\t\tvar query = document.getElementById('frontPageSearchBar').value;\n+\t\tsearchSpotify(query);\n+\t},500);\n+};\n+\n+\n+\n+\n+//spotityintegration.\n+var searchSpotify = function(query){\n+\tvar spotifyResult = m.prop([]);\n+\tif(query){\n+\t\tm.request({method: \"GET\", url: \"http://api.spotify.com/v1/search?q=\"+query+\"&type=track&limit=5\"})\n+\t\t\t.then(spotifyResult)\n+\t\t\t.then(function(){\n+\t\t\t\tupdateSearchResults(spotifyResult().tracks.items)\n+\t\t\t});\n+\t}\n+};\n+\n+\n+var updateSearchResults = function(spotifyTracks){\n+\tvar autocompleteList = document.getElementById('autocompleteList');\n+\twhile (autocompleteList.firstChild) {\n+    \tautocompleteList.removeChild(autocompleteList.firstChild);\n+\t}\n+\tspotifyTracks.forEach(addSpotifySearchResults);\n+\n+};\n+\n+\n+// DOM ELEMENTS\n+var addSpotifySearchResults = function(track){\n+\tvar listItem = document.createElement(\"li\");\n+\tvar link = document.createElement(\"a\");\n+\tconsole.log(track);\n+\tlink.href = \"/swap?uri=\" + track.uri;\n+\tconsole.log(track.uri)\n+\tlink.appendChild(createAlbumCover(track.album.images[2].url));\n+\tlink.appendChild(createAlbumCover(\"https://cdn1.iconfinder.com/data/icons/simple-icons/48/spotify-48-black.png\"));\n+\tlink.appendChild(trackInformationElement(track.name,track.artists[0].name));\n+\tlistItem.setAttribute('class', 'searchResult');\n+\tlistItem.appendChild(link);\n+\tlistItem.appendChild(spotifyWidget(track));\n+\tdocument.getElementById('autocompleteList').appendChild(listItem);\n+};\n+\n+var spotifyWidget = function(track){\n+\tvar div = document.createElement('div');\n+\tdiv.innerHTML = '<iframe src=\"https://embed.spotify.com/?uri='+ track.uri+'\"width=\"300\" height=\"80\" frameborder=\"0\" allowtransparency=\"true\"></iframe>';\n+\tvar elements = div.childNodes;\n+\treturn elements[0];\n+};\n+\n+var trackInformationElement= function(title, artist){\n+\tvar trackInformation = document.createTextNode(title + \" - \" + artist);\n+\treturn trackInformation\n+};\n+\n+\n+var createAlbumCover =function(src){","path":"public/javascript/musicInput.js","position":68,"original_position":68,"commit_id":"12e0d8bbab4dcbc4472f60bd79e986f4359bb6ef","original_commit_id":"12e0d8bbab4dcbc4472f60bd79e986f4359bb6ef","user":{"login":"yellowbit","id":2560260,"avatar_url":"https://avatars.githubusercontent.com/u/2560260?v=3","gravatar_id":"","url":"https://api.github.com/users/yellowbit","html_url":"https://github.com/yellowbit","followers_url":"https://api.github.com/users/yellowbit/followers","following_url":"https://api.github.com/users/yellowbit/following{/other_user}","gists_url":"https://api.github.com/users/yellowbit/gists{/gist_id}","starred_url":"https://api.github.com/users/yellowbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yellowbit/subscriptions","organizations_url":"https://api.github.com/users/yellowbit/orgs","repos_url":"https://api.github.com/users/yellowbit/repos","events_url":"https://api.github.com/users/yellowbit/events{/privacy}","received_events_url":"https://api.github.com/users/yellowbit/received_events","type":"User","site_admin":false},"body":"Se etter en JS-formatter til IDE-en din, så kan den passe på at det er mellomrom der det trengs o.l. ","created_at":"2015-04-20T18:10:33Z","updated_at":"2015-04-20T18:10:33Z","html_url":"https://github.com/breebros/favswap/pull/4#discussion_r28713590","pull_request_url":"https://api.github.com/repos/breebros/favswap/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/breebros/favswap/pulls/comments/28713590"},"html":{"href":"https://github.com/breebros/favswap/pull/4#discussion_r28713590"},"pull_request":{"href":"https://api.github.com/repos/breebros/favswap/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/breebros/favswap/pulls/4","id":33619616,"html_url":"https://github.com/breebros/favswap/pull/4","diff_url":"https://github.com/breebros/favswap/pull/4.diff","patch_url":"https://github.com/breebros/favswap/pull/4.patch","issue_url":"https://api.github.com/repos/breebros/favswap/issues/4","number":4,"state":"open","locked":false,"title":"Search results + clicking search results reroutes to spotify widget","user":{"login":"hjmro","id":5657230,"avatar_url":"https://avatars.githubusercontent.com/u/5657230?v=3","gravatar_id":"","url":"https://api.github.com/users/hjmro","html_url":"https://github.com/hjmro","followers_url":"https://api.github.com/users/hjmro/followers","following_url":"https://api.github.com/users/hjmro/following{/other_user}","gists_url":"https://api.github.com/users/hjmro/gists{/gist_id}","starred_url":"https://api.github.com/users/hjmro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjmro/subscriptions","organizations_url":"https://api.github.com/users/hjmro/orgs","repos_url":"https://api.github.com/users/hjmro/repos","events_url":"https://api.github.com/users/hjmro/events{/privacy}","received_events_url":"https://api.github.com/users/hjmro/received_events","type":"User","site_admin":false},"body":"Ganske stygt, men du kan nå søke opp sang, trykke på den og få den avspilt i neste vindu.","created_at":"2015-04-19T14:25:55Z","updated_at":"2015-04-20T18:10:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8acc54fc65f768e104004c13288be4905387305","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/breebros/favswap/pulls/4/commits","review_comments_url":"https://api.github.com/repos/breebros/favswap/pulls/4/comments","review_comment_url":"https://api.github.com/repos/breebros/favswap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/breebros/favswap/issues/4/comments","statuses_url":"https://api.github.com/repos/breebros/favswap/statuses/12e0d8bbab4dcbc4472f60bd79e986f4359bb6ef","head":{"label":"breebros:f-search-results","ref":"f-search-results","sha":"12e0d8bbab4dcbc4472f60bd79e986f4359bb6ef","user":{"login":"breebros","id":10814336,"avatar_url":"https://avatars.githubusercontent.com/u/10814336?v=3","gravatar_id":"","url":"https://api.github.com/users/breebros","html_url":"https://github.com/breebros","followers_url":"https://api.github.com/users/breebros/followers","following_url":"https://api.github.com/users/breebros/following{/other_user}","gists_url":"https://api.github.com/users/breebros/gists{/gist_id}","starred_url":"https://api.github.com/users/breebros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breebros/subscriptions","organizations_url":"https://api.github.com/users/breebros/orgs","repos_url":"https://api.github.com/users/breebros/repos","events_url":"https://api.github.com/users/breebros/events{/privacy}","received_events_url":"https://api.github.com/users/breebros/received_events","type":"Organization","site_admin":false},"repo":{"id":30196933,"name":"favswap","full_name":"breebros/favswap","owner":{"login":"breebros","id":10814336,"avatar_url":"https://avatars.githubusercontent.com/u/10814336?v=3","gravatar_id":"","url":"https://api.github.com/users/breebros","html_url":"https://github.com/breebros","followers_url":"https://api.github.com/users/breebros/followers","following_url":"https://api.github.com/users/breebros/following{/other_user}","gists_url":"https://api.github.com/users/breebros/gists{/gist_id}","starred_url":"https://api.github.com/users/breebros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breebros/subscriptions","organizations_url":"https://api.github.com/users/breebros/orgs","repos_url":"https://api.github.com/users/breebros/repos","events_url":"https://api.github.com/users/breebros/events{/privacy}","received_events_url":"https://api.github.com/users/breebros/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/breebros/favswap","description":"VI selger dette for to millarder dollasj","fork":false,"url":"https://api.github.com/repos/breebros/favswap","forks_url":"https://api.github.com/repos/breebros/favswap/forks","keys_url":"https://api.github.com/repos/breebros/favswap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/breebros/favswap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/breebros/favswap/teams","hooks_url":"https://api.github.com/repos/breebros/favswap/hooks","issue_events_url":"https://api.github.com/repos/breebros/favswap/issues/events{/number}","events_url":"https://api.github.com/repos/breebros/favswap/events","assignees_url":"https://api.github.com/repos/breebros/favswap/assignees{/user}","branches_url":"https://api.github.com/repos/breebros/favswap/branches{/branch}","tags_url":"https://api.github.com/repos/breebros/favswap/tags","blobs_url":"https://api.github.com/repos/breebros/favswap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/breebros/favswap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/breebros/favswap/git/refs{/sha}","trees_url":"https://api.github.com/repos/breebros/favswap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/breebros/favswap/statuses/{sha}","languages_url":"https://api.github.com/repos/breebros/favswap/languages","stargazers_url":"https://api.github.com/repos/breebros/favswap/stargazers","contributors_url":"https://api.github.com/repos/breebros/favswap/contributors","subscribers_url":"https://api.github.com/repos/breebros/favswap/subscribers","subscription_url":"https://api.github.com/repos/breebros/favswap/subscription","commits_url":"https://api.github.com/repos/breebros/favswap/commits{/sha}","git_commits_url":"https://api.github.com/repos/breebros/favswap/git/commits{/sha}","comments_url":"https://api.github.com/repos/breebros/favswap/comments{/number}","issue_comment_url":"https://api.github.com/repos/breebros/favswap/issues/comments{/number}","contents_url":"https://api.github.com/repos/breebros/favswap/contents/{+path}","compare_url":"https://api.github.com/repos/breebros/favswap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/breebros/favswap/merges","archive_url":"https://api.github.com/repos/breebros/favswap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/breebros/favswap/downloads","issues_url":"https://api.github.com/repos/breebros/favswap/issues{/number}","pulls_url":"https://api.github.com/repos/breebros/favswap/pulls{/number}","milestones_url":"https://api.github.com/repos/breebros/favswap/milestones{/number}","notifications_url":"https://api.github.com/repos/breebros/favswap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/breebros/favswap/labels{/name}","releases_url":"https://api.github.com/repos/breebros/favswap/releases{/id}","created_at":"2015-02-02T16:45:26Z","updated_at":"2015-03-23T20:43:30Z","pushed_at":"2015-04-19T14:38:57Z","git_url":"git://github.com/breebros/favswap.git","ssh_url":"git@github.com:breebros/favswap.git","clone_url":"https://github.com/breebros/favswap.git","svn_url":"https://github.com/breebros/favswap","homepage":null,"size":280,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"breebros:master","ref":"master","sha":"faee93e034acb9a8edeaf2297a8c7afbb0e532e0","user":{"login":"breebros","id":10814336,"avatar_url":"https://avatars.githubusercontent.com/u/10814336?v=3","gravatar_id":"","url":"https://api.github.com/users/breebros","html_url":"https://github.com/breebros","followers_url":"https://api.github.com/users/breebros/followers","following_url":"https://api.github.com/users/breebros/following{/other_user}","gists_url":"https://api.github.com/users/breebros/gists{/gist_id}","starred_url":"https://api.github.com/users/breebros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breebros/subscriptions","organizations_url":"https://api.github.com/users/breebros/orgs","repos_url":"https://api.github.com/users/breebros/repos","events_url":"https://api.github.com/users/breebros/events{/privacy}","received_events_url":"https://api.github.com/users/breebros/received_events","type":"Organization","site_admin":false},"repo":{"id":30196933,"name":"favswap","full_name":"breebros/favswap","owner":{"login":"breebros","id":10814336,"avatar_url":"https://avatars.githubusercontent.com/u/10814336?v=3","gravatar_id":"","url":"https://api.github.com/users/breebros","html_url":"https://github.com/breebros","followers_url":"https://api.github.com/users/breebros/followers","following_url":"https://api.github.com/users/breebros/following{/other_user}","gists_url":"https://api.github.com/users/breebros/gists{/gist_id}","starred_url":"https://api.github.com/users/breebros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breebros/subscriptions","organizations_url":"https://api.github.com/users/breebros/orgs","repos_url":"https://api.github.com/users/breebros/repos","events_url":"https://api.github.com/users/breebros/events{/privacy}","received_events_url":"https://api.github.com/users/breebros/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/breebros/favswap","description":"VI selger dette for to millarder dollasj","fork":false,"url":"https://api.github.com/repos/breebros/favswap","forks_url":"https://api.github.com/repos/breebros/favswap/forks","keys_url":"https://api.github.com/repos/breebros/favswap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/breebros/favswap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/breebros/favswap/teams","hooks_url":"https://api.github.com/repos/breebros/favswap/hooks","issue_events_url":"https://api.github.com/repos/breebros/favswap/issues/events{/number}","events_url":"https://api.github.com/repos/breebros/favswap/events","assignees_url":"https://api.github.com/repos/breebros/favswap/assignees{/user}","branches_url":"https://api.github.com/repos/breebros/favswap/branches{/branch}","tags_url":"https://api.github.com/repos/breebros/favswap/tags","blobs_url":"https://api.github.com/repos/breebros/favswap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/breebros/favswap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/breebros/favswap/git/refs{/sha}","trees_url":"https://api.github.com/repos/breebros/favswap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/breebros/favswap/statuses/{sha}","languages_url":"https://api.github.com/repos/breebros/favswap/languages","stargazers_url":"https://api.github.com/repos/breebros/favswap/stargazers","contributors_url":"https://api.github.com/repos/breebros/favswap/contributors","subscribers_url":"https://api.github.com/repos/breebros/favswap/subscribers","subscription_url":"https://api.github.com/repos/breebros/favswap/subscription","commits_url":"https://api.github.com/repos/breebros/favswap/commits{/sha}","git_commits_url":"https://api.github.com/repos/breebros/favswap/git/commits{/sha}","comments_url":"https://api.github.com/repos/breebros/favswap/comments{/number}","issue_comment_url":"https://api.github.com/repos/breebros/favswap/issues/comments{/number}","contents_url":"https://api.github.com/repos/breebros/favswap/contents/{+path}","compare_url":"https://api.github.com/repos/breebros/favswap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/breebros/favswap/merges","archive_url":"https://api.github.com/repos/breebros/favswap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/breebros/favswap/downloads","issues_url":"https://api.github.com/repos/breebros/favswap/issues{/number}","pulls_url":"https://api.github.com/repos/breebros/favswap/pulls{/number}","milestones_url":"https://api.github.com/repos/breebros/favswap/milestones{/number}","notifications_url":"https://api.github.com/repos/breebros/favswap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/breebros/favswap/labels{/name}","releases_url":"https://api.github.com/repos/breebros/favswap/releases{/id}","created_at":"2015-02-02T16:45:26Z","updated_at":"2015-03-23T20:43:30Z","pushed_at":"2015-04-19T14:38:57Z","git_url":"git://github.com/breebros/favswap.git","ssh_url":"git@github.com:breebros/favswap.git","clone_url":"https://github.com/breebros/favswap.git","svn_url":"https://github.com/breebros/favswap","homepage":null,"size":280,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/breebros/favswap/pulls/4"},"html":{"href":"https://github.com/breebros/favswap/pull/4"},"issue":{"href":"https://api.github.com/repos/breebros/favswap/issues/4"},"comments":{"href":"https://api.github.com/repos/breebros/favswap/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/breebros/favswap/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/breebros/favswap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/breebros/favswap/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/breebros/favswap/statuses/12e0d8bbab4dcbc4472f60bd79e986f4359bb6ef"}}}}