Skip to content

Instantly share code, notes, and snippets.

@fogrew
Created May 25, 2017 15:25
Show Gist options
  • Select an option

  • Save fogrew/12ed241a84bd8663428491c3ddca92ad to your computer and use it in GitHub Desktop.

Select an option

Save fogrew/12ed241a84bd8663428491c3ddca92ad to your computer and use it in GitHub Desktop.
Подсчёт траффика из детализации Мегафона
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))
@fogrew
Copy link
Copy Markdown
Author

fogrew commented May 25, 2017

Задался задачей узнать, сколько было потрачено траффика на мегафоновском модеме. Детализация счёта, которую предоставляет Мегафон не выводит сумм по скачанному траффику. Я решил посчитать сам.

@fogrew
Copy link
Copy Markdown
Author

fogrew commented May 25, 2017

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