Created
March 30, 2012 22:06
-
-
Save gregmac/2255984 to your computer and use it in GitHub Desktop.
Miniprofiler javascript side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var init = function() { | |
var load = function(s,f){ | |
var sc = document.createElement("script"); | |
sc.async = "async"; | |
sc.type = "text/javascript"; | |
sc.src = s; | |
var l = false; | |
sc.onload = sc.onreadystatechange = function(_, abort) { | |
if (!l && (!sc.readyState || /loaded|complete/.test(sc.readyState))) { | |
if (!abort){l=true; f();} | |
} | |
}; | |
document.getElementsByTagName('head')[0].appendChild(sc); | |
}; | |
var initMp = function(){ | |
load("/restapi/mini-profiler-resources/includes.js?v=rZlycOOTnzxZvxTmFuOEV0dSmu4P5m5bLrCtwJHVXPA=",function(){ | |
MiniProfiler.init({ | |
ids: ["e80db77f-24a7-4ea8-9f33-8650873abf72"], | |
path: '/restapi/mini-profiler-resources/', | |
version: 'rZlycOOTnzxZvxTmFuOEV0dSmu4P5m5bLrCtwJHVXPA=', | |
renderPosition: 'right', | |
showTrivial: false, | |
showChildrenTime: false, | |
maxTracesToShow: 15, | |
showControls: true, | |
currentId: 'e80db77f-24a7-4ea8-9f33-8650873abf72', | |
authorized: true | |
}); | |
}); | |
}; | |
load('/restapi/mini-profiler-resources/jquery.1.7.1.js?v=rZlycOOTnzxZvxTmFuOEV0dSmu4P5m5bLrCtwJHVXPA=', initMp); | |
}; | |
var w = 0; | |
var f = false; | |
var deferInit = function(){ | |
if (f) return; | |
if (window.performance && window.performance.timing && window.performance.timing.loadEventEnd == 0 && w < 10000){ | |
setTimeout(deferInit, 100); | |
w += 100; | |
} else { | |
f = true; | |
init(); | |
} | |
}; | |
deferInit(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment