Created
August 26, 2018 12:27
-
-
Save bkralik/30c11c81c143e60855749e3abe4605bd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UserDB pinger | |
| // @version 2 | |
| // @match http://userdb.hkfree.org/* | |
| // @match https://userdb.hkfree.org/* | |
| // @grant GM.xmlHttpRequest | |
| // @run-at document-idle | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
| // ==/UserScript== | |
| $(".grid-cell-IPAdresa span").each(function(index) { | |
| ips = $( this ).attr('title'); | |
| if(ips) { | |
| ips = ips.replace(/ /g, ""); | |
| GM.xmlHttpRequest({ | |
| method: "GET", | |
| url: "http://sojka.hkfree.org/pinger/?rq=ping&ips="+ips, | |
| onload: function(response) { | |
| f = parseFloat(response.responseText); | |
| if(f > 0.95) { | |
| $(this).css("background-color", "LightGreen"); | |
| } else if(f > 0.1) { | |
| $(this).css("background-color", "yellow"); | |
| } else { | |
| $(this).css("background-color", "LightPink"); | |
| } | |
| }.bind(this) | |
| }); | |
| } | |
| }); | |
| $("tr[id^=highlightable-ip] td a[href^='/userdb/subnet']").each(function(index) { | |
| ips = $(this).text(); | |
| if(ips) { | |
| ips = ips.replace(/ /g, ""); | |
| GM.xmlHttpRequest({ | |
| method: "GET", | |
| url: "http://sojka.hkfree.org/pinger/?rq=ping&ips="+ips, | |
| onload: function(response) { | |
| f = parseFloat(response.responseText); | |
| if(f > 0.95) { | |
| $(this).css("background-color", "LightGreen"); | |
| } else if(f > 0.1) { | |
| $(this).css("background-color", "yellow"); | |
| } else { | |
| $(this).css("background-color", "LightPink"); | |
| } | |
| }.bind(this) | |
| }); | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment