diff --git a/README.md b/README.md index 2b6ccad..45bd814 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ vk_music.search "Kasabian", "L.S.F. (Lost Souls Forever)", "2:17", (url) -> audio.setAttribute "src", url document.getElementsByTagName("body")[0].appendChild audio audio.play() + false ``` ### JavaScript example @@ -21,6 +22,7 @@ vk_music.search("Kasabian", "L.S.F. (Lost Souls Forever)", "2:17", function(url) audio = document.createElement("audio"); audio.setAttribute("src", url); document.getElementsByTagName("body")[0].appendChild(audio); - return audio.play(); + audio.play(); + return false; }); ``` \ No newline at end of file diff --git a/src/vkontakte_music.coffee b/src/vkontakte_music.coffee index 10abc89..e538acb 100644 --- a/src/vkontakte_music.coffee +++ b/src/vkontakte_music.coffee @@ -61,10 +61,10 @@ class VkontakteMusic artist+" "+track.replace(/\(.*\)/i, '').split('/')[0] trim: (str) -> - while str.indexOf(' ') isnt -1 - str = str.replace ' ', ' ' - if str.charAt(0) is ' ' - str = str.substring 1 - if str.charAt(str.length - 1) is ' ' - str = str.substring 0, str.length - 1 - str \ No newline at end of file + while str.indexOf(' ') isnt -1 + str = str.replace ' ', ' ' + if str.charAt(0) is ' ' + str = str.substring 1 + if str.charAt(str.length - 1) is ' ' + str = str.substring 0, str.length - 1 + str