1(function ($) { 2 "use strict"; 3 4 var $window = $(window); 5 6 var vis_index = 0; 7 8 /** 9 * Insert a views infinite scroll view into the document after AJAX. 10 * 11 * @param {object} $new_view The new view coming from the server. 12 */ 13 $.fn.infiniteScrollInsertView = function ($new_view) { 14 var $existing_view = this; 15 var $existing_content = $existing_view.find('> .view-content').last().children(); 16 //$new_view.find('> .view-content').last().first().prepend($existing_content); 17 $new_view.find('.view-content').last().prepend($existing_content); 18 $existing_view.replaceWith($new_view); 19 $(document).trigger('infiniteScrollComplete', [$new_view, $existing_content]); 20 }; 21 22 /** 23 * Handle the automatic paging based on the scroll amount. 24 */ 25 Drupal.behaviors.views_infinite_scroll_automatic = { 26 attach : function(context, settings) { 27 28 var settings = settings.views_infinite_scroll; 29 var loadingImg = '<div class="views_infinite_scroll-ajax-loader"><img src="' + settings.img_path + '" alt="loading..."/></div>'; 30 31 $('.pager--infinite-scroll.pager--infinite-scroll-auto', context).once().each(function() { 32 var $pager = $(this); 33 $pager.find('.pager__item').hide(); 34 if ($pager.find('.pager__item a').length) { 35 $pager.append(loadingImg); 36 } 37 $window.bind('scroll.views_infinite_scroll_' + vis_index, function() { 38 if (window.innerHeight + window.pageYOffset > $pager.offset().top - settings.scroll_threshold) { 39 $pager.find('.pager__item a').click(); 40 $window.unbind('scroll.views_infinite_scroll_' + vis_index); 41 } 42 }); 43 vis_index++; 44 }); 45 46 } 47 }; 48 49})(jQuery); 50;
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.