diff --git a/main.bundle.js b/main.bundle.js index 666dd20..7f165fb 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 domStringSearchStart = ``;\n const domStringSearchResult = `\n
\n

KERI Suite Search Engine (KERISSE)

\n

,

\n
\n \n \n 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 // Add search to dom\n if (document.querySelector('#search') === null) {\n document\n .querySelector('body')\n .insertAdjacentHTML('afterbegin', domStringSearchResult);\n }\n\n // TODO: find out why check for null does not work\n // if (document.querySelector('#search-start') === null) {\n if (document.querySelector('#search-start')) {\n document.querySelector('#search-start').remove();\n }\n document\n .querySelector('body')\n .insertAdjacentHTML('beforeend', domStringSearchStart);\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').innerHTML = `` + 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').textContent = 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// 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// typesenseInstantSearchCreateDomElements();\n// }\n\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 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 domStringSearchStart = ``;\n const domStringSearchResult = `\n
\n

KERI Suite Search Engine (KERISSE)

\n

,

\n
\n \n \n 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 // Add search to dom\n if (document.querySelector('#search') === null) {\n document\n .querySelector('body')\n .insertAdjacentHTML('afterbegin', domStringSearchResult);\n }\n\n // TODO: find out why check for null does not work\n // if (document.querySelector('#search-start') === null) {\n if (document.querySelector('#search-start')) {\n document.querySelector('#search-start').remove();\n }\n document\n .querySelector('body')\n .insertAdjacentHTML('beforeend', domStringSearchStart);\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// 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// typesenseInstantSearchCreateDomElements();\n// }\n\n\n//# sourceURL=webpack://kerisse/./src/typesenseInstantSearchInit.js?"); /***/ })