1 2function wb_form_validateForm(formId, values, errors) { 3 var form = $("input[name='wb_form_id'][value='" + formId + "']").parent(); 4 if (!form || form.length === 0 || !errors) return; 5 6 form.find("input[name],textarea[name]").css({backgroundColor: ""}); 7 8 if (errors.required) { 9 for (var i = 0; i < errors.required.length; i++) { 10 var name = errors.required[i]; 11 var elem = form.find("input[name='" + name + "'],textarea[name='" + name + "'],select[name='" + name + "']"); 12 elem.css({backgroundColor: "#ff8c8c"}); 13 } 14 } 15 16 if (Object.keys(errors).length) { 17 for (var k in values) { 18 var elem = form.find("input[name='" + k + "'],textarea[name='" + k + "'],select[name='" + k + "']"); 19 elem.val(values[k]); 20 } 21 } 22} 23 24function isTouchDevice() { 25 return ('ontouchstart' in document.documentElement) && ( 26 navigator.userAgent.match(/Android/i) 27 || navigator.userAgent.match(/webOS/i) 28 || navigator.userAgent.match(/BlackBerry/i) 29 || navigator.userAgent.match(/Windows Phone/i) 30 || navigator.userAgent.match(/Opera Mini/i) 31 || navigator.userAgent.match(/IEMobile/i) 32 || navigator.userAgent.match(/iPhone/i) 33 || navigator.userAgent.match(/iPad/i) 34 || navigator.userAgent.match(/iPod/i) 35 || navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints > 0 36 ); 37} 38function isIOS() { 39 return ('ontouchstart' in document.documentElement) && ( 40 navigator.userAgent.match(/iPhone/i) 41 || navigator.userAgent.match(/iPad/i) 42 || navigator.userAgent.match(/iPod/i) 43 || navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints > 0 44 ); 45} 46 47function wb_show_alert(message, type) { 48 var prompt = $("<div>") 49 .addClass("alert alert-wb-form alert-" + type) 50 .append(message) 51 .prepend($("<button>").addClass("close") 52 .html(" ×") 53 .on("click", function() { $(this).parent().remove(); }) 54 ) 55 .appendTo("body"); 56 setTimeout(function() { prompt.animate({ opacity: 1, right: 0 }, 250); }, 250); 57} 58 59(function() { 60 var popupInited = false; 61 62 var loader, container, popup, 63 iframe, closeBtn, isVisible; 64 65 var setPopupVisible = function(visible) { 66 isVisible = !!visible; 67 if (isVisible) { 68 container.show(); 69 setTimeout(function() { container.addClass('visible'); }, 10); 70 } else { 71 container.removeClass('visible'); 72 setTimeout(function() { container.hide(); }, 300); 73 } 74 }; 75 76 window.wb_close_popup = function() { 77 if (iframe && iframe.length) { 78 iframe.attr('src', '');
79 setPopupVisible(false); 80 } 81 }; 82 83 window.wb_show_popup = function(url, width, height) { 84 if (!popupInited) { 85 popupInited = true; 86 container = $('<div class="wb-popup-container">'); 87 popup = $('<div class="wb-popup">'); 88 loader = $('<div class="wb-popup-loader">').hide(); 89 $('<div class="ico-spin spinner">').appendTo(loader); 90 iframe = $('<iframe>'); 91 closeBtn = $('<div class="wb-popup-btn-close">'); 92 closeBtn.on('click', wb_close_popup); 93 popup.append(loader); 94 popup.append(closeBtn); 95 popup.append(iframe); 96 popup.appendTo(container); 97 container.appendTo('body'); 98 $(document).on('keydown', function(e) { 99 if (e.keyCode === 27) { // Esc 100 if (isVisible) wb_close_popup(); 101 } 102 }); 103 if (isIOS()) { 104 popup.attr('style', '-webkit-overflow-scrolling: touch; overflow-y: auto;'); 105 } 106 } 107 width = width || 400; 108 height = height || 320; 109 loader.show(); 110 popup.css({ width: width + 'px', height: height + 'px' }); 111 iframe.on('load', function() { 112 loader.hide(); 113 }); 114 iframe.attr('src', url); 115 setPopupVisible(true); 116 }; 117 118 $(window).on('message', function(e) { 119 var eData = e.originalEvent.data; 120 if (eData && typeof(eData) === 'object' && eData.data && typeof(eData.data) === 'object') { 121 var event = eData.event, data = eData.data; 122 if (event === 'wb_contact_form_sent') { 123 var type = data.type ? data.type : 'success'; 124 if (data.state) wb_show_alert(data.state, type); 125 if (type === 'success') { 126 setPopupVisible(false); 127 } 128 } 129 } 130 }); 131})(); 132 133(function() { 134 var params = []; 135 136 var i, part; 137 var qs_parts = location.search.replace(/^\?/, '').split('&'); 138 for (i = 0; i < qs_parts.length; i++) { 139 part = qs_parts[i].split('='); 140 if (part.length === 2) { 141 params[decodeURIComponent(part[0])] = decodeURIComponent(part[1]); 142 } 143 } 144 145 window.wb_get_query_param = function(key) { 146 return (key && (key in params)) ? params[key] : null; 147 }; 148})(); 149 150$(function() { 151 // fix for forms in Instagram browser 152 if (navigator.userAgent.indexOf('Instagram') > -1) { 153 $('form').each(function() { 154 if (this.method && this.method.toLowerCase() === 'post' 155 && this.target && this.target === '_blank') { 156 $(this).removeAttr('target'); 157 } 158 }); 159 } 160 161 (function() { 162 var extractYoutubeId = function(url) { 163 var id = null; 164 if (/^https?:\/\/.*youtube.*/i.test(url)) { 165 var parts = url.split('?'); 166 if (parts.length > 1) { 167 var parts2 = parts[1].split('&'); 168 for (var i = 0; i < parts2.length; i++) { 169 var keyVal = parts2[i].split('='); 170 if (keyVal.length > 1) { 171 if (keyVal[0] === 'v' && keyVal[1]) { 172 id = keyVal[1]; 173 break; 174 } 175 } 176 } 177 } 178 } 179 else if (/^(?:https?:\/\/|)youtu\.be\/(.+)$/i.test(url)) { 180 id = RegExp.$1; 181 } 182 if (id) { 183 id = id.replace(/[^a-zA-Z0-9\_\-]/, ''); 184 } 185 return id; 186 }; 187 188 $('.wb_video_background').each(function() { 189 var videoContainer = $(this); 190 var isSite = videoContainer.is('.wb_site_video_background'); 191 var url = videoContainer.data('video'), 192 start = videoContainer.data('start'), 193 end = videoContainer.data('end'); 194 195 if (!start) start = 0; 196 if (!end) end = null; 197 198 if (url) { 199 var youtubeVideoId = extractYoutubeId(url); 200 if (youtubeVideoId) { 201 if (!window.YT) { 202 $.getScript('https://www.youtube.com/iframe_api'); 203 } 204 var onAPIReady = window.onYouTubeIframeAPIReady; 205 window.onYouTubeIframeAPIReady = function() { 206 if (typeof(onAPIReady) === 'function') onAPIReady(); 207 208 var youtubeElementId = videoContainer.attr('id') + '_youtube_container'; 209 var player = $('<div class="wb-youtube-video">' + 210 '<div class="youtube" id="' + youtubeElementId + '"></div>' + 211 '</div>'); 212 videoContainer.append(player); 213 var viewportCont = isSite ? $(window) : videoContainer; 214 var lastWidth, lastHeight; 215 var innerCont = null; 216 var inited = false; 217 var resizer = function() {
218 if (!innerCont) innerCont = player.children('iframe.youtube'); 219 if (!innerCont.length) return; 220 221 var w = viewportCont.width() + 200, 222 h = viewportCont.height() + 200; 223 if (lastWidth === w && lastHeight === h) 224 return; 225 lastWidth = w; lastHeight = h; 226 if (w / h > 16/9) { 227 youtube.setSize(w, w / 16*9); 228 innerCont.css('left', 0); 229 } else { 230 youtube.setSize(h / 9*16, h); 231 innerCont.css('left', -(innerCont.outerWidth() - w) / 2); 232 } 233 }; 234 $(window).on('resize', resizer); 235 236 var initVideo = function(reload) { 237 player.addClass('visible'); 238 clearInterval(timer); 239 timer = setInterval(function() { 240 youtube.seekTo(start); 241 if (youtube.getPlayerState() !== YT.PlayerState.PLAYING) 242 youtube.playVideo(); 243 }, ((end ? end : youtube.getDuration() - 0.5) - start) * 1000); 244 if (reload) { 245 youtube.seekTo(start); 246 if (youtube.getPlayerState() !== YT.PlayerState.PLAYING) 247 youtube.playVideo(); 248 } 249 }; 250 251 var timer; 252 var youtube = new YT.Player(youtubeElementId, { 253 events: { 254 playerVars: { 255 autoplay: 0, 256 autohide: 1, 257 modestbranding: 0, 258 rel: 0, 259 showinfo: 0, 260 controls: 0, 261 disablekb: 1, 262 enablejsapi: 0, 263 iv_load_policy: 3 264 }, 265 onReady: function() { 266 youtube.loadVideoById({ 267 videoId: youtubeVideoId, 268 startSeconds: start 269 }); 270 youtube.mute(); 271 resizer(); 272 }, 273 onStateChange: function(e) { 274 if (e.data === YT.PlayerState.PLAYING) { 275 if (!inited) { 276 initVideo(); 277 inited = true; 278 } 279 } else if (e.data === YT.PlayerState.ENDED) { 280 initVideo(true); 281 } 282 } 283 } 284 }); 285 }; 286 } 287 else { 288 var video = $('<video class="wb-video" muted playsinline>'); 289 var loaded = false; 290 var ratio; 291 var lastWidth, lastHeight; 292 videoContainer.append(video); 293 294 var resizer = function() { 295 if (!ratio) return; 296 var ew = videoContainer.width(); 297 var eh = videoContainer.height(); 298 if (lastWidth && lastWidth === ew && lastHeight && lastHeight === eh) 299 return; 300 lastWidth = ew; lastHeight = eh; 301 var er = ew / eh; 302 var nw = 0, nh = 0, nl = 0, nt = 0; 303 if (ratio > er) { 304 nh = eh; 305 nw = nh * ratio; 306 nl = (nw - ew) / 2; 307 } else if (ratio < eh) { 308 nw = ew; 309 nh = nw / ratio; 310 nt = (nh - eh) / 2; 311 } else { 312 nw = ew; 313 nh = eh; 314 } 315 video.css({width: nw, height: nh, left: -nl, top: -nt}); 316 }; 317 $(window).on('resize', resizer); 318 319 video.get(0).autoplay = true; 320 video.on('loadeddata', function() { 321 if (loaded) return; 322 loaded = true; 323 setInterval(function() { 324 video.get(0).currentTime = start; 325 if (video.get(0).paused) video.get(0).play(); 326 }, ((end ? end : video.get(0).duration) - start) * 1000); 327 video.get(0).currentTime = start; 328 video.get(0).play(); 329 video.addClass('visible'); 330 ratio = (video.width() / video.height()); 331 resizer(); 332 }); 333 video.get(0).src = url; 334 } 335 } 336 }); 337 })(); 338 339 var currLang = (('currLang' in window) && window.currLang) ? window.currLang : null; 340 var useTrailingSlashes = (!('useTrailingSlashes' in window) || window.useTrailingSlashes); 341 var disableRightClick = (('disableRightClick' in window) && window.disableRightClick); 342 var isSiteLanding = (('isSiteLanding' in window) && window.isSiteLanding); 343 344 var isPopupMode = (parseInt(wb_get_query_param('wbPopupMode')) === 1); 345 var popupWidth = wb_get_query_param('wbPopupWidth'); 346 var popupHeight = wb_get_query_param('wbPopupHeight'); 347 348 var openPopupPageUrl = (('openPopupPageUrl' in window) && window.openPopupPageUrl); 349 var openPopupPageWidth = (('openPopupPageWidth' in window) && window.openPopupPageWidth); 350 var openPopupPageHeight = (('openPopupPageHeight' in window) && window.openPopupPageHeight); 351 352 if (disableRightClick) { 353 $(document).on('contextmenu', function(e) { e.preventDefault(); }); 354 } 355 356 var comboBoxes = $('.wb-combobox-controll'); 357 if (comboBoxes.length) { 358 comboBoxes.each(function() { 359 var thisCombo = $(this); 360 var clickFunc = function() { 361 var w = thisCombo.find('input').outerWidth(); 362 var mw = (menu = thisCombo.find('.dropdown-menu')).width(); 363 var ew = thisCombo.parent().outerWidth(); 364 if (mw < ew) menu.width(ew); 365 menu.css({ marginLeft: (-w) + 'px' }); 366 thisCombo.find('.btn-group').toggleClass('open'); 367 }; 368 $(this).find('input').bind('click', clickFunc); 369 $(this).find('.dropdown-toggle').bind('click', clickFunc); 370 }); 371 372 $(document).bind('click', function(e) { 373 var t = $(e.target); 374 if (!t.is('.wb-combobox-controll')) { 375 t = t.parents('.wb-combobox-controll'); 376 $.each($('.wb-combobox-controll'), function() { 377 if (t.get(0) !== $(this).get(0)) { 378 $(this).find('.btn-group').removeClass('open'); 379 } 380 }); 381 } 382 }); 383 } 384 if (currLang) { 385 $('.lang-selector').each(function() { 386 var thisElem = $(this); 387 var type = thisElem.attr('data-type'); 388 if (type === 'flags') { 389 thisElem.find('a[data-lang="' + currLang + '"]').addClass('active'); 390 } else if (type === 'select') { 391 var actLi = thisElem.find('li[data-lang="' + currLang + '"]'); 392 actLi.addClass('active'); 393 thisElem.find('input').val(actLi.find('a').html()); 394 } 395 }); 396 } 397 $('.btn-group.dropdown').each(function() { 398 var ddh = $(this).height(); 399 var ddm = $(this).children('.dropdown-menu'); 400 ddm.addClass('open'); 401 var ddmh = ddm.height(); 402 ddm.removeClass('open'); 403 var ddt = $(this).offset().top; 404 var dh = $(document).height(); 405 if (ddt + ddh + ddmh + 2 >
405= dh) { 406 $(this).removeClass('dropdown').addClass('dropup'); 407 } 408 }); 409 410 var closeMenus = function(ignoreMenu) { 411 $('.wb-menu').each(function() { 412 if( this == ignoreMenu ) 413 return; 414 $(this).find('.over').removeClass('over over-out'); 415 }); 416 }; 417 418 $('body').on('touchstart', function(e) { 419 var ignoreMenu = $(e.target).closest('.wb-menu'); 420 ignoreMenu = ignoreMenu.length ? ignoreMenu.get(0) : null; 421 closeMenus(ignoreMenu); 422 }); 423 424 $('.wb-menu').each(function() { 425 var $menuContainer = $(this); 426 var $menu = $menuContainer.children('ul'); 427 var ignoreHover = null; 428 var isLanding = $menu.is('.menu-landing'); 429 var selectMenuItem = function($elem) { 430 $elem.addClass('over'); 431 var $parent = $elem; 432 while( $parent.length > 0 && $parent.is('li') ) { 433 $parent.removeClass('over-out'); 434 $parent = $parent.parent().parent(); 435 } 436 if( $menuContainer.is('.collapse-expanded') ) { 437 $menu.find('.open-left').removeClass('open-left'); 438 } 439 else { 440 var $submenu = $elem.children('ul'); 441 if( $submenu.length ) { 442 $parent = $elem.parent(); 443 if( $menu.is('.vmenu') && $parent.is('.open-left') ) { 444 $submenu.addClass('open-left'); 445 } 446 else { 447 $submenu.removeClass('open-left'); 448 var ww = $(window).width(); 449 var w = $submenu.outerWidth(true); 450 if( $submenu.offset().left + w >= ww ) 451 $submenu.addClass('open-left'); 452 } 453 if( $submenu.offset().left < 0 ) 454 $submenu.removeClass('open-left'); 455 } 456 } 457 }; 458 var closeMenu = function() { 459 $menu.find('li.over').addClass('over-out'); 460 setTimeout(function() { 461 $menu.find('li.over-out').removeClass('over over-out'); 462 }, 10); 463 }; 464 $menu 465 .on('mouseover', 'li', function(e) { 466 if( ignoreHover ) 467 return; 468 selectMenuItem($(this)); 469 }) 470 .on('mouseout', 'li', function(e) { 471 if( ignoreHover ) 472 return; 473 closeMenu(); 474 }) 475 .on('touchstart', 'a', function(e) { 476 var $elem = $(this).parent(); 477 var isOver = $elem.is('.over') || ($menuContainer.is('.collapse-expanded') && $elem.is('.active')); 478 479 if( ignoreHover ) 480 clearTimeout(ignoreHover); 481 ignoreHover = setTimeout(function() {ignoreHover = null;}, 2000); 482 483 closeMenus($menuContainer.get(0)); 484 closeMenu(); 485 selectMenuItem($elem); 486 487 if( isOver || $elem.children('ul').length == 0 ) { 488 if( isLanding ) 489 e.stopImmediatePropagation(); 490 } 491 else { 492 e.stopImmediatePropagation(); 493 e.preventDefault(); 494 } 495 }) 496 ; 497 }); 498 499 $('.wb-menu-mobile').each(function() { 500 var elem = $(this); 501 var btn = elem.children('.btn-collapser').eq(0); 502 var isLanding = (elem.children('.menu-landing').length > 0 || elem.parents('.wb_header_fixed').length > 0); 503 504 var onResize = function() { 505 var ul = elem.children('ul'); 506 ul.css('max-height', ($(window).scrollTop() - ul.offset().top + $(window).height() - 20) + 'px'); 507 }; 508 509 var updateMenuPosition = function() { 510 elem.children('ul').css({top: (btn.offset().top + btn.outerHeight() - $(window).scrollTop()) + 'px'}); 511 }; 512 513 btn.on('click', function(e) { 514 if (elem.hasClass('collapse-expanded')) { 515 elem.removeClass('collapse-expanded'); 516 } else { 517 elem.addClass('collapse-expanded'); 518 updateMenuPosition(); 519 if (isLanding) onResize(); 520 } 521 }); 522 $(document).on('click', function(e) { 523 if (!$(e.target).is('#' + elem.attr('id') + ', #' + elem.attr('id') + ' *')) { 524 if (elem.hasClass('collapse-expanded')) { 525 elem.removeClass('collapse-expanded'); 526 } 527 e.stopPropagation(); 528 } 529 }); 530 531 $(window).scroll(function() { updateMenuPosition(); }); 532 533 if( isLanding ) { 534 $(window).on('resize', onResize); 535 elem.find('li').on('click', function() { 536 elem.removeClass('collapse-expanded'); 537 }); 538 } 539 }); 540 541 (function() { 542 var menu = $('.menu-landing'); 543 if (menu.length) { 544 var $header = $('#wb_header'); 545 var scrolled = false; 546 var findLinkByHref = function(href) { 547 var link = menu.find('a[href="' + (((href.indexOf('#') === 0) ? '' : '#') + href) + '"]'); 548 if (!link.length) link = menu.find('a[href="' + ((href.indexOf('#') === 0) ? ('#' + encodeURIComponent(href.substring(1))) : encodeURIComponent(href)) + '"]'); 549 if (!link.length) link = menu.find('a[href="' + ((href.indexOf('#') === 0) ? ('#' + decodeURIComponent(href.substring(1))) : decodeURIComponent(href)) + '"]'); 550 return link; 551 }; 552 var activateMenuItem = function(item) { 553 while( item.length > 0 && item.is('li') ) { 554 item.addClass('active'); 555 item = item.parent().parent(); 556 } 557 }; 558 var switchLandingPage = function(alias, ln, scroll) { 559 ln = ln || currLang; 560 var href = ln ? ln + (useTrailingSlashes ? '/' : '') + '#' + alias : '#' + alias; 561 var anchor; 562 $('.wb_page_anchor').each(function() { 563 if (alias === this.name || encodeURIComponent(alias) === this.name 564 || alias === encodeURIComponent(this.name)) { 565 anchor = $(this); 566 return false;
567 } 568 }); 569 if (anchor && anchor.length && scroll) { 570 anchor.attr('name', ''); 571 setTimeout(function() { 572 anchor.attr('name', alias); 573 }, 10); 574 scrolled = true; 575 $('html, body').animate({ scrollTop: anchor.offset().top + 'px' }, 540, function() { 576 setTimeout(function() { scrolled = false; }, 100); 577 }); 578 } 579 var item = findLinkByHref(href).parent(); 580 if (!item.length && /[^\/]+\/(.+)$/.test(href)) { // strip language part from href 581 href = RegExp.$1; 582 item = findLinkByHref(href).parent(); 583 } 584 menu.find('li').removeClass('active'); 585 if (item.length) { 586 activateMenuItem(item); 587 } 588 }; 589 menu.find('a').on('click', function() { 590 var href = $(this).attr('href'), parts = href.split('#'), 591 ln = parts[0] ? parts[0].replace(/\/$/, '') : null, 592 alias = parts[1]; 593 594 if (/^(?:http|https):\/\//.test(href)) return true; 595 switchLandingPage(alias, ln, true); 596 }); 597 $(window).on('hashchange', function() { 598 var link = findLinkByHref(location.hash); 599 if (link.length) { 600 var item = link.parent(); 601 activateMenuItem(item); 602 } 603 }); 604 var scrollToCurrentPage = function() { 605 var anchors = $('.wb_page_anchor'); 606 $(anchors.get().reverse()).each(function() { 607 if ($(this).offset().top <= $(window).scrollTop() + $header.height()) { 608 var alias = $(this).attr('name'); 609 switchLandingPage(alias); 610 return false; 611 } 612 }); 613 }; 614 var detectInitialLink = function() { 615 var link = findLinkByHref(location.hash); 616 if (!link.length && location.hash) { 617 var fakeLink = $('a[name="' + location.hash.substring(1) + '"'), landingPage, anchorLink; 618 if (fakeLink.length && (landingPage = fakeLink.parents('.wb_page')).length && (anchorLink = landingPage.children('.wb_page_anchor')).length) { 619 var name = anchorLink.attr('name'); 620 link = findLinkByHref(name); 621 } 622 } 623 return link; 624 }; 625 var link = detectInitialLink(); 626 if (link.length) { 627 activateMenuItem(link.parent()); 628 } else { 629 setTimeout(function() { 630 scrollToCurrentPage(); 631 }, 100); 632 } 633 setTimeout(function() { 634 $(window).bind('scroll', function() { 635 if (scrolled) return false; 636 scrollToCurrentPage(); 637 }); 638 }, 1000); 639 } 640 })(); 641 642 $(document).on('mousedown', '.ecwid a', function() { 643 var href = $(this).attr('href'); 644 if (href && href.indexOf('#!') === 0) { 645 var url = decodeURIComponent(location.pathname) + href; 646 $(this).attr('href', url); 647 } 648 }); 649 650 var applyAutoHeight = function(selector, getElementsCallback, getShapesCallback) { 651 $(selector).each(function() { 652 var currentTop = null; 653 var expectedShapes = null; 654 var maxHeight = {}; 655 var forcedHeight = {}; 656 var elemCount = {}; 657 var $elements = getElementsCallback($(this)); 658 var hasErrors = false; 659 $elements.each(function() { 660 var i; 661 var $elem = $(this); 662 var shapes = $elem.data('shapes'); 663 if( !shapes ) { 664 var $shapes = getShapesCallback($elem); 665 if( $shapes.length == 0 || (expectedShapes !== null && expectedShapes != $shapes.length) ) { 666 hasErrors = true; 667 return false; 668 } 669 shapes = []; 670 for( i = 0; i < $shapes.length; i++ ) { 671 var $shape = $($shapes.get(0)); 672 shapes[i] = { 673 isMap: $shape.is('.wb-map'), 674 elem: $shape 675 }; 676 } 677 $elem.data('shapes', shapes); 678 } 679 expectedShapes = shapes.length; 680 for( i = expectedShapes - 1; i >= 0; i-- ) { 681 if( !shapes[i].isMap ) 682 shapes[i].elem.css('height', ''); 683 } 684 var top = Math.round($elem.offset().top / 5); 685 if( top !== currentTop ) 686 $elem.css('clear', 'left'); // This is needed to fit more elements on same y position. 687 currentTop = Math.round($elem.offset().top / 5); 688 $elem.data('aht', currentTop); 689 if( !maxHeight.hasOwnProperty(currentTop) ) { 690 maxHeight[currentTop] = []; 691 for( i = 0; i < expectedShapes; i++ ) 692 maxHeight[currentTop][i] = 0; 693 forcedHeight[currentTop] = false; 694 elemCount[currentTop] = 0; 695 } 696 if( !forcedHeight[currentTop] ) { 697 for( i = expectedShapes - 1; i >= 0; i-- ) { 698 if( shapes[i].isMap ) { 699 maxHeight[currentTop][i] = shapes[i].elem.outerHeight(); 700 forcedHeight[currentTop] = true; // map element height has top priority 701 break; 702 } 703 else 704 maxHeight[currentTop][i] = Math.max(maxHeight[currentTop][i], shapes[i].elem.outerHeight()); 705 } 706 } 707 elemCount[currentTop]++; 708 }); 709 if( hasErrors ) 710 return; 711 $elements.each(function() { 712 var $elem = $(this); 713 var shapes = $elem.data('shapes'); 714 var aht = $elem.data('aht'); 715 $elem.css('clear', ''); 716 if( elemCount[aht] < 2 ) 717 return; 718 for( var i = expectedShapes - 1; i >= 0; i-- ) 719 if( !shapes[i].isMap ) 720 shapes[i].elem.css('height', maxHeight[aht][i]); 721 }); 722 }); 723 if (isSiteLanding) { 724 $('#wb_main').children('.wb_page').each(function() { 725 var bg, pageId = $(this).attr('id'); pageId = pageId.replace(/page_(\d+)$/, '$1'); 726 if ((bg = $('#wb_page_' + pageId + '_bg')).length) { 727 bg.css('height', $(this).outerHeight() + 'px'); 728 } 729 }); 730 } 731 if ($('.wb_header_fixed').length) { 732 var headerH = $('.wb_header_fixed').outerHeight(true); 733 $('#wb_main').css('padding-top', headerH + 'px'); 734 $('#wb_main .wb_cont_outer').css('top', headerH + 'px'); 735 $('#wb_header_bg').css('height', headerH + 'px'); 736 $('#wb_sbg_placeholder').css('height', headerH + 'px'); 737 } 738 }; 739 740 var recalcAutoHeightColumns = function() { 741 applyAutoHeight('.auto-height', function($cont) { 742 return $cont.children('.wb-cs-col'); 743 }, function($elem) { 744 return $elem.children(); 745 }); 746 747 applyAutoHeight('.auto-height2', function($cont) { 748 return $cont.children('.wb-cs-col'); 749 }, function($elem) { 750 return $elem.children('.wb-cs-row').children('.wb-cs-col').children('.wb_element_shape'); 751 }); 752 }; 753 754 $(window).on('resize', recalcAutoHeightColumns); 755 $(document).ready(recalcAutoHeightColumns); 756 setTimeout(recalcAutoHeightColumns, 100); 757 recalcAutoHeightColumns(); 758 759 (function() { 760 761 var getMinContentHeight = function(elems) { 762 var totalH = 0; 763 elems.each(function() { 764 if ($(this).is(':not(:visible)')) return true; 765 var h = $(this).outerHeight(); 766 var t = parseInt($(this).css('top')); if (isNaN(t)) t = 0; 767 totalH = Math.max((h + t), totalH); 768 }); 769 return totalH; 770 }; 771 772 var lastContentWidth = null, currentContentWidth = null; 773 var applyModeAutoHeight = function(force) {
774 currentContentWidth = $('.wb_cont_inner').outerWidth(); 775 if (!force && currentContentWidth === lastContentWidth) return; 776 lastContentWidth = currentContentWidth; 777 778 if (!('wbIsAutoLayout' in window)) window.wbIsAutoLayout = ($('.wb-cs-row').length > 0); 779 if (window.wbIsAutoLayout) return; 780 781 if (isSiteLanding) { 782 $('#wb_main > .wb_cont_inner').find('.wb_page').each(function() { 783 var bg = null; 784 var $this = $(this); 785 var pageId = parseInt($this.attr('id').replace(/^page_/, '')); if (isNaN(pageId)) return true; 786 var minH = getMinContentHeight($this.children('.wb_element')); 787 var outerMinH = getMinContentHeight($('#page_' + pageId + 'e').children('.wb_element')); 788 var totalMinH = Math.max(minH, outerMinH); 789 var paddingB = parseInt($this.css('padding-bottom')); if (isNaN(paddingB)) paddingB = 0; 790 $this.css('height', totalMinH + 'px'); 791 $("#" + $this.attr('id') + "e").css('height', totalMinH + 'px'); 792 if ((bg = $('#wb_page_' + pageId + '_bg')).length) { 793 bg.css('height', (totalMinH + paddingB) + 'px'); 794 } 795 }); 796 } else { 797 var paddingT = parseInt($('#wb_main').css('padding-top')); if (isNaN(paddingT)) paddingT = 0; 798 var paddingB = parseInt($('#wb_main').css('padding-bottom')); if (isNaN(paddingB)) paddingB = 0; 799 var height = getMinContentHeight($('#wb_main').find('.wb_element')) + paddingB + paddingT; 800 $('#wb_main').css('height', height + 'px'); 801 if (isPopupMode && !popupHeight) { 802 $('body, .root, .wb_sbg').css('max-height', height + 'px'); 803 } 804 } 805 var rootH = 0; 806 $('.root').children('.wb_container').each(function() { 807 if ($(this).hasClass('wb_header_fixed')) return true; 808 rootH += $(this).outerHeight(); 809 }); 810// $('body, .root, .wb_sbg').css({ height: (rootH + 'px'), minHeight: (rootH + 'px') }); 811 }; 812 813 $(document).ready(function() { applyModeAutoHeight(true); }); 814 $(window).on('load', function() { applyModeAutoHeight(true); }); 815 $(window).on('resize', function() { applyModeAutoHeight(); }); 816 setTimeout(function() { applyModeAutoHeight(true); }, 100); 817 setTimeout(function() { applyModeAutoHeight(true); }, 1000); 818 window.applyModeAutoHeight = applyModeAutoHeight; 819 })(); 820 821 (function() { 822 var header = $('.wb_header_fixed'); 823 if (header.length) { 824 var applyTopToAnchors = function() { 825 var header = $('.wb_header_fixed'); 826 $('.wb_anchor').css('top', (-header.outerHeight()) + 'px'); 827 }; 828 $(window).on('resize', applyTopToAnchors); 829 applyTopToAnchors(); 830 setTimeout(function() { 831 applyTopToAnchors(); 832 }, 100); 833 834 if (/firefox|edg/i.test(navigator.userAgent)) { 835 var pageAnchor, p, el; 836 if ((p = location.href.split('#')).length > 1) { 837 pageAnchor = p[1]; 838 } 839 if (pageAnchor && (el = $('.wb_anchor[name="' + pageAnchor + '"]')).length) { 840 el.get(0).scrollIntoView(true); 841 setTimeout(function() { el.get(0).scrollIntoView(true); }, 100); 842 } 843 } 844 } 845 })(); 846 847 (function() { 848 $('.wb_anchor').each(function() { 849 try { 850 var anchor = $(this); 851 var target = $('[href="#' + this.name + '"]'); 852 if (!target.length) 853 target = $('[href="#' + decodeURIComponent(this.name) + '"]'); 854 if (!target.length) 855 target = $('[href="#' + encodeURIComponent(this.name) + '"]'); 856 if (target.length) { 857 target.each(function() { 858 if ($(this).attr('data-landing') === 'true') return true; 859 $(this).on('click', function() { 860 $(window).scrollTop(anchor.offset().top); 861 }); 862 }); 863 } 864 } catch (e) {} 865 }); 866 })(); 867 868 (function() { 869 var recaptchaList = $('.wb_form_captcha'); 870 var defaultRecaptchaWidth = 304; 871 if (recaptchaList.length) { 872 var resizeCaptcha = function() { 873 recaptchaList.each(function() { 874 var recaptcha = $(this); 875 if (recaptcha.is(':visible')) { 876 var form = recaptcha.parents('.wb_form'); 877 var fw = form.outerWidth(); 878 var scale = Math.min(fw / defaultRecaptchaWidth, 1); 879 var scaleCss = 'scale(' + scale + ')'; 880 if (scale > 0) { 881 recaptcha.css({ 882 'transform': scaleCss, 883 '-o-transform': scaleCss, 884 '-ms-transform': scaleCss, 885 '-moz-transform': scaleCss, 886 '-webkit-transform': scaleCss, 887 'max-width': (fw * scale) + 'px' 888 }); 889 } 890 } 891 }); 892 }; 893 $(window).on('resize', resizeCaptcha); 894 setTimeout(function() { 895 resizeCaptcha(); 896 }, 500); 897 } 898 })(); 899 900 (function() { 901 if (isSiteLanding || isPopupMode) return; 902 903 var header = $('#wb_header'); 904 var main = $('#wb_main'); 905 var footer = $('#wb_footer'); 906 907 var updateMainBlockHeight = function() { 908 if (!main || !header || !footer) return; 909 var headerHeight = header.hasClass('wb_header_fixed') ? 0 : header.outerHeight(true); 910 var minMainBlockHeight = window.innerHeight - headerHeight - footer.outerHeight(true); 911 var mainBlockHeight = parseInt(main.get(0).style.height); 912 if (!mainBlockHeight) mainBlockHeight = 0; 913 main.css('min-height', Math.max(minMainBlockHeight, mainBlockHeight) + 'px'); 914 }; 915 $(window).on('resize', updateMainBlockHeight); 916 updateMainBlockHeight(); 917 setTimeout(function() { updateMainBlockHeight(); }, 100); 918 })(); 919 920 (function() { 921 var updatePositionFixed = function() { 922 if (isTouchDevice()) { 923 if (isIOS() && !window.MSStream) { 924 $('#wb_header_bg, #wb_bgs_cont > div, .wb_sbg, .wb_element_shape > .wb_shp').each(function() { 925 $(this).addClass('wb-no-fixed-bg'); 926 $(this).css({'background-attachment': 'scroll'}); 927 }); 928 } 929 var pageCssSheet, sheet; 930 for (var i = 0; i < document.styleSheets.length; i++) { 931 sheet = document.styleSheets[i]; 932 if (sheet.ownerNode && sheet.ownerNode.getAttribute('id') === 'wb-page-stylesheet') { 933 pageCssSheet = sheet; break; 934 } 935 } 936 if (!pageCssSheet) return; 937
938 var rules = pageCssSheet.cssRules || pageCssSheet.rules; 939 if (!rules) return; 940 941 var fixedBgCss; 942 for (i = 0; i < rules.length; i++) { 943 if (rules[i].selectorText === 'body.site::before') { 944 if (/\bfixed\b/i.test(rules[i].cssText)) { 945 fixedBgCss = rules[i].cssText; 946 pageCssSheet.deleteRule(i); 947 break; 948 } 949 } 950 } 951 if (fixedBgCss) { 952 var css = fixedBgCss.match(/\{(.+)\}/)[1].replace(/\bfixed\b/i, 'scroll'); 953 css += ' position: fixed'; 954 $('<div class="wb_fixed_bg_hack">').prependTo('body'); 955 pageCssSheet.addRule('.wb_fixed_bg_hack', css); 956 } 957 } 958 }; 959 updatePositionFixed(); 960 })(); 961 962 (function() { 963 var baseUrl = $('head base').attr('href'); 964 var convertLinks = function() { 965 $('a[data-popup-processed!="true"]').each(function() { 966 var a = $(this); 967 var href = a.attr('href'); 968 if (/^wb_popup:([^;]*);/.test(href)) { 969 if (!isPopupMode) { 970 var url = RegExp.$1, w, h; 971 var parts = href.split(';'); 972 for (var i = 0; i < parts.length; i++) { 973 var pp = parts[i].split('='); 974 if (pp.length !== 2 || !parseInt(pp[1])) continue; 975 if (pp[0] === 'w') w = parseInt(pp[1]); 976 else if (pp[0] === 'h') h = parseInt(pp[1]); 977 } 978 if (!/^https?:\/\//.test(url)) { 979 url = baseUrl + url; 980 } 981 (function(url, w, h) { 982 a.on('click', function() { 983 wb_show_popup(url, w, h); 984 }); 985 })(url, w, h); 986 } 987 a.attr('data-popup-url', a.attr('href')); 988 a.attr('href', 'javascript:void(0)'); 989 a.removeAttr('target'); 990 a.attr('data-is-popup', 'true'); 991 } 992 else if (isPopupMode) { 993 var target = a.attr('target'); 994 if (!target || target === '_self') { 995 a.attr('target', '_parent'); 996 } 997 } 998 a.attr('data-popup-processed', 'true'); 999 }); 1000 }; 1001 convertLinks(); 1002 setTimeout(convertLinks, 100); 1003 if (window.WB_Gallery) { 1004 setTimeout(function() { 1005 var galleryList = window.WB_Gallery.getGalleryList(); 1006 for (var i=0; i < galleryList.length; i++) { 1007 galleryList[i].onImageDisplayed = function() { 1008 convertLinks(); 1009 }; 1010 } 1011 }, 500); 1012 } 1013 1014 if (openPopupPageUrl && !isPopupMode) { 1015 setTimeout(function() { 1016 wb_show_popup(openPopupPageUrl, openPopupPageWidth, openPopupPageHeight); 1017 }, 1000); 1018 } 1019 1020 var bodyLandingPage = $('body').attr('data-landing-page'); 1021 $('#wb_bgs_cont #wb_page_' + bodyLandingPage + '_bg').show(); 1022 $('#wb_main #page_' + bodyLandingPage).show(); 1023 $('#wb_main #page_' + bodyLandingPage + 'e').show(); 1024 })(); 1025 1026 1027 (function() { 1028 $("[data-enlarge-src]").css("cursor", "pointer").on("click touchstart touchend touchmove", function(e) { 1029 var $this = $(this); 1030 if (e.type === "touchstart") { 1031 $this.data("pswpDisabled", false); 1032 } else if (e.type === "touchmove") { 1033 $this.data("pswpDisabled", true); 1034 } 1035 if ((e.type === "click" || e.type === "touchend") && !$(this).data("pswpDisabled")) { 1036 if ($this.data("clicked")) return; 1037 $this.data("clicked", true); 1038 var img = new Image(); 1039 img.onload = function() { 1040 (new PhotoSwipe($('body > .pswp').get(0), PhotoSwipeUI_Default, [{ 1041 src: this.src, 1042 w: this.width, 1043 h: this.height, 1044 msrc: this.src 1045 }], { index: 0 })).init(); 1046 $this.data("clicked", false); 1047 }; 1048 img.src = $this.attr("data-enlarge-src"); 1049 } 1050 }); 1051 })(); 1052});
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.