From 7f4e66c375dab7a98e45b4f70c6eee1633daa55b Mon Sep 17 00:00:00 2001 From: kordwarshuis Date: Fri, 26 Jul 2024 17:45:53 +0000 Subject: [PATCH] deploy: ead0d29d375f75a6ae2d57d3afa067485b23c08e --- additional1.bundle.js | 2 +- custom.css | 11 +++ index.html | 180 ++++++++++++++++++++++++++++++++++++++++++ main.bundle.js | 2 +- 4 files changed, 193 insertions(+), 2 deletions(-) diff --git a/additional1.bundle.js b/additional1.bundle.js index 89fa22c..6d559db 100644 --- a/additional1.bundle.js +++ b/additional1.bundle.js @@ -1043,7 +1043,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var instantsearch_js_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! instantsearch.js/es */ \"./node_modules/instantsearch.js/es/index.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/search-box/search-box.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/configure/configure.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/hits/hits.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/pagination/pagination.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/clear-refinements/clear-refinements.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/current-refinements/current-refinements.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/refinement-list/refinement-list.js\");\n/* harmony import */ var typesense_instantsearch_adapter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! typesense-instantsearch-adapter */ \"./node_modules/typesense-instantsearch-adapter/lib/TypesenseInstantsearchAdapter.js\");\n/* harmony import */ var instantsearch_js_es_connectors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! instantsearch.js/es/connectors */ \"./node_modules/instantsearch.js/es/connectors/refinement-list/connectRefinementList.js\");\n/**\n * @file This file instantiates the Typesense InstantSearch.js adapter and the InstantSearch.js search client.\n * @author Kor Dwarshuis\n * @version 1.0.0\n * @since 2023-05-19\n */\n\n\n\n// to be used in the future\n// import { queriesWithSortAdjustment } from '/search-index-typesense/overrides/sortAdjustment.js';\n\n\n\n\n// import { SearchClient as TypesenseSearchClient } from 'typesense'; // To get the total number of docs\n\n// import { connectSearchBox } from 'instantsearch.js/es/connectors'\n\n\n// This is a custom widget that displays the refinement list for the \"tag\" attribute, but only for items that have the label \"img\". This is a replacement for the standard refinementList widget. The standard refinementList widget does not allow you to show a message when there are no items available. This custom widget does.\nconst refinementListImageToggle = (0,instantsearch_js_es_connectors__WEBPACK_IMPORTED_MODULE_1__[\"default\"])((renderOptions, isFirstRender) => {\n const { items, widgetParams } = renderOptions;\n\n const container = document.querySelector(\"#tag-refinement-list\");\n\n if (items.length === 0) {\n // Display \"No results\" if there are no items\n container.innerHTML = '
No images available
';\n } else {\n // Otherwise, build and display the refinement list\n const list = items.map(item => {\n return ``;\n }).join('');\n\n container.innerHTML = `
${list}
`;\n }\n});\n\nconst typeSenseInstantSearch = () => {\n // \"Try searching for:\"\n function handleSearchTermClick(event) {\n const searchBox = document.querySelector('.ais-SearchBox-input');\n search.helper.clearRefinements();\n searchBox.value = event.currentTarget.textContent;\n search.helper.setQuery(searchBox.value).search();\n }\n\n document.querySelectorAll('.clickable-search-term').forEach((el) => {\n el.addEventListener('click', handleSearchTermClick);\n });\n\n // to be used in the future\n // function applyCustomSorting(items) {\n // console.log('items: ', items);\n // const currentQuery = search.helper.state.query;\n\n // const matchingQueryObj = queriesWithSortAdjustment.find(\n // (obj) => obj.queryString === currentQuery\n // );\n\n // if (matchingQueryObj) {\n // const sortAdjustment = matchingQueryObj.sortAdjustment;\n // const urlSubstring = matchingQueryObj.urlSubstring;\n\n // return items.map((item) => {\n // item.sort_order = item.url && item.url.includes(urlSubstring) ? sortAdjustment : 0;\n // return item;\n // }).sort((a, b) => b.sort_order - a.sort_order);\n // }\n\n // return items;\n // }\n\n\n\n\n\n const typesenseInstantsearchAdapter = new typesense_instantsearch_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n server: {\n apiKey: 'qy6mC9ZakKZ3C8GUD5T3iDrelDgpp5Zc', // Be sure to use an API key that only allows searches, in production\n nodes: [\n {\n host: '9ktso7i1b8034azqp-1.a1.typesense.net',\n port: '443',\n protocol: 'https',\n },\n ],\n },\n // The following parameters are directly passed to Typesense's search API endpoint.\n // So you can pass any parameters supported by the search endpoint below.\n // queryBy is required.\n // filterBy is managed and overridden by InstantSearch.js. To set it, you want to use one of the filter widgets like refinementList or use the `configure` widget.\n additionalSearchParameters: {\n // query_by: 'title,authors',\n // query_by: 'imgMeta, content, firstHeadingBeforeElement, pageTitle, siteName, source, url',\n query_by: 'content, firstHeadingBeforeElement, pageTitle, siteName, source, url',\n // weights: '10000,1,1,1,1,1,1',\n // filter_by: 'tag:=[p]',\n // filter_by: 'tag:[a]',\n // filter_by: 'contentLength:>50',\n // sort_by: 'contentLength:asc',//asc or desc\n\n // sort_by: 'imgMetaLength:asc, contentLength:asc',//asc or desc\n sort_by: 'imgWidth:desc,contentLength:desc,imgUrl(missing_values: last):desc',//asc or desc\n // sort_by: 'imgWidth:desc,imgUrl(missing_values: last):desc',//asc or desc\n group_by: 'url',\n group_limit: 1\n },\n });\n const searchClient = typesenseInstantsearchAdapter.searchClient;\n\n const search = (0,instantsearch_js_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({\n searchClient,\n indexName: 'Wot-terms',// production\n // indexName: 'Wot-terms-test',// testing\n routing: true,\n // searchFunction(helper) {\n // if (helper.state.query === '') {\n // document\n // .querySelector('.search-modal-backdrop')\n // .classList.add('hidden');\n // document.querySelector('#search').classList.add('hidden');\n // } else {\n // document\n // .querySelector('.search-modal-backdrop')\n // .classList.remove('hidden');\n // document.querySelector('#search').classList.remove('hidden');\n // }\n // helper.search();\n // },\n });\n\n search.addWidgets([\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__[\"default\"])({\n container: '#search-box',\n showSubmit: false,\n showReset: false,\n showLoadingIndicator: true,\n placeholder: 'Enter Search…',\n autofocus: true,\n cssClasses: {\n input: 'form-control',\n },\n // queryHook(query, search) {\n // const modifiedQuery = queryWithoutStopWords(query);\n // if (modifiedQuery.trim() !== '') {\n // search(modifiedQuery);\n // }\n // },\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__[\"default\"])({\n hitsPerPage: 10,\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_5__[\"default\"])({\n container: '#hits',\n\n // to be used in the future\n // transformItems(items) {\n // let sortedItems = applyCustomSorting(items);\n // return sortedItems;\n // },\n templates: {\n item(item) {\n function makeCodeStringShorter(string) {\n /*\n Sometimes code blocks are very long and they take up a lot of space in the search results.\n \n This function takes a string as input and returns a modified version of the string.\n It finds the first occurrence of the tag and the tag in the input string.\n Then, it extracts a substring that includes 100 characters before the first and 100 characters after the first .\n The extracted substring is wrapped in an HTML element with the class \"highlighted\".\n If either the tag or the tag is not found, the function returns the original string unchanged.\n */\n\n // Find the index of the first occurrence of and in the string\n let firstMarkerTagIndex = string.indexOf('');\n let lastMarkerTagIndex = string.indexOf('');\n\n // Check if either < marker > or is not found in the string\n if (firstMarkerTagIndex === -1 || lastMarkerTagIndex === -1) {\n return string; // Return the original string if the tags are not found\n }\n\n // Calculate the start and end indices for the substring\n let start = Math.max(0, firstMarkerTagIndex - 300); // Start xxx characters before the first or at the beginning of the string\n let end = Math.min(string.length, lastMarkerTagIndex + 300); // End xxx characters after the first or at the end of the string\n\n // Extract the substring containing 100 characters before the first and 100 characters after the first \n let firstMarkerTagWith100CharactersBeforeAndAfterIt = string.substring(start, end);\n\n // Add a span with the \"highlighted\" class around the extracted substring\n firstMarkerTagWith100CharactersBeforeAndAfterIt = `${firstMarkerTagWith100CharactersBeforeAndAfterIt}`;\n\n return firstMarkerTagWith100CharactersBeforeAndAfterIt; // Return the modified string\n }\n\n\n // External links should open in a new tab\n let openInNewTab = '';\n if (item.url.indexOf('weboftrust.github.io/WOT-terms') === -1) {\n openInNewTab = 'target=\"_blank\" rel=\"noopener\"';\n }\n\n // \"Postprocess\" the content. Especially code samples can be very long and take up a lot of space in the search results. This function makes the code samples shorter. TODO: check if other content types need to be shortened as well.\n let postProcessedCode = '';\n\n // If the tag is pre or textarea, wrap the content in a
 tag, first let's do the opening tag\n          let postProcessedOpeningTag = '';\n          if (item.tag === 'pre' || item.tag === 'textarea') {\n            postProcessedOpeningTag = '
';\n            postProcessedCode = makeCodeStringShorter(item._highlightResult.content.value);\n          } else { // Otherwise, wrap the content in a 

tag\n postProcessedOpeningTag = '

'\n postProcessedCode = item._highlightResult.content.value;\n }\n\n // If the tag is pre or textarea, wrap the content in a

 tag, now let's do the closing tag\n          let postProcessedClosingTag = '';\n          if (item.tag === 'pre' || item.tag === 'textarea') {\n            postProcessedClosingTag = '
';\n } else { // Otherwise, wrap the content in a

tag\n postProcessedClosingTag = '

'\n }\n // END \"Postprocess\" the content\n\n // Only if curated is true, show a sticky label\n let itemCurated = item.curated === true ? `

Sticky

` : '';\n\n // Only if siteName is not empty, show it\n let itemSiteNameTemplateString = item.siteName !== '' ? `${item._highlightResult.siteName.value}` : '';\n\n // Only if title is not empty, show it\n // mb-4\n let itemTitleTemplateString = item.pageTitle !== '' ? `

${item._highlightResult.pageTitle.value}

` : '';\n\n // Only if author is not empty, show it\n let itemAuthorTemplateString = item.author !== '' ? `• ${item._highlightResult.author.value}` : '';\n\n\n // Add class to img based on imgWidth (img that are under 301 are assumed to be logos etc, above 301 are assumed to be explanations, flowcharts, etc)\n let imgClass = '';\n item.imgWidth < 301 ? imgClass = \"inline-thumb-start\" : imgClass = \"\";\n\n // Only if imgUrl is not empty, show it\n let itemImgUrlTemplateString = item.imgUrl !== '' ? `` : '';\n\n // Only if imgMeta is not empty, show it\n let itemImgMetaTemplateString = item.imgMeta !== '' ? `

${item._highlightResult.imgMeta.value}

` : '';\n\n // Only if creationDate is not empty, show it\n let itemCreationDateTemplateString = item.creationDate !== '' ? `• ${item.creationDate}` : '';\n\n // Only if knowledgeLevel is not empty, show it\n let itemKnowledgeLevelTemplateString = item.knowledgeLevel !== '' ? `• Level: ${item.knowledgeLevel}` : '';\n\n // Only if type is not empty, show it\n let itemTypeTemplateString = item.type !== '' ? `• ${item.type}` : '';\n\n // Only if hierarchy.lvl1 is not empty, show it\n let itemHierarchyLvl1TemplateString = item['hierarchy.lvl1'] !== '' ? `• ${item['hierarchy.lvl1']}` : '';\n\n // Only if firstHeadingBeforeElement is not empty, show it\n let itemFirstHeadingBeforeElementTemplateString = item.firstHeadingBeforeElement !== '' ? `

