Created
May 25, 2017 15:25
-
-
Save fogrew/12ed241a84bd8663428491c3ddca92ad 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
var $ = q => document.querySelectorAll(q) | |
var columns = $('table td:nth-child(4)') | |
var filterNum = n => !isNaN(parseFloat(n)) ? parseFloat(n) : 0 | |
var kb2mb = n => Math.round(n.toFixed(2)/1024)+' MB' | |
var arr = nl => Array.from(nl) | |
var summary = arr(columns).reduce((sum, val) => { | |
return sum += filterNum(val.innerText) | |
}, 0) | |
console.log(kb2mb(summary)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Задался задачей узнать, сколько было потрачено траффика на мегафоновском модеме. Детализация счёта, которую предоставляет Мегафон не выводит сумм по скачанному траффику. Я решил посчитать сам.