changed OSRM debug to work with IE6,
deactivated JSONP timing routines
This commit is contained in:
parent
e132ac5c53
commit
71426cf760
@ -26,7 +26,6 @@ OSRM.JSONP = {
|
|||||||
callbacks: {},
|
callbacks: {},
|
||||||
timeouts: {},
|
timeouts: {},
|
||||||
timers: {},
|
timers: {},
|
||||||
durations: {},
|
|
||||||
|
|
||||||
|
|
||||||
// default callback routines
|
// default callback routines
|
||||||
@ -51,7 +50,7 @@ OSRM.JSONP = {
|
|||||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||||
}
|
}
|
||||||
|
|
||||||
OSRM.debug.log("[jsonp] timout handling: "+id+" "+ (new Date() - OSRM.JSONP.durations[id]) );
|
// OSRM.debug.log("[jsonp] timout handling: "+id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// wrap callback function
|
// wrap callback function
|
||||||
@ -67,7 +66,8 @@ OSRM.JSONP = {
|
|||||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||||
}
|
}
|
||||||
|
|
||||||
OSRM.debug.log("[jsonp] response handling: "+id+" "+ (new Date() - OSRM.JSONP.durations[id]) );
|
// OSRM.JSONP.sum[id] += new Number( new Date() - OSRM.JSONP.durations[id] );
|
||||||
|
// OSRM.debug.log("[jsonp] response handling: "+id+" "+ (OSRM.JSONP.sum[id]/OSRM.JSONP.counter[id]).toFixed(2) );
|
||||||
};
|
};
|
||||||
|
|
||||||
// clean DOM (unfortunately, script elements cannot be reused by all browsers)
|
// clean DOM (unfortunately, script elements cannot be reused by all browsers)
|
||||||
@ -84,9 +84,12 @@ OSRM.JSONP = {
|
|||||||
|
|
||||||
// start timeout timer
|
// start timeout timer
|
||||||
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
|
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
|
||||||
OSRM.JSONP.durations[id] = new Date();
|
|
||||||
|
// if(!OSRM.JSONP.durations) { OSRM.JSONP.durations = {}; OSRM.JSONP.counter = {}; OSRM.JSONP.sum = {}; }
|
||||||
// OSRM.debug.log("[jsonp] init: "+id);
|
// if(OSRM.JSONP.counter[id]) OSRM.JSONP.counter[id]++; else {OSRM.JSONP.counter[id] = 1;OSRM.JSONP.sum[id] = 0;}
|
||||||
|
// OSRM.JSONP.durations[id] = new Date();
|
||||||
|
// OSRM.debug.log("[jsonp] init: "+id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -96,6 +99,5 @@ OSRM.JSONP = {
|
|||||||
OSRM.JSONP.callbacks = {};
|
OSRM.JSONP.callbacks = {};
|
||||||
OSRM.JSONP.timeouts = {};
|
OSRM.JSONP.timeouts = {};
|
||||||
OSRM.JSONP.timers = {};
|
OSRM.JSONP.timers = {};
|
||||||
OSRM.JSONP.durations = {};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -21,6 +21,16 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
OSRM.debug = {};
|
OSRM.debug = {};
|
||||||
|
|
||||||
|
|
||||||
|
// access functions
|
||||||
|
OSRM.debug.log = function(text) {
|
||||||
|
OSRM.debug.content.innerHTML += text + "<hr style='border:none; margin:2px; height:1px; color:#F0F0F0; background:#F0F0F0;'/>";
|
||||||
|
OSRM.debug.content.scrollTop = OSRM.debug.content.scrollHeight;
|
||||||
|
};
|
||||||
|
OSRM.debug.clear = function() {
|
||||||
|
OSRM.debug.content.innerHTML = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// add elements to DOM
|
// add elements to DOM
|
||||||
OSRM.debug.init = function() {
|
OSRM.debug.init = function() {
|
||||||
//create DOM objects for debug output
|
//create DOM objects for debug output
|
||||||
@ -53,14 +63,4 @@ OSRM.debug.init = function() {
|
|||||||
if(document.addEventListener) // FF, CH
|
if(document.addEventListener) // FF, CH
|
||||||
document.addEventListener("DOMContentLoaded", OSRM.debug.init, false);
|
document.addEventListener("DOMContentLoaded", OSRM.debug.init, false);
|
||||||
else // IE
|
else // IE
|
||||||
OSRM.debug.init();
|
OSRM.debug.init();
|
||||||
|
|
||||||
|
|
||||||
// working functions
|
|
||||||
OSRM.debug.log = function(text) {
|
|
||||||
OSRM.debug.content.innerHTML += text + "<hr style='border:none; margin:2px; height:1px; color:#F0F0F0; background:#F0F0F0;'/>";
|
|
||||||
OSRM.debug.content.scrollTop = OSRM.debug.content.scrollHeight;
|
|
||||||
};
|
|
||||||
OSRM.debug.clear = function() {
|
|
||||||
OSRM.debug.content.innerHTML = "";
|
|
||||||
};
|
|
@ -44,7 +44,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
<script src="OSRM.base.js" type="text/javascript"></script>
|
<script src="OSRM.base.js" type="text/javascript"></script>
|
||||||
<script src="OSRM.config.js" type="text/javascript"></script>
|
<script src="OSRM.config.js" type="text/javascript"></script>
|
||||||
<script defer="defer" src="OSRM.debug.js" type="text/javascript"></script>
|
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
|
||||||
|
|
||||||
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
||||||
<script src="OSRM.GUI.js" type="text/javascript"></script>
|
<script src="OSRM.GUI.js" type="text/javascript"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user