Skip to content

Instantly share code, notes, and snippets.

@grigory51
Last active August 29, 2015 14:08
Show Gist options
  • Save grigory51/305edb3cfdb295ffd013 to your computer and use it in GitHub Desktop.
Save grigory51/305edb3cfdb295ffd013 to your computer and use it in GitHub Desktop.
Скрипт, который считает сколько за все время вы потратили денег на покупку билетов на rzd.ru.
//Версия для вставку в строку браузера https://gist.github.com/grigory51/e6b04282cc1261b891fd
function count() {
var cost = 0;
$('.train-info__route-info-holder b:nth-child(2n)').each(function(){
var filteredPrice = $(this).html().replace(/(\&nbsp\;| |руб)/g, '');
var price = parseFloat(filteredPrice) || 0;
cost+=price;
});
console.log("Всего потрачено " + cost + " Р.");
}
function loop() {
if (!$('#MoreOwner').is(':visible') && !$('#WaitMsg').is(':visible')) {
count();
} else {
$('#MoreButton').trigger('click');
setTimeout(loop, 1000);
}
}
loop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment