1const searchClient = algoliasearch("X95XFIWUQS", "29f2191b97784995b31834bac3db86ad"); 2 3if (document.querySelector("#searchbox")) { 4 // console.log("Fund Search"); 5 6 // Fund Search 7 const fund_search = instantsearch({ 8 indexName: nnafAlgolia.indexPrefix + "Funds", 9 hitsPerPage: 10, 10 searchClient 11 }); 12 13 fund_search.addWidgets([ 14 instantsearch.widgets.searchBox({ 15 container: "#searchbox", 16 }), 17 18 instantsearch.widgets.refinementList({ 19 container: "#fund-filters", 20 attribute: "fund_filter", 21 }), 22 23 instantsearch.widgets.toggleRefinement({ 24 container: "#status-toggle", 25 attribute: "open_closed", 26 on: "open", 27 templates: { 28 labelText: "Open Funds Only", 29 }, 30 }), 31 32 instantsearch.widgets.pagination({ 33 container: "#pagination", 34 scrollTo: ".InstantSearch", 35 }), 36 37 instantsearch.widgets.hits({ 38 container: "#hits", 39 templates: { 40 item(hit) { 41 42 return ` 43 <article class="InstantSearch-listing-item"> 44 <div class="InstantSearch-listing-wrap"> 45 <div class="InstantSearch-listing-content"> 46 <div class="InstantSearch-listing-label-wrap"> 47 ${!hit.is_national && hit.location_label ? `<p class="InstantSearch-listing-label c-violet">Located in ${hit.location_label}</p>` : ''} 48 <p class="InstantSearch-listing-label InstantSearch-listing-label-status -${hit.open_closed.toLowerCase() == 'open' ? 'Open' : 'Funding Paused'}"> 49 <span class="-icon"></span> 50 ${hit.open_closed.toLowerCase() == 'open' ? 'Open' : 'Funding Paused'} 51 </p> 52 </div> 53 <a class="InstantSearch-listing-title" href="${hit.url}"> 54 ${hit.title} 55 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 56 </a> 57 ${hit.areas_served ? `<p class="InstantSearch-listing-info"><span class="InstantSearch-listing-label c-violet">Areas served: </span> ${hit.areas_served}</p>` : ''} 58 ${(typeof hit.fund_filter[0] !== 'undefined')? `<p class="InstantSearch-listing-info"><span class="InstantSearch-listing-label c-violet">This fund offers: </span> ${hit.fund_filter.join(', ')}</p>` : ''} 59 </div> 60 </div> 61 </article> 62 `; 63 }, 64 }, 65 }), 66 ]); 67 68 fund_search.start(); 69 70} else if (document.querySelector("#spanish_funds_searchbox")) { 71 // console.log("Spanish Fund Search"); 72 73 // Spanish Fund Search 74 const spanish_fund_search = instantsearch({ 75 indexName: nnafAlgolia.indexPrefix + "Spanish Funds", 76 hitsPerPage: 10, 77 searchClient 78 }); 79 80 spanish_fund_search.addWidgets([ 81 instantsearch.widgets.searchBox({ 82 container: "#spanish_funds_searchbox", 83 }), 84 85 instantsearch.widgets.refinementList({ 86 container: "#spanish-fund-filters", 87 attribute: "fund_filter", 88 }), 89 90 instantsearch.widgets.toggleRefinement({ 91 container: "#spanish-status-toggle", 92 attribute: "open_closed", 93 on: "open", 94 templates: { 95 labelText: "Solo fondos abiertos", 96 }, 97 }), 98 99 instantsearch.widgets.pagination({ 100 container: "#spanish-pagination", 101 scrollTo: ".InstantSearch", 102 }), 103 104 instantsearch.widgets.hits({ 105 container: "#spanish-hits", 106 templates: { 107 item(hit) { 108 109 return ` 110 <article class="InstantSearch-listing-item"> 111 <div class="InstantSearch-listing-wrap"> 112 <div class="InstantSearch-listing-content"> 113 <div class="InstantSearch-listing-label-wrap"> 114 ${hit.location_label && hit.location_label ? `<p class="InstantSearch-listing-label c-violet">Ubicado en ${hit.location_label}</p>` : ''} 115 <p class="InstantSearch-listing-label InstantSearch-listing-label-status -${hit.open_closed.toLowerCase() == 'open' ? 'Open' : 'Fu
115nding Paused'}"> 116 <span class="-icon"></span> 117 ${hit.open_closed.toLowerCase() == 'open' ? 'Abiertos' : 'En pausa'} 118 </p> 119 </div> 120 <a class="InstantSearch-listing-title" href="${hit.url}"> 121 ${hit.title} 122 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 123 </a> 124 ${hit.areas_served ? `<p class="InstantSearch-listing-info"><span class="InstantSearch-listing-label c-violet">Áreas alcanzadas: </span> ${hit.areas_served}</p>` : ''} 125 ${(typeof hit.fund_filter[0] !== 'undefined') ? `<p class="InstantSearch-listing-info"><span class="InstantSearch-listing-label c-violet">Este fondo ofrece: </span> ${hit.fund_filter.join(', ')}</p>` : ''} 126 </div> 127 </div> 128 </article> 129 `; 130 }, 131 }, 132 }), 133 ]); 134 135 spanish_fund_search.start(); 136} else if (document.querySelector("#global_searchbox")) { 137 // console.log("Global Search"); 138 139 // Global Site Search 140 const global_search = instantsearch({ 141 indexName: nnafAlgolia.indexPrefix + "Global Site Search", 142 hitsPerPage: 10, 143 searchClient 144 }); 145 146 147 global_search.addWidgets([ 148 instantsearch.widgets.searchBox({ 149 container: "#global_searchbox", 150 placeholder: "keyword", 151 }), 152 153 instantsearch.widgets.pagination({ 154 container: "#global_pagination", 155 }), 156 157 158 instantsearch.widgets.stats({ 159 container: '#stats', 160 templates: { 161 text(data, { html }) { 162 let count = ''; 163 164 if (data.query) { 165 if (data.hasManyResults) { 166 count += `${data.nbHits} results`; 167 } else if (data.hasOneResult) { 168 count += `1 result`; 169 } else { 170 count += `no results`; 171 } 172 return html`<span>${count} found for "${data.query}"</span>`;
173 } 174 175 }, 176 }, 177 }), 178 179 instantsearch.widgets.hits({ 180 container: "#global_hits", 181 templates: { 182 item:function(item) { 183 184 // we need define the full listing item template for when we have a thumbnail and when we don't 185 if(item.thumbnail_url === false) { 186 return ` 187 <article class="InstantSearch-listing-item"> 188 <div class="InstantSearch-listing-label-wrap"> 189 <p class="InstantSearch-listing-label">${(item.content_type == "page" || item.content_type == "campaign") ? '' : item.content_type}</p> 190 </div> 191 <a class="InstantSearch-listing-title" href="${item.url}"> 192 ${item.title} 193 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 194 </a> 195 <p>${item.excerpt}</p> 196 </article>` 197 } else { 198 return ` 199 <article class="InstantSearch-listing-item"> 200 <div class="InstantSearch-listing-item-wrap"> 201 <div class="InstantSearch-listing-item-content"> 202 <div class="InstantSearch-listing-label-wrap"> 203 <p class="InstantSearch-listing-label">${item.content_type}</p> 204 </div> 205 <a class="InstantSearch-listing-title" href="${item.url}"> 206 ${item.title} 207 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 208 </a> 209 <p>${item.excerpt}</p> 210 </div> 211 <img class="InstantSearch-listing-item-img" src=${item.thumbnail_url} /> 212 </div> 213 </article>` 214 } 215 }, 216 }, 217 }), 218 ]); 219 220 global_search.start(); 221} else if (document.querySelector("#spanish_global_searchbox")) { 222 // console.log("Spanish Global Site Search"); 223 224 // Global Site Search 225 const global_search = instantsearch({ 226 indexName: nnafAlgolia.indexPrefix + "Spanish Global Site Search", 227 hitsPerPage: 10, 228 searchClient 229 }); 230 231 232 global_search.addWidgets([ 233 instantsearch.widgets.searchBox({ 234 container: "#spanish_global_searchbox", 235 placeholder: "palabra clave", 236 }), 237 238 instantsearch.widgets.pagination({ 239 container: "#spanish_global_pagination", 240 }), 241 242 243 instantsearch.widgets.stats({ 244 container: '#spanish_stats', 245 templates: { 246 text(data, { html }) { 247 let count = ''; 248 249 if (data.query) { 250 if (data.hasManyResults) { 251 count += `${data.nbHits} results`; 252 } else if (data.hasOneResult) { 253 count += `1 result`; 254 } else { 255 count += `no results`; 256 } 257 return html`<span>${count} found for "${data.query}"</span>`;
258 } 259 260 }, 261 }, 262 }), 263 264 instantsearch.widgets.hits({ 265 container: "#spanish_global_hits", 266 templates: { 267 item:function(item) { 268 269 // we need define the full listing item template for when we have a thumbnail and when we don't 270 if(item.thumbnail_url === false) { 271 return ` 272 <article class="InstantSearch-listing-item"> 273 <p class="InstantSearch-listing-label">${(item.content_type == "page" || item.content_type == "campaign") ? '' : item.content_type}</p> 274 <a class="InstantSearch-listing-title" href="${item.url}"> 275 ${item.title} 276 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 277 </a> 278 <p>${item.excerpt}</p> 279 </article>` 280 } else { 281 return ` 282 <article class="InstantSearch-listing-item"> 283 <div class="InstantSearch-listing-item-wrap"> 284 <div class="InstantSearch-listing-item-content"> 285 <div class="InstantSearch-listing-label-wrap"> 286 <p class="InstantSearch-listing-label">${item.content_type}</p> 287 </div> 288 <a class="InstantSearch-listing-title" href="${item.url}"> 289 ${item.title} 290 <span class="u-nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="22" viewBox="0 0 12 22" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.50001 13.5L1.5 7.71429L3.17804 6L10.5 13.5L3.17804 21L1.5 19.2857L7.50001 13.5Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/></svg></span> 291 </a> 292 <p>${item.excerpt}</p> 293 </div> 294 <img class="InstantSearch-listing-item-img" src=${item.thumbnail_url} /> 295 </div> 296 </article>` 297 } 298 }, 299 }, 300 }), 301 ]); 302 303 global_search.start(); 304} else if (document.querySelector("#english_events_searchbox")) { 305 console.log("English Events Search"); 306 307 // English Event Search 308 const english_events_search = instantsearch({ 309 indexName: nnafAlgolia.indexPrefix + "English Events", 310 hitsPerPage: 10, 311 searchClient 312 }); 313 314 english_events_search.addWidgets([ 315 instantsearch.widgets.searchBox({ 316 container: "#english_events_searchbox", 317 placeholder: "Search", 318 }), 319 320 instantsearch.widgets.pagination({ 321 container: "#english_events_pagination", 322 scrollTo: ".InstantSearch", 323 }), 324 325 instantsearch.widgets.toggleRefinement({ 326 container: "#english-virtual-toggle", 327 attribute: "is_virtual", 328 on: true, 329 templates: { 330 labelText: "Only Virtual Events", 331 }, 332 }), 333 334 instantsearch.widgets.hits({ 335 container: "#english-event-hits", 336 templates: { 337 item:function(item) { 338 return ` 339 <article class="InstantSearch-listing-item"> 340 <p class="InstantSearch-listing-label">${item.fund_title}</p> 341 <a class="InstantSearch-listing-title -external" href="${item.event_link}"> 342 ${item.title} 343 <span class="u-nowrap"><svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.0606 7.43175L3.72683 7.58328L3.7012 5.18454L14.1819 5.31043L14.3078 15.7911L11.9091 15.7655L12.0606 7.43175Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/><path d="M13 6.99268L2.5 16.9927" stroke="#9E007E" stroke-width="3.5" stroke-miterlimit="2.03203"/></svg></span> 344 </a> 345 <div class="InstantSearch-listing-label-wrap"> 346 <p class="InstantSearch-listing-label"> 347 <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
347<path d="M9.00008 16.0832C12.9121 16.0832 16.0834 12.9119 16.0834 8.99984C16.0834 5.08782 12.9121 1.9165 9.00008 1.9165C5.08806 1.9165 1.91675 5.08782 1.91675 8.99984C1.91675 12.9119 5.08806 16.0832 9.00008 16.0832Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 4.75V9L11.8333 10.4167" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/></svg> 348 ${item.event_time} 349 </p> 350 <p class="InstantSearch-listing-label"> 351 <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_32_384)"><path d="M15.375 7.5835C15.375 12.5418 9 16.7918 9 16.7918C9 16.7918 2.625 12.5418 2.625 7.5835C2.625 5.89274 3.29665 4.27123 4.49219 3.07569C5.68774 1.88015 7.30924 1.2085 9 1.2085C10.6908 1.2085 12.3123 1.88015 13.5078 3.07569C14.7033 4.27123 15.375 5.89274 15.375 7.5835Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 9.7085C10.1736 9.7085 11.125 8.7571 11.125 7.5835C11.125 6.40989 10.1736 5.4585 9 5.4585C7.82639 5.4585 6.875 6.40989 6.875 7.5835C6.875 8.7571 7.82639 9.7085 9 9.7085Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_32_384"><rect width="17" height="17" fill="white" transform="translate(0.5 0.5)"/></clipPath></defs></svg> 352 ${item.location} 353 </p> 354 </div> 355 <p class="mt-2">${item.description}</p> 356 </article>` 357 }, 358 }, 359 }), 360 ]); 361 362 english_events_search.start(); 363} else if (document.querySelector("#spanish_events_searchbox")) { 364 console.log("Spanish Events Search"); 365 366 // Spanish Event Search 367 const spanish_events_search = instantsearch({ 368 indexName: nnafAlgolia.indexPrefix + "Spanish Events", 369 hitsPerPage: 10, 370 searchClient 371 }); 372 373 spanish_events_search.addWidgets([ 374 instantsearch.widgets.searchBox({ 375 container: "#spanish_events_searchbox", 376 placeholder: "Buscar", 377 }), 378 379 instantsearch.widgets.pagination({ 380 container: "#spanish_events_pagination", 381 scrollTo: ".InstantSearch", 382 }), 383 384 instantsearch.widgets.toggleRefinement({ 385 container: "#spanish-virtual-toggle", 386 attribute: "is_virtual", 387 on: true, 388 templates: { 389 labelText: "Solo Eventos Virtuales", 390 }, 391 }), 392 393 instantsearch.widgets.hits({ 394 container: "#spanish-event-hits", 395 templates: { 396 item:function(item) { 397 return ` 398 <article class="InstantSearch-listing-item"> 399 <div class="InstantSearch-listing-label-wrap"> 400 <p class="InstantSearch-listing-label">${item.fund_title}</p> 401 </div> 402 <a class="InstantSearch-listing-title -external" href="${item.event_link}"> 403 ${item.title} 404 <span class="u-nowrap"><svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.0606 7.43175L3.72683 7.58328L3.7012 5.18454L14.1819 5.31043L14.3078 15.7911L11.9091 15.7655L12.0606 7.43175Z" fill="#9E007E" stroke="#9E007E" stroke-miterlimit="2.03203"/><path d="M13 6.99268L2.5 16.9927" stroke="#9E007E" stroke-width="3.5" stroke-miterlimit="2.03203"/></svg></span> 405 </a> 406 <div class="InstantSearch-listing-label-wrap"> 407 <p class="InstantSearch-listing-label"> 408 <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.00008 16.0832C12.9121 16.0832 16.0834 12.9119 16.0834 8.99984C16.0834 5.08782 12.9121 1.9165 9.00008 1.9165C5.08806 1.9165 1.91675 5.08782 1.91675 8.99984C1.91675 12.9119 5.08806 16.0832 9.00008 16.0832Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 4.75V9L11.8333 10.4167" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/></svg> 409 ${item.event_time} 410 </p> 411 <p class="InstantSearch-listing-label"> 412 <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_32_384)"><path d="M15.375 7.5835C15.375 12.5418 9 16.7918 9 16.7918C9 16.7918 2.625 12.5418 2.625 7.5835C2.625 5.89274 3.29665 4.27123 4.49219 3.07569C5.68774 1.88015 7.30924 1.2085 9 1.2085C10.6908 1.2085 12.3123 1.88015 13.5078 3.07569C14.7033 4.27123 15.375 5.89274 15.375 7.5835Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/>
412<path d="M9 9.7085C10.1736 9.7085 11.125 8.7571 11.125 7.5835C11.125 6.40989 10.1736 5.4585 9 5.4585C7.82639 5.4585 6.875 6.40989 6.875 7.5835C6.875 8.7571 7.82639 9.7085 9 9.7085Z" stroke="#530B7B" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_32_384"><rect width="17" height="17" fill="white" transform="translate(0.5 0.5)"/></clipPath></defs></svg> 413 ${item.location} 414 </p> 415 </div> 416 <p class="mt-2">${item.description}</p> 417 </article>` 418 }, 419 }, 420 }), 421 ]); 422 423 spanish_events_search.start(); 424}
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.