-
Notifications
You must be signed in to change notification settings - Fork 2
/
search.html
45 lines (39 loc) · 936 Bytes
/
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
---
layout: default
title: Search
---
<div class="page header">
<div class="container">
<h1>Search <span class="dataset"></span></h1>
</div>
</div>
<hr />
<div class="container">
<div id="search"></div>
</div>
<!-- script for rendering and performing search -->
<script>
require([
'jquery',
'views/search/search-view',
'utilities/web/query-string'
], function ($, SearchView, QueryString) {
// set active dataset
//
var dataset = QueryString.getParam('dataset') || 'xDD';
$('.dataset li.' + dataset).addClass('active');
// add dataset class to body
//
if (dataset.toLowerCase().includes('covid-19') || dataset.toLowerCase().includes('cord-19')) {
$('body').addClass('covid');
}
// set dataset text
//
$('h1 .dataset').html(dataset);
// render search view
//
var searchView = new SearchView();
$('#search').append(searchView.render().$el);
searchView.onAttach();
});
</script>