User:Jonas Lund/temptemp: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<source lang="javascript"> //Xhr Request function getTraceRouteCount(callback) { var currentUrl = window.location.href; var xhr = new XMLHttpRequest(); xhr.onreadystatechan...")
 
No edit summary
 
Line 23: Line 23:
//Change body opacity
//Change body opacity
function opacityTrickery(data) {
function opacityTrickery(data) {
  if(data) {
     $("body").css({opacity: data});
     $("body").css({opacity: data});
  }
}
}



Latest revision as of 15:19, 13 December 2011

//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);