|
1 | 1 | (function () {
|
2 |
| - // Browser timing remains hidden unless we can successfully access the performance object |
3 |
| - var perf = window.performance || window.msPerformance || |
4 |
| - window.webkitPerformance || window.mozPerformance; |
5 |
| - if (!perf) |
6 |
| - return; |
7 |
| - |
8 |
| - var timingOffset = perf.timing.navigationStart, |
9 |
| - timingEnd = perf.timing.loadEventEnd, |
| 2 | + var timingOffset = performance.timing.navigationStart, |
| 3 | + timingEnd = performance.timing.loadEventEnd, |
10 | 4 | totalTime = timingEnd - timingOffset;
|
11 | 5 | function getLeft(stat) {
|
12 |
| - return ((perf.timing[stat] - timingOffset) / (totalTime)) * 100.0; |
| 6 | + return ((performance.timing[stat] - timingOffset) / (totalTime)) * 100.0; |
13 | 7 | }
|
14 | 8 | function getCSSWidth(stat, endStat) {
|
15 |
| - var width = ((perf.timing[endStat] - perf.timing[stat]) / (totalTime)) * 100.0; |
| 9 | + var width = ((performance.timing[endStat] - performance.timing[stat]) / (totalTime)) * 100.0; |
16 | 10 | // Calculate relative percent (same as sql panel logic)
|
17 | 11 | width = 100.0 * width / (100.0 - getLeft(stat));
|
18 | 12 | return (width < 1) ? "2px" : width + "%";
|
|
23 | 17 | // Render a start through end bar
|
24 | 18 | row.innerHTML = '<td>' + stat.replace('Start', '') + '</td>' +
|
25 | 19 | '<td class="djdt-timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
26 |
| - '<td>' + (perf.timing[stat] - timingOffset) + ' (+' + (perf.timing[endStat] - perf.timing[stat]) + ')</td>'; |
| 20 | + '<td>' + (performance.timing[stat] - timingOffset) + ' (+' + (performance.timing[endStat] - performance.timing[stat]) + ')</td>'; |
27 | 21 | row.querySelector('strong').style.width = getCSSWidth(stat, endStat);
|
28 | 22 | } else {
|
29 | 23 | // Render a point in time
|
30 | 24 | row.innerHTML = '<td>' + stat + '</td>' +
|
31 | 25 | '<td class="djdt-timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
32 |
| - '<td>' + (perf.timing[stat] - timingOffset) + '</td>'; |
| 26 | + '<td>' + (performance.timing[stat] - timingOffset) + '</td>'; |
33 | 27 | row.querySelector('strong').style.width = '2px';
|
34 | 28 | }
|
35 | 29 | row.querySelector('.djDebugLineChart').style.left = getLeft(stat) + '%';
|
|
0 commit comments