var defaultScriptElement = document.currentScript;
var constants = {
Asset_Type_Javascript: 'js',
Asset_type_CSS: 'css',
MIME_Javascript: "text/javascript",
MIME_CSS: "text/css"
};
var allLoadingRequestsCompleted = false;
var requestedFileCount = 0;
var completedFileCount = 0;
var expectedFileCount = 0;
var thisScriptElement = document.currentScript;
function dynamicLoadAsset(fileName, assetType) {
var fileRef = null;
if (assetType === constants.Asset_Type_Javascript ) {
fileRef = document.createElement('script');
fileRef.setAttribute("type", constants.MIME_Javascript );
fileRef.setAttribute("src", fileName);
} else if (assetType === constants.Asset_type_CSS ) {
fileRef = document.createElement("link");
fileRef.setAttribute("rel", "stylesheet");
fileRef.setAttribute("type", constants.MIME_CSS );
fileRef.setAttribute("href", fileName);
}
if ( ( fileRef !== null )
&& (typeof fileRef != "undefined")
) {
debug( 'Starting load: ' + fileName );
document.getElementsByTagName("head")[0].appendChild(fileRef);
requestedFileCount++;
fileRef.onload = function( event) {
var source = (event.currentTarget.src === undefined) ? event.target.href : event.currentTarget.src;
debug( 'Loaded: ' + source );
onLoaded( source );
};
}
}
ensureBodyExists();
ensureVideoMenuDivExists( {id: 'video_menu' });
injectSpinner();
dynamicLoadAsset('https://client-prod.pitchhub.com/build/1.29/build/js/video.js', constants.Asset_Type_Javascript );
dynamicLoadAsset('https://client-prod.pitchhub.com/build/1.29/build/js/app_external.js', constants.Asset_Type_Javascript );
dynamicLoadAsset('https://client-prod.pitchhub.com/build/1.29/build/css/app_icons.css', constants.Asset_type_CSS );
dynamicLoadAsset('https://client-prod.pitchhub.com/build/1.29/build/css/app_external.css', constants.Asset_type_CSS );
expectedFileCount =6;
allLoadingRequestsCompleted = true;
function onLoaded( loaded_file ) {
completedFileCount++;
debug('Completed count: ' + completedFileCount.toString() + ';' + 'Expected count: '+ expectedFileCount.toString() );
switch ( loaded_file) {
case 'https://client-prod.pitchhub.com/build/1.29/build/js/video.js': dynamicLoadAsset('https://client-prod.pitchhub.com/build/1.29/build/js/videojs-vimeo.js', constants.Asset_Type_Javascript );
break;
case 'https://client-prod.pitchhub.com/build/1.29/build/js/videojs-vimeo.js': dynamicLoadAsset('https://player.pitchhub.com/en/public/video_menu?token=6860a332d6fbcd8de77b75eebd365e06&presentation_db=6&menu_id=1', constants.Asset_Type_Javascript );
break;
}
if (
( allLoadingRequestsCompleted )
&& ( completedFileCount >= expectedFileCount )
) {
debug('All files loaded');
if ( onVideoMenuStart !== undefined ) {
// Register the default script element
if (screen_helper !== undefined ) {
if ( ( defaultScriptElement !== undefined ) && ( defaultScriptElement !== null) )
screen_helper.registerDefaultScriptElement( thisScriptElement );
}
onVideoMenuStart();
}
}
}
function debug( message ) {
var debug = false;
if (debug) {
console.log( message );
}
}
function injectErrorMessage() {
var HTML =
'
'
+ '
Message from PitchHub: There is a problem with the video ID or token.
'
+ '
';
var element = document.getElementById('video_menu');
if ( !element ) {
element = document.body
}
var append = true;
injectHTML_ByElement( element, HTML, append );
}
function injectSpinner() {
injectSpinnerCSS();
var HTML = '';
var element = document.getElementById('video_menu');
if ( !element ) {
element = document.body
}
var append = true;
injectHTML_ByElement( element, HTML, append );
}
function injectSpinnerCSS() {
var CSS = '.ph-loading{position: relative;height: 100px;width: 100px}.ph-loading-spinner{display:none;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;opacity:.85;text-align:left;border:6px solid rgba(43,51,63,.5);box-sizing:border-box;background-clip:padding-box;width:50px;height:50px;border-radius:25px;visibility:hidden}.ph-loading .ph-loading-spinner{display:block;animation:ph-loading-spinner-show 0s linear .3s forwards}.ph-loading-spinner:after,.ph-loading-spinner:before{content:"";position:absolute;margin:-6px;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.ph-loading .ph-loading-spinner:after,.ph-loading .ph-loading-spinner:before{-webkit-animation:ph-loading-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,ph-loading-spinner-fade 1.1s linear infinite;animation:ph-loading-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,ph-loading-spinner-fade 1.1s linear infinite}.ph-loading .ph-loading-spinner:before{border-top-color:#fff}.ph-loading .ph-loading-spinner:after{border-top-color:#fff;-webkit-animation-delay:.44s;animation-delay:.44s}@keyframes ph-loading-spinner-show{to{visibility:visible}}@-webkit-keyframes ph-loading-spinner-show{to{visibility:visible}}@keyframes ph-loading-spinner-spin{100%{transform:rotate(360deg)}}@-webkit-keyframes ph-loading-spinner-spin{100%{-webkit-transform:rotate(360deg)}}@keyframes ph-loading-spinner-fade{0%{border-top-color:#0a96b8}20%{border-top-color:#0a96b8}35%{border-top-color:#fff}60%{border-top-color:#0a96b8}100%{border-top-color:#0a96b8}}@-webkit-keyframes ph-loading-spinner-fade{0%{border-top-color:#0a96b8}20%{border-top-color:#0a96b8}35%{border-top-color:#fff}60%{border-top-color:#0a96b8}100%{border-top-color:#0a96b8}}';
injectStyle( CSS );
}
function injectHTML_ByElement( Element, HTML, append ) {
if (
( Element !== undefined )
&& ( Element !== null )
) {
if (append ) {
Element.innerHTML += HTML;
}
else {
Element.innerHTML = HTML;
}
}
}
function injectStyle( css ) {
if (
( css !== undefined )
&& ( css !== null )
&& ( css !== '' )
) {
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
}
}
function ensureBodyExists() {
if ( ( document.body === null )
|| ( document.body === undefined )
){
document.body = document.createElement('body');
}
}
function ensureVideoMenuDivExists( element_options ) {
if ( ( element_options === undefined) || ( element_options === null ) ) return;
if ( ( element_options.id === undefined ) || ( element_options.id === null )) return;
var element = document.getElementById( element_options.id );
if ( !element ) {
var default_script_element = thisScriptElement;
// Create a new element
var newElement = document.createElement("div");
newElement.id = element_options.id;
if ( element_options.style !== undefined ) {
newElement.style = element_options.style;
}
if ( element_options.on_click !== undefined ) {
// Need to use an attribute assignment for handlers, which expect a function
newElement.setAttribute('onclick', element_options.on_click );
// newElement.onclick = element_options.on_click;
}
if (
( default_script_element )
&& ( default_script_element.parentNode)
&& ( default_script_element.parentNode.tagName !== 'HEAD' )
){
insertElementBefore_ByElement( default_script_element, newElement );
}
else {
// Append to body
document.body.appendChild( newElement );
}
}
}
function insertElementBefore_ByElement( siblingElement, newElement ) {
if (
( siblingElement !== undefined )
&& ( siblingElement !== null )
) {
var parentElement = siblingElement.parentNode;
if ( parentElement ) {
parentElement.insertBefore(newElement, siblingElement );
}
}
}
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t