diff --git a/assets/js/src/custom.js b/assets/js/src/custom.js index 36a8b2f5..ace52a9d 100755 --- a/assets/js/src/custom.js +++ b/assets/js/src/custom.js @@ -51,7 +51,7 @@ if ( window.location.hash ) { lsx_to.readMoreText = $(this).contents().filter(function() { return this.nodeType === Node.TEXT_NODE; }).text(); - lsx_to.readMoreSet( $(this) ); + lsx_to.readMoreSet( $(this), $(this).closest( '.wp-block-group' ).find('.wp-block-post-content') ); } ); $( '.single-tour-operator .wp-block-read-more' ).on( 'click', function( event ) { @@ -59,17 +59,16 @@ if ( window.location.hash ) { $( this ).hide(); if ( $( this ).hasClass( 'less-link' ) ) { - lsx_to.readMoreSet($( this )); + lsx_to.readMoreSet( $(this), $(this).closest( '.wp-block-group' ).find('.wp-block-post-content') ); } else { - lsx_to.readMoreOpen($( this )); + lsx_to.readMoreOpen( $(this), $(this).closest( '.wp-block-group' ).find('.wp-block-post-content') ); } $( this ).show(); } ); }; - lsx_to.readMoreSet = function( button ) { - let contentWrapper = button.closest( '.wp-block-group' ).find('.wp-block-post-content'); + lsx_to.readMoreSet = function( button, contentWrapper ) { if ( 0 < contentWrapper.length ) { if ( 1 < contentWrapper.children().length ) { @@ -90,8 +89,7 @@ if ( window.location.hash ) { } } - lsx_to.readMoreOpen = function( button ) { - let contentWrapper = button.closest( '.wp-block-group' ).find('.wp-block-post-content'); + lsx_to.readMoreOpen = function( button, contentWrapper ) { if ( 0 < contentWrapper.children().length ) { contentWrapper.children().each( function() { if ( ! $(this).hasClass('wp-block-read-more') ) { @@ -116,7 +114,7 @@ if ( window.location.hash ) { $( '.single-tour-operator .additional-info .lsx-to-more-link' ).each( function() { lsx_to.readMoreTIText = $(this).find('a').text(); - lsx_to.readMoreSetTI( $(this) ); + lsx_to.readMoreSet( $(this), $(this).closest( '.additional-info' ).find('.content') ); } ); $( '.single-tour-operator .additional-info .lsx-to-more-link' ).on( 'click', function( event ) { @@ -124,56 +122,14 @@ if ( window.location.hash ) { $( this ).hide(); if ( $( this ).hasClass( 'less-link' ) ) { - lsx_to.readMoreSetTI($( this )); + lsx_to.readMoreSet( $(this), $(this).closest( '.additional-info' ).find('.content') ); } else { - lsx_to.readMoreOpenTI($( this )); + lsx_to.readMoreOpenTI( $(this), $(this).closest( '.additional-info' ).find('.content') ); } $( this ).show(); } ); - }; - lsx_to.readMoreSetTI = function( button ) { - let contentWrapper = button.closest( '.additional-info' ).find('.content'); - if ( 0 < contentWrapper.length ) { - if ( 1 < contentWrapper.children().length ) { - - //first remove empty p tags. - contentWrapper.children().each( function() { - if ( '' === $(this).html() ) { - $(this).remove(); - } - }); - - var limit = 1; - let counter = 0; - - contentWrapper.children().each( function() { - if ( limit <= counter ) { - $(this).hide(); - } - counter++; - }); - } else { - button.hide(); - } - button.removeClass('less-link'); - button.find('a').text( lsx_to.readMoreTIText ); - } - } - - lsx_to.readMoreOpenTI = function( button ) { - let contentWrapper = button.closest( '.additional-info' ).find('.content'); - if ( 0 < contentWrapper.children().length ) { - contentWrapper.each( function() { - $(this).show(); - }); - button.addClass( 'less-link' ); - button.find('a').text( 'View Less' ); - button.show(); - - } - } /** * Read more (itinerary) effect. @@ -181,14 +137,26 @@ if ( window.location.hash ) { * @package tour-operator * @subpackage scripts */ + + lsx_to.readMoreItinText = ''; + lsx_to.set_read_more_itinerary = function() { - $( '#itinerary .view-more a' ).click( function( event ) { + $( '.single-tour-operator .lsx-itinerary-wrapper .wp-block-read-more' ).each( function() { + lsx_to.readMoreItinText = $(this).find('a').text(); + lsx_to.readMoreSet( $(this), $(this).closest( 'div' ).find('.itinerary-description') ); + } ); + + $( '.single-tour-operator .lsx-itinerary-wrapper .wp-block-read-more' ).on( 'click', function( event ) { event.preventDefault(); $( this ).hide(); - $( this ).parents( '#itinerary' ).find( '.itinerary-item.hidden' ).each( function() { - $( this ).removeClass( 'hidden' ); - } ); + if ( $( this ).hasClass( 'less-link' ) ) { + lsx_to.readMoreSet( $(this), $(this).closest( 'div' ).find('.itinerary-description') ); + } else { + lsx_to.readMoreOpen( $(this), $(this).closest( 'div' ).find('.itinerary-description') ); + } + + $( this ).show(); } ); }; @@ -380,7 +348,7 @@ if ( window.location.hash ) { $document.ready( function() { lsx_to.set_read_more(); lsx_to.set_read_more_travel_info(); - //lsx_to.set_read_more_itinerary(); + lsx_to.set_read_more_itinerary(); lsx_to.build_slider( window_width ); } ); diff --git a/includes/classes/legacy/class-accommodation.php b/includes/classes/legacy/class-accommodation.php index d0ccb24a..3d3af61f 100644 --- a/includes/classes/legacy/class-accommodation.php +++ b/includes/classes/legacy/class-accommodation.php @@ -123,6 +123,8 @@ public function price_filter( $html = '', $meta_key = false, $value = false, $be 'single_supplement' ]; + do_action( 'qm/debug', [ get_post_type(), $meta_key ] ); + if ( get_post_type() === 'accommodation' && in_array( $meta_key, $currency_fields ) ) { $price_type = get_post_meta( get_the_ID(), 'price_type', true ); $value = preg_replace( '/[^0-9,.]/', '', $value );