1(function ($, Drupal) { 2 'use strict'; 3 4 Drupal.behaviors.masonry = { 5 attach: function (context) { 6 const NOT_MASONRY_LISTINGS_CLASSES = [ 7 'listing--listing-media-publication', 8 'listing--listing-media-finance-publication', 9 ]; 10 11 const wrappers = once('masonry', '.views-infinite-scroll-content-wrapper', context); 12 wrappers.forEach(function (grid) { 13 const listingWrapper = grid.closest('.listing'); 14 let isMasonry = true; 15 16 if (listingWrapper == null) { 17 return; 18 } 19 20 NOT_MASONRY_LISTINGS_CLASSES.forEach(item => { 21 if (listingWrapper.classList.contains(item)) isMasonry = false; 22 }); 23 24 if (!isMasonry) return; 25 26 const isRTL = document.documentElement.dir === 'rtl' || false; 27 let msnry = new Masonry(grid, { 28 columnWidth: '.press-releases-listing__item-sizer', 29 itemSelector: '.press-releases-listing__item', 30 horizontalOrder: true, 31 originLeft: !isRTL, 32 transitionDuration: 0, 33 }); 34 35 let imgLoad = imagesLoaded(grid); 36 imgLoad.on('progress', () => { 37 msnry.layout(); 38 }); 39 40 $(document).ajaxComplete(() => { 41 msnry.reloadItems(); 42 msnry.layout(); 43 44 $(listingWrapper).find('img').off('load').on('load', () => { 45 msnry.reloadItems(); 46 msnry.layout(); 47 }); 48 }); 49 }); 50 } 51 }; 52 53 Drupal.behaviors.infiniteScrollSpinner = { 54 attach: function (context) { 55 const $spinner = $(once('infinite-scroll-spinner', '[rel=next]', context)); 56 $spinner.on('click', function () { 57 let listing = $(this).closest('.listing'); 58 59 if (listing.find('.infinite-scroll-spinner').length === 0) {
60 listing.append('<div class="infinite-scroll-spinner"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>'); // jshint ignore:line 61 } 62 $(document).ajaxComplete(() => { 63 $('.infinite-scroll-spinner').remove(); 64 }); 65 }); 66 } 67 }; 68 69 Drupal.behaviors.planetListingResultCount = { 70 attach: function (context) { 71 const $wrapper = $(once('planet-listing-result-count', '.planet--listing_container', context)); 72 if (!$wrapper.length) return; 73 74 var resultCount = $('.planet--listing__row.views-row').length; 75 var countWrapper = $('.planet-listing--result-summary .result-count'); 76 var separatorWrapper = $('.planet-listing--result-summary .result-separator'); 77 if (countWrapper.length > 0) { 78 countWrapper.html(resultCount); 79 } 80 if (separatorWrapper.length > 0) { 81 separatorWrapper.html(Drupal.t('of')); 82 } 83 } 84 }; 85 86})(jQuery, Drupal);
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.