Created
August 30, 2015 13:53
-
-
Save fogrew/cbb0975e2f557db0c86f to your computer and use it in GitHub Desktop.
Подсчёт времени разговоров на МТС
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var min = 0; | |
var sec = 0; | |
$('table tr').each(function(e) { | |
var tr = $(this); | |
var phone = tr.find('td:nth-child(8)'); | |
var time = tr.find('td:nth-child(10)'); | |
if(phone.text()=='Телеф.') { | |
sec += parseInt(time.text().replace(/(\d+):(\d+)/, '$2')); | |
if(sec > 60) { | |
min++; | |
sec = sec - 60; | |
} | |
min += parseInt(time.text().replace(/(\d+):(\d+)/, '$1')); | |
} | |
}); | |
console.log('Минут: ' + min + ', секунд: ' + sec); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Тут я считал потраченный интернет-траффик на Мегафон