brightcove.js
5 years ago
dependencies.js
7 months ago
main.js
7 months ago
quiz.js
4 years ago
recipes.js
5 years ago
slideshow-shortcode.js
7 months ago
brightcove.js
30 lines
| 1 | /* global brightcove, brightcoveData */ |
| 2 | ( function ( $ ) { |
| 3 | var script = document.createElement( 'script' ), |
| 4 | tld = 'co.jp' === brightcoveData.tld ? 'co.jp' : 'com', |
| 5 | timer = false; |
| 6 | |
| 7 | // Load Brightcove script |
| 8 | script.src = 'https://sadmin.brightcove.' + tld + '/js/BrightcoveExperiences.js'; |
| 9 | script.type = 'text/javascript'; |
| 10 | script.language = 'JavaScript'; |
| 11 | document.head.appendChild( script ); |
| 12 | |
| 13 | // Start detection for Brightcove script loading in its object |
| 14 | try_brightcove(); |
| 15 | |
| 16 | // Detect if Brightcove script has loaded and bind some events once loaded |
| 17 | function try_brightcove() { |
| 18 | clearTimeout( timer ); |
| 19 | |
| 20 | if ( 'object' === typeof brightcove ) { |
| 21 | $( document ).ready( brightcove.createExperiences ); |
| 22 | $( 'body' ).on( 'post-load', brightcove.createExperiences ); |
| 23 | |
| 24 | brightcove.createExperiences(); |
| 25 | } else { |
| 26 | timer = setTimeout( try_brightcove, 100 ); |
| 27 | } |
| 28 | } |
| 29 | } )( jQuery ); |
| 30 |