1jQuery(document).ready(function($) { 2 let involvement = ''; 3 4 5 const clearData = () => { 6 $('#ActionAlertList').empty(); 7 $('#EventList').empty(); 8 $('#ProfessionalDevelopmentList').empty(); 9 $('#InitiativesList').empty(); 10 $('#action-alerts-load-more-btn').addClass('hide-button'); 11 $('#events-load-more-btn').addClass('hide-button'); 12 $('#initiatives-load-more-btn').addClass('hide-button'); 13 }; 14 15 const checkForHiddenTiles = () => { 16 if ($('#ActionAlertList').find('.tile.hidden').length > 0) { 17 $('#action-alerts-load-more-btn').removeClass('hide-button'); 18 } else { 19 $('#action-alerts-load-more-btn').addClass('hide-button'); 20 } 21 22 if ($('#EventList').find('.tile.hidden').length > 0) { 23 $('#events-load-more-btn').removeClass('hide-button'); 24 }else { 25 $('#events-load-more-btn').addClass('hide-button'); 26 } 27 28 if ($('#InitiativesList').find('.tile.hidden').length > 0) { 29 $('#initiatives-load-more-btn').removeClass('hide-button'); 30 } else { 31 $('#initiatives-load-more-btn').addClass('hide-button'); 32 } 33 }; 34 35 const formatResponse = (post, classes, newTab) => { 36 return ` 37 <a href="${post.link}" class="tile ${classes}" ${newTab ? 'target="_blank"' : ''}> 38 <div class="tile--image"> 39 <img src="${ post.image }" alt="${ post.image_alt }" /> 40 </div> 41 <div class="tile--content"> 42 <h3 class="proxima-nova-bold font-extrabold tile--content-title">${ post.title }</h3> 43 <p class="tile--content-description">${ post.description ? post.description : '' }</p> 44 </div> 45 </a> 46 `; 47 }; 48 49 const requestData = () => { 50 $.ajax({
51 url: loadGetInvolved.ajaxurl, 52 type: 'POST', 53 data: { 54 action: 'load_get_involved', 55 involvement: involvement, 56 nonce: loadGetInvolved.nonce 57 }, 58 success: function(response) { 59 if (response.action_alerts.length > 0) { 60 response.action_alerts.forEach(function(post, index) { 61 if (index > 2) { 62 $('#ActionAlertList').append(formatResponse(post, 'action-alert hidden', true)); 63 } else { 64 $('#ActionAlertList').append(formatResponse(post, 'action-alert', true)); 65 } 66 }); 67 } else { 68 $('#ActionAlertList').append(`<p>No action alerts found for ${involvement}</p>`); 69 } 70 71 if(response.events.length > 0) { 72 response.events.forEach(function(post, index) { 73 if (index > 2) { 74 $('#EventList').append(formatResponse(post, 'event-tile hidden', false)); 75 } else { 76 $('#EventList').append(formatResponse(post, 'event-tile', false)); 77 } 78 }); 79 } else { 80 $('#EventList').append(`<p>No events found for ${involvement}</p>`); 81 } 82 83 if(response.initiatives.length > 0) { 84 response.initiatives.forEach(function(post, index) { 85 if (index > 2) { 86 $('#InitiativesList').append(formatResponse(post, 'initiative-tile hidden', false)); 87 } else { 88 $('#InitiativesList').append(formatResponse(post, 'initiative-tile', false)); 89 } 90 }); 91 } else { 92 $('#InitiativesList').append(`<p>No initiatives found for ${involvement}</p>`); 93 } 94 checkForHiddenTiles(); 95 } 96 }); 97 }; 98 99 100 $('#MadLibsInput').on('change', function(e) { 101 e.preventDefault(); 102 involvement = $(this).val(); 103 clearData(); 104 requestData(); 105 }); 106 107 $ActionAlertList = $('#ActionAlertList'); 108 $EventsList = $('#EventList'); 109 $InitiativesList = $('#InitiativesList'); 110 $('#action-alerts-load-more-btn').on('click', function(e) { 111 e.preventDefault(); 112 $ActionAlertList.find('.tile.hidden').slice(0, 3).removeClass('hidden'); 113 checkForHiddenTiles(); 114 }); 115 116 $('#events-load-more-btn').on('click', function(e) { 117 e.preventDefault(); 118 $EventsList.find('.tile.hidden').slice(0, 3).removeClass('hidden'); 119 checkForHiddenTiles(); 120 }); 121 122 $('#initiatives-load-more-btn').on('click', function(e) { 123 e.preventDefault(); 124 $InitiativesList.find('.tile.hidden').slice(0, 3).removeClass('hidden'); 125 checkForHiddenTiles(); 126 }); 127 128});
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.