1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10(function() { 11 'use strict'; 12 13 // youtube or vimeo 14 function checkPlayerName(url) { 15 if (url === 'false') return false; 16 17 var result = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/); 18 19 if (result && /youtube/g.test(result[3])) { 20 return 'youtube'; 21 } else if (result && /vimeo/g.test(result[3])) { 22 return 'vimeo'; 23 } 24 25 return false; 26 } 27 28 // youtube or vimeo 29 function getVideoId(url) { 30 if (url === 'false') return false; 31 32 var result = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/); 33 34 return result ? result[6] : false; 35 } 36 37 function getYTPreviewUrl(videoId, quality) { 38 return 'https://img.youtube.com/vi/' + videoId + '/' + 39 (quality || '') + 'default.jpg'; 40 } 41 42 function getVimeoPreviewUrl(vimeoId, callback) { 43 var request = new XMLHttpRequest(); 44 request.open('GET.html', 'https://vimeo.com/api/v2/video/' + vimeoId + '.json', true); 45 request.onreadystatechange = function() { 46 if (this.readyState === 4) { 47 if (this.status >= 200 && this.status < 400) { 48 var response = JSON.parse(this.responseText); 49 50 callback(response[0].thumbnail_large); 51 } 52 } 53 }; 54 request.send(); 55 request = null; 56 } 57 58 var getYTPreviewUrlWithBestQuality = (function() { 59 var cache = {}; 60 61 return function(id) { 62 var def = $.Deferred(); 63 if (id in cache) { 64 if (cache[id]) { 65 def.resolve(cache[id]); 66 } else { 67 def.reject('Preview image not found.'); 68 } 69 } else { 70 $('<img>').on('load', function() { 71 if (120 === (this.naturalWidth || this.width)) { 72 // selection of preview in the best quality 73 var file = this.src.split('').pop(); 74 switch (file) { 75 case 'maxresdefault.jpg': 76 this.src = this.src.replace(file, 'sddefault.html'); 77 break; 78 case 'sddefault.jpg': 79 this.src = this.src.replace(file, 'hqdefault.html'); 80 break; 81 case 'hqdefault.jpg': 82 this.src = this.src.replace(file, 'default.html'); 83 break; 84 default: 85 cache[id] = null; 86 def.reject('Preview image not found.'); 87 break; 88 } 89 } else { 90 def.resolve(cache[id] = this.src); 91 } 92 }).attr('src', getYTPreviewUrl(id, 'maxres')); 93 } 94 95 return def; 96 }; 97 })(); 98 99 /* 100 * check for youtube/vimeo video section and 101 * load videopreview from youtube/vimeo on 'add' event and enable YTPlayer/vimeo_player 102 * */ 103 if (!$('html').hasClass('is-builder')) { 104 $(document).on('add.cards', function(event) { 105 if (!$(event.target).hasClass('carousel')) return; 106 var isDesktop = $('html').hasClass('desktop'); 107 108 $(event.target).outerFind('[data-bg-video-slide]').each(function() { 109 var videoId = getVideoId($(this).attr('data-bg-video-slide')); 110 if (!videoId) return; 111 112 var $preview = $('<div class="mbr-background-video-preview"></div>').css({ 113 display: 'none', 114 backgroundSize: 'cover', 115 backgroundPosition: 'center' 116 }); 117 118 $('.container-slide', this).before($preview); 119 var playerName = checkPlayerName($(this).attr('data-bg-video-slide'));
120 var $overlay = $(this).find('.mbr-overlay'); 121 122 if (playerName === 'youtube') { 123 getYTPreviewUrlWithBestQuality(videoId).done(function(url) { 124 $preview.css('background-image', 'url("' + url + '")').show(); 125 }); 126 127 if (isDesktop && $.fn.YTPlayer && !$(this).find('.playerBox').length) { 128 $('.container-slide', this) 129 .before('<div class="mbr-background-video"></div>').prev() 130 .YTPlayer({ 131 videoURL: videoId, 132 containment: 'self', 133 showControls: false, 134 mute: true 135 }); 136 137 if ($overlay.length) { 138 $('.YTPOverlay', this).css({ 139 opacity: $overlay.css('opacity'), 140 backgroundColor: $overlay.css('background-color') 141 }); 142 } 143 144 $(this).find('.image_wrapper img').css('opacity', '0'); 145 $(this).find('.image_wrapper .mbr-overlay').css('opacity', '0'); 146 } 147 } else { 148 getVimeoPreviewUrl(videoId, function(url) { 149 $preview.css('background-image', 'url("' + url + '")').show(); 150 }); 151 152 if (isDesktop && $.fn.vimeo_player && !$(this).find('.playerBox').length) { 153 $('.container-slide', this) 154 .before('<div class="mbr-background-video"></div>').prev() 155 .vimeo_player({ 156 videoURL: videoId, 157 containment: 'self', 158 showControls: false, 159 mute: true 160 }); 161 162 if ($overlay.length) { 163 $('.vimeo_player_overlay', this).css({ 164 opacity: $overlay.css('opacity'), 165 backgroundColor: $overlay.css('background-color') 166 }); 167 } 168 } 169 } 170 }); 171 172 $(event.target).find('.carousel-item iframe').css({ 173 transitionProperty: 'opacity', 174 transitionDuration: '1000ms' 175 }); 176 177 // pause YTPlayer/vimeo_player in hidden slides, apply some css rules 178 $(this).on('slide.bs.carousel', 'section.carousel', function(event) { 179 $(event.target).find('.carousel-item.active .mb_YTPlayer').each(function() { 180 $(this).YTPPause(); 181 }); 182 183 $(event.target).find('.carousel-item.active .vimeo_player').each(function() { 184 $(this).v_pause(); 185 }); 186 187 $(event.target).find('.carousel-item:not(.active) iframe').css('opacity', 0); 188 }); 189 190 // start YTPPlayer in active slides, apply some css rules 191 $(this).on('slid.bs.carousel', 'section.carousel', function(event) { 192 $(event.target).find('.carousel-item.active .mb_YTPlayer').each(function() { 193 $(this).YTPPlay(); 194 }); 195 196 $(event.target).find('.carousel-item.active .vimeo_player').each(function() { 197 $(this).v_play(); 198 }); 199 200 $(event.target).find('.carousel-item.active iframe').resize().css('opacity', 1); 201 }); 202 }); 203 } 204})(); 205}
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.