1/* 2 3@package fhp 4 5*/ 6 7 8function scrollToElement() { 9 let index = jQuery( ".article" ).length - 3; 10 elements = document.querySelectorAll('.article'); 11 element = document.querySelector('.loadmore'); 12 element.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}); 13} 14 15jQuery(function($){ // use jQuery code inside this to avoid "$ is not defined" error 16 $('.loadmore').click(function(e){ 17 18 e.preventDefault(); 19 20 var button = $(this), 21 total = button.data('max'), 22 current = button.data('current'), 23 id = button.data('id'), 24 data = { 25 'action': 'loadmoregeneric', 26 'id': id, 27 'page' : current, 28 'max' : total, 29 'nonce' : ajax_var.check_nonce, 30 }; 31 32 33 $.ajax({ 34 type: "POST", 35 dataType: "html", 36 url: ajax_var.url, 37 data: data, 38 39 success: function(data){ 40 41 if(data) { 42 $(".grid-container").append(data); 43 let nb_of_posts = $(".grid-container").children().length -1; 44 let start_count = nb_of_posts - 6; 45 /* for(i = start_count; i < nb_of_posts; i++) { 46 $(".grid-container article:nth-child("+i+")").hide(); 47 } */ 48 49 ajax_var.current_page++; 50 button.attr("disabled",false); 51 current = current + 1; 52 button.data('current' , current); 53 button.attr('data-current' , current) 54 if(current == total) { 55 console.log('reached'); 56 /* $('.loadmore').attr('disabled'); 57 $('.loadmore').addClass('disabled'); */ 58 button.hide(); 59 } 60 61 } else{ 62 //alert('You reached the end!'); 63 button.hide(); 64 } 65 }, 66 error : function(jqXHR, textStatus, errorThrown) { 67 console.log('error') 68 } 69 70 }); 71 return false; 72 73 }); 74 75 76 $('.loadmorepublications').click(function(e){ 77 78 e.preventDefault(); 79 80 var button = $(this), 81 total = button.data('max'), 82 current = button.data('current'), 83 id = button.data('id'), 84 data = { 85 'action': 'loadmorepublications', 86 'id': id, 87 'page' : current, 88 'max' : total, 89 'nonce' : ajax_var.check_nonce, 90 }; 91 92 93 $.ajax({
94 type: "POST", 95 dataType: "html", 96 url: ajax_var.url, 97 data: data, 98 99 success: function(data){ 100 101 if(data) { 102 $(".grid-container").append(data); 103 let nb_of_posts = $(".grid-container").children().length -1; 104 let start_count = nb_of_posts - 6; 105 /* for(i = start_count; i < nb_of_posts; i++) { 106 $(".grid-container article:nth-child("+i+")").hide(); 107 } */ 108 109 ajax_var.current_page++; 110 button.attr("disabled",false); 111 current = current + 1; 112 button.data('current' , current); 113 button.attr('data-current' , current) 114 if(current == total) { 115 console.log('reached'); 116 /* $('.loadmore').attr('disabled'); 117 $('.loadmore').addClass('disabled'); */ 118 button.hide(); 119 } 120 121 } else{ 122 //alert('You reached the end!'); 123 button.hide(); 124 } 125 }, 126 error : function(jqXHR, textStatus, errorThrown) { 127 console.log('error') 128 } 129 130 }); 131 return false; 132 133 }); 134 135 $('.loadmorecampagnes').click(function(e){ 136 137 e.preventDefault(); 138 139 var button = $(this), 140 total = button.data('max'), 141 current = button.data('current'), 142 id = button.data('id'), 143 data = { 144 'action': 'loadmorecampagnes', 145 'id': id, 146 'page' : current, 147 'max' : total, 148 'nonce' : ajax_var.check_nonce, 149 }; 150 151 152 $.ajax({
153 type: "POST", 154 dataType: "html", 155 url: ajax_var.url, 156 data: data, 157 158 success: function(data){ 159 160 if(data) { 161 $(".grid-container").append(data); 162 let nb_of_posts = $(".grid-container").children().length -1; 163 let start_count = nb_of_posts - 6; 164 /* for(i = start_count; i < nb_of_posts; i++) { 165 $(".grid-container article:nth-child("+i+")").hide(); 166 } */ 167 168 ajax_var.current_page++; 169 button.attr("disabled",false); 170 current = current + 1; 171 button.data('current' , current); 172 button.attr('data-current' , current) 173 if(current == total) { 174 console.log('reached'); 175 /* $('.loadmore').attr('disabled'); 176 $('.loadmore').addClass('disabled'); */ 177 button.hide(); 178 } 179 180 } else{ 181 //alert('You reached the end!'); 182 button.hide(); 183 } 184 }, 185 error : function(jqXHR, textStatus, errorThrown) { 186 console.log('error') 187 } 188 189 }); 190 return false; 191 192 }); 193 194 $('.loadmorecategory').click(function(e){ 195 196 e.preventDefault(); 197 198 var button = $(this), 199 total = button.data('max'), 200 current = button.data('current'), 201 id = button.data('id'), 202 data = { 203 'action': 'loadmorecategory', 204 'id': id, 205 'page' : current, 206 'max' : total, 207 'nonce' : ajax_var.check_nonce, 208 }; 209 210 211 $.ajax({
212 type: "POST", 213 dataType: "html", 214 url: ajax_var.url, 215 data: data, 216 217 success: function(data){ 218 219 if(data) { 220 $(".grid-container").append(data); 221 let nb_of_posts = $(".grid-container").children().length -1; 222 let start_count = nb_of_posts - 6; 223 /* for(i = start_count; i < nb_of_posts; i++) { 224 $(".grid-container article:nth-child("+i+")").hide(); 225 } */ 226 227 ajax_var.current_page++; 228 button.attr("disabled",false); 229 current = current + 1; 230 button.data('current' , current); 231 button.attr('data-current' , current) 232 if(current == total) { 233 console.log('reached'); 234 /* $('.loadmore').attr('disabled'); 235 $('.loadmore').addClass('disabled'); */ 236 button.hide(); 237 } 238 239 } else{ 240 //alert('You reached the end!'); 241 button.hide(); 242 } 243 }, 244 error : function(jqXHR, textStatus, errorThrown) { 245 console.log('error') 246 } 247 248 }); 249 return false; 250 251 }); 252 253});
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.