1// Scripts related to: ~\Views\Hospitality/Index.cshtml 2 3Views.Hospitality.Index = class extends Views.Page { 4 constructor() { 5 super(); 6 const $target = $('.hospitality-body-container'); 7 Utils.fetch($target, `/${Utils.getLanguageFromUrl()}/Hospitality/_GetArticles`, { 8 action: (r) => { 9 $target.html(r); 10 this.addBehaviorsToLightboxes(); 11 } 12 }); 13 14 $('.hospitality-subtitles-item').on('click', function (e) { 15 $('.hospitality-subtitles-item').removeClass('active'); 16 console.log(this); 17 $(this).addClass('active'); 18 }); 19 20 $('.hospitality-subtitles-all-offers')?.on('click', () => { 21 Utils.fetch($target, `/${Utils.getLanguageFromUrl()}/Hospitality/_GetArticles`, { 22 action: (r) => { 23 $target.html(r); 24 this.addBehaviorsToLightboxes(); 25 } 26 }); 27 }); 28 $('.hospitality-subtitles-compare-offers')?.on('click', () => { 29 Utils.fetch($target, `/${Utils.getLanguageFromUrl()}/Hospitality/_GetOffers`, { 30 body: {} 31 }) 32 }); 33 } 34 35 addBehaviorsToLightboxes() { 36 const $hospitalityGrid = $(`.hospitality-grid`); 37 const $lightboxes = $hospitalityGrid.find('.hospitality-article-item-lightbox'); 38 39 $hospitalityGrid.find('.hospitality-grid-item').each((index, item) => { 40 const $lightbox = $lightboxes.eq(index); 41 $(item).on('click', (event) => { 42 this.open($lightbox); 43 44 const $closeButton = $lightbox.find('.grid-item-lightbox-button-close'); 45 $closeButton.on('click', (e) => this.close(e, $lightbox)); 46 $(document).on('keydown', (e) => { 47 if (e.key === 'Escape') this.close(e, $lightbox); 48 }); 49 }); 50 }); 51 52 $('.grid-item-lightbox-button-url').off('click').on('click', (e) => { 53 e.stopPropagation(); 54 window.location.href = $(this).attr('href'); 55 }); 56 57 $('.hospitality-article-item-lightbox').on('click', function(e) { 58 e.stopPropagation(); 59 }); 60 } 61 62 open($lightbox) { 63 if ($lightbox.length) { 64 const $content = $lightbox.find('.lightbox-content'); 65 if ($content.is(':empty')) { 66 Utils.fetch($content, `/${Utils.getLanguageFromUrl()}/Hospitality/_GetLightboxContent/${parseInt($content.data('web-page-id'), 10) || 0}`, { 67 loaderId: $lightbox.find(`#hospitality-article-lightbox-loader`), 68 action: (r) => { $content.replaceWith(r); } 69 }); 70 } 71 $lightbox.css('display', 'flex'); 72 setTimeout(() => $lightbox.addClass('visible'), 10); 73 $('#lightbox-overlay').show(); 74 $('#lightbox-overlay').off('click').on('click', (e) => this.close(e, $lightbox)); 75 Utils.disableScrolling(); 76 } 77 } 78 79 close(event, $lightbox) { 80 if ($lightbox.length) { 81 event.stopPropagation(); 82 $lightbox.removeClass('visible'); 83 setTimeout(() => $lightbox.css('display', 'none'), 200); 84 $('#lightbox-overlay').hide(); 85 Utils.enableScrolling(); 86 } 87 } 88}
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.