1(function ($) { 2 "use strict"; 3 4 let Deco_Load_More = { 5 6 page: 2, 7 8 loadMongoItems: function () { 9 10 $(document).on('click', '.js_custom-load-more-mongo-items', function (e) { 11 e.preventDefault(); 12 13 let button = $(this), 14 container = button.attr('data-container'), 15 next_page_link = button.attr('data-link'); 16 17 next_page_link = next_page_link + '?pg=' + Deco_Load_More.page; 18 19 $.ajax({ 20 type : 'GET', 21 dataType : "html", 22 url : next_page_link, 23 beforeSend: function () { 24 $(container).css('opacity', 0.3); 25 $(container).removeClass('with-shadow'); 26 button.addClass('is-loading'); 27 Deco_Load_More.page += 1; 28 }, 29 success : function (html) { 30 let content = $(html).find(container), 31 loader = content.siblings('.js_custom-load-more'); 32 33 if (content.length) { 34 $(container).append(content.html()); 35 } 36 37 if (loader.length) { 38 button.replaceWith(loader); 39 } 40 }, 41 complete : function () { 42 button.removeClass('is-loading'); 43 $(container).css('opacity', 1); 44 45 $(document).find('.js__loading-element').addClass('is-loaded'); 46 $(window).trigger('scroll'); 47 }, 48 error : function (e) { 49 console.log(e); 50 } 51 }); 52 }); 53 54 }, 55 56 loadItems: function () { 57 58 $(document).on('click', '.js_custom-load-more-posts', function (e) { 59 e.preventDefault(); 60 61 let button = $(this), 62 container = button.attr('data-container'), 63 data = { 64 action : 'deco_custom_load_more_posts', 65 page : button.attr('data-page'), 66 posts_per_page: button.attr('data-posts-per-page'), 67 template : button.attr('data-template'), 68 query : button.attr('data-query'), 69 }; 70 71 if (button.hasClass('is-loading')) { 72 return false; 73 } 74 75 $.ajax({ 76 type : 'GET', 77 url : deco_vars.ajaxurl, 78 dataType : 'json', 79 data : data, 80 beforeSend: function () { 81 $(container).css('opacity', 0.3); 82 $(container).removeClass('with-shadow'); 83 button.addClass('is-loading'); 84 }, 85 success : function (response) { 86 console.log(response); 87 if (response.success) { 88 $(container).append(response.data.html); 89 button.attr('data-page', response.data.page); 90 91 if (response.data.hide_paginate) { 92 button.hide(); 93 } 94 } 95 }, 96 complete : function () { 97 button.removeClass('is-loading'); 98 $(container).css('opacity', 1); 99 100 $(document).find('.js__loading-element').addClass('is-loaded'); 101 $(window).trigger('scroll'); 102 }, 103 error : function (e) { 104 console.log(e); 105 } 106 }); 107 }); 108 109 }, 110 111 init: function () { 112 if (!$('.js_custom-load-more').length) { 113 return; 114 } 115 Deco_Load_More.loadMongoItems(); 116 Deco_Load_More.loadItems(); 117 } 118 119 }; 120 121 $(document).ready(function () { 122 Deco_Load_More.init(); 123 }); 124 125})(jQuery);
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.