8000 Avoid using the nano applet in perf/index.html if it isn't needed. · lodash/lodash@260ff6d · GitHub
[go: up one dir, main page]

Skip to content

Commit 260ff6d

Browse files
committed
Avoid using the nano applet in perf/index.html if it isn't needed.
Former-commit-id: 342983337140dd5608848b7f09d24038ea61d1a1
1 parent 7cb3741 commit 260ff6d

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

perf/index.html

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,23 @@
2727
<script src="perf.js"></script>
2828
<script>
2929
(function() {
30-
var useApplet = !/[?&]nojava=true(?:&|$)/.test(location.search);
30+
if (/[?&]nojava=true(?:&|$)/.test(location.search)) {
31+
return;
32+
}
33+
var measured,
34+
perfNow,
35+
begin = new Date;
3136

37+
// is the applet really needed?
38+
while (!(measured = new Date - begin)) { }
39+
if (measured != 1 && !((perfNow = window.performance) && typeof (perfNow.webkitNow || perfNow.now) == 'function')) {
40+
// load applet
41+
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
42+
}
43+
}());
44+
</script>
45+
<script>
46+
(function() {
3247
function init() {
3348
var fbUI = document.getElementById('FirebugUI'),
3449
fbDoc = fbUI && (fbDoc = fbUI.contentWindow || fbUI.contentDocument).document || fbDoc,
@@ -38,16 +53,7 @@
3853
return setTimeout(init, 15);
3954
}
4055
fbUI.style.height = fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
41-
42-
// give applet time to initialize
43-
lodash.delay(run, useApplet ? 500 : 15);
44-
}
45-
46-
if (useApplet) {
47-
// using innerHTML avoids an alert in some versions of IE6
48-
var div = document.createElement('div');
49-
div.innerHTML = '<applet code=nano archive="../vendor/benchmark.js/nano.jar">';
50-
document.body.insertBefore(div.lastChild, document.body.firstChild);
56+
setTimeout(run, 15);
5157
}
5258

5359
window.onload = init;

0 commit comments

Comments
 (0)
0