Skip to content

Instantly share code, notes, and snippets.

@milushov
Created June 11, 2012 01:24
Show Gist options
  • Save milushov/2908003 to your computer and use it in GitHub Desktop.
Save milushov/2908003 to your computer and use it in GitHub Desktop.
http://vk.com/audio total duration of searched tracks
var total_time = function() {
var durs_sourse = [], total = 0;
$('.duration').each(function(i,v){ durs_sourse.push( $(v).html() ); })
for(v in durs_sourse) {
total += parseInt(durs_sourse[v].split(':')[0]*60) + parseInt(durs_sourse[v].split(':')[1])
}
return 'всего ' + (total/(60*60)).toFixed() + ' час. ' + (total%(60)) + ' мин.';
}
total_time();
@milushov
Copy link
Author

this need jquery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment