1jQuery(document).ready(function(){ 2 "use strict"; 3 setClusterData(); 4 checkClusterWidth(); 5}); 6 7jQuery(window).resize(function(){ 8 checkClusterWidth(); 9}); 10 11function checkClusterWidth () { 12 const width = window.innerWidth; 13 jQuery('.citadela-block-custom-container.responsive-options').each(function(){ 14 const $cluster = jQuery( this ); 15 $cluster.trigger( 'screen-resized', [ width ] ); 16 }); 17} 18 19function setClusterData(){ 20 jQuery('.citadela-block-custom-container.responsive-options').each(function(){ 21 const $cluster = jQuery( this ); 22 const $bgImage = $cluster.children('.bg-image-wrapper'); 23 // image background was moved to separated div, check to keep backward compatibility 24 const $imageCssHolder = $bgImage.length ? $bgImage : $cluster; 25 const sizeClasses = [ 'cover', 'full-horizontal', 'full-vertical', 'auto' ]; 26 var sizeClass = ''; 27 jQuery.each( sizeClasses, function( index, value ){ 28 if( $cluster.hasClass( `bg-size-${value}` ) ) sizeClass = `bg-size-${value}`; 29 }); 30 31 const desktopAttrs = { 32 backgroundImage: $imageCssHolder.css( 'backgroundImage' ), 33 size: sizeClass, 34 fixed: $cluster.hasClass( 'fixed-bg' ) ? true : false, 35 position: $imageCssHolder.css( 'backgroundPosition' ), 36 repeat: $imageCssHolder.css( 'backgroundRepeat' ), 37 radius: $imageCssHolder.css( 'borderRadius' ), 38 } 39 40 // if mobile attrs were not defined, are same as desktop settings 41 const mobileAttrs = $cluster.data( 'block-attr' ); 42 mobileAttrs.backgroundImage = mobileAttrs.backgroundImage === undefined ? desktopAttrs.backgroundImage : mobileAttrs.backgroundImage; 43 mobileAttrs.size = mobileAttrs.size === undefined ? desktopAttrs.size : mobileAttrs.size; 44 mobileAttrs.fixed = mobileAttrs.fixed === undefined ? desktopAttrs.fixed : mobileAttrs.fixed; 45 mobileAttrs.position = mobileAttrs.position === undefined ? desktopAttrs.position : mobileAttrs.position; 46 mobileAttrs.repeat = desktopAttrs.repeat; 47 mobileAttrs.radius = desktopAttrs.radius; 48 49 const breakpoint = $cluster.data( 'block-mobile-breakpoint' ); 50 51 $cluster.on( 'screen-resized', function( event, width ){ 52 if( width < breakpoint ){ 53 //mobile 54 if( mobileAttrs.disableBackgroundImage ){ 55 $imageCssHolder.css( 'backgroundImage', '' ); 56 $imageCssHolder.css( 'backgroundPosition', '' ); 57 $imageCssHolder.css( 'backgroundRepeat', '' ); 58 $imageCssHolder.css( 'backgroundRadius', '' ); 59 if( $imageCssHolder.hasClass('bg-image-wrapper') ){ 60 $imageCssHolder.hide(); 61 } 62 63 }else{ 64 $imageCssHolder.css( 'backgroundImage', mobileAttrs.backgroundImage ); 65 $cluster.removeClass( desktopAttrs.size ).addClass( mobileAttrs.size ); 66 $imageCssHolder.css( 'backgroundPosition', mobileAttrs.position ); 67 $imageCssHolder.css( 'backgroundRepeat', mobileAttrs.repeat ); 68 $imageCssHolder.css( 'backgroundRadius', mobileAttrs.radius ); 69 70 if( mobileAttrs.fixed ){ 71 $cluster.addClass( 'fixed-bg' ); 72 $imageCssHolder.css( 'backgroundPosition', '' ); 73 }else{ 74 $cluster.removeClass( 'fixed-bg' ); 75 } 76 } 77 } else { 78 //desktop 79 if( $imageCssHolder.hasClass('bg-image-wrapper') ){ 80 $imageCssHolder.show(); 81 } 82 $imageCssHolder.css( 'backgroundImage', desktopAttrs.backgroundImage ); 83 $cluster.removeClass( mobileAttrs.size ).addClass( desktopAttrs.size ); 84 $imageCssHolder.css( 'backgroundPosition', desktopAttrs.position ); 85 $imageCssHolder.css( 'backgroundRepeat', desktopAttrs.repeat ); 86 $imageCssHolder.css( 'backgroundRadius', desktopAttrs.radius ); 87 88 if( desktopAttrs.fixed ){ 89 $cluster.addClass( 'fixed-bg' ); 90 $imageCssHolder.css( 'backgroundPosition', '' ); 91 }else{ 92 $cluster.removeClass( 'fixed-bg' ); 93 } 94 } 95 }); 96 97 //show background 98 $cluster.removeClass( "loading-image" ); 99 }); 100 101 102}
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.