diff -r 719aed020d05 -r 059e197617bb integration/mediapart/article_files/probe-13.js --- a/integration/mediapart/article_files/probe-13.js Tue Apr 16 17:01:05 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -/*!Version: 13.3*/ -var radar={};function cdxProbing(){this.maxMeasurementsByCountry={FR:1};this.cancelled=false;this.providers=[];this.currentProvider=null;this.currentProbeIdx=0}cdxProbing.defaultMaxMeasurements=4;cdxProbing.ResultCodes={SUCCESS:{name:"SUCCESS",code:0},HTTP_TIMEOUT:{name:"HTTP_TIMEOUT",code:1},HTTP_INVALID_FILE:{name:"HTTP_INVALID_FILE",code:4}};cdxProbing.prototype.go=function(c){var a=cdxFeatures,b;b=a.reqs[c];if(b){this.downloadProbeDefinitions(b)}};cdxProbing.prototype.notifyCancelled=function(){var a=cdxFeatures,b;for(b in a.reqs){if(a.reqs.hasOwnProperty(b)){a.reqs[b].notify("Sampling Cancelled")}}};cdxProbing.prototype.cancel=function(){this.cancelled=true;if(!this.currentProvider){this.notifyCancelled()}else{if(this.currentProbeIdx-1};cdxProbing.prototype.beginProbe=function(){var e=this,c=document.getElementById("radar_downloads"),b,d,a;b=this.currentProvider.probes[this.currentProbeIdx];d=this.currentProvider.requestor;switch(b.tag){case"img":a=this.beginSampleImage();break;case"script":a=this.beginSampleScript();break;case"iframe":a=this.beginSampleIFrame();break;default:console.info("Invalid probe definition");return}this.currentTag=a;radar.stoppedAt=null;c.appendChild(a);this.scriptTimeoutId=setTimeout(function(){e.onScriptTimeout()},b.timeout);this.startedAt=new Date()};cdxProbing.prototype.beginSampleScript=function(){var c=this,b=this.currentProvider.probes[this.currentProbeIdx],a=document.createElement("script");a.type="text/javascript";a.src=cdxProbing.makeAssetUrl(b,this.currentProvider);a.onload=(function(d){return function(){if(!d.cancelled){if(radar.stoppedAt){c.sampleComplete(radar.stoppedAt)}else{c.sampleComplete(new Date(),cdxProbing.ResultCodes.HTTP_INVALID_FILE)}}}}(b));a.onreadystatechange=function(){if(("loaded"===a.readyState)||("complete"===a.readyState)){if(!radar.stoppedAt){c.sampleComplete(new Date(),cdxProbing.ResultCodes.HTTP_INVALID_FILE)}else{c.sampleComplete(radar.stoppedAt)}}};a.onerror=function(){c.sampleComplete(new Date(),cdxProbing.ResultCodes.HTTP_INVALID_FILE)};return a};cdxProbing.prototype.beginSampleImage=function(){var c=this,b=this.currentProvider.probes[this.currentProbeIdx],a=document.createElement("img");a.src=cdxProbing.makeAssetUrl(b,this.currentProvider);a.style.display="none";a.onload=function(){c.onSampleComplete()};a.onerror=function(){c.sampleComplete(new Date(),cdxProbing.ResultCodes.HTTP_INVALID_FILE)};return a};cdxProbing.prototype.beginSampleIFrame=function(){var c=this,b=this.currentProvider.probes[this.currentProbeIdx],a=document.createElement("iframe");a.src=cdxProbing.makeAssetUrl(b,this.currentProvider);a.style.display="none";if(a.addEventListener){a.addEventListener("load",function(){c.onSampleComplete()},false)}else{if(a.attachEvent){a.attachEvent("onload",function(){c.onSampleComplete()})}}return a};cdxProbing.prototype.onSampleComplete=function(){this.sampleComplete(new Date())};cdxProbing.makeAssetUrl=function(a,e){var d,c="",b=a.url;if(0!==b.indexOf("http")){b="//"+b}if(!e.omitQueryStrings){d=Math.round(10000000000*Math.random());if(e.addProbeId){c="&pb="+e.requestor.zid+"-"+e.requestor.cid+"-"+e.zid+"-"+e.cid+"-"+e.pid}if(0>b.indexOf("?",0)){b+="?rnd="+d}else{b+="&rnd="+d}b+=c}return b};cdxProbing.prototype.calculateMeasurement=function(e,d,c){var g=/-(\d+)kb\.js$/i,b=e-d,f,a;if(0>c.probeType.indexOf("_KBPS")){return b}f=g.exec(c.url);if(!f||(2>f.length)){return 0}a=parseInt(f[1],10);return Math.floor(8*1000*a/b)};cdxProbing.prototype.onScriptTimeout=function(){this.scriptTimeoutId=null;this.sampleComplete(new Date(),cdxProbing.ResultCodes.HTTP_TIMEOUT)};cdxProbing.prototype.sampleComplete=function(f,d){var c=cdxFeatures,g,a,b,e;if(this.cancelled){this.notifyCancelled();return}g=this.currentProvider;a=g.probes[this.currentProbeIdx];if(!a){return}this.callComplete();b=this.calculateMeasurement(f.getTime(),this.startedAt.getTime(),a);d=d||cdxProbing.ResultCodes.SUCCESS;e=g.zid+"/"+g.cid+"/"+g.pid+"/"+cdxCore.getProbeTypeCode(a.probeType)+"/"+d.code+"/"+(d.code===0?b.toString(10):"0");c.addReport("f1",g.requestor,e);g.requestor.notify("Probe Completed",{providerZoneId:g.zid,providerCustomerId:g.cid,providerId:g.pid,probeType:cdxCore.getProbeTypeCode(a.probeType),elapsed:b,resultCode:d.code});if((0!==d.code)&&cdxCore.isColdProbeType(a.probeType)){c.submitReportBatch(this.postSubmitReportBatch())}else{if(this.currentProbeIdx<(this.currentProvider.probes.length-1)){this.currentProbeIdx++;this.beginProbe()}else{c.submitReportBatch(this.postSubmitReportBatch())}}};cdxProbing.prototype.callComplete=function(){if(this.scriptTimeoutId){clearTimeout(this.scriptTimeoutId);this.scriptTimeoutId=null}this.currentTag.onload=this.currentTag.onerror=this.currentTag.onreadystatechange=null};cdxProbing.filter=function(b){var c,d,a=[];for(c=0;c