1jQuery(document).ready(function ($) { 2 if ($('body').hasClass('home')) { 3 // https://www.elegantthemes.com/blog/tips-tricks/learning-to-master-the-basics-of-ajax 4 $.get( 5 jp.ajaxURL, { 6 'action': 'get_latest_blogs', 7 'nonce': jp.nonce, 8 }, 9 function (response) { 10 if (response.success) { 11 appendBlogToHTML(response.data.content) 12 } 13 } 14 ); 15 16 $.get( 17 jp.ajaxURL, { 18 'action': 'get_latest_events', 19 'nonce': jp.nonce, 20 }, 21 function (response) { 22 if (response.success) { 23 appendEventToHTML(response.data.content) 24 } 25 } 26 ); 27 } 28 29 function appendBlogToHTML(data) { 30 if (data.length > 0) { 31 $('#learn-vese-online-accordion .et_pb_accordion_item').each(function (i, obj) { 32 if (data.length - 1 < i) { 33 $(obj).closest('.et_pb_accordion_item').hide(); 34 return; 35 } 36 var titleHtml = '<span>' + data[i].post_title + '</span>'; 37 $(obj).find('.et_pb_toggle_title').html('').append(titleHtml).find('span').attr('data-link', data[i].guid); 38 if (data[i].post_excerpt) { 39 $(obj).find('.et_pb_toggle_content').html('<span>' + data[i].post_excerpt + '</span>'); 40 } else { 41 $(obj).find('.et_pb_toggle_content').html('<span>' + data[i].post_content + '</span>'); 42 } 43 }); 44 } else { 45 $('#learn-vese-online-accordion').html('There is no post.'); 46 $('#learn-vese-online-accordion').next().hide(); 47 } 48 } 49 50 function appendEventToHTML(data) { 51 if (data.length > 0) { 52 $('#life-list .et_pb_column').each(function (i, obj) { 53 if (data.length - 1 < i) { 54 $(obj).closest('.et_pb_column').hide(); 55 return; 56 } 57 $(obj).find('.et_pb_main_blurb_image a').attr({ href: data[i].guid }); 58 $(obj).find('.et_pb_module_header a').html(data[i].post_title).attr({ href: data[i].guid }); 59 var d = new Date(data[i].post_date); 60 var year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d); 61 var month = new Intl.DateTimeFormat('en', { month: 'short' }).format(d); 62 var day = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d); 63 $(obj).find('.et_pb_blurb_description p').html(month + ' ' + day + ', ' + year); 64 setTimeout(function() { 65 if (data[i].thumb) { 66 // console.log('data[i].thumb: ', data[i].thumb); 67 $(obj).find('.et_pb_image_wrap img').attr({ 68 src: data[i].thumb,
69 srcset: data[i].thumb + ' 480w, ' + data[i].thumb.replace('.jpg,', '-212x300.jpg') + ' 212w' 70 }); 71 } 72 }, 200); 73 }); 74 } else { 75 $('#life-list').html('There is no event.'); 76 $('#life-list').next().hide(); 77 } 78 } 79});
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.