${item.firstHeadingBeforeElement}

` : '';\n\n let siteBrandingClass = '';\n if (item.siteName === \"Gleif website\") {\n siteBrandingClass = \"gleif\";\n }\n if (item.siteName === \"eSSIF-Lab\") {\n siteBrandingClass = \"essif-lab\";\n }\n if (item.siteName === \"KERISSE (this site)\") {\n siteBrandingClass = \"kerisse\";\n }\n return `\n
\n
\n ${itemCurated}

Found on: ${itemSiteNameTemplateString}

\n
\n
\n
\n ${item._highlightResult.url.value}\n ${itemAuthorTemplateString}\n ${itemCreationDateTemplateString}\n ${itemKnowledgeLevelTemplateString}\n ${itemTypeTemplateString}\n ${itemHierarchyLvl1TemplateString}\n
\n
\n ${itemTitleTemplateString}\n ${itemFirstHeadingBeforeElementTemplateString}\n\n ${postProcessedOpeningTag}\n ${postProcessedCode}\n ${postProcessedClosingTag}\n\n ${itemImgUrlTemplateString}\n ${itemImgMetaTemplateString}\n
\n \n
\n `;\n },\n },\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({\n container: '#pagination',\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_7__[\"default\"])({\n container: '#clear-refinements',\n templates: {\n resetLabel: 'Clear filters'\n },\n cssClasses: {\n button: 'btn btn-secondary btn-sm align-content-center mb-5 mt-3'\n }\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_8__[\"default\"])({\n container: '#current-refinements-list',\n cssClasses: {\n list: 'list-unstyled',\n item: '',\n delete: 'btn btn-sm btn-link text-decoration-none p-0 px-2',\n },\n transformItems: (items) => {\n // hide the heading if there are no current refinements\n document.querySelector(\"#current-refinements-list-container\").classList.add(\"d-none\");\n const labelLookup = {\n content: 'Content',\n author: 'Author',\n category: 'Category',\n source: 'Source',\n mediaType: 'File type',\n };\n const modifiedItems = items.map((item) => {\n // show the heading if there are current refinements\n document.querySelector(\"#current-refinements-list-container\").classList.remove(\"d-none\");\n return {\n ...item,\n label: labelLookup[item.attribute] || '',\n };\n });\n return modifiedItems;\n },\n }),\n // Currently not useful\n // sortBy({\n // container: '#sort-by',\n // items: [\n // { label: 'Default Sort', value: 'Wot-terms' },\n // { label: 'Content Length: Low to High', value: 'Wot-terms/sort/contentLength:asc' },\n // { label: 'Content Length: High to Low', value: 'Wot-terms/sort/contentLength:desc' },\n // ],\n // cssClasses: {\n // select: 'form-select form-select-sm mb-2 border-light-2',\n // },\n // }),\n\n // // KNOWLEDGELEVEL\n // refinementList({\n // container: '#knowledgelevel-refinement-list',\n // attribute: 'knowledgeLevel',\n // searchable: false,\n // searchablePlaceholder: 'Search knowledge level',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // // TYPE\n // refinementList({\n // container: '#type-refinement-list',\n // attribute: 'type',\n // searchable: false,\n // searchablePlaceholder: 'Search type',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // // SUBJECT\n // refinementList({\n // container: '#subject-refinement-list',\n // attribute: 'hierarchy.lvl1',\n // searchable: false,\n // searchablePlaceholder: 'Subject',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // TAG\n\n\n refinementListImageToggle({\n container: '#tag-refinement-list',\n attribute: 'tag',\n // Include other necessary widget options here\n transformItems: items => items.filter(item => ['img'].includes(item.label)),\n limit: 1000\n }),\n\n // CATEGORY\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#category-refinement-list',\n attribute: 'category',\n searchable: true,\n searchablePlaceholder: 'Category',\n showMore: false,\n // max_facet_values: 100, TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n // SOURCE\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#source-refinement-list',\n attribute: 'source',\n searchable: true,\n searchablePlaceholder: 'Source',\n showMore: true,\n // max_facet_values: 100, TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#author-refinement-list',\n attribute: 'author',\n searchable: true,\n searchablePlaceholder: 'Author',\n showMore: true,\n // max_facet_values: 100,TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n // MEDIATYPE\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#media-type-refinement-list',\n attribute: 'mediaType',\n searchable: true,\n searchablePlaceholder: 'File type',\n showMore: true,\n // max_facet_values: 100,TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n ]);\n\n // function handleSearchTermClick(event) {\n // const searchBox = document.querySelector('#search-box input[type=search]');\n // search.helper.clearRefinements();\n // searchBox.val(event.currentTarget.textContent);\n // search.helper.setQuery(searchBox.val()).search();\n // }\n\n // search.on('render', function () {\n // // Make artist names clickable\n // // $('#hits .clickable-search-term').on('click', handleSearchTermClick);\n // document.querySelectorAll('.hit-url a').forEach((el) => {\n // el.addEventListener('click', handleSearchTermClick);\n // });\n // });\n\n search.start();\n};\n\ntypeSenseInstantSearch();\n\n// export function onRouteDidUpdate({ location, previousLocation }) {\n// // Don't execute if we are still on the same page; the lifecycle may be fired\n// // because the hash changes (e.g. when navigating between headings)\n// if (location.pathname === previousLocation?.pathname) return;\n// typeSenseInstantSearch();\n// }\n\n\n//# sourceURL=webpack://kerisse/./src/typesenseInstantSearch.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var instantsearch_js_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! instantsearch.js/es */ \"./node_modules/instantsearch.js/es/index.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/search-box/search-box.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/configure/configure.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/hits/hits.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/pagination/pagination.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/clear-refinements/clear-refinements.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/current-refinements/current-refinements.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/refinement-list/refinement-list.js\");\n/* harmony import */ var typesense_instantsearch_adapter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! typesense-instantsearch-adapter */ \"./node_modules/typesense-instantsearch-adapter/lib/TypesenseInstantsearchAdapter.js\");\n/* harmony import */ var instantsearch_js_es_connectors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! instantsearch.js/es/connectors */ \"./node_modules/instantsearch.js/es/connectors/refinement-list/connectRefinementList.js\");\n/**\n * @file This file instantiates the Typesense InstantSearch.js adapter and the InstantSearch.js search client.\n * @author Kor Dwarshuis\n * @version 1.0.0\n * @since 2023-05-19\n */\n\n\n\n// to be used in the future\n// import { queriesWithSortAdjustment } from '/search-index-typesense/overrides/sortAdjustment.js';\n\n\n\n\n// import { SearchClient as TypesenseSearchClient } from 'typesense'; // To get the total number of docs\n\n// import { connectSearchBox } from 'instantsearch.js/es/connectors'\n\n\n// This is a custom widget that displays the refinement list for the \"tag\" attribute, but only for items that have the label \"img\". This is a replacement for the standard refinementList widget. The standard refinementList widget does not allow you to show a message when there are no items available. This custom widget does.\nconst refinementListImageToggle = (0,instantsearch_js_es_connectors__WEBPACK_IMPORTED_MODULE_1__[\"default\"])((renderOptions, isFirstRender) => {\n const { items, widgetParams } = renderOptions;\n\n const container = document.querySelector(\"#tag-refinement-list\");\n\n if (items.length === 0) {\n // Display \"No results\" if there are no items\n container.innerHTML = '
No images available
';\n } else {\n // Otherwise, build and display the refinement list\n const list = items.map(item => {\n return ``;\n }).join('');\n\n container.innerHTML = `
${list}
`;\n }\n});\n\nconst typeSenseInstantSearch = () => {\n // \"Try searching for:\"\n function handleSearchTermClick(event) {\n const searchBox = document.querySelector('.ais-SearchBox-input');\n search.helper.clearRefinements();\n searchBox.value = event.currentTarget.textContent;\n search.helper.setQuery(searchBox.value).search();\n }\n\n document.querySelectorAll('.clickable-search-term').forEach((el) => {\n el.addEventListener('click', handleSearchTermClick);\n });\n\n // to be used in the future\n // function applyCustomSorting(items) {\n // console.log('items: ', items);\n // const currentQuery = search.helper.state.query;\n\n // const matchingQueryObj = queriesWithSortAdjustment.find(\n // (obj) => obj.queryString === currentQuery\n // );\n\n // if (matchingQueryObj) {\n // const sortAdjustment = matchingQueryObj.sortAdjustment;\n // const urlSubstring = matchingQueryObj.urlSubstring;\n\n // return items.map((item) => {\n // item.sort_order = item.url && item.url.includes(urlSubstring) ? sortAdjustment : 0;\n // return item;\n // }).sort((a, b) => b.sort_order - a.sort_order);\n // }\n\n // return items;\n // }\n\n\n\n\n\n const typesenseInstantsearchAdapter = new typesense_instantsearch_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n server: {\n apiKey: 'qy6mC9ZakKZ3C8GUD5T3iDrelDgpp5Zc', // Be sure to use an API key that only allows searches, in production\n nodes: [\n {\n host: '9ktso7i1b8034azqp-1.a1.typesense.net',\n port: '443',\n protocol: 'https',\n },\n ],\n },\n // The following parameters are directly passed to Typesense's search API endpoint.\n // So you can pass any parameters supported by the search endpoint below.\n // queryBy is required.\n // filterBy is managed and overridden by InstantSearch.js. To set it, you want to use one of the filter widgets like refinementList or use the `configure` widget.\n additionalSearchParameters: {\n // query_by: 'title,authors',\n // query_by: 'imgMeta, content, firstHeadingBeforeElement, pageTitle, siteName, source, url',\n query_by: 'content, firstHeadingBeforeElement, pageTitle, siteName, source, url',\n // weights: '10000,1,1,1,1,1,1',\n // filter_by: 'tag:=[p]',\n // filter_by: 'tag:[a]',\n // filter_by: 'contentLength:>50',\n // sort_by: 'contentLength:asc',//asc or desc\n\n // sort_by: 'imgMetaLength:asc, contentLength:asc',//asc or desc\n sort_by: 'imgWidth:desc,contentLength:desc,imgUrl(missing_values: last):desc',//asc or desc\n // sort_by: 'imgWidth:desc,imgUrl(missing_values: last):desc',//asc or desc\n group_by: 'url',\n group_limit: 1\n },\n });\n const searchClient = typesenseInstantsearchAdapter.searchClient;\n\n const search = (0,instantsearch_js_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({\n searchClient,\n indexName: 'Wot-terms',// production\n // indexName: 'Wot-terms-test',// testing\n routing: true,\n // searchFunction(helper) {\n // if (helper.state.query === '') {\n // document\n // .querySelector('.search-modal-backdrop')\n // .classList.add('hidden');\n // document.querySelector('#search').classList.add('hidden');\n // } else {\n // document\n // .querySelector('.search-modal-backdrop')\n // .classList.remove('hidden');\n // document.querySelector('#search').classList.remove('hidden');\n // }\n // helper.search();\n // },\n });\n\n search.addWidgets([\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__[\"default\"])({\n container: '#search-box',\n showSubmit: false,\n showReset: false,\n showLoadingIndicator: true,\n placeholder: 'Enter Search…',\n autofocus: true,\n cssClasses: {\n input: 'form-control',\n },\n // queryHook(query, search) {\n // const modifiedQuery = queryWithoutStopWords(query);\n // if (modifiedQuery.trim() !== '') {\n // search(modifiedQuery);\n // }\n // },\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__[\"default\"])({\n hitsPerPage: 10,\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_5__[\"default\"])({\n container: '#hits',\n\n // to be used in the future\n // transformItems(items) {\n // let sortedItems = applyCustomSorting(items);\n // return sortedItems;\n // },\n templates: {\n item(item) {\n function makeCodeStringShorter(string) {\n /*\n Sometimes code blocks are very long and they take up a lot of space in the search results.\n \n This function takes a string as input and returns a modified version of the string.\n It finds the first occurrence of the tag and the tag in the input string.\n Then, it extracts a substring that includes 100 characters before the first and 100 characters after the first .\n The extracted substring is wrapped in an HTML element with the class \"highlighted\".\n If either the tag or the tag is not found, the function returns the original string unchanged.\n */\n\n // Find the index of the first occurrence of and in the string\n let firstMarkerTagIndex = string.indexOf('');\n let lastMarkerTagIndex = string.indexOf('');\n\n // Check if either < marker > or is not found in the string\n if (firstMarkerTagIndex === -1 || lastMarkerTagIndex === -1) {\n return string; // Return the original string if the tags are not found\n }\n\n // Calculate the start and end indices for the substring\n let start = Math.max(0, firstMarkerTagIndex - 300); // Start xxx characters before the first or at the beginning of the string\n let end = Math.min(string.length, lastMarkerTagIndex + 300); // End xxx characters after the first or at the end of the string\n\n // Extract the substring containing 100 characters before the first and 100 characters after the first \n let firstMarkerTagWith100CharactersBeforeAndAfterIt = string.substring(start, end);\n\n // Add a span with the \"highlighted\" class around the extracted substring\n firstMarkerTagWith100CharactersBeforeAndAfterIt = `${firstMarkerTagWith100CharactersBeforeAndAfterIt}`;\n\n return firstMarkerTagWith100CharactersBeforeAndAfterIt; // Return the modified string\n }\n\n\n // External links should open in a new tab\n let openInNewTab = '';\n if (item.url.indexOf('weboftrust.github.io/WOT-terms') === -1) {\n openInNewTab = 'target=\"_blank\" rel=\"noopener\"';\n }\n\n // \"Postprocess\" the content. Especially code samples can be very long and take up a lot of space in the search results. This function makes the code samples shorter. TODO: check if other content types need to be shortened as well.\n let postProcessedCode = '';\n\n // If the tag is pre or textarea, wrap the content in a
 tag, first let's do the opening tag\n          let postProcessedOpeningTag = '';\n          if (item.tag === 'pre' || item.tag === 'textarea') {\n            postProcessedOpeningTag = '
';\n            postProcessedCode = makeCodeStringShorter(item._highlightResult.content.value);\n          } else { // Otherwise, wrap the content in a 

tag\n postProcessedOpeningTag = '

'\n postProcessedCode = item._highlightResult.content.value;\n }\n\n // If the tag is pre or textarea, wrap the content in a

 tag, now let's do the closing tag\n          let postProcessedClosingTag = '';\n          if (item.tag === 'pre' || item.tag === 'textarea') {\n            postProcessedClosingTag = '
';\n } else { // Otherwise, wrap the content in a

tag\n postProcessedClosingTag = '

'\n }\n // END \"Postprocess\" the content\n\n // Only if curated is true, show a sticky label\n let itemCurated = item.curated === true ? `

Sticky

` : '';\n\n // Only if siteName is not empty, show it\n let itemSiteNameTemplateString = item.siteName !== '' ? `${item._highlightResult.siteName.value}` : '';\n\n // Only if title is not empty, show it\n // mb-4\n let itemTitleTemplateString = item.pageTitle !== '' ? `

${item._highlightResult.pageTitle.value}

` : '';\n\n // Only if author is not empty, show it\n let itemAuthorTemplateString = item.author !== '' ? `• ${item._highlightResult.author.value}` : '';\n\n\n // Add class to img based on imgWidth (img that are under 301 are assumed to be logos etc, above 301 are assumed to be explanations, flowcharts, etc)\n let imgClass = '';\n item.imgWidth < 301 ? imgClass = \"inline-thumb-start\" : imgClass = \"\";\n\n // Only if imgUrl is not empty, show it\n let itemImgUrlTemplateString = item.imgUrl !== '' ? `` : '';\n\n // Only if imgMeta is not empty, show it\n let itemImgMetaTemplateString = item.imgMeta !== '' ? `

${item._highlightResult.imgMeta.value}

` : '';\n\n // Only if creationDate is not empty, show it\n let itemCreationDateTemplateString = item.creationDate !== '' ? `• ${item.creationDate}` : '';\n\n // Only if knowledgeLevel is not empty, show it\n let itemKnowledgeLevelTemplateString = item.knowledgeLevel !== '' ? `• Level: ${item.knowledgeLevel}` : '';\n\n // Only if type is not empty, show it\n let itemTypeTemplateString = item.type !== '' ? `• ${item.type}` : '';\n\n // Only if hierarchy.lvl1 is not empty, show it\n let itemHierarchyLvl1TemplateString = item['hierarchy.lvl1'] !== '' ? `• ${item['hierarchy.lvl1']}` : '';\n\n // Only if firstHeadingBeforeElement is not empty, show it\n let itemFirstHeadingBeforeElementTemplateString = item.firstHeadingBeforeElement !== '' ? `

${item.firstHeadingBeforeElement}

` : '';\n\n let siteBrandingClass = '';\n if (item.siteName === \"Gleif website\") {\n siteBrandingClass = \"gleif\";\n }\n if (item.siteName === \"eSSIF-Lab\") {\n siteBrandingClass = \"essif-lab\";\n }\n if (item.siteName === \"KERISSE (this site)\") {\n siteBrandingClass = \"kerisse\";\n }\n return `\n
\n
\n ${itemCurated}

Found on: ${itemSiteNameTemplateString}

\n
\n
\n
\n ${item._highlightResult.url.value}\n ${itemAuthorTemplateString}\n ${itemCreationDateTemplateString}\n ${itemKnowledgeLevelTemplateString}\n ${itemTypeTemplateString}\n ${itemHierarchyLvl1TemplateString}\n
\n
\n ${itemTitleTemplateString}\n ${itemFirstHeadingBeforeElementTemplateString}\n\n ${postProcessedOpeningTag}\n ${postProcessedCode}\n ${postProcessedClosingTag}\n\n ${itemImgUrlTemplateString}\n ${itemImgMetaTemplateString}\n
\n \n
\n `;\n },\n },\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({\n container: '#pagination',\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_7__[\"default\"])({\n container: '#clear-refinements',\n templates: {\n resetLabel: 'Clear filters'\n },\n cssClasses: {\n button: 'btn btn-secondary btn-sm align-content-center mb-5 mt-3'\n }\n }),\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_8__[\"default\"])({\n container: '#current-refinements-list',\n cssClasses: {\n list: 'list-unstyled',\n item: '',\n delete: 'btn btn-sm btn-link text-decoration-none p-0 px-2',\n },\n transformItems: (items) => {\n // hide the heading if there are no current refinements\n document.querySelector(\"#current-refinements-list-container\").classList.add(\"d-none\");\n const labelLookup = {\n content: 'Content',\n author: 'Author',\n category: 'Category',\n source: 'Source',\n mediaType: 'File type',\n };\n const modifiedItems = items.map((item) => {\n // show the heading if there are current refinements\n document.querySelector(\"#current-refinements-list-container\").classList.remove(\"d-none\");\n return {\n ...item,\n label: labelLookup[item.attribute] || '',\n };\n });\n return modifiedItems;\n },\n }),\n // Currently not useful\n // sortBy({\n // container: '#sort-by',\n // items: [\n // { label: 'Default Sort', value: 'Wot-terms' },\n // { label: 'Content Length: Low to High', value: 'Wot-terms/sort/contentLength:asc' },\n // { label: 'Content Length: High to Low', value: 'Wot-terms/sort/contentLength:desc' },\n // ],\n // cssClasses: {\n // select: 'form-select form-select-sm mb-2 border-light-2',\n // },\n // }),\n\n // // KNOWLEDGELEVEL\n // refinementList({\n // container: '#knowledgelevel-refinement-list',\n // attribute: 'knowledgeLevel',\n // searchable: false,\n // searchablePlaceholder: 'Search knowledge level',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // // TYPE\n // refinementList({\n // container: '#type-refinement-list',\n // attribute: 'type',\n // searchable: false,\n // searchablePlaceholder: 'Search type',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // // SUBJECT\n // refinementList({\n // container: '#subject-refinement-list',\n // attribute: 'hierarchy.lvl1',\n // searchable: false,\n // searchablePlaceholder: 'Subject',\n // showMore: false,\n // cssClasses: {\n // searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n // searchableSubmit: 'hidden',\n // searchableReset: 'hidden',\n // showMore: 'btn btn-secondary btn-sm align-content-center',\n // list: 'list-unstyled',\n // count: '',\n // label: '',\n // checkbox: 'me-2',\n // },\n // sortBy: ['name:asc', 'count:desc'],\n // }),\n // TAG\n\n\n refinementListImageToggle({\n container: '#tag-refinement-list',\n attribute: 'tag',\n // Include other necessary widget options here\n transformItems: items => items.filter(item => ['img'].includes(item.label)),\n limit: 1000\n }),\n\n // CATEGORY\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#category-refinement-list',\n attribute: 'category',\n searchable: true,\n searchablePlaceholder: 'Category',\n showMore: false,\n // max_facet_values: 100, TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n // SOURCE\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#source-refinement-list',\n attribute: 'source',\n searchable: true,\n searchablePlaceholder: 'Source',\n showMore: true,\n // max_facet_values: 100, TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#author-refinement-list',\n attribute: 'author',\n searchable: true,\n searchablePlaceholder: 'Author',\n showMore: true,\n // max_facet_values: 100,TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n // MEDIATYPE\n (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_9__[\"default\"])({\n container: '#media-type-refinement-list',\n attribute: 'mediaType',\n searchable: true,\n searchablePlaceholder: 'File type',\n showMore: true,\n // max_facet_values: 100,TODO: does this work?\n cssClasses: {\n searchableInput: 'form-control form-control-sm mb-2 border-light-2',\n searchableSubmit: 'hidden',\n searchableReset: 'hidden',\n showMore: 'btn btn-secondary btn-sm align-content-center',\n list: 'list-unstyled',\n count: '',\n label: '',\n checkbox: 'me-2',\n },\n sortBy: ['name:asc', 'count:desc'],\n }),\n ]);\n\n function debounce(func, delay) {\n let debounceTimer;\n return function () {\n const context = this;\n const args = arguments;\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(() => func.apply(context, args), delay);\n };\n }\n\n const debounceDelay = 600;\n const loader = document.querySelector('#loader')\n\n search.on('render', debounce(function () {\n loader.textContent = 'Search results are loaded';\n loader.classList.add('visible');\n setTimeout(() => {\n loader.classList.remove('visible');\n }, 2000);\n }, debounceDelay));\n\n search.start();\n};\n\ntypeSenseInstantSearch();\n\n// export function onRouteDidUpdate({ location, previousLocation }) {\n// // Don't execute if we are still on the same page; the lifecycle may be fired\n// // because the hash changes (e.g. when navigating between headings)\n// if (location.pathname === previousLocation?.pathname) return;\n// typeSenseInstantSearch();\n// }\n\n\n//# sourceURL=webpack://kerisse/./src/typesenseInstantSearch.js?"); /***/ }), diff --git a/custom.css b/custom.css index 7d6289c..e80a1ed 100644 --- a/custom.css +++ b/custom.css @@ -993,4 +993,15 @@ article .markdown .inline-medium-end, footer { background: #313846; +} + +#loader { + opacity: 0; + transition: all 0.3s ease-in-out; +} + +.visible { + /* visibility: visible; */ + opacity: 1 !important; + transition: all 0.3s ease-in-out; } \ No newline at end of file diff --git a/index.html b/index.html index 0bcd75f..4f36bdc 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,186 @@ + + + + + + + + diff --git a/main.bundle.js b/main.bundle.js index bde88dc..a21d5d2 100644 --- a/main.bundle.js +++ b/main.bundle.js @@ -26,7 +26,7 @@ eval("const paths = {\n url: \"https://weboftrust.github.io\",\n baseUrl: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _paths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../paths */ \"./paths.js\");\n/* harmony import */ var _paths__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_paths__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * @file This file creates the DOM elements for the Typesense search box and search results. The DOM elements for the search hits are in the main Typesense InstantSearch plugin code.\n * @author Kor Dwarshuis\n * @version 1.0.0\n * @since 2023-05-19\n */\n\n\n\nconst typesenseInstantSearchCreateDomElements = () => {\n const domStringSearchResult = `\n
\n \n\n
\n

KERISSE

\n

KERI Suite Search Engine

\n\n
\n \n \n Indexed:\n ,\n pages: |\n GitHub repo |\n Kerific Browser\n Extension\n \n
\n\n \n Jump to search results\n \n\n \n\n \n\n
\n\n \n
\n
\n
\n
\n
\n \n

Refine

\n
\n
\n
\n
\n\n
\n
\n

Current refinements

\n
\n
\n
\n\n

Only Images

\n
\n\n

Category

\n
\n\n

Source

\n
\n\n

Author

\n
\n\n

File type

\n
\n \n
\n
\n \n
\n

Results

\n
\n
\n
\n
\n
\n
\n\n\n\n `;\n\n // Add search to dom\n if (document.querySelector('#search') === null) {\n document\n .querySelector('body')\n .insertAdjacentHTML('afterbegin', domStringSearchResult);\n }\n\n\n /*\n TIMESTAMP \n \n The code below Fetches HTML content from indexed-in-KERISSE on this same domain using the `fetch` API.\n \n It then parses the fetched HTML using `DOMParser` and queries the DOM to find a paragraph element with the id \"index-created-timestamp-source\".\n \n If the element is found, its text content is added to the search result page; otherwise, an appropriate message indicating the absence of such an element is logged.\n */\n\n // Fetching the HTML content\n fetch((_paths__WEBPACK_IMPORTED_MODULE_0___default().indexedInKERISSE), {\n headers: {\n 'Cache-Control': 'no-cache',\n 'Pragma': 'no-cache',\n 'Expires': '0'\n }\n })\n .then(response => response.text())\n .then(html => {\n // Parsing the fetched HTML string into a DOM object\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n\n // Finding the paragraph elements by their id's\n const timestampElement = doc.querySelector('#index-created-timestamp-source');\n const pageCountElement = doc.querySelector('#index-created-page-count-source');\n\n if (timestampElement) {\n // Extracting and logging the content of the paragraph\n const timestampContent = timestampElement.textContent;\n document.querySelector('#index-created-timestamp-target-search-modal').textContent = timestampContent;\n } else {\n console.log('Element with id \"index-created-timestamp-source\" not found.');\n }\n\n if (pageCountElement) {\n // Extracting and logging the content of the paragraph\n const pageCountContent = pageCountElement.textContent;\n document.querySelector('#index-created-page-count-target-search-modal').innerHTML = pageCountContent;\n } else {\n console.log('Element with id \"index-created-page-count-source\" not found.');\n }\n })\n .catch(error => {\n console.error(`Error fetching the content: ${error}`);\n });\n // END TIMESTAMP\n\n\n\n};\n\ntypesenseInstantSearchCreateDomElements();\n\n//# sourceURL=webpack://kerisse/./src/typesenseInstantSearchInit.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _paths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../paths */ \"./paths.js\");\n/* harmony import */ var _paths__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_paths__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * @file This file fetches HTML content from indexed-in-KERISSE on this same domain using the `fetch` API.\n \n It then parses the fetched HTML using `DOMParser` and queries the DOM to find a paragraph element with the id \"index-created-timestamp-source\".\n \n If the element is found, its text content is added to the search result page; otherwise, an appropriate message indicating the absence of such an element is logged.\n * @author Kor Dwarshuis\n * @version 1.0.0\n * @since 2023-05-19\n */\n\n\n\n// Fetching the HTML content\nfetch((_paths__WEBPACK_IMPORTED_MODULE_0___default().indexedInKERISSE), {\n headers: {\n 'Cache-Control': 'no-cache',\n 'Pragma': 'no-cache',\n 'Expires': '0'\n }\n})\n .then(response => response.text())\n .then(html => {\n // Parsing the fetched HTML string into a DOM object\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n\n // Finding the paragraph elements by their id's\n const timestampElement = doc.querySelector('#index-created-timestamp-source');\n const pageCountElement = doc.querySelector('#index-created-page-count-source');\n\n if (timestampElement) {\n // Extracting and logging the content of the paragraph\n const timestampContent = timestampElement.textContent;\n document.querySelector('#index-created-timestamp-target-search-modal').textContent = timestampContent;\n } else {\n console.log('Element with id \"index-created-timestamp-source\" not found.');\n }\n\n if (pageCountElement) {\n // Extracting and logging the content of the paragraph\n const pageCountContent = pageCountElement.textContent;\n document.querySelector('#index-created-page-count-target-search-modal').innerHTML = pageCountContent;\n } else {\n console.log('Element with id \"index-created-page-count-source\" not found.');\n }\n })\n .catch(error => {\n console.error(`Error fetching the content: ${error}`);\n });\n// END TIMESTAMP\n\n//# sourceURL=webpack://kerisse/./src/typesenseInstantSearchInit.js?"); /***/ })