Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (60 sloc) 2.01 KB
@{
Layout = "_miscpage";
ViewBag.Title = "Search - Randal Vance Cunanan";
}
@section HeaderTitle
{
Search for <span id="searchQuery"></span>
}
<div id="searchResults">
</div>
@section Scripts {
<script src="/libs/lunr/lunr.min.js"></script>
<script src="/searchindex.js"></script>
<script type="text/javascript">
function getQueryParam(name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
return null;
}
else {
return results[1] || 0;
}
}
function runQuery(query) {
var searchQuery = $("#searchQuery"),
searchResults = $("#searchResults");
searchResults.empty();
searchQuery.html(query);
if (query.length < 2) {
return;
}
var results = searchModule.search(query);
if (results.length == 0) {
searchResults.append("<p><b>No results found for query '" + query + "'</b></p>")
}
else {
searchResults.append("<p>Number of matching posts: <b>" + results.length + "</b></p>");
var listHtml = "<ul>";
for (var i = 0; i < results.length; ++i) {
var res = results[i];
listHtml += "<li><a href='" + res.url + "'>" + res.title + "</a><p>" + res.description + "</p></li>";
}
listHtml += "</ul>"
searchResults.append(listHtml);
}
}
$(function () {
var searchBox = $("#searchbox");
searchBox.on('input propertychange paste', function () {
runQuery(searchBox.val());
});
var q = getQueryParam("q");
if (q) {
q = decodeURIComponent(q);
searchBox.val(q);
runQuery(q);
}
});
</script>
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.