1 2 3// Ajax Handler 4 5/** 6 * 7 * Curator.io Network Types 8 * 9 **/ 10const NETWORK_INSTAGRAM = 2; 11const NETWORK_FACEBOOK = 3; 12const NETWORK_YOUTUBE = 8; 13const NETWORK_RSS = 10; 14const NETWORK_TIKTOK = 25; 15const NETWORK_BLOG = 999; 16 17/** 18 * searchTerms object can contain: 19 * 20 * network : array of Network types or [] for all 21 * text : search string 22 * 23 **/ 24 25const searchPosts = async ( searchTerms ) => { 26 console.log('searchPosts: ', searchTerms); 27 var url = c12Ajax.ajaxurl; 28 var data = { 29 action : 'search_social_post', 30 terms : JSON.stringify(searchTerms) 31 }; 32 url += '?' + ( new URLSearchParams( data ) ).toString(); 33 34 var response = await fetch(url, { 35 method : 'GET' 36 } ); 37 return response.json(); 38} 39 40const getPostByWPID = async ( id ) => { 41 // console.log('ID from within getPostByWPID: ', id) 42 var url = c12Ajax.ajaxurl; 43 var data = { 44 action : 'get_social_post', 45 post_id : id, 46 curator_id : '' 47 }; 48 url += '?' + ( new URLSearchParams( data ) ).toString(); 49 50 var response = await fetch(url, { 51 method : 'GET' 52 } ); 53 return response.json(); 54} 55 56const getPostByCuratorID = async ( id ) => { 57 console.log('ID from within getPostByCuratorID: ', id) 58 var url = c12Ajax.ajaxurl; 59 var data = { 60 action : 'get_social_post', 61 post_id : '', 62 curator_id : id 63 }; 64 url += '?' + ( new URLSearchParams( data ) ).toString(); 65 66 var response = await fetch(url, { 67 method : 'GET' 68 } ); 69 return response.json(); 70} 71 72 73const getPostByStoryboard = async ( storyboard ) => { 74 //console.log('ID from within getPostByCuratorID: ', id) 75 var url = c12Ajax.ajaxurl; 76 var data = { 77 action : 'get_social_post', 78 post_id : '', 79 curator_id : '', 80 storyboard : storyboard 81 }; 82 url += '?' + ( new URLSearchParams( data ) ).toString(); 83 84 var response = await fetch(url, { 85 method : 'GET' 86 } ); 87 return response.json(); 88}
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.