-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
search.html
273 lines (234 loc) · 10.4 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.7.1 -->
<title>Search The Scoop Directory | scoop-directory</title>
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="Search The Scoop Directory" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A directory of buckets for the scoop package manager for Windows" />
<meta property="og:description" content="A directory of buckets for the scoop package manager for Windows" />
<link rel="canonical" href="https://rasa.github.io/scoop-directory/search.html" />
<meta property="og:url" content="https://rasa.github.io/scoop-directory/search.html" />
<meta property="og:site_name" content="scoop-directory" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Search The Scoop Directory" />
<script type="application/ld+json">
{"headline":"Search The Scoop Directory","description":"A directory of buckets for the scoop package manager for Windows","url":"https://rasa.github.io/scoop-directory/search.html","@type":"WebSite","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- Minimul theme -->
<link rel="stylesheet" href="https://rasa.github.io/scoop-directory/assets/css/style.css?v=b57c2f1379ad9a17805766f7e1ca5bf3a1c7b4cc">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
<!-- /Minimul theme -->
<!-- Caymen theme -->
<!--
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="/scoop-directory/assets/css/style.css?v=448d7408fa7bab7eca92e646c6d23b853c9aead5">
-->
<!-- /Caymen theme -->
<!-- start custom head snippets, customize with your own _includes/head-custom.html file -->
<!-- Setup Google Analytics -->
<!-- You can set your favicon here -->
<link rel="shortcut icon" type="image/x-icon" href="/scoop-directory/favicon.ico"/>
<!-- end custom head snippets -->
<style>
table td {
text-align: left;
display: table-cell;
vertical-align: top;
}
span.leftright {
display: flex;
justify-content: space-between;
}
span.bottomright {
position: absolute;
right: 0;
bottom: 0;
}
.top {
display: inline-block;
vertical-align:top;
width: 100%;
}
.bot {
text-align: right;
display: inline-block;
vertical-align:bottom;
width: 100%;
}
.bot:before{
content: '';
display: inline-block;
height: 24px;
}
</style>
</head>
<body>
<div class="wrapper">
<header>
<h1><a href="/scoop-directory/">scoop-directory</a></h1>
<p>A directory of buckets for the scoop package manager for Windows</p>
<p class="view"><a href="https://github.com/rasa/scoop-directory">View the Project on GitHub <small>rasa/scoop-directory</small></a></p>
</header>
<section>
<h1 id="scoop-directory"><a href="https://scoop.sh/">Scoop</a> Directory</h1>
<p><a href="https://github.com/rasa/scoop-directory/actions/workflows/update-index.yml"><img src="https://github.com/rasa/scoop-directory/actions/workflows/update-index.yml/badge.svg" alt="update-index" /></a> <!--
--> <a href="https://ci.appveyor.com/project/rasa/scoop-directory" title="Build Status"><img src="https://ci.appveyor.com/api/projects/status/github/rasa/scoop-directory?svg=true" alt="Build Status" /></a> <!--
--> <a href="https://gitter.im/lukesampson/scoop"><img src="https://badges.gitter.im/lukesampson/scoop.svg" alt="Chat on Gitter" /></a> <!--
--> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="Software License" /></a> <!--
--> <a href="https://github.com/h404bi/awesome-scoop/blob/master/README.md" title="Awesome Scoop"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Scoop" /></a> </p>
<p>To search, enter an application name, a bucket name, an author name, or repository name:</p>
<input id="searchbox-name" type="text" placeholder="Start typing a keyword" autofocus />
<br/>
<br/>
Results: <select name="rows" id="rows">
<option value="100">100</option>
<option value="200">200</option>
<option value="400">400</option>
<option value="800">800</option>
<option value="1600">1600</option>
<option value="9999">All</option>
</select>
<br/>
<p><em id="metainfotext"></em></p>
<br/>
<table>
<thead>
<tr>
<th style="text-align: left"><span class="leftright"><span>Name</span><span>Version</span></span></th>
<th style="text-align: left">Description (License)</th>
<th style="text-align: left">Bucket<br/>Latest version</th>
</tr>
</thead>
<tbody id="searchresults">
</tbody>
</table>
</section>
<footer>
<p>This project is maintained by <a href="https://github.com/rasa">@rasa</a> and <a href="https://github.com/rashil2000">@rashil2000</a></p>
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="https://rasa.github.io/scoop-directory/assets/js/scale.fix.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.8.0/sql-wasm.js" integrity="sha512-n7swEtVCvXpQ7KxgpPyp0+DQQEf5vPpmzCRl14x2sp2v5LpCYCjrAx03mkBAbWwGF9eUoIk8YVcDFuJRIeYttg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
var db, mancount, bukcount;
var nameInput = document.getElementById('searchbox-name');
var reqdiv = document.getElementById('searchresults');
var metainfo = document.getElementById('metainfotext');
nameInput.addEventListener('input', function (e) {
var rowsInput = document.getElementById('rows');
var rows = parseInt(rowsInput.value.trim(), 10)
if (rows <= 0)
rows = 100
const query = nameInput.value.trim().toLowerCase().replace(' ', '%');
if (query.length >= 2)
runQuery(query, rows);
else {
reqdiv.innerHTML = '';
metainfo.innerHTML = `Query ${mancount} manifests among ${bukcount} buckets`;
}
});
const runQuery = async (query, rows) => {
var results = [];
// See https://stackoverflow.com/a/7313467/1432614
var ireplace = function(s, strReplace, strWith) {
// See http://stackoverflow.com/a/3561711/556609
var esc = strReplace.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var reg = new RegExp(esc, 'ig');
return s.replace(reg, strWith);
};
// Specifies the SQL function's name, the number of it's arguments, and the js function to use
db.create_function("ireplace", ireplace);
var stmt = db.prepare(`
SELECT
ireplace(name, "${query}", "<b>${query}</b>") AS hname,
version,
bucket_url,
ireplace(description, "${query}", "<b>${query}</b>") AS description,
manifest_url,
homepage,
license,
REPLACE(REPLACE(ireplace(bucket, "${query}", "<b>${query}</b>"), "/", "/​"), "-", "‑") AS bucket,
name AS name
FROM
apps
WHERE
name LIKE "%${query}%" OR
description LIKE "%${query}%" OR
bucket LIKE "${query}" OR
bucket LIKE "${query}%" OR
bucket LIKE "%/${query}"
ORDER BY CASE
WHEN name LIKE "${query}" THEN 1
WHEN name LIKE "${query}%" THEN 2
WHEN name LIKE "%${query}" THEN 3
WHEN name LIKE "%${query}%" THEN 4
ELSE 5
END,
name,
version DESC
LIMIT ${rows}
`);
while(stmt.step())
results.push(stmt.getAsObject());
stmt.free();
// console.log(results);
metainfo.innerHTML = `${results.length} result(s)`;
reqdiv.innerHTML = '';
for (var i of results)
reqdiv.insertAdjacentHTML('beforeend', `
<tr>
<td style="text-align: left; display: table-cell; vertical-align: top;">
<span class="leftright">
<span><a target="_blank" href="${i.homepage}">${i.hname}</a></span>
<span><a target="_blank" href="${i.manifest_url}">
${i.version.split("*").length - 1 === 2
? `<em>${i.version.replaceAll('*', '')}</em>`
: i.version}</a>
</span>
</span>
</td>
<td style="text-align: left; display: table-cell; vertical-align: top;">${i.description} (<em>${i.license.length < 2 ? `Undefined` : i.license}</em>)</td>
<td style="text-align: left; display: table-cell; vertical-align: top;"><a target="_blank" href="${i.bucket_url}">${i.bucket}</a></td>
</tr>
`);
};
(async () => {
const sqlPromise = initSqlJs({
locateFile: filename => `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.8.0/${filename}`
});
const dataPromise = fetch("/scoop-directory/scoop_directory.db").then(res => res.arrayBuffer());
const [SQL, buf] = await Promise.all([sqlPromise, dataPromise])
db = new SQL.Database(new Uint8Array(buf));
var cntst = db.prepare(`
SELECT (
SELECT COUNT(*) FROM apps
) AS appc, (
SELECT COUNT(*) FROM buckets
) AS bukc
`);
cntst.step();
mancount = cntst.getAsObject()['appc'];
bukcount = cntst.getAsObject()['bukc'];
cntst.free();
metainfo.innerHTML = `Query ${mancount} manifests among ${bukcount} buckets`;
const q = (new URLSearchParams(window.location.search)).get('q');
if (q && q.trim().length >= 2) {
nameInput.value = q;
nameInput.dispatchEvent(new Event("input"));
}
})();
</script>
</body>
</html>