-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsearch.html
78 lines (70 loc) · 2.08 KB
/
search.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Search
description: Search OpenRAP
allowSearch: false
layout: default
---
{% include searchbar.html %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="search-inner p-20 mt-20">
<p>
<span id="search-process">Loading</span> results
<span id="search-query-container" style="display: none;"
>for "<strong id="search-query"></strong>"</span
>
</p>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
<script>
window.data = {
{% for post in site.pages %}
{% if post.allowSearch %}
{% if post.title %}
{% if added %},{% endif %}
{% assign added = false %}
"{{ post.url | slugify }}": {
"id": "{{ post.url | slugify }}",
"title": "{{ post.title | xml_escape }}",
"keywords": "{{ post.keywords | join: ", " | xml_escape }}",
"description": "{{ post.description | xml_escape }}",
"category": "{{ post.categories | join: ", " | xml_escape }}",
"userRole": "{{ post.SubCategories}}",
"url": " {{ post.url | xml_escape }}",
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{% assign added = true %}
{% endif %}
{% endif %}
{% endfor %}
};
</script>
<script>
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split("&"),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split("=");
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var searchQuery = getUrlParameter("q");
$("#searchBoxInput").val(searchQuery);
</script>
<script
type="text/javascript"
src="/assets/js/lunr.min.js"
async
defer
></script>
<script type="text/javascript" src="/assets/js/search.js" async defer></script>
<!-- Footer -->
<div class="footer-fix"> </div>