-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsearch.html
More file actions
52 lines (48 loc) · 1.37 KB
/
search.html
File metadata and controls
52 lines (48 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>scripttools</title>
<link rel="stylesheet" href="/css/site.css">
</head>
<body>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="index.html">README</a></li>
<li><a href="LICENSE">LICENSE</a></li>
<li><a href="INSTALL.html">INSTALL</a></li>
<li><a href="user_manual.html">User Manual</a></li>
<li><a href="about.html">About</a></li>
<li><a href="search.html">Search</a></li>
<li><a href="https://github.com/rsdoiel/scripttool">GitHub</a></li>
</ul>
</nav>
<section>
<h1 id="scripttool">scripttool</h1>
<link href="./pagefind/pagefind-ui.css" rel="stylesheet">
<script src="./pagefind/pagefind-ui.js" type="text/javascript"></script>
<div id="search">
</div>
<script>
const u = URL.parse(window.location.href);
const basePath = u.pathname.replace(/search.html$/g, '');
// Function to extract query parameters from the URL
function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// Extract the query parameter
const searchQuery = getQueryParam('q');
window.addEventListener('DOMContentLoaded', (event) => {
const searchUI = new PagefindUI({
element: "#search",
baseUrl: basePath
});
if (searchQuery) {
searchUI.triggerSearch(searchQuery);
}
});
</script>
</section>
</body>
</html>