1
0
Fork 0

Minor fixes

This commit is contained in:
magnolia-fan 2011-09-15 23:32:23 +04:00
parent 16fffcd9d0
commit 1e7ebeb23f
2 changed files with 10 additions and 8 deletions

View File

@ -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;
});
```

View File

@ -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
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