Last active
August 29, 2015 14:08
-
-
Save grigory51/305edb3cfdb295ffd013 to your computer and use it in GitHub Desktop.
Скрипт, который считает сколько за все время вы потратили денег на покупку билетов на rzd.ru.
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
//Версия для вставку в строку браузера 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(/(\ \;| |руб)/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