initCountdowns(); function goTo( target ){ if( target == "home" && location.pathname != "/" ){ location.href = "/"; } if( $( target ).length > 0 ){ closeModals(); smoothScrollTo( target, -70 ); } else{ location.href = "/" + target; } } //--------------------- //When scrolled below 200px toggle back to top button //--------------------- $( document ).scroll( function(){ var heroHeight = $( 'section.hero' ).outerHeight(); if( window.pageYOffset > heroHeight ){ $( '#to-top' ).show(); } else{ $( '#to-top' ).hide(); } } ); //--------------------- //Scrolling changes #hash //--------------------- if( history.pushState ){ var targetableSections = []; $( '.cms-contents > section[id]' ).each( function( index ){ targetableSections[index] = { hash: $( this ).attr( "id" ), top: $( this ).offset().top } } ) if( targetableSections.length > 0 ){ var currentSection; var viewPortOffset = window.innerHeight / 2 - 300; $( document ).scroll( function(){ $( '.cms-contents > section[id]' ).each( function( index ){ targetableSections[index] = { hash: $( this ).attr( "id" ), top: $( this ).offset().top } } ); var documentTOP = $( document ).scrollTop() if( documentTOP < (targetableSections[0].top - viewPortOffset) ){ //remove hash since we're on hero image history.replaceState( "", document.title, window.location.pathname + window.location.search ); } else{ //set hash to section in center of viewport for(var i = 0; i < targetableSections.length; i++){ if( documentTOP >= (targetableSections[i].top - viewPortOffset) ){ currentSection = '#' + targetableSections[i].hash; } } if( window.location.hash != currentSection ){ history.replaceState( "", document.title, currentSection ); } } } ) } } //--------------------- //Hero slider //--------------------- $( '#hero-slider' ).slick( { dots: true, arrows: false, autoplay: true, autoplaySpeed: 4000, speed: 400, } ); //--------------------- //Speakers widget functions //--------------------- $( 'a[data-speaker-link]' ).on( 'click', function( e ){ e.preventDefault(); var iframeUrl = $( this ).attr( 'data-speaker-link' ); $.ajax( iframeUrl ).done( function( data ){ $( '#modal-speaker .ajax-wrap' ).html( data ); openModal( 'speaker' ); } ); } ); $( '.speakers-toggle' ).on( 'click', function(){ var $section = $( this ).closest( 'section' ); if( $( this ).attr( "data-toggled" ) == "true" ){ $( this ).attr( "data-toggled", "false" ).text( phraseButtonShow ).toggleClass( "is-active" ); $section.find( '.speaker:nth-child(1n + 11)' ).hide().addClass( 'hidden' ); //11th item and more setTimeout( function(){ smoothScrollTo( $section.find( '.speakers-wrap' ), -250 ); }, 200 ) } else{ $( this ).attr( "data-toggled", "true" ).text( phrasePagingShow ).toggleClass( "is-active" ); //10 items $section.find( '.speaker.hidden' ).show().removeClass( 'hidden' ); } } ); /* Enter submit */ $( '.registration-widget input[type="text"]' ).keypress( function( event ){ if( event.which == 13 ){ event.preventDefault(); $( '[name="submit_finish"]' ).click(); $( '[name="submit_next"]' ).click(); $( '[name="submit_invite"]' ).click(); } } ); // Make sure that navigation fits on screen. If it doesnt move current last item under More // + take contact-btn and clone it into body ///////////////////// $( document ).ready( function(){ checkIfMenuFits(); } ); $( window ).on( 'resize', function(){ checkIfMenuFits() } ); function checkIfMenuFits(){ var $header = $( '.cms-header' ); if( window.innerWidth >= 1024 ){ var $moreToggle = $( '.menu-extended.show-for-large' ); var $moreMenu = $moreToggle.find( '> ul' ); while($header.outerHeight() > 130){ //default height is 70 (no toolbar) or ~115 with toolbar $( '.headbar-menu > li' ).not( '.menu-extended' ).not( '.big-btn' ).not( '.register-btn' ).not( '.contact-btn' ).last().prependTo( $moreMenu ); } ;$header.removeClass( 'header-hidden' ); if( $moreMenu.find( '> li' ).length == 0 ){ $moreToggle.hide() } else{ $moreToggle.show() } } else{ $header.removeClass( 'header-hidden' ); } }; function initCountdowns(){ var translations = { "day": "day", "days": "days", "hour": "hour", "hours": "hours", "minute": "minute", "minutes": "minutes", "second": "second", "seconds": "seconds", } var $countdowns = $('[data-countdown]'); if($countdowns.length){ var tag = document.createElement( 'script' ); tag.src = 'https://cdn.idc.com/COMMONS/SCRIPTS/design-moment-no-locales-plus-timezones-for-10-years.min.js'; tag.async = false; document.head.appendChild( tag ); tag.addEventListener( 'load', function(){ if( document.readyState == 'complete' ){ build() } else{ window.addEventListener( 'load', function(){ build() } ); } } ); } function build(){ $( '[data-countdown]' ).each( function(){ var $this = $( this ); var config = $this.attr( 'data-countdown' ).split( ',' ); var dateTime = config[0]; if(dateTime=="semik_start"){ dateTime = dynamicEventDateStart; } var timeZone = config[1]; $this.attr( 'title', 'Counting down to: ' + dateTime + ', timezone: ' + timeZone ); var eventTime = moment.tz( dateTime, timeZone ); var userTime = moment.tz( moment.tz.guess() ) var distance = eventTime.diff( userTime ); //if countdown to time is at least 1hour away if( distance >= (1000 * 60 * 60) ){ var svgStrokeMax = 138; var progressCircleHTML = ''; var html = ''; var days = Math.floor( distance / (1000 * 60 * 60 * 24) ); var daysLabel = (days == 1 ? translations.day : translations.days).slice( 0, 1 ); html += '' + progressCircleHTML + '' + days + '' + daysLabel + ''; var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) ); var hoursLabel = (hours == 1 ? translations.hour : translations.hours).slice( 0, 1 ); html += '' + progressCircleHTML + '' + hours + '' + hoursLabel + ''; var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) ); var minutesLabel = (minutes == 1 ? translations.minute : translations.minutes).slice( 0, 1 ); html += '' + progressCircleHTML + '' + minutes + '' + minutesLabel + ''; var seconds = Math.floor( (distance % (1000 * 60)) / 1000 ); var secondsLabel = (seconds == 1 ? translations.second : translations.seconds).slice( 0, 1 ); html += '' + progressCircleHTML + '' + seconds + '' + secondsLabel + ''; $this.html( html ); countUp( $this ); var x = setInterval( function(){ // Get today's date and time //var now = new Date().getTime(); var userTime = moment.tz( moment.tz.guess() ) // Find the distance between now and the count down date //var distance = countDownDate - now; var distance = eventTime.diff( userTime ); // Time calculations for days, hours, minutes and seconds var days = Math.floor( distance / (1000 * 60 * 60 * 24) ); var daysPercentage = days / 10; var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) ); var hoursPercentage = hours / 24; var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) ); var minutesPercentage = minutes / 60; var seconds = Math.floor( (distance % (1000 * 60)) / 1000 ); var secondsPercentage = seconds / 60; function getScrolledSvgPx( percantageScrolled ){ var percentageSvg = svgStrokeMax - ((1 - percantageScrolled) * svgStrokeMax); if( percentageSvg < 0 ){ percentageSvg = 0; } return percentageSvg + "px"; } // Display the result in the element with id="demo" $this.find( '[data-countdown="daysValue"]' ).text( days < 10 ? "0" + days : days ); $this.find( '[data-countdown="days"] .progress-circle circle' ).css( 'stroke-dashoffset', getScrolledSvgPx( daysPercentage ) ); $this.find( '[data-countdown="hoursValue"]' ).text( hours < 10 ? "0" + hours : hours ); $this.find( '[data-countdown="hours"] .progress-circle circle' ).css( 'stroke-dashoffset', getScrolledSvgPx( hoursPercentage ) ); $this.find( '[data-countdown="minutesValue"]' ).text( minutes < 10 ? "0" + minutes : minutes ); $this.find( '[data-countdown="minutes"] .progress-circle circle' ).css( 'stroke-dashoffset', getScrolledSvgPx( minutesPercentage ) ); $this.find( '[data-countdown="secondsValue"]' ).text( seconds < 10 ? "0" + seconds : seconds ); $this.find( '[data-countdown="seconds"] .progress-circle circle' ).css( 'stroke-dashoffset', getScrolledSvgPx( secondsPercentage ) ); // If the count down is finished, write some text if( distance < 0 ){ $this.hide(); clearInterval( x ); } }, 1000 ); } } ) } } $( document ).ready( function(){ if( $( '[data-map-x]' ).length ){ baiduEmbedAndInit(); } function baiduEmbedAndInit(){ window.HOST_TYPE = "2"; window.BMap_loadScriptTime = (new Date).getTime(); var script = document.createElement( 'script' ); //FORCE US mode for debugging - add &country=us to script source; //script.src = 'https://api.map.baidu.com/api?v=2.0&ak=E4805d16520de693a3fe707cdc962045'; script.src = 'https://api.map.baidu.com/getscript?v=2.0&ak=30ekNdTvSc9HExgPhbxmjjoR0zWMdoGM&services=&t=20200327103013'; script.async = false; script.type = "text/javascript"; document.head.appendChild( script ); script.addEventListener( 'load', function(){ if( document.readyState == 'complete' ){ //console.log("embeding - window is ready"); initBaidu() } else{ //console.log("waiting for window loaded - then will embed"); window.addEventListener( 'load', function(){ initBaidu() } ); } } ); } function initBaidu(){ $( '[data-map-x]' ).each( function(){ var x = $( this ).attr( 'data-map-x' ); var y = $( this ).attr( 'data-map-y' ); var zoom = $( this ).attr( 'data-map-zoom' ); $( this ).attr("class","semik__baidu"); $(this).append('
'); var map = new BMap.Map( "map-x-" + x + "-y-" + y ); var point = new BMap.Point( x, y ); map.centerAndZoom( point, zoom ); map.enableScrollWheelZoom( true ); //var opt={offset: new BMap.Size(150, 5),type: BMAP_NAVIGATION_CONTROL_PAN}; //map.addControl(new BMap.NavigationControl(opt)); map.addControl( new BMap.NavigationControl() ); map.addControl( new BMap.ScaleControl() ); map.addControl( new BMap.OverviewMapControl() ); map.addControl( new BMap.MapTypeControl() ); var myIcon = new BMap.Icon( "https://cdn.idc.com/cn/RESOURCES/IMAGES/mapPin.png", new BMap.Size( 48, 48 ), {anchor: new BMap.Size( 24, 48 )} ); var marker = new BMap.Marker( point, {icon: myIcon} ); map.addOverlay( marker ); $(this).find('.idc-loader').remove(); $(this).append('
'+phraseMakeMapInteractableTooltip+'
'); var $embed = $(this).find('>.embed-wrap'); var $headup = $(this).find('>.headsup'); $embed.css( "pointer-events", "none" ); $(this).click( function(){ $embed.css( "pointer-events", "auto" ); $headup.addClass('is-hidden'); } ); $(this).mouseleave( function(){ $embed.css( "pointer-events", "none" ); $headup.removeClass('is-hidden'); } ); } ); } } );