Last active
November 2, 2016 16:25
-
-
Save sylwke3100/463411e936a5a7601eac00649c482861 to your computer and use it in GitHub Desktop.
Kalkulator dystansów na stronie KZK GOP
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
// ==UserScript== | |
// @name KZK GOP Kalkulator | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Liczy Dystans | |
// @author Sylwke3100 | |
// @match http://rozklady.kzkgop.com.pl/rozklad/pokaz_kurs.php?id_kursu=* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var $distance = 0; | |
setTimeout(function(){ | |
$("tr").each(function (index ){ | |
var q = $(this).find("td").eq(2).text(); | |
if (q.search("km") > -1 ){ | |
$distance = $distance + parseFloat(q.substr(0, (q.length - 3))); | |
} | |
}); | |
$("table tbody tr:last-child").after("<tr><td class=strzalka></td><td><b>Dystans Całkowity</b></td><td>"+ $distance.toFixed(2) + " km</td></tr>"); | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment