Merge pull request #147 from reuters-graphics/ad-flow-fix
Change script load flow to make it identical to initial implementation
This commit is contained in:
commit
7846ddd209
3 changed files with 12 additions and 6 deletions
|
|
@ -8,8 +8,10 @@
|
||||||
window.graphicsAdQueue = window.graphicsAdQueue || [];
|
window.graphicsAdQueue = window.graphicsAdQueue || [];
|
||||||
loadScript(
|
loadScript(
|
||||||
'https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js',
|
'https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js',
|
||||||
loadBootstrap
|
{ onload: loadBootstrap, async: false }
|
||||||
);
|
);
|
||||||
|
// Load Freestar script
|
||||||
|
loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import getParameterByName from './getParameterByName';
|
import getParameterByName from './getParameterByName';
|
||||||
import Ias from './ias';
|
import Ias from './ias';
|
||||||
import { loadScript } from './loadScript';
|
|
||||||
|
|
||||||
const ONETRUST_LOGS = 'ot_logs';
|
const ONETRUST_LOGS = 'ot_logs';
|
||||||
const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock';
|
const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock';
|
||||||
|
|
@ -42,9 +41,6 @@ export const loadBootstrap = () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
(<any>window).bootstrap.getResults((result) => {
|
(<any>window).bootstrap.getResults((result) => {
|
||||||
// Load Freestar script
|
|
||||||
loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
|
|
||||||
|
|
||||||
// Set GAM
|
// Set GAM
|
||||||
window.googletag = (<any>window).googletag || { cmd: [] };
|
window.googletag = (<any>window).googletag || { cmd: [] };
|
||||||
window.googletag.cmd.push(() => {
|
window.googletag.cmd.push(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
export const loadScript = (src: string, onload?: () => void) => {
|
interface attributesInterface {
|
||||||
|
onload?: () => void,
|
||||||
|
async?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export const loadScript = (src: string, attributes?: attributesInterface) => {
|
||||||
|
const { onload, async = true } = attributes || {};
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.addEventListener('load', onload);
|
script.addEventListener('load', onload);
|
||||||
|
script.async = async;
|
||||||
script.src = src;
|
script.src = src;
|
||||||
document.head.append(script);
|
document.head.append(script);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue