1'use strict'; 2 3(function ($, app) { 4 $(document).ready(function () { 5 initBlogArchiveWidgets(); 6 }); 7 8 function initBlogArchiveWidgets() { 9 var widgets = $('.li-widgets--blog-archive'); 10 if (!widgets.length) return; 11 12 widgets.each(function () { 13 var $widget = $(this); 14 var $content = $widget.find('.blog-archive__content'); 15 var $grid = $widget.find('#blog-archive-grid'); 16 var $button = $widget.find('.blog-archive__load-more'); 17 18 if (!$content.length || !$grid.length || !$button.length) { 19 return; 20 } 21 22 $button.on('click', function () { 23 if ($button.hasClass('loading')) return; 24 25 $button.addClass('loading'); 26 27 var offset = parseInt($content.data('offset'), 10) || 0; 28 var postsPerPage = parseInt($content.data('posts-per-page'), 10) || 3; 29 var cat = $content.data('category') || ''; 30 var search = $content.data('search') || ''; 31 32 $.ajax({ 33 url: app && app.ajaxurl ? app.ajaxurl : window.ajaxurl, 34 method: 'POST', 35 dataType: 'JSON', 36 data: { 37 action: 'buo-blog-archive-load', 38 offset: offset, 39 postsPerPage: postsPerPage, 40 cat: cat, 41 search: search 42 }, 43 success: function (response) { 44 if (response.status === 'SUCCESS') { 45 // Neue Beiträge ans Grid anhängen 46 $grid.append(response.posts); 47 48 // Offset erhöhen 49 var newOffset = offset + (response.returned_posts || 0); 50 $content.data('offset', newOffset); 51 52 // Button entfernen, falls keine weiteren Beiträge 53 if (!response.more_posts_available) { 54 $button.remove(); 55 } 56 } 57 58 if ($button.length) { 59 $button.removeClass('loading'); 60 } 61 }, 62 error: function () { 63 if ($button.length) { 64 $button.removeClass('loading'); 65 } 66 } 67 }); 68 }); 69 }); 70 } 71})(jQuery, window.libaseApp || window.libaseApp === undefined ? window.libaseApp : {});
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.