1(function ($) { 2 3 var splashVideo; 4 5 "use strict"; 6 //check if splash modal is already set 7 function isSplashed() { 8 var splashed = false; 9 if (typeof (sessionStorage) !== 'undefined') { 10 splashed = sessionStorage.getItem('umggr-splashed'); 11 } 12 return splashed; 13 } 14 15 //set splashed session key 16 function setSplashed() { 17 if (typeof (sessionStorage) !== 'undefined') { 18 sessionStorage.setItem('umggr-splashed', true); 19 } 20 } 21 function setplayerSplash(container, videoId) { 22 console.log('video'); 23 24 if(!$(container).length || (typeof YTPlayer === 'undefined')) return; 25 26 var ytPlayerHost = (!UMGGR_Splash_Shortcode.disable_cookies ? 'https://www.youtube.com' : 'https://www.youtube-nocookie.com'); 27 28 var ytPlayerAutoplay = false; 29 var ytPlayerMute = false; 30 if (UMGGR_Splash_Shortcode.autoplay_setting != 'null') { 31 ytPlayerAutoplay = true; 32 ytPlayerMute = true; 33 } 34 $(container).YTPlayer({ 35 videoId: videoId, 36 host: ytPlayerHost, 37 playerVars: {'autoplay': ytPlayerAutoplay, 'mute': ytPlayerMute, 'controls': 0, 'showinfo': 0, 'rel': 0, 'playlist': videoId, 'loop': 1}, 38 events: { 39 'onReady': function(event){ 40 $('#umggr-splash').trigger('youtube-splash-ready'); 41 $('#umggr-splash .media-aspect-wrapper').delay(400).show(350); 42 }, 43 } 44 }); 45 splashVideo = $(container).data('ytPlayer').player; 46 47 } 48 function setYtVideo(container, videoId) { 49 $(container).parent().hide(); 50 if (typeof (YT) == 'undefined' || typeof (YT.Player) == 'undefined') { 51 window.onYouTubeIframeAPIReady = function () { 52 setplayerSplash(container, videoId); 53 }; 54 } 55 else 56 { 57 setplayerSplash(container, videoId); 58 } 59 } 60 61 UMGGR_Splash_Shortcode.showSplash = function() { 62 //check if #splash modal is present and cookie is not set 63 //splash cookie is set once modal is shown once and valid for the current browser session 64 //only show splash page on homepage 65 if ($('#umggr-splash').length && UMGGR_Splash_Shortcode.is_home){ 66 var $obj = $('#umggr-splash'); 67 if($obj.attr('data-repeatsplash') == 'first_time') { 68 if(!isSplashed()) { 69 $obj.show(); 70 $('body').addClass('-no-overflow'); 71 } 72 }else{ 73 sessionStorage.setItem('umggr-splashed', ''); 74 $obj.show(); 75 $('body').addClass('-no-overflow'); 76 } 77 78 } 79 } 80 81 UMGGR_Splash_Shortcode.initSplash = function() { 82 83 if ($('#umggr-splash .splash-video-contain .yt-holder').length > 0){ 84 var ytId = $('#umggr-splash .splash-video-contain .yt-holder').data('yt-id'); 85 var container = $('#umggr-splash .splash-video-contain .yt-holder')[0]; 86 setYtVideo(container, ytId); 87 } 88 $('.close-modal').click(function () { 89 if ($(this).parents('#umggr-splash').length) { 90 $('#umggr-splash').fadeOut(500, function(){ 91 $('body').removeClass('-no-overflow'); 92 $('#umggr-splash').remove(); 93 setSplashed(); 94 }); 95 } 96 $('body').removeClass('-no-overflow'); 97 }); 98 99 if (UMGGR_Splash_Shortcode.video_format == 'youtube') { 100 // add the mute / unmute functionality to the mute icons 101 var sound_playing = false; 102 $('body').on('click', '.splash-mute-unmute', function(e) { 103 e.preventDefault(); 104 sound_playing = !sound_playing; 105 $(this).toggleClass('playing'); 106 muteUnmute(splashVideo, sound_playing); 107 }); 108 109 $('body').on('click', '.splash-video-overlay', function(e) { 110 e.preventDefault(); 111 sound_playing = !sound_playing; 112 $(this).toggleClass('playing'); 113 muteUnmute(splashVideo, sound_playing); 114 }); 115 } else if (UMGGR_Splash_Shortcode.video_format == 'mp4') { 116 $('body').on('click', '.splash-mute-unmute', function(e) { 117 e.preventDefault(); 118 if( jQuery("#mp4-video").prop('muted') ) { 119 jQuery("#mp4-video").prop('muted', false); 120 $('.splash-mute-unmute-mute').show(); 121 $('.splash-mute-unmute-unmute').hide(); 122 } else { 123 jQuery("#mp4-video").prop('muted', true); 124 $('.splash-mute-unmute-mute').hide(); 125 $('.splash-mute-unmute-unmute').show(); 126 } 127 }); 128 } 129 130 function muteUnmute(player, sound_playing) { 131 if (sound_playing) { 132 player.unMute(); 133 $('.splash-mute-unmute-mute').show(); 134 $('.splash-mute-unmute-unmute').hide(); 135 } else { 136 player.mute(); 137 $('.splash-mute-unmute-mute').hide(); 138 $('.splash-mute-unmute-unmute').show(); 139 } 140 } 141 142 // hide the overlay mute button if cursor is left still for 2.5 seconds 143 var timeout; 144 $('.splash-video-overlay').mousemove(function(){ 145 if (sound_playing) { 146 $('.splash-mute-unmute-unmute').fadeIn(); 147 } else { 148 $('.splash-mute-unmute-mute').fadeIn(); 149 } 150 clearTimeout(timeout); 151 timeout = setTimeout(function(){ 152 if (sound_playing) { 153 $('.splash-mute-unmute-unmute').fadeOut(); 154 } else { 155 $('.splash-mute-unmute-mute').fadeOut(); 156 } 157 }, 2000); 158 }); 159 } 160 161 $(document).ready(function () { 162 UMGGR_Splash_Shortcode.initSplash(); 163 164 if(typeof UMGGR_Deeplink_Module !== 'undefined') { 165 UMGGR_Deeplink_Module.onEvent('loaded', function() { 166 console.log(UMGGR_Deeplink_Module.currentLink ) 167 //do not open splash if deeplinking into a post/section 168 if(UMGGR_Deeplink_Module.currentLink === null) { 169 UMGGR_Splash_Shortcode.showSplash(); 170 } 171 }); 172 } else { 173 UMGGR_Splash_Shortcode.showSplash(); 174 } 175 });
176 177})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.