1jQuery(document).ready(function ($) { 2 $('#add-new-speaker').on('click', function () { 3 $('#new-speaker-form').toggle(); 4 }); 5 $('#save-new-speaker').on('click', function () { 6 var newSpeakerName = $('#new-speaker-name').val(); 7 var newSpeakerPhone = $('#new-speaker-phone').val(); 8 var newSpeakerEmail = $('#new-speaker-email').val(); 9 var newSpeakerRole = $('#new-speaker-role').val(); 10 $.ajax({ 11 url: artcloud_admin.ajax_url, 12 type: 'POST', 13 data: { 14 action: 'create_new_speaker', 15 name: newSpeakerName, 16 speakers_phonenumber: newSpeakerPhone, 17 speakers_email: newSpeakerEmail, 18 speakers_role: newSpeakerRole 19 }, 20 success: function (response) { 21 $('#new-speaker-name').val(''); 22 $('#new-speaker-phone').val(''); 23 $('#new-speaker-email').val(''); 24 $('#new-speaker-role').val(''); 25 fetchLatestSpeaker(); 26 $('#new-speaker-form').toggle(); 27 } 28 }); 29 }); 30 function fetchLatestSpeaker() { 31 $.ajax({ 32 url: artcloud_admin.ajax_url, 33 type: 'POST', 34 data: { 35 action: 'get_latest_campaign_speakers', 36 post_id: $('#post_ID').val() 37 }, 38 success: function (response) { 39 } 40 }); 41 } 42}); 43// 44jQuery(document).ready(function ($) { 45 $('#add-new-location').on('click', function () { 46 $('#new-location-form').toggle(); 47 }); 48 $('#save-new-location').on('click', function () { 49 var newLocationName = $('#new-location-name').val(); 50 var newLocationAddress = $('#new-location-address').val(); 51 var newLocationZip = $('#new-location-zip').val(); 52 var newLocationCity = $('#new-location-city').val(); 53 $.ajax({ 54 url: artcloud_admin.ajax_url, 55 type: 'POST', 56 data: { 57 action: 'create_new_location', 58 name: newLocationName, 59 venue_address: newLocationAddress, 60 venue_zip: newLocationZip, 61 venue_city: newLocationCity, 62 }, 63 success: function (response) { 64 $('#new-location-name').val(''); 65 $('#new-location-address').val(''); 66 $('#new-location-zip').val(''); 67 $('#new-location-city').val(''); 68 fetchLatestData(); 69 $('#new-location-form').toggle(); 70 } 71 }); 72 }); 73 function fetchLatestData() { 74 $.ajax({ 75 url: artcloud_admin.ajax_url, 76 type: 'POST', 77 data: { 78 action: 'get_latest_event_locations', 79 post_id: $('#post_ID').val() 80 }, 81 success: function (response) { 82 } 83 }); 84 } 85 //hide and show recurring event options 86 $('.cmb2-id-select-recurring-type').css('display', 'none'); 87 $('.cmb2-id-no-of-events').css('display', 'none'); 88 $('#cmb2-id--is-recurring-event').on('click', function () { 89 $('.cmb2-id-select-recurring-type').toggle(); 90 $('.cmb2-id-no-of-events').toggle(); 91 }); 92 function loadSpeakerSuggestions(searchTerm) { 93 var postId = $('#search_event_speakers').data('id'); 94 $.ajax({ 95 url: artcloud_admin.ajax_url, 96 type: 'POST', 97 dataType: 'json', 98 data: { 99 action: 'get_speaker_terms', 100 post_id: postId, 101 search_term: searchTerm || '', 102 }, 103 success: function (response) { 104 // console.log(response); 105 if (response.length > 0) { 106 $('#event_speakers_suggestions').empty(); 107 var uniqueTerms = {}; 108 response.forEach(function (term) { 109 if (!uniqueTerms[term.name]) { 110 var listItem = $('<li>').text(term.name); 111 var addButton = $('<a href="javascript:void(0)"><span class="dashicons dashicons-plus-alt"></span></a>') 112 .on('click', function () { 113 addSpeakerTerm(term.term_id); 114 $('#search_event_speakers').val(''); 115 $('#event_speakers_suggestions').empty(); 116 }); 117 listItem.append(' ').append(addButton); 118 $('#event_speakers_suggestions').append(listItem); 119 uniqueTerms[term.name] = true; 120 } 121 }); 122 } else { 123 $('#event_speakers_suggestions').empty(); 124 } 125 }, 126 }); 127 } 128 129 $('#search_event_speakers').on('focus click', function () { 130 var searchTerm = $(this).val(); 131 loadSpeakerSuggestions(searchTerm); 132 }); 133 134 $('#search_event_speakers').on('input', function () { 135 var searchTerm = $(this).val(); 136 loadSpeakerSuggestions(searchTerm); 137 }); 138 function addSpeakerTerm(termId) { 139 var postId = $('#search_event_speakers').data('id'); 140 $.ajax({ 141 url: artcloud_admin.ajax_url, 142 type: 'POST', 143 dataType: 'json', 144 data: { 145 action: 'add_speaker_term', 146 post_id: postId, 147 term_id: termId, 148 }, 149 success: function (response) { 150 // console.log(response); 151 renderSpeakerTerms(response, postId); 152 }, 153 }); 154 } 155 156 $('#dynamic-speaker-content ul').on('click', '.remove-speaker', function () { 157 delete_speaker($(this)); 158 }); 159 160 function delete_speaker(clickedElement) { 161 var termId = clickedElement.data('id'); 162 var postId = clickedElement.data('event-id'); 163 $.ajax({ 164 url: artcloud_admin.ajax_url, 165 type: 'POST', 166 dataType: 'json', 167 data: { 168 action: 'delete_speaker_term', 169 post_id: postId, 170 term_id: termId, 171 }, 172 success: function (response) { 173 // console.log(response); 174 renderSpeakerTerms(response, postId); 175 }, 176 }); 177 } 178
179 function renderSpeakerTerms(terms, postId) { 180 $('#dynamic-speaker-content ul').empty(); 181 $.each(terms, function (index, term) { 182 termHtml = '<li>' + term.term_name + '<a href="javascript:void(0)" class="remove-speaker" data-id="' + term.term_id + '" data-event-id="' + postId + '"><span class="dashicons dashicons-trash"></span></a></li>'; 183 $('#dynamic-speaker-content ul').append(termHtml); 184 }); 185 $('#dynamic-speaker-content ul').off('click', '.remove-speaker').on('click', '.remove-speaker', function () { 186 delete_speaker($(this)); 187 }); 188 } 189 function loadVenueSuggestions(searchTerm) { 190 var postId = $('#search_event_venue').data('id'); 191 $.ajax({ 192 url: artcloud_admin.ajax_url, 193 type: 'POST', 194 dataType: 'json', 195 data: { 196 action: 'get_venue_terms', 197 post_id: postId, 198 search_term: searchTerm || '', 199 }, 200 success: function (response) { 201 // console.log(response); 202 if (response.length > 0) { 203 $('#event_venue_suggestions').empty(); 204 var uniqueTerms = {}; 205 response.forEach(function (term) { 206 if (!uniqueTerms[term.name]) { 207 var listItem = $('<li>').text(term.name); 208 var addButton = $('<a href="javascript:void(0)"><span class="dashicons dashicons-plus-alt"></span></a>') 209 .on('click', function () { 210 addVenueTerm(term.term_id); 211 $('#search_event_venue').val(''); 212 $('#event_venue_suggestions').empty(); 213 }); 214 listItem.append(' ').append(addButton); 215 $('#event_venue_suggestions').append(listItem); 216 uniqueTerms[term.name] = true; 217 } 218 }); 219 } else { 220 $('#event_venue_suggestions').empty(); 221 } 222 }, 223 }); 224 } 225 226 $('#search_event_venue').on('focus click', function () { 227 var searchTerm = $(this).val(); 228 loadVenueSuggestions(searchTerm); 229 }); 230 231 $('#search_event_venue').on('input', function () { 232 var searchTerm = $(this).val(); 233 loadVenueSuggestions(searchTerm); 234 }); 235 236 function addVenueTerm(termId) { 237 var postId = $('#search_event_venue').data('id'); 238 $.ajax({ 239 url: artcloud_admin.ajax_url, 240 type: 'POST', 241 dataType: 'json', 242 data: { 243 action: 'add_venue_term', 244 post_id: postId, 245 term_id: termId, 246 }, 247 success: function (response) { 248 // console.log(response); 249 renderVenueTerms(response, postId); 250 }, 251 }); 252 } 253 254 $('#dynamic-location-content ul').on('click', '.remove-location', function () { 255 delete_venue($(this)); 256 }); 257 258 function delete_venue(clickedElement) { 259 var termId = clickedElement.data('id'); 260 var postId = clickedElement.data('event-id'); 261 $.ajax({ 262 url: artcloud_admin.ajax_url, 263 type: 'POST', 264 dataType: 'json', 265 data: { 266 action: 'delete_venue_term', 267 post_id: postId, 268 term_id: termId, 269 }, 270 success: function (response) { 271 // console.log(response); 272 renderVenueTerms(response, postId); 273 }, 274 }); 275 } 276 277 function renderVenueTerms(terms, postId) { 278 $('#dynamic-location-content ul').empty(); 279 $.each(terms, function (index, term) { 280 var termHtml = '<li>' + term.term_name + '<a href="javascript:void(0)" class="remove-location" data-id="' + term.term_id + '" data-event-id="' + postId + '"><span class="dashicons dashicons-trash"></span></a></li>'; 281 $('#dynamic-location-content ul').append(termHtml); 282 }); 283 $('#dynamic-location-content ul').off('click', '.remove-location').on('click', '.remove-location', function () { 284 delete_venue($(this)); 285 }); 286 } 287});
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.