-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.ejs
128 lines (128 loc) · 6.74 KB
/
search.ejs
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
<!DOCTYPE html>
<html>
<head>
<title><%= query %> - Sleuth</title>
<link rel='stylesheet' href='all.css'>
<link rel='stylesheet' href='search.css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="search" type="application/opensearchdescription+xml" title="Sleuth" href="opensearch.xml" />
<meta content="https://sleuth.kestron.software/favicon.jpg" property="og:image" />
</head>
<body data-using-sidebar="<%= useSidebar %>">
<header class="header">
<a href="/"><image src='sleuth.png' id='logo' /></a><br><br>
<p class="tagline"><span class="cyan">S</span>earch <span class="cyan">L</span>everaging <span class="cyan">E</span>xternal <span class="cyan">U</span>nified <span class="cyan">T</span>ools for <span class="cyan">H</span>unting</p>
<form class="search-form" action='/search' autocomplete='off'>
<input placeholder='Search...' value="<%= query %>" id='q' name='q'> <input type="submit" value="Search">
</form>
<nav class="results-type-nav" aria-label="Results type navigation">
<!--a href='images?q=<%= query %>'>Images</a-->
</nav>
</header>
<% if (typeof suggestions === 'object' && suggestions.suggestions.length > 0) { %>
<ul id="search-suggestions">
<h2>Suggestions</h2>
<% for (let i = 0; i < suggestions.suggestions.length; i++) { %>
<li>
<div class="suggestions-engines-indicator-wrapper">
<% for (let engine of suggestions.suggestedBy[i].split(", ")) { %>
<% const e = engine.toLowerCase().replace("duckduckgo", "ddg") %>
<span class="engine engine-<%= e %>" title="Suggestion #<%= i+1 %> was suggested by <%= engine %>">
<img src="/<%= e %>.png" width="20px" height="20px" style="position: relative; top: .3em">
</span>
<% } %>
</div>
<a href="/search?q=<%= suggestions.suggestions[i] %>" title="<%= suggestions.suggestions[i] %> - Sleuth">
<%= suggestions.suggestions[i] %>
</a>
</li>
<% } %>
</ul>
<% } %>
<% if(abstractData.txt){ %>
<div id='abstract'>
<button id="close-abstract" class="button" onclick="document.getElementById('abstract').style.display = 'none';document.getElementById('open-abstract').style.display = 'block'">Close Abstract</button>
<h1><%= abstractData.head %></h1>
<img src='<%= abstractData.img %>'>
<p>
<%= abstractData.txt %>
</p>
<a href='<%= abstractData.src %>'><h4><%= abstractData.srcName %></h4></a>
</div>
<% } %>
<main class="results">
<% if (useLoadEngines == "true" || useLoadEngines == "yes") { %>
<div id="googleResults">
<h1 class='tCenter'>Google Results</h1>
<span id='googleLoading' class='center'>Loading...</span>
</div>
<div id="bingResults">
<h1 class='tCenter'>Bing Results</h1>
<span id='bingLoading' class='center'>Loading...</span>
</div>
<div id="ddgResults">
<h1 class='tCenter'>DuckDuckGo Results</h1>
<div id='ddgLoading' class='center'>Loading...</div>
</div>
<% } else if(useCombinedResults == "true" || useCombinedResults == "yes") { %>
<% if (abstractData.txt) { %>
<!-- Kinda a temporary fix, should be re-thought later. - Shipment22 -->
<button id="open-abstract" class="button" onclick="document.getElementById('abstract').style.display = 'block';this.style.display='none'" style="margin-block: -1.5rem 2.2rem;">Open Abstract</button>
<% } %>
<% for (let i = 0; i < results.length; i++) { %>
<article class="result">
<a href="<%= results[i].url %>">
<h2 class="title">
<img src="<%= results[i].favi %>" class="result-favicon" width="24px" height="24px" loading="lazy">
<%= results[i].title %>
</h2>
<div class="url"><%= results[i].url %></div>
</a>
<p class="description"><%- results[i].description %></p>
<div class="engines-indicator-wrapper"><%- results[i].engineIndecator %> </div>
</article>
<hr>
<% } %>
<% } else { %>
<!-- Old segmented results -->
<h1>Google Results</h1>
<% for (let i = 0; i < googleResults.length; i++) { %>
<article class="result">
<a href="<%= googleResults[i].url %>">
<div class="url"><%= googleResults[i].url.slice(7) %></div>
<h2 class="title"><img src="<%= results[i].favi %>" width='2%' loading='lazy'> <%= googleResults[i].title %></h2>
</a>
<p class="description"><%- googleResults[i].description %></p>
</article>
<hr>
<% } %>
<h1>Bing Results</h1>
<% for (let i = 0; i < bingResults.length; i++) { %>
<article class="result">
<a href="<%= bingResults[i].url %>">
<div class="url"><%= bingResults[i].url %></div>
<h2 class="title"><img src="<%= results[i].favi %>" width='2%' loading='lazy'> <%= bingResults[i].title %></h2>
</a>
<p class="description"><%- bingResults[i].description %></p>
</article>
<hr>
<% } %>
<h1>DuckDuckGo Results</h1>
<% for (let i = 0; i < ddgResults.length; i++) { %>
<article class="result">
<a href="<%= ddgResults[i].url %>">
<div class="url"><%= ddgResults[i].url %></div>
<h2 class="title"><img src="<%= results[i].favi %>" width='2%' loading='lazy'> <%= ddgResults[i].title %></h2>
</a>
<p class="description"><%- ddgResults[i].description %></p>
</article>
<hr>
<% } %>
<% } %>
</main>
<script src='footer.js'></script>
<% if (useLoadEngines == "true" || useLoadEngines == "yes") { %>
<script src='loadEngines.js'></script>
<% } %>
</body>
</html>