1"use strict"; 2//Wrapping all JavaScript code into a IIFE function for prevent global variables creation 3(function($){ 4 5var $body = $('body'); 6var $window = $(window); 7 8function putPlaceholdersToInputs() { 9 $('select').wrap('<div class="select-wrap"></div>'); 10 11 //for categories 12 $('select[name="cat"]').on('change', function() { 13 var $form = $(this).closest('form'); 14 if($form.length) { 15 $form.trigger('submit'); 16 } 17 }); 18 19 $('label[for]').each(function () { 20 var $label = $(this); 21 var $input = $('#'+ $label.attr('for')); 22 if(!$input.attr('placeholder')) { 23 if(!$input.is('[type="radio"]') && !$input.is('[type="checkbox"]') && !$input.is('select')) { 24 var text = $label.text(); 25 text = text.replace(/\t| |\*/g,''); 26 $input.attr('placeholder', text); 27 $label.css({'display': 'none'}); 28 } 29 } 30 }) 31} 32 33//hidding menu elements that do not fit in menu width 34//processing center logo 35function menuHideExtraElements() { 36 37 if($body.hasClass('header_show_all_menu_items') && !$body.find('.header_logo_center').length) { 38 return; 39 } 40 41 //cleaning changed elements 42 $('.sf-more-li, .sf-logo-li').remove(); 43 var windowWidth = $('body').innerWidth(); 44 45 $('.sf-menu').each(function(){ 46 var $thisMenu = $(this); 47 var $menuWraper = $thisMenu.closest('.top-nav'); 48 $menuWraper.attr('style', ''); 49 if (windowWidth > 1199) { 50 //grab all main menu first level items 51 var $menuLis = $menuWraper.find('.sf-menu > li'); 52 $menuLis.removeClass('sf-xl-hidden'); 53 54 var $headerLogoCenter = $thisMenu.closest('.header_logo_center'); 55 var logoWidth = 0; 56 var summaryLiWidth = 0; 57 58 if ( $headerLogoCenter.length ) { 59 var $logo = $headerLogoCenter.find('.logo'); 60 // 30/2 - left and right margins 61 logoWidth = $logo.outerWidth(true) + 70; 62 } 63 64 if ( false ) { 65 // var wrapperWidth = $('.sf-menu').width(); 66 var wrapperWidth = $menuWraper.outerWidth(true); 67 $menuLis.each(function(index) { 68 //4 - 4px additional width for inline-block LI element 69 var elementWidth = $(this).outerWidth() +4; 70 summaryLiWidth += elementWidth; 71 if(summaryLiWidth >= (wrapperWidth-logoWidth)) { 72 var $newLi = $('<li class="sf-more-li"><a>...</a><ul></ul></li>'); 73 $($menuLis[index - 1 ]).before($newLi); 74 var newLiWidth = $($newLi).outerWidth(true); 75 var $extraLiElements = $menuLis.filter(':gt('+ ( index - 2 ) +')'); 76 $extraLiElements.clone().appendTo($newLi.find('ul')); 77 $extraLiElements.addClass('sf-xl-hidden'); 78 return false; 79 } 80 }); 81 } 82 83 //processing center logo 84 if ( $headerLogoCenter.length ) { 85 var $menuLisVisible = $headerLogoCenter.find('.sf-menu > li:not(.sf-xl-hidden)'); 86 var menuLength = $menuLisVisible.length; 87 var summaryLiVisibleWidth = 0; 88 $menuLisVisible.each(function(){ 89 summaryLiVisibleWidth += $(this).outerWidth(); 90 }); 91 92 var centerLi = Math.floor( menuLength / 2 ); 93 if ( (menuLength % 2 === 0) ) { 94 centerLi--; 95 } 96 var $liLeftFromLogo = $menuLisVisible.eq(centerLi); 97 $liLeftFromLogo.after('<li class="sf-logo-li"><a href="#"> </a></li>'); 98 $headerLogoCenter.find('.sf-logo-li').width(logoWidth); 99 var liLeftRightDotX = $liLeftFromLogo.offset().left + $liLeftFromLogo.outerWidth(); 100 var logoLeftDotX = windowWidth/2 - logoWidth/2; 101 var menuLeftOffset = liLeftRightDotX - logoLeftDotX; 102 $menuWraper.css({'left': -menuLeftOffset}) 103 } 104 105 }// > 991 106 }); //sf-menu each 107} //menuHideExtraElements 108 109function initMegaMenu(timeOut) { 110 var $megaMenu = $('.top-nav .mega-menu'); 111 if($megaMenu.length) { 112 setTimeout(function () { 113 114 var windowWidth = $('body').innerWidth(); 115 if (windowWidth > 991) { 116 $megaMenu.each(function(){ 117 var $thisMegaMenu = $(this); 118 //temporary showing mega menu to proper size calc 119 $thisMegaMenu.css({'display': 'block', 'left': 'auto'}); 120 121 //checking for sticked side header 122 var stickedSideHeaderWidth = 0; 123 var $stickedSideHeader = $('.header_side_sticked'); 124 if($stickedSideHeader.length && $stickedSideHeader.hasClass('active-slide-side-header')) { 125 stickedSideHeaderWidth = $stickedSideHeader.outerWidth(true); 126 if($stickedSideHeader.hasClass('header_side_right')) { 127 stickedSideHeaderWidth = -stickedSideHeaderWidth; 128 } 129 windowWidth = windowWidth - stickedSideHeaderWidth; 130 } 131 var thisWidth = $thisMegaMenu.outerWidth(); 132 var thisOffset = $thisMegaMenu.offset().left - stickedSideHeaderWidth; 133 var thisLeft = (thisOffset + (thisWidth/2)) - windowWidth/2; 134 $thisMegaMenu.css({'left' : -thisLeft, 'display': 'none'}); 135 if(!$thisMegaMenu.closest('ul').hasClass('nav')) { 136 $thisMegaMenu.css('left', ''); 137 } 138 }); 139 } 140 }, timeOut); 141 142 } 143}
143 144 145//NOTE: affixed sidebar works bad with side headers 146function initAffixSidebar() { 147 var $affixAside = $('.affix-aside'); 148 if ($affixAside.length) { 149 150 $window = $(window); 151 152 //on stick and unstick event 153 $affixAside.on('affix.bs.affix', function(e) { 154 var affixWidth = $affixAside.width() - 1; 155 var affixLeft = $affixAside.offset().left; 156 $affixAside 157 .width(affixWidth) 158 .css("left", affixLeft); 159 160 }).on('affix-bottom.bs.affix', function(e) { 161 var affixWidth = $affixAside.width() - 1; 162 //if sticked left header 163 var stickedSideHeaderWidth = 0; 164 var $stickedSideHeader = $('.header_side_sticked'); 165 if($stickedSideHeader.length && $stickedSideHeader.hasClass('active-slide-side-header') && !$stickedSideHeader.hasClass('header_side_right')) { 166 stickedSideHeaderWidth = $stickedSideHeader.outerWidth(true); 167 } 168 var affixLeft = $affixAside.offset().left - stickedSideHeaderWidth - $('#box_wrapper').offset().left;; 169 170 $affixAside 171 .width(affixWidth) 172 .css("left", affixLeft); 173 }).on('affix-top.bs.affix', function(e) { 174 $affixAside.css({"width": "", "left": ""}); 175 }); 176 177 //counting offset 178 var offsetTopAdd = 10; 179 var offsetBottomAdd = 150; 180 var offsetTop = $affixAside.offset().top - $('.page_header').height(); 181 //note that page_footer and page_copyright sections must exists - else this will cause error in last jQuery versions 182 var offsetBottom = $('.page_footer').outerHeight(true) + $('.page_copyright').outerHeight(true); 183 184 $affixAside.affix({ 185 offset: { 186 top: offsetTop - offsetTopAdd, 187 bottom: offsetBottom + offsetBottomAdd 188 }, 189 }); 190 191 $window.on('resize', function() { 192 //returning sidebar in top position if it is sticked because of unexpected behavior 193 $affixAside.removeClass("affix affix-bottom").addClass("affix-top").trigger('affix-top.bs.affix'); 194 195 var offsetTopSectionsArray = [ 196 '.page_topline', 197 '.page_toplogo', 198 '.page_header', 199 '.page_title', 200 '.blog_slider', 201 '.blog-featured-posts' 202 ]; 203 var offsetTop = 0; 204 205 offsetTopSectionsArray.map(function (val) { 206 offsetTop += $(val).outerHeight(true) || 0; 207 }); 208 //note that page_footer and page_copyright sections must exists - else this will cause error in last jQuery versions 209 var offsetBottom = $('.page_footer').outerHeight(true) 210 + $('.page_copyright').outerHeight(true); 211 212 $affixAside.data('bs.affix').options.offset.top = offsetTop - offsetTopAdd; 213 $affixAside.data('bs.affix').options.offset.bottom = offsetBottom + offsetBottomAdd; 214 215 $affixAside.affix('checkPosition'); 216 217 }); 218 219 $affixAside.affix('checkPosition'); 220 221 }//eof checking of affix sidebar existing 222} 223 224//photoSwipe gallery plugin 225function initPhotoSwipe() { 226 if(typeof PhotoSwipe !== 'undefined') { 227 228 //adding prettyPhoto for backward compatibility. Deprecated. 229 //will leave only .photoswipe-link later 230 var gallerySelectors = '.photoswipe-link, a[data-gal^="prettyPhoto"], [data-thumb] a'; 231 var $galleryLinks = $(gallerySelectors); 232 if ($galleryLinks.length) { 233 234 //adding photoswipe gallery markup 235 if (!($('.pswp').length)) { 236 $body.append('<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"><div class="pswp__bg"></div><div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div></div><div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div><a class="pswp__button pswp__button--close" title="Close (Esc)"></a><a class="pswp__button pswp__button--share" title="Share"></a><a class="pswp__button pswp__button--fs" title="Toggle fullscreen"></a><a class="pswp__button pswp__button--zoom" title="Zoom in/out"></a><div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div><div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div> </div><a class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></a><a class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></a><div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div>'); 237 //if function already was called - return (all listeners was setted and .pswp gallery container was added) 238 } else { 239 return; 240 } 241 //adding prettyPhoto for backward compatibility. Deprecated. 242 $('body').on('click', gallerySelectors, function (e) { 243 e.preventDefault(); 244 245 var $link = $(this); 246 var $linksParentContainer = $link.closest('.photoswipe-container, .isotope-wrapper, .owl-carousel, .flickr_ul, .images'); 247 var $links = $linksParentContainer.find(gallerySelectors); 248 249 //if no container only adding this link 250 if(!$links.length) { 251 $links.push($link); 252 } 253 var items = []; 254 255 var options = { 256 bgOpacity : 0.7, 257 showHideOpacity : true, 258 history: false, 259 shareEl: false, 260 index: 0 261 }; 262 var gallery = $('.pswp')[0]; 263 //building items array 264 var counter = 0; 265 var clonedClick = false;
266 var clonedRealIndex = 0; 267 $links.each(function (i) { 268 var $this = $(this); 269 //if cloned element (owl or flexslider thumbs) - continue 270 if ($this.closest('.clone, .cloned').length) { 271 if (($link[0] === $this[0])) { 272 clonedClick = true; 273 clonedRealIndex = parseInt($this.data('index'), 10); 274 options.index = clonedRealIndex; 275 } 276 return; 277 } 278 var item = {}; 279 //start slide from clicked element 280 if (($link[0] === $this[0])) { 281 options.index = counter; 282 } 283 284 //video or image 285 if ($this.data('iframe')) { 286 var autoplay = ( $links.length > 1 ) ? '' : '&autoplay=1'; 287 item.html = '<div class="embed-responsive embed-responsive-16by9">'; 288 //for wordpress - iframe tag is escaped 289 if($this.data('iframe').indexOf('src=') !== -1) { 290 item.html += $this.data('iframe').replace(/&/g, '&').replace(/$lt;/g, '<').replace(/>/g, '>').replace(/$quot;/g, '"'); 291 292 //for html - building iframe manually 293 } else { 294 //autoplay only if 1 iframe in gallery 295 item.html += '<iframe class="embed-responsive-item" src="' + $(this).data('iframe') + '?rel=0' + autoplay + '&enablejsapi=1&api=1"></iframe>'; 296 } 297 // item.html += '<iframe class="embed-responsive-item" src="'+ $(this).data('iframe') + '?rel=0&autoplay=1'+ '"></iframe>'; 298 item.html += '</div>'; 299 } else { 300 item.src = $this.attr('href'); 301 //default values 302 var width = 1170; 303 var height = 780; 304 //template data on A element 305 var data = $this.data(); 306 //image data in Woo 307 var dataImage = $this.find('img').first().data(); 308 if (data.width) { 309 width = data.width; 310 } 311 if (data.height) { 312 height = data.height; 313 } 314 if(typeof dataImage !== 'undefined') { 315 if (dataImage.large_image_width) { 316 width = dataImage.large_image_width; 317 } 318 if (dataImage.large_image_height) { 319 height = dataImage.large_image_height; 320 } 321 } 322 item.w = width; 323 item.h = height; 324 } 325 items.push(item); 326 counter++; 327 }); 328 329 var pswpGallery = new PhotoSwipe(gallery, PhotoSwipeUI_Default, items, options); 330 pswpGallery.init(); 331 332 //pausing video on close and on slide change 333 pswpGallery.listen('afterChange', function() { 334 $(pswpGallery.container).find('iframe').each(function() { 335 //"method":"pause" - form Vimeo, other - for YouTube 336 $(this)[0].contentWindow.postMessage('{"method":"pause","event":"command","func":"pauseVideo","args":""}', '*') 337 }); 338 }); 339 pswpGallery.listen('close', function() { 340 $(pswpGallery.container).find('iframe').each(function() { 341 //"method":"pause" - form Vimeo, other - for YouTube 342 $(this)[0].contentWindow.postMessage('{"method":"pause","event":"command","func":"pauseVideo","args":""}', '*') 343 }); 344 }); 345 346 }); 347 } 348 349 } 350} 351 352//helper functions to init elements only when they appears in viewport (jQUery.appear plugin) 353function initAnimateElement(self, index) { 354 var animationClass = !self.data('animation') ? 'fadeInUp' : self.data('animation'); 355 var animationDelay = !self.data('delay') ? 150 : self.data('delay'); 356 setTimeout(function(){ 357 self.addClass("animated " + animationClass); 358 }, index * animationDelay); 359} 360function initCounter(self) { 361 if (self.hasClass('counted')) { 362 return; 363 } else { 364 self.countTo().addClass('counted'); 365 } 366} 367function initProgressbar(el) { 368 el.progressbar({ 369 transition_delay: 300 370 }); 371} 372function initChart(el) { 373 var data = el.data(); 374 var size = data.size ? data.size : 270; 375 var line = data.line ? data.line : 20; 376 var bgcolor = data.bgcolor ? data.bgcolor : '#ffffff'; 377 var trackcolor = data.trackcolor ? data.trackcolor : '#c14240'; 378 var speed = data.speed ? data.speed : 3000; 379 380 el.easyPieChart({ 381 barColor: trackcolor, 382 trackColor: bgcolor, 383 scaleColor: false, 384 scaleLength: false, 385 lineCap: 'butt', 386 lineWidth: line, 387 size: size, 388 rotate: 0, 389 animate: speed, 390 onStep: function(from, to, percent) { 391 $(this.el).find('.percent').text(Math.round(percent)); 392 } 393 }); 394} 395 396function initGoogleMap() { 397 //Google Map script 398 var $googleMaps = $('#map, .page_map'); 399 if ( $googleMaps.length ) { 400 $googleMaps.each(function() { 401 var $map = $(this); 402 403 var lat; 404 var lng; 405 var map; 406 407 //map styles. You can grab different styles on https://snazzymaps.com/ 408 409 //dark style 410 //var styles = [{"featureType":"all","elementType":"labels","stylers":[{"visibility":"on"}]},{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"administrative.locality","elementType":"labels.text.fill","stylers":[{"color":"#c4c4c4"}]},{"featureType":"administrative.neighborhood","elementType":"labels.text.fill","stylers":[{"color":"#707070"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21},{"visibility":"on"}]},{"featureType":"poi.business","elementType":"geometry","stylers":[{"visibility":"on"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#be2026"},{"lightness":"0"},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"visibility":"off"}]},{"featureType":"road.highway","elementType":"labels.text.fill","stylers":[{"visibility":"off"}]},{"featureType":"road.highway","elementType":"labels.text.stroke","stylers":[{"visibility":"off"},{"hue":"#ff000a"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#575757"}]},{"featureType":"road.arterial","elementType":"labels.text.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"road.arterial","elementType":"labels.text.stroke","stylers":[{"color":"#2c2c2c"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#999999"}]},{"featureType":"road.local","elementType":"labels.text.stroke","stylers":[{"saturation":"-52"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}]; 411 412 // light style 413 var styles = [{"featureType": "water","elementType": "geometry","stylers": [{"color": "#e9e9e9"},{"lightness": 17}]},{"featureType": "landscape","elementType": "geometry","stylers": [{"color": "#f5f5f5"},{"lightness": 20}]},{"featureType": "road.highway","elementType": "geometry.fill","stylers": [{"color": "#ffffff"},{"lightness": 17}]},{"featureType": "road.highway","elementType": "geometry.stroke","stylers": [{"color": "#ffffff"},{"lightness": 29},{"weight": 0.2}]},{"featureType": "road.arterial","elementType": "geometry","stylers": [{"color": "#ffffff"},{"lightness": 18}]},{"featureType": "road.local","elementType": "geometry","stylers": [{"color": "#ffffff"},{"lightness": 16}]},{"featureType": "poi","elementType": "geometry","stylers": [{"color": "#f5f5f5"},{"lightness": 21}]},{"featureType": "poi.park","elementType": "geometry","stylers": [{"color": "#dedede"},{"lightness": 21}]},{"elementType": "labels.text.stroke","stylers": [{"visibility": "on"},{"color": "#ffffff"},{"lightness": 16}]},{"elementType": "labels.text.fill","stylers": [{"saturation": 36},{"color": "#333333"},{"lightness": 40}]},{"elementType": "labels.icon","stylers": [{"visibility": "off"}]},{"featureType": "transit","elementType": "geometry","stylers": [{"color": "#f2f2f2"},{"lightness": 19}]},{"featureType": "administrative","elementType": "geometry.fill","stylers": [{"color": "#fefefe"},{"lightness": 20}]},{"featureType": "administrative","elementType": "geometry.stroke","stylers": [{"color": "#fefefe"},{"lightness": 17},{"weight": 1.2}]}]; 414 415 //markers 416 var $markers = $map.find('.marker'); 417 418 //map settings 419 var address = $markers.first().find('.marker-address').text() ? $markers.first().find('.marker-address').text() : 'london, baker street, 221b'; 420 var geocoder = new google.maps.Geocoder(); 421 422 423 var draggable = $map.data('draggable') ? $map.data('draggable') : false;
424 var scrollwheel = $map.data('scrollwheel') ? $map.data('scrollwheel') : false; 425 426 //type your address after "address=" 427 geocoder.geocode({ 428 address: address 429 }, function(data){ 430 431 lat = data[0].geometry.location.lat(); 432 lng = data[0].geometry.location.lng(); 433 434 var center = new google.maps.LatLng(lat, lng); 435 var settings = { 436 mapTypeId: google.maps.MapTypeId.ROADMAP, 437 zoom: 16, 438 draggable: draggable, 439 scrollwheel: scrollwheel, 440 center: center, 441 styles: styles 442 }; 443 map = new google.maps.Map($map[0], settings); 444 445 var infoWindows = []; 446 447 $($markers).each(function(index) { 448 449 var $marker = $(this); 450 var markerTitle = $marker.find('.marker-title').text(); 451 452 //building info widnow HTML code 453 var markerDescription = ''; 454 markerDescription += markerTitle ? '<h3 class="makret-title">' + markerTitle + '</h3>' : ''; 455 markerDescription += $marker.find('.marker-description').html() ? '<div class="marker-description">' + $marker.find('.marker-description').html() + '</div>' : ''; 456 if(markerDescription) { 457 markerDescription = '<div class="map_marker_description">' + markerDescription + '</div>'; 458 } 459 460 geocoder.geocode({ 461 address: $marker.find('.marker-address').text() 462 }, function(data){ 463 var iconSrc = $marker.find('.marker-icon').attr('src'); 464 465 var lat = data[0].geometry.location.lat(); 466 var lng = data[0].geometry.location.lng(); 467 468 var center = new google.maps.LatLng(lat, lng); 469 470 var marker = new google.maps.Marker({ 471 position: center, 472 title: markerTitle, 473 map: map, 474 icon: iconSrc 475 }); 476 477 var infowindow = new google.maps.InfoWindow({ 478 content: markerDescription 479 }); 480 481 infoWindows.push(infowindow); 482 483 google.maps.event.addListener(marker, 'click', function() { 484 for (var i=0;i<infoWindows.length;i++) { 485 infoWindows[i].close(); 486 } 487 infowindow.open(map,marker); 488 }); 489 }); 490 }); 491 }); 492 }); //each Google map 493 }//google map length 494} 495 496//function that initiating template plugins on window.load event 497function documentReadyInit() { 498 //////////// 499 //mainmenu// 500 //////////// 501 if ($().scrollbar) { 502 $('[class*="scrollbar-"]').scrollbar(); 503 //fix for firefox on mac 504 if ( /mac/i.test(navigator.platform) && /firefox/i.test(navigator.userAgent) ) { 505 jQuery('[class*="scrollbar-"]').addClass('scroll-content').wrap('<div class="scroll-wrapper firefox-on-macos"></div>'); 506 } 507 } 508 if ($().superfish) { 509 $('ul.sf-menu').superfish({ 510 popUpSelector: 'ul:not(.mega-menu ul), .mega-menu ', 511 delay: 700, 512 animation: {opacity:'show', marginTop: 0}, 513 animationOut: {opacity: 'hide', marginTop: 5}, 514 speed: 200, 515 speedOut: 200, 516 disableHI: false, 517 cssArrows: true, 518 autoArrows: true, 519 onInit: function () { 520 var $thisMenu = $(this); 521 $thisMenu.find('.sf-with-ul').after('<span class="sf-menu-item-mobile-toggler"/>'); 522 $thisMenu.find('.sf-menu-item-mobile-toggler').on('click', function (e) { 523 var $parentLi = $(this).parent(); 524 if($parentLi.hasClass('sfHover')) { 525 $parentLi.superfish('hide'); 526 } else { 527 $parentLi.superfish('show'); 528 } 529 }); 530 //for wp - add .active on li 531 $thisMenu.find('.current-menu-parent, .current-menu-item').addClass('active'); 532 } 533 534 }); 535 $('ul.sf-menu-side').superfish({ 536 popUpSelector: 'ul:not(.mega-menu ul), .mega-menu ', 537 delay: 500, 538 animation: {opacity:'show', height: 100 +'%'}, 539 animationOut: {opacity: 'hide', height: 0}, 540 speed: 400, 541 speedOut: 300, 542 disableHI: false, 543 cssArrows: true, 544 autoArrows: true 545 }); 546 } 547 548 549 //toggle mobile menu 550 $('.page_header .toggle_menu, .page_toplogo .toggle_menu').on('click', function(){ 551 $(this) 552 .toggleClass('mobile-active') 553 .closest('.page_header') 554 .toggleClass('mobile-active') 555 .end() 556 .closest('.page_toplogo') 557 .next() 558 .find('.page_header') 559 .toggleClass('mobile-active'); 560 $body.toggleClass('overflow-hidden-lg'); 561 }); 562 563 $('.sf-menu a').on('click', function(){ 564 var $this = $(this);
565 //If this is a local link or item with sumbenu - not toggling menu 566 if (($this.hasClass('sf-with-ul')) || !($this.attr('href').charAt(0) === '#')) { 567 return; 568 } 569 $this 570 .closest('.page_header') 571 .toggleClass('mobile-active') 572 .find('.toggle_menu') 573 .toggleClass('mobile-active'); 574 $body.toggleClass('overflow-hidden-lg'); 575 }); 576 577 //side header processing 578 var $sideHeader = $('.page_header_side'); 579 // toggle sub-menus visibility on menu-click 580 $('ul.menu-click').find('li').each(function(){ 581 var $thisLi = $(this); 582 //toggle submenu only for menu items with submenu 583 if ($thisLi.find('ul').length) { 584 $thisLi 585 .append('<span class="toggle_submenu color-darkgrey"></span>') 586 //adding anchor 587 .find('.toggle_submenu, > a') 588 .on('click', function(e) { 589 var $thisSpanOrA = $(this); 590 //if this is a link and it is already opened - going to link 591 if (($thisSpanOrA.attr('href') === '#') || !($thisSpanOrA.parent().hasClass('active-submenu'))) { 592 e.preventDefault(); 593 } 594 if ($thisSpanOrA.parent().hasClass('active-submenu')) { 595 $thisSpanOrA.parent().removeClass('active-submenu'); 596 return; 597 } 598 $thisLi.addClass('active-submenu').siblings().removeClass('active-submenu'); 599 }); 600 } //eof sumbenu check 601 }); 602 if ($sideHeader.length) { 603 $('.toggle_menu_side').on('click', function(){ 604 var $thisToggler = $(this); 605 $thisToggler.toggleClass('active'); 606 if ($thisToggler.hasClass('header-slide')) { 607 $sideHeader.toggleClass('active-slide-side-header'); 608 } else { 609 if($thisToggler.parent().hasClass('header_side_right')) { 610 $body.toggleClass('active-side-header slide-right'); 611 } else { 612 $body.toggleClass('active-side-header'); 613 } 614 $body.parent().toggleClass('html-active-push-header'); 615 } 616 //fixing mega menu and aside affix on toggling side sticked header 617 if($thisToggler.closest('.header_side_sticked').length) { 618 initMegaMenu(600); 619 var $affixAside = $('.affix-aside'); 620 if($affixAside.length) { 621 $affixAside.removeClass("affix affix-bottom").addClass("affix-top").css({"width": "", "left": ""}).trigger('affix-top.bs.affix'); 622 setTimeout(function () { 623 $affixAside.removeClass("affix affix-bottom").addClass("affix-top").css({"width": "", "left": ""}).trigger('affix-top.bs.affix'); 624 }, 10); 625 } 626 } 627 }); 628 //hidding side header on click outside header 629 $body.on('mousedown touchstart', function( e ) { 630 if ( !($(e.target).closest('.page_header_side').length) && !($sideHeader.hasClass('header_side_sticked')) ) { 631 $sideHeader.removeClass('active-slide-side-header'); 632 $body.removeClass('active-side-header slide-right'); 633 $body.parent().removeClass('html-active-push-header'); 634 var $toggler = $('.toggle_menu_side'); 635 if(($toggler).hasClass('active')) { 636 $toggler.removeClass('active'); 637 } 638 } 639 }); 640 } //sideHeader check 641 642 //1 and 2/3/4th level offscreen fix 643 var MainWindowWidth = $window.width(); 644 $window.on('resize', function(){ 645 MainWindowWidth = $(window).width(); 646 }); 647 //2/3/4 levels 648 $('.top-nav .sf-menu').on('mouseover', 'ul li', function(){ 649 // $('.mainmenu').on('mouseover', 'ul li', function(){ 650 if(MainWindowWidth > 991) { 651 var $this = $(this); 652 // checks if third level menu exist 653 var subMenuExist = $this.find('ul').length; 654 if( subMenuExist > 0){ 655 var subMenuWidth = $this.find('ul, div').first().width(); 656 var subMenuOffset = $this.find('ul, div').first().parent().offset().left + subMenuWidth; 657 // if sub menu is off screen, give new position 658 if((subMenuOffset + subMenuWidth) > MainWindowWidth){ 659 var newSubMenuPosition = subMenuWidth + 0; 660 $this.find('ul, div').first().css({ 661 left: -newSubMenuPosition, 662 }); 663 } else { 664 $this.find('ul, div').first().css({ 665 left: '100%', 666 }); 667 } 668 } 669 } 670 //1st level 671 }).on('mouseover', '> li', function(){ 672 if(MainWindowWidth > 991) { 673 var $this = $(this); 674 var subMenuExist = $this.find('ul').length; 675 if( subMenuExist > 0){ 676 var subMenuWidth = $this.find('ul').width(); 677 var subMenuOffset = $this.find('ul').parent().offset().left; 678 // if sub menu is off screen, give new position 679 if((subMenuOffset + subMenuWidth) > MainWindowWidth){ 680 var newSubMenuPosition = MainWindowWidth - (subMenuOffset + subMenuWidth); 681 $this.find('ul').first().css({ 682 left: newSubMenuPosition, 683 }); 684 } 685 } 686 } 687 }); 688 689 ///////////////////////////////////////// 690 //single page localscroll and scrollspy// 691 ///////////////////////////////////////// 692 var navHeight = $('.page_header').outerHeight(true); 693 //if sidebar nav exists - binding to it. Else - to main horizontal nav 694 if ($('.mainmenu_side_wrapper').length) { 695 $body.scrollspy({ 696 target: '.mainmenu_side_wrapper', 697 offset: navHeight ? navHeight : 50 698 }); 699 } else if ($('.top-nav').length) { 700 $body.scrollspy({ 701 target: '.top-nav', 702 offset: navHeight 703 }) 704 } 705 if ($().localScroll) { 706 $('.top-nav > ul, .mainmenu_side_wrapper > ul, #land, .comments-link').localScroll({ 707 duration:900, 708 easing:'easeInOutQuart', 709 offset: navHeight ? -navHeight+40 : -20 710 }); 711 } 712 713 //background image teaser and sections with half image bg 714 //put this before prettyPhoto init because image may be wrapped in prettyPhoto link 715 $(".bg_teaser, .cover-image").each(function(){ 716 var $element = $(this); 717 var $image = $element.find("img").first(); 718 if (!$image.length) { 719 $image = $element.parent().find("img").first(); 720 } 721 if (!$image.length) { 722 return; 723 } 724 var imagePath = $image.attr("src"); 725 $element.css("background-image", "url(" + imagePath + ")"); 726 var $imageParent = $image.parent(); 727 //if image inside link - adding this link, removing gallery to preserve duplicating gallery items 728 if ($imageParent.is('a')) {
729 $element.prepend($image.parent().clone().html('')); 730 $imageParent.attr('data-gal', ''); 731 } 732 }); 733 734 //video images preview - from WP 735 $('.embed-placeholder').each(function(){ 736 $(this).on('click', function(e) { 737 var $thisLink = $(this); 738 // if prettyPhoto popup with YouTube - return 739 if ($thisLink.hasClass('photoswipe-link')) { 740 return; 741 } 742 e.preventDefault(); 743 if ($thisLink.attr('href') === '' || $thisLink.attr('href') === '#') { 744 $thisLink.replaceWith($thisLink.data('iframe').replace(/&/g, '&').replace(/$lt;/g, '<').replace(/>/g, '>').replace(/$quot;/g, '"')).trigger('click'); 745 } else { 746 $thisLink.replaceWith('<iframe class="embed-responsive-item" src="'+ $thisLink.attr('href') + '?rel=0&autoplay=1'+ '"></iframe>'); 747 } 748 }); 749 }); 750 751 //toTop 752 if ($().UItoTop) { 753 $().UItoTop({ easingType: 'easeInOutQuart' }); 754 } 755 756 //parallax 757 if ($().parallax) { 758 $('.s-parallax').parallax("50%", 0.01); 759 } 760 761 //prettyPhoto 762 if ($().prettyPhoto) { 763 $("a[data-gal^='prettyPhoto']").prettyPhoto({ 764 hook: 'data-gal', 765 theme: 'facebook' /* light_rounded / dark_rounded / light_square / dark_square / facebook / pp_default*/ 766 }); 767 } 768 initPhotoSwipe(); 769 770 //////////////////////////////////////// 771 //init Bootstrap JS components// 772 //////////////////////////////////////// 773 //adding .form-control class for search widgets 774 // $('[type="search"]').addClass('form-control'); 775 776 //video in bootstrap tabs 777 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 778 if (typeof (e.relatedTarget) !== 'undefined') { 779 var iframe = $(e.relatedTarget.hash).find('iframe'); 780 var src = iframe.attr('src'); 781 iframe.attr('src', ''); 782 iframe.attr('src', src); 783 } 784 }); 785 786 787 //bootstrap carousel 788 if ($().carousel) { 789 $('.carousel').carousel(); 790 } 791 792 //bootstrap collapse - show first tab 793 $('.panel-group').each(function() { 794 $(this).find('a').first().filter('.collapsed').trigger('click'); 795 }); 796 //tooltip 797 if ($().tooltip) { 798 $('[data-toggle="tooltip"]').tooltip(); 799 } 800 801 //comingsoon counter 802 if ($().countdown) { 803 var $counter = $('#comingsoon-countdown, .comingsoon-countdown'); 804 $counter.each(function () { 805 var $this = $(this); 806 //today date plus month for demo purpose 807 var date = ($this.data('date') !== 'undefined') ? $this.data('date') : false; 808 if(date) { 809 date = new Date(date); 810 } else { 811 date = new Date(); 812 date.setMonth(date.getMonth()+1); 813 } 814 $this.countdown({until: date}); 815 }); 816 } 817 818 ///////////////////////////////////////////////// 819 //PHP widgets - contact form, search, MailChimp// 820 ///////////////////////////////////////////////// 821 //search modal 822 $(".search_modal_button").on('click', function(e){ 823 e.preventDefault(); 824 $('#search_modal').modal('show').find('input').first().focus(); 825 }); 826 827 //placeholders to inputs 828 putPlaceholdersToInputs(); 829 830 // Blockquote with background 831 $( 'blockquote.blockquote-bg' ).each( function () 832 { 833 let quote = $( this );
834 let img = quote.find( 'img' ); 835 if ( img.length > 0 ) 836 { 837 quote.wrap( '<div class="ds"></div>' ); 838 quote.attr( 'style', 'background-image: url("' + img.attr( 'src' ) + '")' ); 839 quote.addClass( 'blockquote-has-image' ); 840 img.remove(); 841 } 842 }); 843 844 // Wide menu toggle 845 $( '.sf-menu' ).each( function () 846 { 847 let windowWidth = $('body').innerWidth(); 848 // $menuLis.each( function() { 849 if ( windowWidth > 1199 ) 850 { 851 } 852 }); 853 wideMenuToggle(); 854} 855 856// Wide menu toggle 857function wideMenuToggle () 858{ 859 let windowWidth = $('body').innerWidth(); 860 $( '.header_absolute .wide-menu-toggle .sf-menu' ).each( function () 861 { 862 let thisMenu = $( this ); 863 let menuWraper = thisMenu.closest('.top-nav'); 864 let menuLis = menuWraper.find( '.sf-menu > li' ); 865 menuLis.addClass( 'wide-menu-toggle--item' ).hide(); 866 let wideMenuToggleSwitch = $( '.wide-menu-toggle--switch' ); 867 thisMenu.append( wideMenuToggleSwitch ); 868 wideMenuToggleSwitch.show().addClass( 'wide-menu-toggle--switch-active' ); 869 wideMenuToggleSwitch.on( 'click', function () { 870 if ( wideMenuToggleSwitch.hasClass( 'wide-menu-toggle--switch-active' ) ) 871 { 872 wideMenuTogglePassive(); 873 } 874 else 875 { 876 wideMenuToggleActive(); 877 } 878 } ); 879 $window.on( 'scroll', function () 880 { 881 if ( $('body').innerWidth() > 1199 ) 882 { 883 // if ( $( '.page_header' ).hasClass( 'affix-top' ) ) 884 if ( window.scrollY == 0 ) 885 { 886 wideMenuToggleOn(); 887 } 888 else 889 { 890 wideMenuToggleOff(); 891 } 892 } 893 }).on( 'resize', function () 894 { 895 // console.log( windowWidth ); 896 if ( $('body').innerWidth() > 1199 ) 897 { 898 wideMenuToggleOn(); 899 } 900 else 901 { 902 wideMenuToggleOff(); 903 } 904 }); 905 }); 906 function wideMenuToggleOn () 907 { 908 let menuLis = $( '.wide-menu-toggle--item' ); 909 $( menuLis[ menuLis.length - 1 ] ).removeClass( 'wide-menu-toggle--item-last' ); 910 menuLis.hide(); 911 $( '.wide-menu-toggle--switch' ).show(); 912 wideMenuToggleActive(); 913 } 914 function wideMenuToggleOff () 915 { 916 let menuLis = $( '.wide-menu-toggle--item' ); 917 $( menuLis[ menuLis.length - 1 ] ).addClass( 'wide-menu-toggle--item-last' ); 918 menuLis.show(); 919 $( '.wide-menu-toggle--switch' ).hide(); 920 } 921 function wideMenuToggleActive () 922 { 923 $( '.wide-menu-toggle--item' ).hide(); 924 $( '.wide-menu-toggle--label' ).show(); 925 $( '.wide-menu-toggle--bars' ).show(); 926 $( '.wide-menu-toggle--close' ).hide(); 927 $( '.wide-menu-toggle--switch' ).addClass( 'wide-menu-toggle--switch-active' ); 928 } 929 function wideMenuTogglePassive () 930 { 931 $( '.wide-menu-toggle--item' ).show(); 932 $( '.wide-menu-toggle--label' ).hide(); 933 $( '.wide-menu-toggle--bars' ).hide(); 934 $( '.wide-menu-toggle--close' ).show(); 935 $( '.wide-menu-toggle--switch' ).removeClass( 'wide-menu-toggle--switch-active' ); 936 } 937} 938 939//function that initiating template plugins on window.load event 940function windowLoadInit() { 941 ////////////// 942 //flexslider// 943 ////////////// 944 if ($().flexslider) { 945 var $introSlider = $(".page_slider .flexslider"); 946 $introSlider.each(function(index){ 947 var $currentSlider = $(this); 948 var data = $currentSlider.data(); 949 var nav = (data.nav !== 'undefined') ? data.nav : true; 950 var dots = (data.dots !== 'undefined') ? data.dots : true; 951 var speed = (data.speed !== 'undefined') ? data.speed : 7000; 952 953 $currentSlider.flexslider({ 954 animation: "fade", 955 pauseOnHover: true, 956 useCSS: true, 957 controlNav: dots, 958 directionNav: nav, 959 prevText: "", 960 nextText: "", 961 smoothHeight: false, 962 slideshowSpeed:speed, 963 animationSpeed:600, 964 start: function( slider ) { 965 slider.find('.intro_layers').children().css({'visibility': 'hidden'}); 966 slider.find('.flex-active-slide .intro_layers').children().each(function(index){ 967 var self = $(this); 968 var animationClass = !self.data('animation') ? 'fadeInRight' : self.data('animation'); 969 setTimeout(function(){ 970 self.addClass("animated "+animationClass); 971 }, index*250); 972 }); 973 }, 974 after :function( slider ){ 975 slider.find('.flex-active-slide .intro_layers').children().each(function(index){ 976 var self = $(this); 977 var animationClass = !self.data('animation') ? 'fadeInRight' : self.data('animation'); 978 setTimeout(function(){ 979 self.addClass("animated "+animationClass); 980 }, index*250); 981 }); 982 }, 983 end :function( slider ){ 984 slider.find('.intro_layers').children().each(function() { 985 var self = $(this); 986 var animationClass = !self.data('animation') ? 'fadeInRight' : self.data('animation'); 987 self.removeClass('animated ' + animationClass).css({'visibility': 'hidden'}); 988 // $(this).attr('class', ''); 989 }); 990 }, 991 992 }) 993 //wrapping nav with container - uncomment if need 994 // .find('.flex-control-nav') 995 // .wrap('<div class="container nav-container"/>') 996 }); //.page_slider flex slider 997 998 $(".flexslider").each(function(index){ 999 var $currentSlider = $(this); 1000 //exit if intro slider already activated 1001 if ($currentSlider.find('.flex-active-slide').length) { 1002 return; 1003 } 1004 $currentSlider.flexslider({ 1005 animation: "fade", 1006 useCSS: true, 1007 controlNav: true, 1008 directionNav: false, 1009 prevText: "", 1010 nextText: "", 1011 smoothHeight: false, 1012 slideshowSpeed:5000, 1013 animationSpeed:800, 1014 }) 1015 }); 1016 } 1017 1018 //////////////// 1019 //owl carousel// 1020 //////////////// 1021 if ($().owlCarousel) { 1022 $('.owl-carousel').each(function() { 1023 var $carousel = $(this); 1024 $carousel.find('> *').each(function (i) { 1025 $(this).attr('data-index', i); 1026 }); 1027 var data = $carousel.data(); 1028 1029 var loop = data.loop ? data.loop : false, 1030 margin = (data.margin || data.margin === 0) ? data.margin : 30, 1031 nav = data.nav ? data.nav : false, 1032 navPrev = data.navPrev ? data.navPrev : '<i class="fa fa-chevron-left">', 1033 navNext = data.navNext ? data.navNext : '<i class="fa fa-chevron-right">', 1034 dots = data.dots ? data.dots : false,
1035 themeClass = data.themeclass ? data.themeclass : 'owl-theme', 1036 center = data.center ? data.center : false, 1037 items = data.items ? data.items : 4, 1038 autoplay = data.autoplay ? data.autoplay : false, 1039 responsiveXs = data.responsiveXs ? data.responsiveXs : 1, 1040 responsiveSm = data.responsiveSm ? data.responsiveSm : 2, 1041 responsiveMd = data.responsiveMd ? data.responsiveMd : 3, 1042 responsiveLg = data.responsiveLg ? data.responsiveLg : 4, 1043 draggable = (data.draggable === false) ? data.draggable : true, 1044 syncedClass = (data.syncedClass) ? data.syncedClass : false, 1045 filters = data.filters ? data.filters : false; 1046 1047 if (filters) { 1048 $carousel.after($carousel.clone().addClass('owl-carousel-filter-cloned')); 1049 $(filters).on('click', 'a', function( e ) { 1050 //processing filter link 1051 e.preventDefault(); 1052 if ($(this).hasClass('selected')) { 1053 return; 1054 } 1055 var filterValue = $( this ).attr('data-filter'); 1056 $(this).siblings().removeClass('selected active'); 1057 $(this).addClass('selected active'); 1058 1059 //removing old items 1060 for (var i = $carousel.find('.owl-item').length - 1; i >= 0; i--) { 1061 $carousel.trigger('remove.owl.carousel', [1]); 1062 }; 1063 1064 //adding new items 1065 var $filteredItems = $($carousel.next().find(' > ' +filterValue).clone()); 1066 $filteredItems.each(function() { 1067 $carousel.trigger('add.owl.carousel', $(this)); 1068 $(this).addClass('scaleAppear'); 1069 }); 1070 1071 $carousel.trigger('refresh.owl.carousel'); 1072 1073 //reinit prettyPhoto in filtered OWL carousel 1074 if ($().prettyPhoto) { 1075 $carousel.find("a[data-gal^='prettyPhoto']").prettyPhoto({ 1076 hook: 'data-gal', 1077 theme: 'facebook' /* light_rounded / dark_rounded / light_square / dark_square / facebook / pp_default*/ 1078 }); 1079 } 1080 }); 1081 1082 } //filters 1083 1084 $carousel.owlCarousel({ 1085 loop: loop, 1086 margin: margin, 1087 nav: nav, 1088 autoplay: autoplay, 1089 dots: dots,
1090 themeClass: themeClass, 1091 center: center, 1092 navText: [navPrev,navNext], 1093 mouseDrag: draggable, 1094 touchDrag: draggable, 1095 items: items, 1096 responsive: { 1097 0:{ 1098 items: responsiveXs 1099 }, 1100 767:{ 1101 items: responsiveSm 1102 }, 1103 992:{ 1104 items: responsiveMd 1105 }, 1106 1200:{ 1107 items: responsiveLg 1108 } 1109 }, 1110 }) 1111 .addClass(themeClass); 1112 if(center) { 1113 $carousel.addClass('owl-center'); 1114 } 1115 1116 $window.on('resize', function() { 1117 $carousel.trigger('refresh.owl.carousel'); 1118 }); 1119 1120 //topline two synced carousels 1121 if($carousel.hasClass('owl-news-slider-items') && syncedClass) { 1122 $carousel.on('changed.owl.carousel', function(e) { 1123 var indexTo = loop ? e.item.index+1 : e.item.index; 1124 $(syncedClass).trigger('to.owl.carousel', [indexTo]); 1125 }) 1126 } 1127 1128 1129 }); 1130 1131 1132 } //eof owl-carousel 1133 1134 //////////////////// 1135 //header processing/ 1136 //////////////////// 1137 //stick header to top 1138 //wrap header with div for smooth sticking 1139 var $header = $('.page_header').first(); 1140 var boxed = $header.closest('.boxed').length; 1141 var headerSticked = $('.header_side_sticked').length; 1142 var headerStickedDisabled = ( $body.hasClass('header_disable_affix_xl') && $body.hasClass('header_disable_affix_xs') ) ? true : false; 1143 if ($header.length) { 1144 //hiding main menu 1st levele elements that do not fit width 1145 menuHideExtraElements(); 1146 //mega menu 1147 initMegaMenu(1); 1148 1149 if (!headerStickedDisabled) { 1150 1151 //wrap header for smooth stick and unstick 1152 var headerHeight = $header.outerHeight(); 1153 //wrap header only if it not inside .header_absolute class 1154 // if( !($header.closest('.header_absolute')).length) { 1155 $header.wrap('<div class="page_header_wrapper"></div>'); 1156 // } 1157 var $headerWrapper = $('.page_header_wrapper'); 1158 if (!boxed) { 1159 $headerWrapper.css({height: headerHeight}); 1160 } 1161 1162 //headerWrapper background - same as header 1163 if( $header.hasClass('ls') ) { 1164 $headerWrapper.addClass('ls'); 1165 if ( $header.hasClass('ms') ) { 1166 $headerWrapper.addClass('ms'); 1167 } 1168 } else if ( $header.hasClass('ds') ) { 1169 $headerWrapper.addClass('ds'); 1170 if ( $header.hasClass('bs') ) { 1171 $headerWrapper.addClass('bs'); 1172 } 1173 if ( $header.hasClass('ms') ) { 1174 $headerWrapper.addClass('ms'); 1175 } 1176 1177 } else if ( $header.hasClass('cs') ) { 1178 $headerWrapper.addClass('cs'); 1179 if ( $header.hasClass('cs2') ) { 1180 $headerWrapper.addClass('cs2'); 1181 } 1182 if ( $header.hasClass('cs3') ) { 1183 $headerWrapper.addClass('cs3'); 1184 } 1185 } else if ( $header.hasClass('gradient-background') ) { 1186 $headerWrapper.addClass('gradient-background'); 1187 } 1188 1189 //get offset 1190 var headerOffset = 0; 1191 //check for sticked template headers 1192 if (!boxed && !($headerWrapper.css('position') === 'fixed')) { 1193 headerOffset = $header.offset().top; 1194 } 1195 1196 //for boxed layout - show or hide main menu elements if width has been changed on affix 1197 $header.on('affixed-top.bs.affix affixed.bs.affix affixed-bottom.bs.affix', function ( e ) { 1198 if( $header.hasClass('affix-top') ) { 1199 $headerWrapper.removeClass('affix-wrapper affix-bottom-wrapper').addClass('affix-top-wrapper'); 1200 //cs to ls when affixed 1201 // if($header.hasClass('cs')) { 1202 // $header.removeClass('ls'); 1203 // } 1204 } else if ( $header.hasClass('affix') ) { 1205 $headerWrapper.removeClass('affix-top-wrapper affix-bottom-wrapper').addClass('affix-wrapper'); 1206 //cs to ls when affixed 1207 // if($header.hasClass('cs')) { 1208 // $header.addClass('ls'); 1209 // } 1210 } else if ( $header.hasClass('affix-bottom') ) { 1211 $headerWrapper.removeClass('affix-wrapper affix-top-wrapper').addClass('affix-bottom-wrapper'); 1212 } else { 1213 $headerWrapper.removeClass('affix-wrapper affix-top-wrapper affix-bottom-wrapper'); 1214 } 1215 1216 //calling this functions disable menu items animation when going from affix to affix-top with centered logo inside 1217 //in boxed layouts header is always fixed 1218 if (boxed && !($header.css('position') === 'fixed')) { 1219 menuHideExtraElements(); 1220 initMegaMenu(1); 1221 } 1222 if(headerSticked) { 1223 initMegaMenu(1); 1224 } 1225 1226 }); 1227 1228 //if header has different height on afixed and affixed-top positions - correcting wrapper height 1229 $header.on('affixed-top.bs.affix', function () { 1230 // $headerWrapper.css({height: $header.outerHeight()}); 1231 }); 1232 1233 //fixing auto affix bug - toggle affix on click when page is at the top 1234 $header.on('affix.bs.affix', function(){ 1235 if( !$window.scrollTop() ) return false;
1236 }); 1237 1238 $header.affix({ 1239 offset: { 1240 top: headerOffset, 1241 bottom: -10 1242 } 1243 }); 1244 } //headerStickedDisabled 1245 } //$header.length if check 1246 1247 //aside affix 1248 initAffixSidebar(); 1249 1250 $body.scrollspy('refresh'); 1251 1252 //appear plugin is used to elements animation, counter, pieChart, bootstrap progressbar 1253 if ($().appear) { 1254 //animation to elements on scroll 1255 var $animate = $('.animate'); 1256 $animate.appear(); 1257 1258 $animate.filter(':appeared').each(function(index){ 1259 initAnimateElement($(this), index); 1260 }); 1261 1262 $body.on('appear', '.animate', function(e, $affected ) { 1263 $($affected).each(function(index){ 1264 initAnimateElement($(this), index); 1265 }); 1266 }); 1267 1268 //counters init on scroll 1269 if ($().countTo) { 1270 var $counter = $('.counter'); 1271 $counter.appear(); 1272 1273 $counter.filter(':appeared').each(function(){ 1274 initCounter($(this)); 1275 }); 1276 $body.on('appear', '.counter', function(e, $affected ) { 1277 $($affected).each(function(){ 1278 initCounter($(this)); 1279 }); 1280 }); 1281 } 1282 1283 //bootstrap animated progressbar 1284 if ($().progressbar) { 1285 var $progressbar = $('.progress .progress-bar'); 1286 $progressbar.appear(); 1287 1288 $progressbar.filter(':appeared').each(function(){ 1289 initProgressbar($(this)); 1290 }); 1291 $body.on('appear', '.progress .progress-bar', function(e, $affected ) { 1292 $($affected).each(function(){ 1293 initProgressbar($(this)); 1294 }); 1295 }); 1296 //animate progress bar inside bootstrap tab 1297 $('a[data-toggle="tab"]').on('shown.bs.tab', function(e) { 1298 initProgressbar($($(e.target).attr('href')).find('.progress .progress-bar')); 1299 }); 1300 //animate progress bar inside bootstrap dropdown 1301 $('.dropdown').on('shown.bs.dropdown', function(e) { 1302 initProgressbar($(this).find('.progress .progress-bar')); 1303 }); 1304 } 1305 1306 //circle progress bar 1307 if ($().easyPieChart) { 1308 var $chart = $('.chart'); 1309 1310 $chart.appear(); 1311 1312 $chart.filter(':appeared').each(function(){ 1313 initChart($(this)); 1314 }); 1315 $body.on('appear', '.chart', function(e, $affected ) { 1316 $($affected).each(function(){ 1317 initChart($(this)); 1318 }); 1319 }); 1320 1321 } 1322 1323 } //appear check 1324 1325 //Flickr widget 1326 // use http://idgettr.com/ to find your ID 1327 if ($().jflickrfeed) { 1328 var $flickr = $("#flickr, .flickr_ul"); 1329 if ( $flickr.length ) { 1330 if ( ! ( $flickr.hasClass('flickr_loaded') ) ) { 1331 $flickr.jflickrfeed({ 1332 flickrbase: "http://api.flickr.com/services/feeds/", 1333 limit: 4, 1334 qstrings: { 1335 id: "131791558@N04" 1336 }, 1337 itemTemplate: '<a href="{{image_b}}" class="photoswipe-link"><li><img alt="{{title}}" src="{{image_m}}" /></li></a>' 1338 //complete 1339 }, function(data) { 1340 initPhotoSwipe(); 1341 }).addClass('flickr_loaded'); 1342 } 1343 } 1344 } 1345 1346 // Instagram widget 1347 if($().spectragram) { 1348 var Spectra = { 1349 instaToken: '3905738328.60c782d.b65ed3f058d64e6ab32c110c6ac12d9b', 1350 instaID: '60c782dfecaf4050b59ff4c159246641', 1351 1352 init: function () { 1353 jQuery.fn.spectragram.accessData = { 1354 accessToken: this.instaToken, 1355 clientID: this.instaID 1356 }; 1357 1358 //available methods: getUserFeed, getRecentTagged 1359 $('.instafeed').each(function(){ 1360 var $this = $(this); 1361 if ($this.find('img').length) { 1362 return; 1363 } 1364 $this.spectragram('getRecentTagged',{ 1365 max: 8, 1366 //pass username if you are using getUserFeed method 1367 query: 'grey', 1368 wrapEachWith: '<div class="photo">' 1369 }); 1370 }); 1371 } 1372 } 1373 1374 Spectra.init(); 1375 } 1376 1377 // init Isotope 1378 $('.isotope-wrapper').each(function(index) { 1379 var $container = $(this); 1380 var layoutMode = ($container.hasClass('masonry-layout')) ? 'masonry' : 'fitRows'; 1381 var columnWidth = ($container.children('.col-md-4').length) ? '.col-md-4' : false;
1382 $container.isotope({ 1383 percentPosition: true, 1384 layoutMode: layoutMode, 1385 masonry: { 1386 //TODO for big first element in grid - giving smaller element to use as grid 1387 // columnWidth: '.isotope-wrapper > .col-md-4' 1388 columnWidth: columnWidth 1389 } 1390 }); 1391 1392 var $filters = $container.attr('data-filters') ? $($container.attr('data-filters')) : $container.prev().find('.filters'); 1393 // bind filter click 1394 if ($filters.length) { 1395 $filters.on( 'click', 'a', function( e ) { 1396 e.preventDefault(); 1397 var $thisA = $(this); 1398 var filterValue = $thisA.attr('data-filter'); 1399 $container.isotope({ filter: filterValue }); 1400 $thisA.siblings().removeClass('selected active'); 1401 $thisA.addClass('selected active'); 1402 }); 1403 //for works on select 1404 $filters.on( 'change', 'select', function( e ) { 1405 e.preventDefault(); 1406 var filterValue = $(this).val(); 1407 $container.isotope({ filter: filterValue }); 1408 }); 1409 } 1410 }); 1411 1412 1413 ///////// 1414 //SHOP/// 1415 ///////// 1416 $('#toggle_shop_view').on('click', function( e ) { 1417 e.preventDefault(); 1418 $(this).toggleClass('grid-view'); 1419 $('#products').toggleClass('grid-view list-view'); 1420 }); 1421 1422 let quantity_init = () => { 1423 var $numberInput = $('input[type="number"]'); 1424 $numberInput.before('<input type="button" value="+" class="plus"><i class="fa fa-caret-up" aria-hidden="true"></i>'); 1425 $numberInput.after('<input type="button" value="-" class="minus"><i class="fa fa-caret-down" aria-hidden="true"></i>'); 1426 1427 $('.plus').on('click', function (e) { 1428 var numberField = $(this).parent().find('[type="number"]'); 1429 var currentVal = ( numberField.val() === '' ) ? 0 : numberField.val(); 1430 numberField.val(parseFloat(currentVal) + 1).trigger('change'); 1431 }); 1432 $('.minus').on('click', function (e) { 1433 var numberField = $(this).parent().find('[type="number"]'); 1434 var currentVal = numberField.val(); 1435 numberField.val(parseFloat(currentVal) - 1).trigger('change'); 1436 if(currentVal < 2){ 1437 numberField.val(1); 1438 } 1439 }); 1440 }; 1441 1442 quantity_init(); 1443 1444 1445 //checkout collapse forms - only for HTML 1446 $('a.showlogin, a.showcoupon').on('click', function( e ) { 1447 e.preventDefault(); 1448 var $form = $(this).parent().next(); 1449 1450 if($form.css('display') === 'none') { 1451 $form.show(150); 1452 } else { 1453 $form.hide(150); 1454 } 1455 }); 1456 1457 1458 //remove product from cart - only for HTML 1459 $('a.remove').on('click', function( e ) { 1460 e.preventDefault(); 1461 $(this).closest('tr, .media').remove(); 1462 }); 1463 1464 1465 //flexslider - only for HTML 1466 $('.images').flexslider({ 1467 animation: "slide", 1468 controlNav: "thumbnails", 1469 selector: "figure > div", 1470 directionNav: false, 1471 }); 1472 1473 //tabs - only for HTML 1474 $( '.wc-tab, .woocommerce-tabs .panel:not(.panel .panel)' ).hide(); 1475 1476 $('.wc-tabs li a, ul.tabs li a').on( 'click', function( e ) { 1477 e.preventDefault(); 1478 var $tab = $( this ); 1479 var $tabs_wrapper = $tab.closest( '.wc-tabs-wrapper, .woocommerce-tabs' ); 1480 var $tabs = $tabs_wrapper.find( '.wc-tabs, ul.tabs' ); 1481 1482 $tabs.find( 'li' ).removeClass( 'active' ); 1483 $tabs_wrapper.find( '.wc-tab, .panel:not(.panel .panel)' ).hide(); 1484 1485 $tab.closest( 'li' ).addClass( 'active' ); 1486 $tabs_wrapper.find( $tab.attr( 'href' ) ).show(); 1487 } ); 1488 // Review link 1489 $('a.woocommerce-review-link').on( 'click', function() { 1490 $( '.reviews_tab a' ).trigger('click'); 1491 return true; 1492 }); 1493 1494 //parsing URL hash 1495 var hash = window.location.hash; 1496 var url = window.location.href; 1497 var $tabs = $( '.wc-tabs, ul.tabs' ).first(); 1498 1499 if ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' || hash === '#tab-reviews' ) { 1500 $tabs.find( 'li.reviews_tab a' ).trigger('click'); 1501 } else if ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) { 1502 $tabs.find( 'li.reviews_tab a' ).trigger('click'); 1503 } else if ( hash === '#tab-additional_information' ) { 1504 $tabs.find( 'li.additional_information_tab a' ).trigger('click'); 1505 } else { 1506 $tabs.find( 'li:first a' ).trigger('click'); 1507 } 1508 1509 1510 //price filter - only for HTML 1511 if ($().slider) { 1512 var $rangeSlider = $(".slider-range-price"); 1513 if ($rangeSlider.length) { 1514 var $priceMin = $(".slider_price_min"); 1515 var $priceMax = $(".slider_price_max"); 1516 $rangeSlider.slider({ 1517 range: true, 1518 min: 0, 1519 max: 100000, 1520 values: [ 1500, 30000 ], 1521 slide: function( event, ui ) { 1522 $priceMin.val( ui.values[ 0 ] ); 1523 $priceMax.val( ui.values[ 1 ] ); 1524 } 1525 }); 1526 $priceMin.val($rangeSlider.slider("values", 0)); 1527 $priceMax.val($rangeSlider.slider("values", 1)); 1528 } 1529 } 1530 1531 1532 //woocommerce related products, upsells products 1533 $('.related.products ul.products, .upsells.products ul.products, .cross-sells ul.products') 1534 .addClass('owl-carousel top-right-nav') 1535 .owlCarousel({ 1536 loop: true, 1537 autoplay: true, 1538 margin: 15, 1539 nav: true, 1540 dots: false, 1541 items: 3, 1542 navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'], 1543 responsive: { 1544 0: { 1545 items: 1 1546 }, 1547 767: { 1548 items: 2 1549 }, 1550 992: { 1551 items: 2 1552 }, 1553 1200: { 1554 items: 2 1555 } 1556 } 1557 }); 1558 1559 //color filter 1560 $(".color-filters").find("a[data-background-color]").each(function() { 1561 $(this).css({"background-color" : $(this).data("background-color")}); 1562 }); 1563 //////////////// 1564 // end of SHOP// 1565 //////////////// 1566 1567 1568 1569 //Unyson or other messages modal 1570 var $messagesModal = $('#messages_modal'); 1571 if ($messagesModal.find('ul').length) { 1572 $messagesModal.modal('show'); 1573 } 1574 1575 //page preloader 1576 $(".preloader_img, .preloader_css").fadeOut(800); 1577 setTimeout(function () { 1578 $(".preloader").fadeOut(800, function(){ 1579 // setTimeout(function () { 1580 // $('.preloader').remove(); 1581 // }, 300); 1582 }); 1583 }, 200); 1584}//eof windowLoadInit 1585 1586$.fn.iconedWrap = function ( icon, wrapClass = 'iconed-field before', method = 'out-wrap', mod = 'none' ) 1587{ 1588 return this.each( function() 1589 { 1590 let subj = $( this ); 1591 if ( 'out-wrap' === method && 'none' === mod ) 1592 { 1593 subj.wrap( function() 1594 { 1595 return "<span class='" + wrapClass + "'>" + icon + "</span>"; 1596 }); 1597 } 1598 if ( 'out-wrap' === method && 'inclusive' === mod ) 1599 { 1600 subj.parent().addClass( wrapClass ); 1601 subj.before( icon ); 1602 } 1603 if ( 'in-wrap' === method && 'none' === mod ) 1604 { 1605 subj.prepend( "<span class='" + wrapClass + "'>" + icon ); 1606 subj.append( "</span>" ); 1607 } 1608 if ( 'in-wrap' === method && 'inclusive' === mod ) 1609 { 1610 subj.addClass( wrapClass ); 1611 subj.prepend( icon ); 1612 } 1613 }); 1614}; 1615 1616function postChatRows() { 1617 $( '.format-chat .entry-content > p' ).each( function( index ) { 1618 var str_array = $( this ).html(); 1619 // console.log( $( this ).is( ':first' ) ); 1620 if ( /[a-zA-Z]/.test( str_array ) ) { 1621 $( this ).addClass( 'chat-row' ); 1622 str_array = str_array.split( ':' ); 1623 $( this ).html( '<span class="chat-author">' + str_array[ 0 ] + '</span>' 1624 + '<span class="chat-separator">:</span>' 1625 + '<span class="chat-text">' + str_array.slice( 1 ).join() + '</span>' ); 1626 } else { 1627 $( this ).remove(); 1628 } 1629 }); 1630} 1631 1632 1633function iconedFields() { 1634 1635 // Active class for iconed fields if focused/unfocused 1636 $( '.iconed-field input, .iconed-field textarea' ) 1637 .on('focus blur', function() { 1638 $(this).parent().toggleClass('active'); 1639 }); 1640 1641 // .disabled & .textarea classes for iconed elements 1642 var elem_enabled = true; 1643 $('.iconed-field, .iconed-select').each( function () { 1644 1645 var disElem = $(this).find( 1646 'input[disabled],' + 1647 'textarea[disabled],' + 1648 'select[disabled]'); 1649 if( disElem.length ){ 1650 $(this).addClass('disabled'); 1651 elem_enabled = false;
1652 } else { 1653 elem_enabled = true; 1654 } 1655 1656 disElem = $(this).find('textarea'); 1657 if( disElem.length ){ 1658 $(this).addClass('textarea'); 1659 } 1660 1661 if( elem_enabled ) { 1662 $(this).on('mouseenter', function () { 1663 $(this).addClass('hover'); 1664 }); 1665 $(this).on('mouseleave', function () { 1666 $(this).removeClass('hover'); 1667 }); 1668 } 1669 1670 }); 1671 1672 // Icon clickable 1673 1674 $('.iconed-field.before.icon-clickable').click( function (e) { 1675 if ( e.offsetX < 43 ) { 1676 $( this ).closest( 'form' ).submit(); 1677 } 1678 }); 1679 1680 $('.iconed-field.after.icon-clickable').click( function (e) { 1681 if ( e.offsetX + 45 > $( this ).width() ) { 1682 $( this ).closest( 'form' ).submit(); 1683 } 1684 }); 1685} 1686 1687$(function() { 1688 documentReadyInit(); 1689 initGoogleMap(); 1690}); 1691 1692$window.on('load', function(){ 1693 windowLoadInit(); 1694}); //end of "window load" event 1695 1696$window.on('resize', function(){ 1697 1698 $body.scrollspy('refresh'); 1699 1700 //header processing 1701 menuHideExtraElements(); 1702 initMegaMenu(1); 1703 var headerStickedDisabled = ($body.hasClass('header_disable_affix_xl') && $body.hasClass('header_disable_affix_xs') ) ? true : false; 1704 if(!headerStickedDisabled) { 1705 var $header = $('.page_header').first(); 1706 //checking document scrolling position 1707 if ($header.length && !$(document).scrollTop() && $header.first().data('bs.affix')) { 1708 $header.first().data('bs.affix').options.offset.top = $header.offset().top; 1709 } 1710 if (!$header.closest('.boxed').length) { 1711 var affixed = false; 1712 if($header.hasClass('affix')) { 1713 affixed = true; 1714 //animation duration 1715 $header.removeClass('affix'); 1716 1717 //TODO fix header wrapper height from small to large when page is scrolled (not top) 1718 setTimeout(function () { 1719 //editing header wrapper height for smooth stick and unstick 1720 $(".page_header_wrapper").css({height: $header.first().outerHeight()}); 1721 $header.addClass('affix'); 1722 }, 250); 1723 } 1724 1725 if(!affixed) { 1726 //editing header wrapper height for smooth stick and unstick 1727 $(".page_header_wrapper").css({height: $header.first().outerHeight()}); 1728 } 1729 } 1730 }//headerStickedDisabled 1731}); 1732//end of IIFE function 1733})(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.