1/* UItoTop jQuery Plugin | Matt Varone | http://www.mattvarone.com/web-design/uitotop-jquery-plugin */ 2!function(n){n.fn.UItoTop=function(o){var e={text:"To Top",min:200,inDelay:600,outDelay:400,containerID:"toTop",containerHoverID:"toTopHover",scrollSpeed:1200,easingType:"linear"},t=n.extend(e,o),i="#"+t.containerID,a="#"+t.containerHoverID;n("body").append('<a href="#" id="'+t.containerID+'"><span>'+t.text+"</span></a>"),n(i).hide().on("click.UItoTop",function(){return n("html, body").animate({scrollTop:0},t.scrollSpeed,t.easingType),n("#"+t.containerHoverID,this).stop().animate({opacity:0},t.inDelay,t.easingType),!1}).hover(function(){n(a,this).stop().animate({opacity:1},600,"linear")},function(){n(a,this).stop().animate({opacity:0},700,"linear")}),n(window).scroll(function(){var o=n(window).scrollTop();"undefined"==typeof document.body.style.maxHeight&&n(i).css({position:"absolute",top:o+n(window).height()-50}),o>t.min?n(i).fadeIn(t.inDelay):n(i).fadeOut(t.Outdelay)})}}(jQuery); 3/* jquery.stickup.min.js */ 4!function(t){t.fn.stickUp=function(e){function o(){a=parseInt(n.offset().top),d=parseInt(n.css("margin-top")),u=parseInt(n.outerHeight(!0)),c.pseudo&&(t('<div class="pseudoStickyBlock"></div>').insertAfter(n),i=t(".pseudoStickyBlock"),i.css({position:"relative",display:"block"})),c.active&&s(),n.addClass("stuckMenu")}function s(){p.on("scroll.stickUp",function(){r=t(this).scrollTop(),S=r>k?"down":"up",k=r,0!=h.length?correctionValue=h.outerHeight(!0):correctionValue=0,f=parseInt(l.scrollTop()),a-correctionValue<f?(n.addClass("isStuck"),v.addClass("isStuck"),c.pseudo?(n.css({position:"fixed",top:correctionValue}),i.css({height:u})):n.css({position:"fixed",top:correctionValue})):(n.removeClass("isStuck"),v.removeClass("isStuck"),c.pseudo?(n.css({position:"relative",top:0}),i.css({height:0})):n.css({position:"absolute",top:0}))}).trigger("scroll.stickUp"),p.on("resize",function(){n.hasClass("isStuck")?a!=parseInt(i.offset().top)&&(a=parseInt(i.offset().top)):a!=parseInt(n.offset().top)&&(a=parseInt(n.offset().top))})}var c={correctionSelector:".correctionSelector",listenSelector:".listenSelector",active:!1,pseudo:!0};t.extend(c,e);var i,r,n=t(this),l=t(window),p=t(document),a=0,u=0,d=0,f=0,k=0,S="",h=t(c.correctionSelector),v=t(c.listenSelector);0!=n.length&&o()}}(jQuery); 5/* super-guacamole.min.js */ 6!function(e,t){function n(t){var n,i,r=this;n={id:"",href:"",title:"···",children:{},templates:{},container:null},i=e.extend(n,t),r.id=i.id,r.href=i.href,r.title=i.title,r.children=i.children,r.templates=i.templates,r.$container=i.container,r.node=null,r.attachedNode=null,r.options={},r.visible=!0}var i={menu:'<li class="%1$s"><a href="%2$s">%3$s</a>%4$s</li>',child_wrap:"<ul>%s</ul>",child:'<li class="%1$s" id="%5$s"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>'};n.prototype.set=function(e){if(!1==e instanceof n)throw new Error("Invalid argument type");return this.children[e.id]=e,this},n.prototype.push=function(e){return this.set(e)},n.prototype.get=function(e){var t=null;return this.map(e,function(e,n){return t=n,n}),t},n.prototype.map=function(e,t,n){var i={id:e},r=this;return"string"!=typeof e&&(i=e),n=n||this.children,0>=n.length?i:(Object.keys(n).forEach(function(e){child=n[e],i.id===child.id?n[i.id]=t(child):child.children&&0<Object.keys(child.children).length&&(i=r.map(i,t,child.children))}),i)},n.prototype.has=function(e){return t!==this.children[e]},n.prototype.isVisible=function(){return this.visible},n.prototype.forEach=function(e){return this.children.forEach(e)},n.prototype.countVisibleAttachedNodes=function(){var t=this,n=-1;return Object.keys(t.children).forEach(function(i){e(t.children[i].getAttachedNode()).attr("hidden")||n++}),n},n.prototype.countVisibleNodes=function(){var t,n=this,i=0;return Object.keys(n.children).forEach(function(r){t=n.children[r],e(t.getNode()).attr("hidden")||i++}),i},n.prototype.countVisible=function(){var e=this,t=0;return Object.keys(e.children).forEach(function(n){e.children[n].isVisible()&&t++}),t},n.prototype.getNode=function(){return this.node},n.prototype.getAttachedNode=function(){return this.attachedNode}
6,n.prototype.setNode=function(e){this.node=e},n.prototype.attachNode=function(e){this.attachedNode=e},n.prototype.setOptions=function(e){return this.options=e,this},n.prototype.getOptions=function(){return this.options},n.prototype.render=function(){function t(e,n,i){var r=e.replace(new RegExp("\\%"+n+"\\$s","g"),i);return pipes={replace:function(e,n){return t(r,e,n),pipes},get:function(){return r}},pipes}function n(e,i,r){var o="",a=Object.keys(i.children);return r=r||!1,a.forEach(function(e){o+=n("super-guacamole__menu__child",i.children[e])}),t(r?d:c,1,e+" menu-item"+(0<a.length?" menu-item-has-children":"")).replace(2,i.href).replace(3,i.title).replace(4,0<a.length?o:"").replace(5,i.id).get().replace('<ul class="sub-menu"></ul>',"")}function i(e){var t="";return Object.keys(e).forEach(function(i){t+=n("super-guacamole__menu",e[i])}),t}var r,o=this,c=o.templates.menu,d=o.templates.child,a=o.$container;o.options.$menu;return 0<a.length&&(a.append(i([o])),a.find(".super-guacamole__menu__child").each(function(){$current_el=e(this),id=e(this).attr("id"),r=a.find("#"+id.replace("sg-","")),0===r.length&&(r=a.find("."+id.replace("sg-",""))),0<r.length&&o.map(id,function(e){return e.attachNode(r),e.setNode($current_el),e})})),this},n.extract=function(t){function i(e){var t="",n=null,i=/menu\-item\-[0-9]+/i;return e.attr("class").split(" ").forEach(function(e){n=i.exec(e),null!==n&&(t=n[0])}),t}var r,o,c,d,a={};return t.each(function(t,u){r=e(u),o=r.find("a:first"),menuId=r.attr("id"),"undefined"==typeof menuId&&(menuId=i(r)),c=new n({id:"sg-"+menuId,href:o.attr("href"),title:o.get(0).childNodes[0].data}),c.attachNode(r),-1<r.children(".sub-menu").length&&(subMenu=n.extract(r.children(".sub-menu").children(".menu-item")),Object.keys(subMenu).forEach(function(e){d=subMenu[e],c.set(d)})),a[c.id]=c}),a},n.prototype.attachedNodesFit=function(){var t,n,i=this,r=0,o=0,c=e(e(".header-container > .container").length>0?".header-container > .container":".header-container > div"),d=i.$container.outerWidth(!0)-i.$container.find(".super-guacamole__menu").outerWidth(!0)-(parseInt(c.css("padding-left"),10)+parseInt(c.css("padding-right"),10))/2;return Object.keys(i.children).forEach(function(r){n=i.children[r],$attachedNode=e(n.getAttachedNode()),t=e(n.getNode()),$attachedNode.removeAttr("hidden"),t.attr("hidden",!0)}),Object.keys(i.children).forEach(function(c){n=n=i.children[c],$attachedNode=e(n.getAttachedNode()),t=e(n.getNode()),o=$attachedNode.outerWidth(!0),o>0&&$attachedNode.data("width",o),r+=$attachedNode.data("width"),r>d&&($attachedNode.attr("hidden",!0),t.removeAttr("hidden"))}),!0},n.prototype.menuFit=function(t){var n,i=this,r={removeAttr:function(e,t){return e.removeAttr(t)},attr:function(e,t){return e.attr(t,!0)}},o="removeAttr",c=i.options.threshold||768;return t=t||!1,0===i.countVisibleNodes()&&(o="attr"),e(window).width()<=c-1&&(o="attr",Object.keys(i.children).forEach(function(t){n=i.children[t],$attachedNode=e(n.getAttachedNode()),$node=e(n.getNode()),$attachedNode.removeAttr("hidden"),$node.attr("hidden",!0)})),t||r[o](i.$container.find(".super-guacamole__menu"),"hidden"),"removeAttr"===o},n.prototype.watch=function(t){function n(){r.attachedNodesFit(),r.menuFit()}function i(e){var t;return function(i){function r(){n(),timeout=null}t&&clearTimeout(t),t=setTimeout(r,e)}}var r=this;return(t=t||!1)?(n(),r):(e(window).on("resize",i(10)),e(window).on("orientationchange",i(10)),r)},e.fn.superGuacamole=function(t){var r,o,c,d,a=e(this),u=a.find("#main-menu");r={threshold:544,minChildren:3,childrenFilter:"li",menuTitle:"···",menuUrl:"#",templates:i},o=e.extend(r,t),c=u.children(o.childrenFilter+":not(.super-guacamole__menu):not(.super-guacamole__menu__child)"),d=new n({title:o.menuTitle,href:o.menuUrl,templates:o.templates,children:n.extract(c),container:u}),o.$menu=u,d.setOptions(o).render().watch(!0).watch()}}(jQuery); 7 8(function( $ ) { 9 "use strict"; 10 11 CherryJsCore.utilites.namespace( 'theme_script' ); 12 CherryJsCore.theme_script = { 13 init: function() { 14 // Document ready event check 15 if ( CherryJsCore.status.is_ready ) { 16 this.document_ready_render(); 17 } else { 18 CherryJsCore.variable.$document.on( 'ready', this.document_ready_render.bind( this ) ); 19 } 20 21 // Windows load event check 22 if ( CherryJsCore.status.on_load ) { 23 this.window_load_render(); 24 } else { 25 CherryJsCore.variable.$window.on( 'load', this.window_load_render.bind( this ) ); 26 } 27 }, 28 29 document_ready_render: function() { 30 this.smart_slider_init( this ); 31 this.swiper_carousel_init( this ); 32 this.post_formats_custom_init( this ); 33 this.navbar_init( this ); 34 this.subscribe_init( this ); 35 this.main_menu( this, $( '.main-navigation' ) ); 36 this.mega_menu( this ); 37 this.to_top_init( this ); 38 this.playlist_slider_widget_init( this ); 39 this.news_smart_box_init( this ); 40 this.header_search( this ); 41 this.mobile_menu( this ); 42 this.vertical_menu_init( this ); 43 this.add_project_inline_style( this ); 44 this.anchor_navigation( this ); 45 this.anchor_scrolling_navigation( this ); 46 this.ofi_init( this ); 47 }, 48 49 window_load_render: function() { 50 this.page_preloader_init( this ); 51 }, 52
53 anchor_navigation: function ( self ) { 54 $( '.page-template-landing div:not(.woocommerce-tabs) a[href*=#]:not([href=#])' ).on( 'click', function() { 55 56 if ( location.pathname.replace( /^\//, '' ) === this.pathname.replace( /^\//, '' ) || location.hostname === this.hostname ) { 57 var target = $( this.hash ), 58 targetLink = this.hash, 59 menuHeight = $( '#main-menu' ).outerHeight(true); 60 61 target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' ); 62 63 if ( target.length ) { 64 $( 'html, body' ).animate( { 65 scrollTop: target.offset().top - menuHeight 66 }, 1000 ); 67 68 return false; 69 } 70 } 71 }); 72 }, 73 74 anchor_scrolling_navigation: function ( self ) { 75 76 var $document = $( document ), 77 top = null, 78 changed = false, 79 currentHash = null, 80 sections = null, 81 timeout = null, 82 interval = null, 83 menuHeight = $( '#main-menu' ).outerHeight(true), 84 $sections = $( '.tm_pb_anchor' ); 85 86 sections = getSections(); 87 88 89 $( window ).on( 'scroll.cherry_anchor_navigation', function () { 90 var newTop = $document.scrollTop(); 91 92 changed = newTop != top; 93 94 if ( changed ) { 95 top = newTop; 96 } 97 }); 98 99 $( window ).on( 'resize.cherry_anchor_navigation', function () { 100 sections = getSections(); 101 }); 102 103 function getSections() { 104 sections = $.map( $sections, function ( event ) { 105 var $event = $( event ), 106 position = $event.position(); 107 108 return { 109 top: position.top - menuHeight, 110 bottom: position.top + $event.outerHeight( true ) - menuHeight, 111 hash: $event.attr( 'id' ) 112 }; 113 }); 114 115 return sections; 116 117 } 118 119 function iteration() { 120 121 var sectionsLength = sections.length, 122 section, 123 scrollTop; 124 125 while ( section = sections[--sectionsLength] ) { 126 127 if ( section.top >= top || section.bottom <= top ) { 128 continue; 129 } 130 131 if ( currentHash == section.hash ) { 132 break; 133 } 134 135 currentHash = section.hash; 136 history.pushState( null, null, '#' + section.hash ); 137 } 138 } 139 140 timeout = setTimeout( function (){ 141 interval = setInterval( iteration, 250 ); 142 }, 250 ); 143 }, 144 145 smart_slider_init: function( self ) { 146 $( '.sailfish-smartslider' ).each( function() { 147 var slider = $( this ), 148 sliderId = slider.data( 'id' ), 149 sliderWidth = slider.data( 'width' ), 150 sliderHeight = slider.data( 'height' ), 151 sliderOrientation = slider.data( 'orientation' ), 152 slideDistance = slider.data( 'slide-distance' ), 153 slideDuration = slider.data( 'slide-duration' ), 154 sliderFade = slider.data( 'slide-fade' ), 155 sliderNavigation = slider.data( 'navigation' ), 156 sliderFadeNavigation = slider.data( 'fade-navigation' ), 157 sliderPagination = slider.data( 'pagination' ), 158 sliderAutoplay = slider.data( 'autoplay' ), 159 sliderFullScreen = slider.data( 'fullscreen' ), 160 sliderShuffle = slider.data( 'shuffle' ), 161 sliderLoop = slider.data( 'loop' ), 162 sliderThumbnailsArrows = slider.data( 'thumbnails-arrows' ), 163 sliderThumbnailsPosition = slider.data( 'thumbnails-position' ), 164 sliderThumbnailsWidth = slider.data( 'thumbnails-width' ), 165 sliderThumbnailsHeight = slider.data( 'thumbnails-height' ); 166 167 if ( $( '.smart-slider__items', '#' + sliderId ).length > 0 ) { 168 $( '#' + sliderId ).sliderPro( { 169 width: sliderWidth, 170 height: sliderHeight, 171 orientation: sliderOrientation, 172 slideDistance: slideDistance, 173 slideAnimationDuration: slideDuration, 174 fade: sliderFade, 175 arrows: sliderNavigation, 176 fadeArrows: sliderFadeNavigation, 177 buttons: sliderPagination, 178 autoplay: sliderAutoplay, 179 fullScreen: sliderFullScreen, 180 shuffle: sliderShuffle, 181 loop: sliderLoop, 182 waitForLayers: false, 183 thumbnailArrows: sliderThumbnailsArrows, 184 thumbnailsPosition: sliderThumbnailsPosition, 185 thumbnailWidth: sliderThumbnailsWidth, 186 thumbnailHeight: sliderThumbnailsHeight, 187 init: function() { 188 $( this ).resize(); 189 }, 190 sliderResize: function( event ) { 191 var thisSlider = $( '#' + sliderId ), 192 slides = $( '.sp-slide', thisSlider ); 193 194 slides.each( function() { 195 196 if ( $( '.sp-title a', this ).width() > $( this ).width() ) { 197 $( this ).addClass( 'text-wrapped' ); 198 } else { 199 $( this ).removeClass( 'text-wrapped' ); 200 } 201 202 } ); 203 }, 204 breakpoints: { 205 991: { 206 height: parseFloat( sliderHeight ) * 0.75 207 }, 208 767: { 209 height: parseFloat( sliderHeight ) * 0.5, 210 thumbnailsPosition: ( 'top' === this.thumbnailsPosition ) ? 'top' : 'bottom', 211 thumbnailHeight: parseFloat( sliderThumbnailsHeight ) * 0.75, 212 thumbnailWidth: parseFloat( sliderThumbnailsWidth ) * 0.75 213 } 214 } 215 } ); 216 } 217 } );//each end 218 }, 219 220 swiper_carousel_init: function( self ) { 221 222 // Enable swiper carousels 223 jQuery( '.sailfish-carousel' ).each( function() { 224 var swiper = null, 225 uniqId = jQuery( this ).data( 'uniq-id' ), 226 slidesPerView = parseFloat( jQuery( this ).data( 'slides-per-view' ) ), 227 slidesPerGroup = parseFloat( jQuery( this ).data( 'slides-per-group' ) ), 228 slidesPerColumn = parseFloat( jQuery( this ).data( 'slides-per-column' ) ), 229 spaceBetweenSlides = parseFloat( jQuery( this ).data( 'space-between-slides' ) ), 230 durationSpeed = parseFloat( jQuery( this ).data( 'duration-speed' ) ), 231 swiperLoop = jQuery( this ).data( 'swiper-loop' ), 232 freeMode = jQuery( this ).data( 'free-mode' ), 233 grabCursor = jQuery( this ).data( 'grab-cursor' ), 234 mouseWheel = jQuery( this ).data( 'mouse-wheel' ), 235 breakpointsSettings = { 236 1199: { 237 slidesPerView: Math.floor( slidesPerView * 0.75 ), 238 spaceBetween: Math.floor( spaceBetweenSlides * 0.75 ) 239 },
240 991: { 241 slidesPerView: Math.floor( slidesPerView * 0.5 ), 242 spaceBetween: Math.floor( spaceBetweenSlides * 0.5 ) 243 }, 244 767: { 245 slidesPerView: ( 0 !== Math.floor( slidesPerView * 0.25 ) ) ? Math.floor( slidesPerView * 0.25 ) : 1 246 } 247 }; 248 249 if ( 1 == slidesPerView ) { 250 breakpointsSettings = {} 251 } 252 253 var swiper = new Swiper( '#' + uniqId, { 254 slidesPerView: slidesPerView, 255 slidesPerGroup: slidesPerGroup, 256 slidesPerColumn: slidesPerColumn, 257 spaceBetween: spaceBetweenSlides, 258 speed: durationSpeed, 259 loop: swiperLoop, 260 freeMode: freeMode, 261 grabCursor: grabCursor, 262 mousewheelControl: mouseWheel, 263 paginationClickable: true, 264 nextButton: '#' + uniqId + '-next', 265 prevButton: '#' + uniqId + '-prev', 266 pagination: '#' + uniqId + '-pagination', 267 onInit: function() { 268 $( '#' + uniqId + '-next' ).css( { 'display': 'block' } ); 269 $( '#' + uniqId + '-prev' ).css( { 'display': 'block' } ); 270 }, 271 breakpoints: breakpointsSettings 272 } 273 ); 274 } ); 275 }, 276 277 post_formats_custom_init: function( self ) { 278 CherryJsCore.variable.$document.on( 'cherry-post-formats-custom-init', function( event ) { 279 280 if ( 'slider' !== event.object ) { 281 return; 282 } 283 284 var uniqId = '#' + event.item.attr( 'id' ), 285 swiper = new Swiper( uniqId, { 286 pagination: uniqId + ' .swiper-pagination', 287 paginationClickable: true, 288 nextButton: uniqId + ' .swiper-button-next', 289 prevButton: uniqId + ' .swiper-button-prev', 290 spaceBetween: 0, 291 onInit: function() { 292 $( uniqId + ' .swiper-button-next' ).css( { 'display': 'block' } ); 293 $( uniqId + ' .swiper-button-prev' ).css( { 'display': 'block' } ); 294 } 295 } ); 296 297 event.item.data( 'initalized', true ); 298 } ); 299 300 var items = []; 301 302 $( '.mini-gallery .post-thumbnail__link' ).on( 'click', function( event ) { 303 event.preventDefault(); 304 305 $( this ).parents( '.mini-gallery' ).find( '.post-gallery__slides > a[href]' ).each( function() { 306 items.push( { 307 src: $( this ).attr( 'href' ), 308 type: 'image' 309 } ); 310 } ); 311 312 $.magnificPopup.open( { 313 items: items, 314 gallery: { 315 enabled: true 316 } 317 } ); 318 } ); 319 }, 320 321 navbar_init: function( self ) { 322 323 $( window ).load( function() { 324 325 var $layout = window.sailfish.labels.header_layout, 326 $navbar = ( 'style-3' === $layout || 'style-7' === $layout ) ? $( '.vertical-menu-toggle' ) : $( '#main-menu' ); 327 328 if ( !$.isFunction( jQuery.fn.stickUp ) || undefined === window.sailfish.stickUp || !$navbar.length ) { 329 return !1; 330 } 331 332 $navbar.stickUp( { 333 correctionSelector: '#wpadminbar', 334 listenSelector: '.listenSelector', 335 pseudo: true, 336 active: true 337 } ); 338 CherryJsCore.variable.$document.trigger( 'scroll.stickUp' ); 339 340 } ); 341 }, 342 343 subscribe_init: function( self ) { 344 CherryJsCore.variable.$document.on( 'click', '.subscribe-block__submit', function( event ) { 345 346 event.preventDefault(); 347 348 var $this = $( this ), 349 form = $this.parents( 'form' ),
350 nonce = form.find( 'input[name="nonce"]' ).val(), 351 mail_input = form.find( 'input[name="subscribe-mail"]' ), 352 mail = mail_input.val(), 353 error = form.find( '.subscribe-block__error' ), 354 success = form.find( '.subscribe-block__success' ), 355 hidden = 'hidden'; 356 357 if ( '' === mail ) { 358 mail_input.addClass( 'error' ); 359 return !1; 360 } 361 362 if ( $this.hasClass( 'processing' ) ) { 363 return !1; 364 } 365 366 $this.addClass( 'processing' ); 367 error.empty(); 368 mail_input.removeClass( 'error' ); 369 370 if ( !error.hasClass( hidden ) ) { 371 error.addClass( hidden ); 372 } 373 374 if ( !success.hasClass( hidden ) ) { 375 success.addClass( hidden ); 376 } 377 378 $.ajax( { 379 url: sailfish.ajaxurl, 380 type: 'post', 381 dataType: 'json', 382 data: { 383 action: 'sailfish_subscribe', 384 mail: mail, 385 nonce: nonce 386 }, 387 error: function() { 388 $this.removeClass( 'processing' ); 389 } 390 } ).done( function( response ) { 391 392 $this.removeClass( 'processing' ); 393 394 if ( true === response.success ) { 395 success.removeClass( hidden ); 396 mail_input.val( '' ); 397 return 1; 398 } 399 400 error.removeClass( hidden ).html( response.data.message ); 401 mail_input.addClass( 'error' ); 402 return !1; 403 404 } ); 405 406 } ); 407 }, 408 409 410 isMegaMenuEnabled: function() { 411 412 if ( undefined === window.sailfish.megaMenu ) { 413 return false; 414 } 415 416 if ( true === window.sailfish.megaMenu.isActive && 'main' == window.sailfish.megaMenu.location ) { 417 return true; 418 } 419 420 return false; 421 }, 422 423 main_menu: function( self, $mainNavigation ) { 424 425 if ( self.isMegaMenuEnabled() ) { 426 //return; 427 } 428 429 var transitionend = 'transitionend oTransitionEnd webkitTransitionEnd', 430 moreMenuContent = '···', 431 imgurl = '', 432 srcset = '', 433 hasimg = false, 434 hasicon = false, 435 hasprop = Object.prototype.hasOwnProperty, 436 $menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]', $mainNavigation ), 437 liWithChildren = 'li.menu-item-has-children, li.page_item_has_children', 438 $body = $( 'body' ), 439 $parentNode, 440 menuItem, 441 subMenu, 442 index = -1, 443 $layout = window.sailfish.labels.header_layout; 444 445 if ( hasprop.call( window, 'sailfish' ) && 446 hasprop.call( window.sailfish, 'more_button_options' ) && 447 hasprop.call( window.sailfish.more_button_options, 'more_button_type' ) ) { 448 switch ( window.sailfish.more_button_options.more_button_type ) { 449 case 'image': 450 imgurl = window.sailfish.more_button_options.more_button_image_url; 451 if ( window.sailfish.more_button_options.retina_more_button_image_url ) { 452 srcset = ' srcset="' + window.sailfish.more_button_options.retina_more_button_image_url + ' 2x"'; 453 } 454 moreMenuContent = '<img src="' + imgurl + '"' + srcset + ' alt="' + moreMenuContent + '">'; 455 hasimg = true; 456 break; 457 case 'icon': 458 moreMenuContent = '<i class="fa ' + window.sailfish.more_button_options.more_button_icon + '"></i>'; 459 hasicon = true; 460 break; 461 case 'text': 462 default: 463 moreMenuContent = window.sailfish.more_button_options.more_button_text || moreMenuContent; 464 hasimg = false; 465 hasicon = false; 466 break; 467 } 468 } 469 470 if ( 'style-3' !== $layout && 'style-7' !== $layout ) { 471 $mainNavigation.superGuacamole( { 472 threshold: 768, // Minimal menu width, when this plugin activates 473 minChildren: 3, // Minimal visible children count 474 childrenFilter: '.menu-item', // Child elements selector 475 menuTitle: moreMenuContent, // Menu title 476 menuUrl: '#', 477 templates: { 478 menu: '<li id="%5$s" class="%1$s' + ( hasimg ? ' super-guacamole__menu-with-image' : '' ) + 479 ( hasicon ? ' super-guacamole__menu-with-icon' : '' ) + '"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>', 480 child_wrap: '<ul class="%1$s">%2$s</ul>', 481 child: '<li id="%5$s" class="%1$s"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>' 482 } 483 } ); 484 } 485 486 function hideSubMenu( menuItem, $event ) { 487 var subMenus = menuItem.find( '.sub-menu' ), 488 subMenu = menuItem.children( '.sub-menu' ).first(); 489 490 menuItem 491 .removeData( 'index' ) 492 .removeClass( 'menu-hover' ); 493 494 subMenu.addClass( 'in-transition' ); 495 496 subMenus 497 .one( transitionend, function() { 498 subMenus.removeClass( 'in-transition' ); 499 } ); 500 } 501 502 function handleMenuItemHover( $event ) { 503 if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) { 504 return; 505 } 506 menuItem = $( $event.target ).parents( '.menu-item' ); 507 subMenu = menuItem.children( '.sub-menu' ).first(); 508 509 var subMenus = menuItem.find( '.sub-menu' ); 510 511 if ( !menuItem.hasClass( 'menu-item-has-children' ) ) { 512 menuItem = $event.target.tagName === 'LI' ? 513 $( $event.target ) : 514 $( $event.target ).parents().filter( '.menu-item' ); 515 } 516 517 switch ( $event.type ) { 518 case 'mouseenter': 519 case 'mouseover': 520 if ( 0 < subMenu.length ) { 521 var maxWidth = $body.outerWidth( true ), 522 subMenuOffset = subMenu.offset().left + subMenu.outerWidth( true ); 523 menuItem.addClass( 'menu-hover' ); 524 subMenu.addClass( 'in-transition' ); 525 if ( maxWidth <= subMenuOffset ) { 526 subMenu.addClass( 'left-side' ); 527 subMenu.find( '.sub-menu' ).addClass( 'left-side' ); 528 } else if ( 0 > subMenu.offset().left ) { 529 subMenu.removeClass( 'left-side' ); 530 subMenu.find( '.sub-menu' ).removeClass( 'left-side' ); 531 } 532 subMenus 533 .one( transitionend, function() { 534 subMenus.removeClass( 'in-transition' ); 535 } ); 536 } 537 break; 538 case 'mouseleave': 539 case 'mouseout': 540 hideSubMenu( menuItem, $event ); 541 break; 542 } 543 } 544 545 CherryJsCore.variable.$window.on( 'orientationchange resize', function() { 546 if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) { 547 return; 548 } 549 $mainNavigation.find( '.menu-item' ).removeClass( 'menu-hover' ); 550 $mainNavigation.find( '.sub-menu.left-side' ).removeClass( 'left-side' ); 551 } ); 552 553 $( liWithChildren ).hoverIntent( { 554 over: function() { 555 }, 556 out: function() { 557 }, 558 timeout: 300, 559 selector: '.menu-item' 560 } ); 561 562 $mainNavigation.on( 'mouseenter mouseover mouseleave mouseout', '.menu-item', handleMenuItemHover ); 563 564 function doubleClickMenu( $jqEvent ) { 565 $parentNode = $( this ); 566 567 if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) { 568 return true; 569 } 570 571 var menuIndex = $parentNode.index(); 572 573 if ( menuIndex !== parseInt( $parentNode.data( 'index' ), 10 ) ) { 574 $jqEvent.preventDefault(); 575 } 576 577 $parentNode.data( 'index', menuIndex ); 578 } 579 580 // Check if touch events supported
581 if ( 'ontouchend' in window ) { 582 583 // Attach event listener for double click 584 $( liWithChildren, $mainNavigation ) 585 .on( 'click', doubleClickMenu ); 586 587 // Reset index on touchend event 588 CherryJsCore.variable.$document.on( 'touchend', function( $jqEvent ) { 589 if ( !$( 'html' ).hasClass( 'mobile-menu-active' ) ) { 590 $parentNode = $( $jqEvent.target ).parents().filter( '.menu-item:first' ); 591 592 if ( $parentNode.hasClass( 'menu-hover' ) === false ) { 593 hideSubMenu( $parentNode, $jqEvent ); 594 595 index = $parentNode.data( 'index' ); 596 597 if ( index ) { 598 $parentNode.data( 'index', parseInt( index, 10 ) - 1 ); 599 } 600 } 601 } 602 } ); 603 } 604 605 $menuToggle.on( 'click', function( $event ) { 606 $event.preventDefault(); 607 $mainNavigation.toggleClass( 'toggled' ); 608 } ); 609 }, 610 611 mega_menu: function( self ) { 612 613 /** 614 * Mega-menu mobile SubMenu Toggled. 615 */ 616 function megaMenuSubMenuToggled() { 617 $( this ).toggleClass( 'active' ); 618 } 619 620 // ADD to Mega-menu sub-menu toggle active class. 621 $( '.mega-menu-mobile-arrow' ).on( 'click', megaMenuSubMenuToggled ); 622 }, 623 624 mobile_menu: function( self ) { 625 626 var $mainNavigation = $( '.main-navigation' ), 627 $menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]' ); 628 629 $mainNavigation 630 .find( 'li.menu-item-has-children > a' ) 631 .append( '<span class="sub-menu-toggle"></span>' ); 632 633 /** 634 * Debounce the function call 635 * 636 * @param {number} threshold The delay. 637 * @param {Function} callback The function. 638 */ 639 function debounce( threshold, callback ) { 640 var timeout; 641 642 return function debounced( $event ) { 643 function delayed() { 644 callback.call( this, $event ); 645 timeout = null; 646 } 647 648 if ( timeout ) { 649 clearTimeout( timeout ); 650 } 651 652 timeout = setTimeout( delayed, threshold ); 653 }; 654 } 655 656 /** 657 * Resize event handler. 658 * 659 * @param {jqEvent} jQuery event. 660 */ 661 function resizeHandler( $event ) { 662 var $window = CherryJsCore.variable.$window, 663 width = $window.outerWidth( true ); 664 665 if ( 768 <= width ) { 666 $mainNavigation.removeClass( 'mobile-menu' ); 667 } else { 668 $mainNavigation.addClass( 'mobile-menu' ); 669 } 670 } 671 672 /** 673 * Toggle sub-menus. 674 * 675 * @param {jqEvent} $event jQuery event. 676 */ 677 function toggleSubMenuHandler( $event ) { 678 679 $event.preventDefault(); 680 681 $( this ).toggleClass( 'active' ); 682 $( this ).parents().filter( 'li:first' ).toggleClass( 'sub-menu-open' ); 683 } 684 685 /** 686 * Toggle menu. 687 * 688 * @param {jqEvent} $event jQuery event. 689 */ 690 function toggleMenuHandler( $event ) { 691 var $toggle = $( '.sub-menu-toggle' ); 692 693 if ( !$event.isDefaultPrevented() ) { 694 $event.preventDefault(); 695 } 696 697 setTimeout( function() { 698 if ( !$mainNavigation.hasClass( 'animate' ) ) { 699 $mainNavigation.addClass( 'animate' ); 700 } 701 $mainNavigation.toggleClass( 'show' ); 702 $( 'html' ).toggleClass( 'mobile-menu-active' ); 703 }, 10 ); 704 705 $menuToggle.toggleClass( 'toggled' ); 706 $menuToggle.attr( 'aria-expanded', !$menuToggle.hasClass( 'toggled' ) ); 707 708 if ( $toggle.hasClass( 'active' ) ) { 709 $toggle.removeClass( 'active' ); 710 $mainNavigation.find( '.sub-menu-open' ).removeClass( 'sub-menu-open' ); 711 } 712 } 713 714 resizeHandler(); 715 CherryJsCore.variable.$window.on( 'resize orientationchange', debounce( 500, resizeHandler ) ); 716 $( '.sub-menu-toggle', $mainNavigation ).on( 'click', toggleSubMenuHandler ); 717 $menuToggle.on( 'click', toggleMenuHandler ); 718 }, 719 720 page_preloader_init: function( self ) { 721 722 if ( $( '.page-preloader-cover' )[0] ) { 723 $( '.page-preloader-cover' ).delay( 500 ).fadeTo( 500, 0, function() { 724 $( this ).remove(); 725 } ); 726 } 727 }, 728 729 to_top_init: function( self ) { 730 if ( $.isFunction( jQuery.fn.UItoTop ) && undefined !== window.sailfish.toTop ) { 731 $().UItoTop( { 732 text: sailfish.labels.totop_button, 733 scrollSpeed: 600 734 } ); 735 } 736 }, 737 738 ofi_init: function( self ) { 739 if ( $( 'body' ).hasClass( 'ie' ) && 'undefined' !== typeof objectFitImages ) { 740 objectFitImages(); 741 } 742 }, 743 744 playlist_slider_widget_init: function( self ) { 745 $( '.widget-playlist-slider .playlist-slider' ).each( function() { 746 var $this = $( this ), 747 settings = $this.data( 'settings' ), 748 breakpoints = JSON.parse( settings.breakpoints ); 749 750 $this.sliderPro( { 751 autoplay: false, 752 width: settings['width'], 753 height: parseInt( settings['height'] ), 754 orientation: 'vertical', 755 waitForLayers: false, 756 touchSwipe: false, 757 updateHash: false, 758 arrows: settings['arrows'], 759 buttons: settings['buttons'], 760 thumbnailArrows: settings['thumbnailArrows'], 761 thumbnailsPosition: settings['thumbnailsPosition'], 762 thumbnailPointer: true, 763 thumbnailWidth: settings['thumbnailWidth'], 764 thumbnailHeight: settings['thumbnailHeight'], 765 breakpoints: breakpoints, 766 init: function() { 767 $this.resize().fadeTo( 0, 1 ); 768 }, 769 gotoSlideComplete: function( event ) { 770 var prevSlide = $( '.sp-slide', $this ).eq( event.previousIndex ),
771 iframe = prevSlide.find( 'iframe' ), 772 html5Video = prevSlide.find( 'video' ); 773 774 if ( iframe[0] ) { 775 var iframeSrc = iframe.attr( 'src' ); 776 777 iframe.attr( 'src', iframeSrc ); 778 } else if ( html5Video[0] ) { 779 html5Video[0].stop(); 780 } 781 } 782 } ); 783 } ); 784 }, 785 news_smart_box_init: function( self ) { 786 jQuery( '.news-smart-box__instance' ).each( function() { 787 var uniqId = $( this ).data( 'uniq-id' ), 788 instanceSettings = $( this ).data( 'instance-settings' ), 789 instance = $( '#' + uniqId ), 790 $termItem = $( '.news-smart-box__navigation-terms-list-item', instance ), 791 $currentTerm = $( '.news-smart-box__navigation-title', instance ), 792 $listContainer = $( '.news-smart-box__wrapper', instance ), 793 $ajaxPreloader = $( '.nsb-spinner', instance ), 794 $termsList = $( '.news-smart-box__navigation-terms-list', instance ), 795 $menuToggle = $( '.menu-toggle', instance ), 796 ajaxGetNewInstance = null, 797 ajaxGetNewInstanceSuccess = true, 798 showNewItems = null; 799 800 $termItem.each( function() { 801 var slug = $( this ).data( 'slug' ); 802 803 if ( 'category' === instanceSettings.terms_type ) { 804 if ( slug === instanceSettings.current_category ) { 805 $( this ).addClass( 'is-active' ); 806 } 807 } else { 808 if ( slug === instanceSettings.current_tag ) { 809 $( this ).addClass( 'is-active' ); 810 } 811 } 812 } ); 813 814 $menuToggle.on( 'click', function( $jqEvent ) { 815 $jqEvent.preventDefault(); 816 $menuToggle.toggleClass( 'news-smart-box__navigation-toggle--open' ); 817 $termsList.toggleClass( 'news-smart-box__navigation-terms-list--open' ); 818 } ); 819 820 $termItem.on( 'click', function() { 821 var slug = $( this ).data( 'slug' ), 822 data = { 823 action: 'new_smart_box_instance', 824 value_slug: slug, 825 instance_settings: instanceSettings 826 }, 827 currentTermName = $( this ).text(), 828 counter = 0; 829 830 if ( !$( this ).hasClass( 'is-active' ) ) { 831 $termItem.removeClass( 'is-active' ); 832 $( this ).addClass( 'is-active' ); 833 } 834 835 $currentTerm.html( currentTermName ); 836 837 if ( ajaxGetNewInstance !== null ) { 838 ajaxGetNewInstance.abort(); 839 } 840 ajaxGetNewInstance = $.ajax( { 841 type: 'GET', 842 url: sailfish.ajaxurl, 843 data: data, 844 cache: false, 845 beforeSend: function() { 846 ajaxGetNewInstanceSuccess = false; 847 $ajaxPreloader.css( { 'display': 'block' } ).fadeTo( 300, 1 ); 848 }, 849 success: function( response ) { 850 ajaxGetNewInstanceSuccess = true; 851 852 $ajaxPreloader.fadeTo( 300, 0, function() { 853 $( this ).css( { 'display': 'none' } ); 854 } ); 855 856 $( '.news-smart-box__listing', $listContainer ).html( response ); 857 858 counter = 0; 859 $( '.news-smart-box__item-inner', $listContainer ).addClass( 'animate-cycle-sh
859ow' ); 860 $( '.news-smart-box__item', $listContainer ).each( function() { 861 showItem( $( this ), 100 * parseInt( counter ) + 200 ); 862 counter++; 863 } ) 864 865 } 866 } ); 867 868 } ); 869 870 var showItem = function( itemList, delay ) { 871 var timeOutInterval = setTimeout( function() { 872 $( '.news-smart-box__item-inner', itemList ).removeClass( 'animate-cycle-show' ); 873 }, delay ); 874 } 875 } ); 876 }, 877 header_search: function( self ) { 878 var $header = $( '.site-header' ), 879 $searchToggle = $( '.search-form__toggle, .search-form__close', $header ), 880 $headerSearch = $( '.header-search', $header ), 881 $searchInput = $( '.search-form__field', $headerSearch ), 882 searchHandler = function( event ) { 883 $header.toggleClass( 'search-active' ); 884 if ( $header.hasClass( 'search-active' ) ) { 885 $searchInput.focus(); 886 } 887 }, 888 removeActiveClass = function( event ) { 889 if ( $( event.target ).closest( $searchToggle ).length || $( event.target ).closest( $headerSearch ).length ) { 890 return; 891 } 892 893 if ( $header.hasClass( 'search-active' ) ) { 894 $header.removeClass( 'search-active' ); 895 } 896 897 event.stopPropagation(); 898 }; 899 900 $searchToggle.on( 'click', searchHandler ); 901 CherryJsCore.variable.$document.on( 'click', removeActiveClass ); 902 903 }, 904 vertical_menu_init: function( self ) { 905 var $mainNavigation = $( '.main-navigation.vertical-menu' ), 906 $mainMenu = $( '.menu', $mainNavigation ), 907 $back = $( '.back', $mainNavigation ), 908 $close = $( '.close', $mainNavigation ), 909 currentTranslate = parseInt( $mainMenu.css( 'transform' ) ), 910 isAnimate = false, 911 offset = 300; 912 913 resizeHandler(); 914 CherryJsCore.variable.$window.on( 'resize', resizeHandler ); 915 916 function resizeHandler( event ) { 917 var $window = CherryJsCore.variable.$window, 918 width = $window.outerWidth( true ); 919 920 if ( 768 > width ) { 921 $mainNavigation.removeClass( 'vertical-menu' ); 922 923 $( '.vertical-menu-toggle' ).off( 'click.open', openHandler ); 924 $( '.menu-item-has-children > a', $mainNavigation ).off( 'click.active', clickHandler ); 925 $back.off( 'click.back', backHandler ); 926 $close.off( 'click.close', closeHandler ); 927 $mainMenu.removeClass( 'scroll' ); 928 929 $( '.main-navigation .menu' ).css( 'transform', 'translateX(0)' ); 930 } else { 931 $mainNavigation.addClass( 'vertical-menu' ); 932 933 $( '.vertical-menu-toggle' ).on( 'click.open', openHandler ); 934 $( '.menu-item-has-children > a', $mainNavigation ).on( 'click.active', clickHandler ); 935 $back.on( 'click.back', backHandler ); 936 $close.on( 'click.close', closeHandler ); 937 $mainMenu.addClass( 'scroll' ); 938 } 939 } 940 941 $( '.menu-item-has-children', $mainNavigation ).each( function() { 942 var $li = $( this ), 943 $link = $( '>a', $li ), 944 linkText = $link.html(), 945 linkHref = $link[0].cloneNode( true ), 946 $subMenu = $( '> .sub-menu', $li ); 947 $subMenu.prepend( '<li class="parent-title"><a href="' + linkHref + '">' + linkText + '</a></li>' ); 948 } ); 949 950 function openHandler( event ) { 951 $( this ).toggleClass( 'toggled' ); 952 if ( $mainNavigation.hasClass( 'menu-open' ) ) { 953 closeHandler(); 954 return false; 955 } 956 $mainNavigation.toggleClass( 'menu-open' ); 957 } 958 959 function backHandler( event ) { 960 var currentTranslate = parseInt( ($mainMenu.css( 'transform' ).replace( /,/g, "" )).split( " " )[4] ), 961 translate = currentTranslate + offset, 962 $active = $( '.active', $mainMenu ), 963 $lastActive = $( $active[$active.length - 1] ); 964 965 if ( isAnimate ) { 966 return false; 967 } 968 969 if ( currentTranslate < 0 ) { 970 isAnimate = true; 971 $mainMenu.css( 'transform', 'translateX(' + translate + 'px)' ); 972 973 if ( translate >= 0 ) { 974 translate = 0; 975 $( this ).addClass( 'hide' ); 976 $close.removeClass( 'hide' ); 977 } 978 979 setTimeout( function() { 980 $lastActive.removeClass( 'active' ); 981 $lastActive.siblings().toggleClass( 'hide' ); 982 $( '>a', $lastActive ).removeClass( 'hide' ); 983 $lastActive.parent().addClass( 'scroll' ); 984 isAnimate = false;
985 }, 250 ); 986 987 } 988 return false; 989 } 990 991 function closeHandler( event ) { 992 if ( !isAnimate ) { 993 $( '.active', $mainMenu ).removeClass( 'active' ); 994 $( '.hide', $mainMenu ).removeClass( 'hide' ); 995 $( '.close.hide', $mainNavigation ).removeClass( 'hide' ); 996 $back.addClass( 'hide' ); 997 $mainNavigation.removeClass( 'menu-open' ); 998 $mainMenu.css( 'transform', 'translateX(0)' ); 999 } 1000 1001 $( '.vertical-menu-toggle' ).removeClass( 'toggled' ); 1002 return false; 1003 } 1004 1005 function clickHandler( event ) { 1006 var $_target = $( event.currentTarget ), 1007 $mainMenu = $_target.closest( '.menu' ), 1008 deep = $_target.parents( 'ul' ).length, 1009 translate = deep * offset; 1010 1011 $mainMenu.css( 'transform', 'translateX(' + -translate + 'px)' ); 1012 1013 setTimeout( function() { 1014 $_target.parent().addClass( 'active' ); 1015 $_target.parent().siblings().toggleClass( 'hide' ); 1016 $_target.parents( '.active' ).find( '> a' ).addClass( 'hide' ); 1017 $_target.siblings( 'ul' ).addClass( 'scroll' ); 1018 $_target.parents( 'ul' ).removeClass( 'scroll' ); 1019 }, 250 ); 1020 1021 $back.removeClass( 'hide' ); 1022 $close.addClass( 'hide' ); 1023 1024 return false; 1025 } 1026 }, 1027 1028 add_project_inline_style: function( self ) { 1029 var $projectGridContainer = $( '.projects-container.grid-layout' ), 1030 $projectJustifiedContainer = $( '.projects-container.justified-layout' ), 1031 $projectGridTermsContainer = $( '.projects-terms-container.grid-layout' ), 1032 $projectContainer = $( '.projects-container' ), 1033 1034 addInlineStyle = function() { 1035 var $this = $( this ), 1036 $projectsSettings = $this.data( 'settings' ), 1037 $projectItemIndent = Math.ceil( +$projectsSettings['item-margin'] ); 1038 1039 $this.css( { 1040 'margin-left': -$projectItemIndent / 2 + 'px', 1041 'margin-right': -$projectItemIndent / 2 + 'px' 1042 } ); 1043 }, 1044 1045 addTemplateClass = function() { 1046 var $this = $( this ), 1047 $projectsSettings = $this.data( 'settings' ), 1048 $projectsTemplate = $projectsSettings['template']; 1049 1050 if ( $projectsTemplate ) { 1051 $this.addClass( $projectsTemplate.replace( '.', '-' ) ); 1052 } 1053 }; 1054 1055 $projectGridContainer.each( addInlineStyle ); 1056 $projectJustifiedContainer.each( addInlineStyle ); 1057 $projectGridTermsContainer.each( addInlineStyle ); 1058 1059 $projectContainer.each( addTemplateClass ); 1060 } 1061 }; 1062 CherryJsCore.theme_script.init(); 1063 1064}( 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.