|
22693 | 22693 | var name = 'bs-chart-frame',
|
22694 | 22694 | iframe = createElement('iframe', name);
|
22695 | 22695 |
|
| 22696 | + addListener(iframe, 'load', function () { |
| 22697 | + // the element the charts are inserted into |
| 22698 | + me.container = query('#bs-chart', idoc)[0]; |
| 22699 | + |
| 22700 | + if (!me.container) return; |
| 22701 | + |
| 22702 | + // Browserscope's UA div is inserted before an element with the id of "bs-ua-script" |
| 22703 | + loadScript('https://www.browserscope.org/ua?o=js', me.container).id = 'bs-ua-script'; |
| 22704 | + |
| 22705 | + // the "autoload" string is created following the guide at |
| 22706 | + // https://developers.google.com/loader/?hl=en#auto-loading |
| 22707 | + setTimeout(function() { loadScript('https://www.google.com/jsapi?autoload=' + encodeURIComponent('{' + |
| 22708 | + 'modules:[{' + |
| 22709 | + 'name:"visualization",' + |
| 22710 | + 'version:1,' + |
| 22711 | + 'packages:["corechart","table"],' + |
| 22712 | + 'callback:ui.browserscope.load' + |
| 22713 | + '}]' + |
| 22714 | + '}'), idoc); }, 2000); |
| 22715 | + }); |
| 22716 | + |
22696 | 22717 | iframe.id = name;
|
22697 | 22718 | iframe.frameBorder = 0;
|
22698 | 22719 | iframe.scrolling = 'no';
|
|
22733 | 22754 |
|
22734 | 22755 | // the frame window of the charts
|
22735 | 22756 | me.chartWindow = iwin;
|
22736 |
| - |
22737 |
| - // ensure that content in iframe is processed by executing on next tick |
22738 |
| - setTimeout(function() { |
22739 |
| - // the element the charts are inserted into |
22740 |
| - me.container = query('#bs-chart', idoc)[0]; |
22741 |
| - |
22742 |
| - // Browserscope's UA div is inserted before an element with the id of "bs-ua-script" |
22743 |
| - loadScript('https://www.browserscope.org/ua?o=js', me.container).id = 'bs-ua-script'; |
22744 |
| - |
22745 |
| - // the "autoload" string is created following the guide at |
22746 |
| - // https://developers.google.com/loader/?hl=en#auto-loading |
22747 |
| - setTimeout(function() { loadScript('https://www.google.com/jsapi?autoload=' + encodeURIComponent('{' + |
22748 |
| - 'modules:[{' + |
22749 |
| - 'name:"visualization",' + |
22750 |
| - 'version:1,' + |
22751 |
| - 'packages:["corechart","table"],' + |
22752 |
| - 'callback:ui.browserscope.load' + |
22753 |
| - '}]' + |
22754 |
| - '}'), idoc); }, 2000); |
22755 |
| - }, 1); |
22756 | 22757 | });
|
22757 | 22758 |
|
22758 | 22759 | // hide the chart while benchmarks are running
|
|
0 commit comments