/** ***************************************************************************************** ** CONTENT BOXES BLOCK ********************************************************************** *********************************************************************************************/ ( function( jQuery ) { 'use strict'; function cbinit() { /* remove links from backend content boxes */ jQuery('.editor-styles-wrapper .contentboxes-wrap a').removeAttr("href"); /* fix margins */ jQuery( ".subtitle-above" ).next().css( "margin-top", "12px" ); // RTL if (jQuery('body').hasClass("rtl")) { var rtlorigin = false; } else { var rtlorigin = true; } var jQuerycontentboxesgrid = jQuery('.contentboxes-masonry'); jQuerycontentboxesgrid.imagesLoaded( function() { jQuerycontentboxesgrid.masonry({ percentPosition: true, isOriginLeft: rtlorigin }); }); // content box one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //content boxes height - square jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait high jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width() - 24; if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); /* resizing */ jQuery(window).on('load',CBsizeContent); jQuery(window).on('resize',CBsizeContent); function CBsizeContent() { var windowWidth = jQuery(window).width(); var windowHeight = jQuery(window).height(); var topbarHeight = jQuery(".topbar").height(); var headerHeight = jQuery("header").height(); var viewheight = windowHeight - topbarHeight - headerHeight + 24; /* 100% vh of content boxes */ if (windowWidth < 960) { jQuery('.contentboxes-image-wrap.no-content.mobile-viewheight, .contentboxes-image-wrap.has-content.mobile-viewheight').each(function(){ jQuery(this).css( "height" , viewheight ); }); } // content box one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //content boxes height - 100% (square) jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half 50% (landscape) jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - half 75% (landscape high) jQuery('.contentboxes-image-wrap.three-quarter-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var threequarterboxheight = boxheight * 1.34; var boxwidth = jQuery(this).width(); if (threequarterboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (threequarterboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - 150% (portrait) jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - 200% (portrait high) jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width(); if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); /* RESPONSIVE RESIZING */ if (windowWidth < 1200) { //content boxes height - portrait jQuery('.contentboxes-image-wrap.quarter-width.double-height.has-content').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width(); if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); } if (windowWidth < 960) { //content boxes height mobile - square jQuery('.contentboxes-image-wrap.mobile-square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half jQuery('.contentboxes-image-wrap.mobile-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); } } } jQuery( document ).ready( cbinit ); jQuery( document ).on( 'mb_blocks_preview/contentboxes', cbinit ); } )( jQuery ); /** ***************************************************************************************** ** HERO BLOCK **************************************************************************** *********************************************************************************************/ ( function( jQuery ) { 'use strict'; function cbinit() { jQuery(window).on('load',sizeContentHero); jQuery(window).on('resize',sizeContentHero); jQuery(document).on('mb_blocks_preview/hero-image',sizeContentHero); jQuery('.section-hero').on('mb_blocks_preview/hero-video',sizeContentHero); function sizeContentHero() { var windowWidth = jQuery(window).width(); var windowHeight = jQuery(window).height(); var topbarHeight = jQuery(".topbar").height(); var headerHeight = jQuery("header").height(); var viewheight = windowHeight - topbarHeight - headerHeight; console.log('window height = ' + windowHeight); console.log('top bar height = ' + topbarHeight); console.log('header height = ' + headerHeight); console.log('view height = ' + viewheight); /* 100% vh of hero image block */ jQuery('.full-viewheight .hero-image').each(function(){ jQuery(this).css( "min-height" , viewheight ); }); if (windowWidth < 960) { jQuery('.full-viewheightmobile .hero-image').each(function(){ jQuery(this).css( "min-height" , viewheight ); }); } jQuery('.section-hero').each(function(){ var imageheight = jQuery(this).find('.hero-background').outerHeight(); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > imageheight ) { jQuery(this).find('.hero-background').css( "height" , contentheight ); } else if (imageheight > contentheight ) { jQuery(this).find('.hero-background').css( "height" , '' ); } }); /* 100% vh of hero video block */ jQuery('.full-viewheight .hero-bgvideo-wrap').each(function(){ jQuery(this).find('.hero-bgvideo').css( "min-height" , viewheight ); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , contentheight ); } else if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , viewheight ); } }); if (windowWidth < 960) { jQuery('.full-viewheightmobile .hero-bgvideo-wrap').each(function(){ jQuery(this).find('.hero-bgvideo').css( "min-height" , viewheight ); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , contentheight ); } else if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , viewheight ); } }); } } // Tooltip jQuery( document ).on( 'mb_blocks_preview/hero-image', function( e ) { var herocontent = jQuery(e.target ).find('.hero-content'); jQuery( herocontent ).append( "
Edit content in the block settings on the right side.
" ); jQuery( e.target ).find('.hero-content').on( "dblclick", function( event ) { jQuery(this).find('.block-tooltip').fadeIn(300).delay(3000).fadeOut(300); }); } ); } jQuery( document ).ready( cbinit ); jQuery( document ).on( 'mb_blocks_preview/hero-image', cbinit ); } )( jQuery ); /** ***************************************************************************************** ** GALLERY BLOCK **************************************************************************** *********************************************************************************************/ jQuery(document).on('mb_blocks_preview/gallery', function(){ 'use strict'; /* masonry */ var jQuerygallerygrid = jQuery('.gallery-images-masonry'); jQuerygallerygrid.imagesLoaded( function() { jQuerygallerygrid.masonry({ percentPosition: true, }); }); }); /** ***************************************************************************************** ** MENU BLOCK ******************************************************************************* *********************************************************************************************/ jQuery(document).on('mb_blocks_preview/menu mb_blocks_preview/menutabs', function(){ 'use strict'; // RTL if (jQuery('body').hasClass("rtl")) { var rtlorigin = false; } else { var rtlorigin = true; } var jQuerygridnested = jQuery('.menu-items.masonry-nested'); jQuerygridnested.imagesLoaded( function() { jQuerygridnested.masonry({ itemSelector: '.masonry-box-nested', percentPosition: true, transitionDuration: 0, stamp: '.stamp', isOriginLeft: rtlorigin }); }); var jQuerymenugrid = jQuery('.menu-categories.menu-masonry'); jQuerymenugrid.imagesLoaded( function() { jQuerymenugrid.masonry({ itemSelector: '.masonry-box', percentPosition: true, transitionDuration: 0, isOriginLeft: rtlorigin }); }); }); /** ***************************************************************************************** ** MENU WITH TABS BLOCK ******************************************************************************* *********************************************************************************************/ jQuery(document).on('mb_blocks_preview/menutabs', function(){ 'use strict'; // RTL if (jQuery('body').hasClass("rtl")) { var rtlorigin = false; } else { var rtlorigin = true; } /** MENU TABS ***********************************************************/ var masonrynestedUpdate = function() { setTimeout(function() { var jQuerygridnested = jQuery('.menu-items.masonry-nested'); jQuerygridnested.masonry({ itemSelector: '.masonry-box-nested', percentPosition: true, transitionDuration: 0, isOriginLeft: rtlorigin }); }, 0); }; var masonryUpdate = function() { setTimeout(function() { var jQuerymenugrid = jQuery('.menu-categories.menu-masonry'); jQuerymenugrid.masonry({ itemSelector: '.masonry-box', percentPosition: true, transitionDuration: 0, isOriginLeft: rtlorigin }); }, 0); }; jQuery('.redsun-tabs a.button').on('click', function(e) { var jQuerygridnested = jQuery('.menu-items.masonry-nested'); var jQuerymenugrid = jQuery('.menu-categories.menu-masonry'); jQuerygridnested.on('click', masonrynestedUpdate); jQuerymenugrid.on('click', masonryUpdate); e.preventDefault(); }); jQuery( '.redsun-tabs' ).each(function() { jQuery( this ).find('li:first').addClass('active'); }); jQuery( '.redsun-tabs' ).each(function() { jQuery( this ).find('li:first').addClass('active'); }); jQuery( '.redsun-tabs' ).each(function() { jQuery( this ).find('a:first').show(); }); jQuery( '.redsun-tabs' ).each(function() { jQuery( this ).find('.tabpanel').not(':first').hide(); }); jQuery( '.redsun-tabs a' ).on('click', function(){ jQuery(this).parent( ".menu-tab" ).addClass('active'); jQuery(this).parent( ".menu-tab" ).siblings().removeClass('active'); jQuery(this).addClass('active').siblings().removeClass('active'); jQuery(jQuery(this).attr('href')).show().addClass('active').removeClass('sibling'); jQuery(jQuery(this).attr('href')).siblings().addClass('sibling').removeClass('active'); jQuery('.tabpanel.sibling').hide(); jQuery('.tabpanel.active').show(); var jQuerygridnested = jQuery('.menu-items.masonry-nested'); var jQuerymenugrid = jQuery('.menu-categories.menu-masonry'); //jQuerygridnested.on('click', masonrynestedUpdate); //jQuerymenugrid.on('click', masonryUpdate); jQuerygridnested.masonry('layout'); jQuerymenugrid.masonry('layout'); return false; }); }); /** ***************************************************************************************** ** TEAM BLOCK ********************************************************************** *********************************************************************************************/ jQuery(document).on('mb_blocks_preview/contentboxes mb_blocks_preview/team', function(){ 'use strict'; /* remove links from backend content boxes */ jQuery('.editor-styles-wrapper .contentboxes-wrap a').removeAttr("href"); /* fix margins */ jQuery( ".subtitle-above" ).next().css( "margin-top", "12px" ); // RTL if (jQuery('body').hasClass("rtl")) { var rtlorigin = false; } else { var rtlorigin = true; } var jQuerycontentboxesgrid = jQuery('.contentboxes-masonry'); jQuerycontentboxesgrid.imagesLoaded( function() { jQuerycontentboxesgrid.masonry({ percentPosition: true, isOriginLeft: rtlorigin }); }); // team one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //team boxes height - square jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //team boxes height - half jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //team boxes height - portrait jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //team boxes height - portrait high jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width() - 24; if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); /* resizing */ jQuery(window).on('load',TeamsizeContent); jQuery(window).on('resize',TeamsizeContent); function TeamsizeContent() { // content box one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //content boxes height - square jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait high jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width() - 24; if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); } }); // Dark or light skin var skin = soulkitchen_variables.skin; function themeskin(){ return [skin]; } // Tooltip jQuery( document ).on( 'mb_blocks_preview/contentboxes', function( e ) { 'use strict'; var cbcontent = jQuery(e.target ).find('.contentboxes-content'); jQuery( cbcontent ).append( "
Edit content in the block settings on the right side.
" ); jQuery( e.target ).find('.contentboxes-content').on( "dblclick", function( event ) { jQuery(this).find('.block-tooltip').fadeIn(300).delay(3000).fadeOut(300); }); } );