Skip to content

Instantly share code, notes, and snippets.

@Kapeli
Created February 25, 2014 22:17
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Kapeli/9219091 to your computer and use it in GitHub Desktop.
Save Kapeli/9219091 to your computer and use it in GitHub Desktop.
function latencyTest(url) {
$.ajax({
url: "http://"+url+".kapeli.com/feeds/latencyTest_v2.txt",
cache: false,
success: function(content){
if(beginsWith("Just a latency test. Move along.", content))
{
var link = document.getElementsByClassName("downloadButton")[0];
if(link.getAttribute("href") == "Dash.zip")
{
link.href = "http://"+url+".kapeli.com/Dash.zip";
}
}
}
});
}
$(window).load(function() {
latencyTest('london');
latencyTest('london2');
latencyTest('newyork');
latencyTest('dallas');
latencyTest('sanfrancisco');
latencyTest('tokyo');
latencyTest('sydney');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment