-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.html
More file actions
146 lines (131 loc) · 4.83 KB
/
search.html
File metadata and controls
146 lines (131 loc) · 4.83 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Search results for {{ .SearchText }}</title>
<link href="/res/bootstrap4.css" rel="stylesheet">
<style>html, body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {
padding-top: 56px;
}
@media (max-width: 990px) {
.container {
padding-top: 100px;
}
#submitButton {
width: 0;
height: 0;
visibility: hidden;
}
#rootnav {
height: 150px;
}
}
.nav-scroller .nav {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
color: rgba(255, 255, 255, .75);
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.nav-underline .nav-link {
padding-top: .75rem;
padding-bottom: .75rem;
font-size: .875rem;
color: #6c757d;
}
.nav-underline .nav-link:hover {
color: #007bff;
}
.nav-underline .active {
font-weight: 500;
color: #343a40;
}
.text-white-50 {
color: rgba(255, 255, 255, .5);
}
.bg-purple {
background-color: #6f42c1;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
.lh-100 {
line-height: 1;
}
.lh-125 {
line-height: 1.25;
}
</style>
</head>
<body class="bg-light">
<nav id="rootnav" class="navbar navbar-expand-lg fixed-top navbar-light bg-light">
<a class="navbar-brand mr-auto mr-lg-0"></a>
<div class="navbar-collapse offcanvas-collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">< Back<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/random">Random Page</a>
</li>
</ul>
<form id="myForm" class="form-inline my-2 my-lg-0">
<input id="searchFor" class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search"
value="{{ .SearchText }}">
<button id="submitButton" class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<main role="main" class="container">
<div class="d-flex align-items-center p-3 my-3 text-white-50 bg-purple rounded box-shadow">
<svg class="mr-3" width="24" height="24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd"
clip-rule="evenodd">
<path d="M15.853 16.56c-1.683 1.517-3.911 2.44-6.353 2.44-5.243 0-9.5-4.257-9.5-9.5s4.257-9.5 9.5-9.5 9.5 4.257 9.5 9.5c0 2.442-.923 4.67-2.44 6.353l7.44 7.44-.707.707-7.44-7.44zm-6.353-15.56c4.691 0 8.5 3.809 8.5 8.5s-3.809 8.5-8.5 8.5-8.5-3.809-8.5-8.5 3.809-8.5 8.5-8.5z"/>
</svg>
<div class="lh-100">
<h6 class="mb-0 text-white lh-100">Search Results for {{ .SearchText }}</h6>
<small>There are {{ .Count }} result(s).</small>
</div>
</div>
<div class="my-3 p-3 bg-white rounded box-shadow">
<h6 class="border-bottom border-gray pb-2 mb-0">Search Results</h6>
{{ with .SearchResults}}
{{ range . }}
<div class="media text-muted pt-3">
<div class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<div class="d-flex justify-content-between align-items-center w-100">
<strong class="text-gray-dark">{{ .SearchResult }}</strong>
<a href="/page/{{ .LinkContent }}">View</a>
</div>
<span class="d-block">Written by {{ .AuthorName }} on {{ .WrittenDate }}.</span>
</div>
</div>
{{ end }}
{{ end }}
<small class="d-block text-right mt-3"> <a href="/all">All articles</a> </small>
</div>
</main>
<script>
document.getElementById('myForm').onsubmit = function (evt) {
window.location.href = document.getElementById('searchFor').value
evt.preventDefault()
}
</script>
</body>
</html>