1(function($) { 2 var myPlayer; 3 var videoReady = false; 4 var firstView = false; 5 var isBuilder = $('html').hasClass('is-builder'); 6 7 $.extend($.easing, { 8 easeInOutCubic: function(x, t, b, c, d) { 9 if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; 10 return c / 2 * ((t -= 2) * t * t + 2) + b; 11 } 12 }); 13 14 $.fn.outerFind = function(selector) { 15 return this.find(selector).addBack(selector); 16 }; 17 18 19 20 (function($, sr) { 21// debouncing function from John Hann 22// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 23var debounce = function(func, threshold, execAsap) { 24 var timeout; 25 26 return function debounced() { 27 var obj = this, 28 args = arguments; 29 30 function delayed() { 31 if (!execAsap) func.apply(obj, args); 32 timeout = null; 33 } 34 35 if (timeout) clearTimeout(timeout); 36 else if (execAsap) func.apply(obj, args); 37 38 timeout = setTimeout(delayed, threshold || 100); 39 }; 40}; 41// smartresize 42jQuery.fn[sr] = function(fn) { 43 return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); 44}; 45 46})(jQuery, 'smartresize'); 47 48(function() { 49 50 var scrollbarWidth = 0, 51 originalMargin, touchHandler = function(event) { 52 event.preventDefault(); 53 }; 54 55 function getScrollbarWidth() { 56 if (scrollbarWidth) return scrollbarWidth; 57 var scrollDiv = document.createElement('div'); 58 $.each({ 59 top: '-9999px', 60 width: '50px', 61 height: '50px', 62 overflow: 'scroll', 63 position: 'absolute' 64 }, function(property, value) { 65 scrollDiv.style[property] = value; 66 }); 67 $('body').append(scrollDiv); 68 scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 69 $('body')[0].removeChild(scrollDiv); 70 return scrollbarWidth; 71 } 72 73})(); 74 75$.isMobile = function(type) { 76 var reg = []; 77 var any = { 78 blackberry: 'BlackBerry', 79 android: 'Android', 80 windows: 'IEMobile', 81 opera: 'Opera Mini', 82 ios: 'iPhone|iPad|iPod' 83 }; 84 type = 'undefined' == $.type(type) ? '*' : type.toLowerCase(); 85 if ('*' == type) reg = $.map(any, function(v) { 86 return v; 87 }); 88 else if (type in any) reg.push(any[type]); 89 return !!(reg.length && navigator.userAgent.match(new RegExp(reg.join('|'), 'i'))); 90 }; 91 92 var isSupportViewportUnits = (function() { 93// modernizr implementation 94var $elem = $('<div style="height: 50vh; position: absolute; top: -1000px; left: -1000px;">').appendTo('body'); 95var elem = $elem[0]; 96var height = parseInt(window.innerHeight / 2, 10); 97var compStyle = parseInt((window.getComputedStyle ? getComputedStyle(elem, null) : elem.currentStyle)['height'], 10); 98$elem.remove(); 99return compStyle == height; 100}()); 101 102 $(function() { 103 104 $('html').addClass($.isMobile() ? 'mobile' : 'desktop'); 105 106 107 108if ($.isMobile() && navigator.userAgent.match(/Chrome/i)) { // simple fix for Chrome's scrolling 109 (function(width, height) { 110 var deviceSize = [width, width]; 111 deviceSize[height > width ? 0 : 1] = height; 112 $(window).smartresize(function() { 113 var windowHeight = $(window).height(); 114 if ($.inArray(windowHeight, deviceSize) < 0) 115 windowHeight = deviceSize[$(window).width() > windowHeight ? 1 : 0]; 116 $('.mbr-section--full-height').css('height', windowHeight + 'px'); 117 }); 118 })($(window).width(), $(window).height()); 119} else if (!isSupportViewportUnits) { // fallback for .mbr-section--full-height 120 $(window).smartresize(function() { 121 $('.mbr-section--full-height').css('height', $(window).height() + 'px'); 122 }); 123 $(document).on('add.cards', function(event) { 124 if ($('html').hasClass('mbr-site-loaded') && $(event.target).outerFind('.mbr-section--full-height').length) 125 $(window).resize(); 126 }); 127} 128 129 130 131 132// background video 133function videoParser(card) { 134 $(card).outerFind('[data-bg-video]').each(function() { 135 var videoURL = $(this).attr('data-bg-video'); 136 var parsedUrl = videoURL.match(/(http:\/\/|https:\/\/|)?(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/); 137
138 var $img = $('<div class="mbr-background-video-preview">').hide().css({ 139 backgroundSize: 'cover', 140 backgroundPosition: 'center' 141 }); 142 $('> *:eq(0)', this).before($img); 143 144 145 146 if (parsedUrl && /youtube/g.test(parsedUrl[3])) { 147 var previewURL = 'http' + ('https:' === location.protocol ? 's' : '') + ':'; 148 previewURL += '//img.youtube.com/vi/' + parsedUrl[6] + '/maxresdefault.jpg'; 149 150 $('<img>').on('load', function() { 151 if (120 === (this.naturalWidth || this.width)) { 152 153 var file = this.src.split('/').pop(); 154 155 switch (file) { 156 case 'maxresdefault.jpg': 157 this.src = this.src.replace(file, 'sddefault.jpg'); 158 break; 159 case 'sddefault.jpg': 160 this.src = this.src.replace(file, 'hqdefault.jpg'); 161 break; 162 default: 163 164 } 165 } else { 166 $img.css('background-image', 'url("' + this.src + '")').show(); 167 } 168 }).attr('src', previewURL); 169 170 // if ($.fn.YTPlayer && !$.isMobile()) { 171 if ($.fn.YTPlayer ) { 172 $('> *:eq(1)', this).before('<div id="video_intro" class="mbr-background-video"></div>'); 173 myPlayer = jQuery('#video_intro').YTPlayer({ 174 autoPlay:true, 175 videoURL: parsedUrl[6], 176 containment: 'self', 177 showControls: false, 178 mute: false, 179 vol: 100, 180 showYTLogo: false, 181 useOnMobile: false, 182 onReady: function(event) { 183 videoReady = true; 184 185 } 186 }); 187 $('#video_intro').on('YTPStart YTPPlay',function(e){ 188 189 190 191 checkVisible(); 192 }); 193 function checkVisible(){ 194 195 if($(window).scrollTop() > $(window).height()){ 196 197 myPlayer.YTPPause(); 198 jQuery('#video_intro').YTPPause(); 199 }else{ 200 jQuery('#video_intro').YTPPlay(); 201 myPlayer.YTPPlay(); 202 } 203 204 } 205 $(window).scroll(function(){ 206 if(videoReady){ 207 if($(window).scrollTop()>$(window).height()){ 208 209 myPlayer.YTPPause(); 210 }else{ 211 212 myPlayer.YTPPlay(); 213 } 214 } 215 }); 216 217 218 } 219 220 } 221}); 222} 223 224 225 226videoParser(document.body); 227 228 229 230 231}); 232 233 234 235 236 237 238/* if ($('nav.navbar').length) { 239var navHeight = $('nav.navbar').height(); 240$('.mbr-after-navbar.mbr-fullscreen').css('padding-top', navHeight + 'px'); 241}*/ 242 243function isIE() { 244 var ua = window.navigator.userAgent; 245 var msie = ua.indexOf("MSIE "); 246 247 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { 248 return true; 249 } 250 251 return false; 252} 253 254// fixes for IE 255if (isIE()) { 256 $(document).on('add.cards', function(event) { 257 var $eventTarget = $(event.target); 258 259 if ($eventTarget.hasClass('mbr-fullscreen')) { 260 $(window).on('load resize', function() { 261 $eventTarget.css('height', 'auto'); 262 263 if ($eventTarget.outerHeight() <= $(window).height()) { 264 $eventTarget.css('height', '1px'); 265 } 266 }); 267 } 268 269 if ($eventTarget.hasClass('mbr-slider') || $eventTarget.hasClass('mbr-gallery')) { 270 $eventTarget.find('.carousel-indicators').addClass('ie-fix').find('li').css({ 271 display: 'inline-block', 272 width: '30px' 273 }); 274 275 if ($eventTarget.hasClass('mbr-slider')) { 276 $eventTarget.find('.full-screen .slider-fullscreen-image').css('height', '1px'); 277 } 278 } 279 }); 280} 281 282var lastId, 283topMenu = $(".navbar-nav"), 284topMenuHeight = topMenu.height(), 285 286menuItems = topMenu.find("a"), 287 288scrollItems = menuItems.map(function(){ 289 var item = $($(this).attr("href")); 290 if (item.length) { return item; } 291}); 292 293 294menuItems.click(function(e){ 295 topMenuHeight = topMenu.height(); 296 var href = $(this).attr("href"), 297 offsetTop = href === "#" ? 0 : $(href).offset().top - topMenuHeight - 65; 298 $('html, body').stop().animate({ 299 scrollTop: offsetTop 300 }, 1000); 301 e.preventDefault(); 302}); 303 304 305$(window).scroll(function(){ 306 307 var fromTop = $(this).scrollTop()+topMenuHeight + 150; 308 309 310 var cur = scrollItems.map(function(){ 311 if ($(this).offset().top < fromTop) 312 return this; 313 }); 314 cur = cur[cur.length-1]; 315 var id = cur && cur.length ? cur[0].id : ""; 316 317 if (lastId !== id) { 318 lastId = id; 319 menuItems.parent().removeClass("active").end().filter("[href='#"+id+"']").parent().addClass("active"); 320 } 321 322}); 323 324 325})(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.