User:Jonas Lund/temptemp

From XPUB & Lens-Based wiki
//Xhr Request
function getTraceRouteCount(callback) {
  var currentUrl = window.location.href;
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function(data) {
    if (xhr.readyState == 4) {
      if (xhr.status == 200) {
        var data = xhr.responseText;
        callback(data);
      } else {
        callback(null);
      }
    }
  }
  // Note that any URL fetched here must be matched by a permission in
  // the manifest.json file!
  var url = "http://pzwart3.wdka.hro.nl/~egreenhalgh/hopsToPercent2.py?url="+ currenUrl;
  xhr.open('GET', url, true);
  xhr.send();
};

//Change body opacity
function opacityTrickery(data) {
  if(data) {
    $("body").css({opacity: data});
  }
}

//Start Functions
getTraceRouteCount(opacityTrickery);