1function fetchPageContent (pageId) { 2 return new Promise(function (resolve, reject) { 3 fetch(ajaxScriptsObject.ajaxurl + '?action=loadPageContent', { 4 method: 'POST', 5 body: JSON.stringify({ 6 pageId: pageId, 7 }) 8 }) 9 .then(function (resp) { 10 return resp.text(); 11 }) 12 .then(function (data) { 13 resolve(data ?? ""); 14 }) 15 .catch(function (err) { 16 reject(err); 17 }); 18 }); 19} 20 21function fetchExhibitionContent (exhibitionType, page) { 22 return new Promise(function (resolve, reject) { 23 fetch(ajaxScriptsObject.ajaxurl + '?action=loadExhibitions', { 24 method: 'POST', 25 body: JSON.stringify({ 26 exhibitionType: exhibitionType, 27 page: page, 28 }) 29 }) 30 .then(function (resp) { 31 return resp.text(); 32 }) 33 .then(function (data) { 34 resolve(data ?? ""); 35 }) 36 .catch(function (err) { 37 reject(err); 38 }); 39 }); 40} 41 42function fetchEventsContent (page, perPage) { 43 return new Promise(function (resolve, reject) { 44 fetch(ajaxScriptsObject.ajaxurl + '?action=loadEvents', { 45 method: 'POST', 46 body: JSON.stringify({ 47 page: page, 48 perPage: perPage 49 }) 50 }) 51 .then(function (resp) { 52 return resp.text(); 53 }) 54 .then(function (data) { 55 resolve(data ?? ""); 56 }) 57 .catch(function (err) { 58 reject(err); 59 }); 60 }); 61} 62 63function fetchTeacherResourcesContent (page, perPage) { 64 return new Promise(function (resolve, reject) { 65 fetch(ajaxScriptsObject.ajaxurl + '?action=loadTeacherResources', { 66 method: 'POST', 67 body: JSON.stringify({ 68 page: page, 69 perPage: perPage 70 }) 71 }) 72 .then(function (resp) { 73 return resp.text(); 74 }) 75 .then(function (data) { 76 resolve(data ?? ""); 77 }) 78 .catch(function (err) { 79 reject(err); 80 }); 81 }); 82} 83 84function fetchPressReleasesContent (page, perPage, year) { 85 const invalidSelects = document.querySelectorAll('.invalid-select'); 86 invalidSelects.forEach(invalidSelect => { 87 invalidSelect.remove(); 88 }); 89 90 return new Promise(function (resolve, reject) { 91 fetch(ajaxScriptsObject.ajaxurl + '?action=loadPressReleases', { 92 method: 'POST', 93 body: JSON.stringify({ 94 page: page, 95 perPage: perPage, 96 year: year, 97 }) 98 }) 99 .then(function (resp) { 100 return resp.text(); 101 }) 102 .then(function (data) { 103 resolve(data ?? ""); 104 }) 105 .catch(function (err) { 106 reject(err); 107 }); 108 }); 109} 110 111function fetchCollectionHighlightsContent (collectionHighlightId, page, perPage) { 112 return new Promise(function (resolve, reject) { 113 fetch(ajaxScriptsObject.ajaxurl + '?action=loadCollectionHighlights', { 114 method: 'POST', 115 body: JSON.stringify({ 116 page: page, 117 perPage: perPage, 118 collectionHighlightId: collectionHighlightId, 119 }) 120 }) 121 .then(function (resp) { 122 return resp.text(); 123 }) 124 .then(function (data) { 125 resolve(data ?? ""); 126 }) 127 .catch(function (err) { 128 reject(err); 129 }); 130 }); 131} 132 133function fetchReactComponent (componentName, postId) { 134 return new Promise(function (resolve, reject) { 135 fetch(ajaxScriptsObject.ajaxurl + '?action=loadReactComponent', { 136 method: 'POST', 137 body: JSON.stringify({ 138 componentName: componentName, 139 postId: postId, 140 }) 141 }) 142 .then(function (resp) { 143 return resp.text(); 144 }) 145 .then(function (data) { 146 resolve(data ?? ""); 147 }) 148 .catch(function (err) { 149 reject(err); 150 }); 151 }); 152} 153 154function fetchReactComponentByFields (componentName, fields) { 155 return new Promise(function (resolve, reject) { 156 fetch(ajaxScriptsObject.ajaxurl + '?action=loadReactComponentByFields', { 157 method: 'POST', 158 body: JSON.stringify({ 159 componentName: componentName, 160 fields: fields, 161 }) 162 }) 163 .then(function (resp) { 164 return resp.text(); 165 }) 166 .then(function (data) { 167 resolve(data ?? ""); 168 }) 169 .catch(function (err) { 170 reject(err); 171 }); 172 }); 173} 174 175function fetchTemplatePart (componentName, data) { 176 return new Promise(function (resolve, reject) { 177 fetch(ajaxScriptsObject.ajaxurl + '?action=loadTemplatePart', { 178 method: 'POST', 179 body: JSON.stringify({ 180 componentName: componentName, 181 data: data 182 }) 183 }) 184 .then(function (resp) { 185 return resp.text(); 186 }) 187 .then(function (data) { 188 resolve(data ?? ""); 189 }) 190 .catch(function (err) { 191 reject(err); 192 }); 193 }); 194} 195 196function fetchMapsDynamicGrid (roomId, page) { 197 return new Promise(function (resolve, reject) { 198 fetch(ajaxScriptsObject.ajaxurl + '?action=loadMapsGrid', { 199 method: 'POST', 200 body: JSON.stringify({ 201 roomId: roomId, 202 page: page, 203 }) 204 }) 205 .then(function (resp) { 206 return resp.text(); 207 }) 208 .then(function (data) { 209 resolve(data ?? ""); 210 }) 211 .catch(function (err) { 212 reject(err); 213 }); 214 }); 215} 216 217function fetchSearchResults (searchFields, page) { 218 return new Promise(function (resolve, reject) { 219 fetch(ajaxScriptsObject.ajaxurl + '?action=loadSearch', { 220 method: 'POST', 221 body: JSON.stringify({ 222 searchFields: searchFields, 223 page: page, 224 }) 225 }) 226 .then(function (resp) { 227 return resp.text(); 228 }) 229 .then(function (data) { 230 resolve(data ?? ""); 231 }) 232 .catch(function (err) { 233 reject(err); 234 }); 235 }); 236} 237 238function fetchCloseEmergencyDialog (dialoguesToRemove) { 239 return new Promise(function (resolve, reject) { 240 fetch(ajaxScriptsObject.ajaxurl + '?action=closeEmergencyDialog', { 241 method: 'POST', 242 body: JSON.stringify({ 243 dialoguesIDs: dialoguesToRemove.join(','), 244 }) 245 }) 246 .then(function (resp) { 247 return resp.text(); 248 }) 249 .then(function (data) { 250 resolve(data ?? ""); 251 }) 252 .catch(function (err) { 253 reject(err); 254 }); 255 }); 256} 257 258
259function fetchClosePopupWindow (popupsToRemove) { 260 return new Promise(function (resolve, reject) { 261 fetch(ajaxScriptsObject.ajaxurl + '?action=closePopup', { 262 method: 'POST', 263 body: JSON.stringify({ 264 popupIds: popupsToRemove.join(','), 265 }) 266 }) 267 .then(function (resp) { 268 return resp.text(); 269 }) 270 .then(function (data) { 271 resolve(data ?? ""); 272 }) 273 .catch(function (err) { 274 reject(err); 275 }); 276 }); 277}
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.