-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsearch.html
507 lines (481 loc) · 19.2 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
<!DOCTYPE html>
<html lang="zxx">
<head>
<!--====== Required meta tags ======-->
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="description" content="" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<!--====== Title ======-->
<title>
搜索结果 - Serverless Registry - Serverless package management platform
</title>
<!--====== Bootstrap css ======-->
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
<!--=== Owl-Carousel ===-->
<link rel="stylesheet" href="static/css/owl.carousel.min.css" />
<!--====== Magnific ======-->
<link rel="stylesheet" href="static/css/magnific-popup.css" />
<!--===nice-select===-->
<link rel="stylesheet" href="static/css/nice-select.css" />
<!--====== Animate CSS ======-->
<link rel="stylesheet" href="static/css/animate.min.css" />
<!--====== Font Awesome ======-->
<link rel="stylesheet" href="static/css/font-awesome.min.css" />
<!--====== Main Css ======-->
<link rel="stylesheet" href="static/css/style.css" />
<!--====== Responsive Css ======-->
<link rel="stylesheet" href="static/css/responsive.css" />
<style>
.text-flow-ellipsis-multiple {
/* 多余内容省略号处理-多行 */
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.text-flow-ellipsis-single {
/* 多余内容省略号处理-单行 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.preButton {
width: 120px;
height: 34px;
border: 1px solid rgba(4, 10, 41, 0.12);
border-radius: 3px;
color: #fff;
line-height: 2.53;
text-align: center;
font-weight: 500;
background: #547af8;
}
.download {
margin-left: 20px;
width: 120px;
height: 34px;
border: 1px solid rgba(4, 10, 41, 0.12);
border-radius: 3px;
color: #051c35;
line-height: 2.53;
text-align: center;
font-weight: 500;
background: #fff;
}
</style>
<script src="https://res.zvo.cn/translate/translate.js"></script>
<script>
function alertfun() {
const alerted = localStorage.getItem("alerted") || "none";
if (alerted != "ok") {
localStorage.setItem("alerted", "ok");
alert(
"Reminder: English information of some content is automatically presented through machine translation. The machine translation process may cause some semantic and other content problems. If you find any, please feedback to the community maintainer email [email protected]"
);
}
}
</script>
</head>
<body>
<!--====== Preloader Start ======-->
<div id="preloader">
<div class="loader-cubes">
<div class="loader-cube1 loader-cube"></div>
<div class="loader-cube2 loader-cube"></div>
<div class="loader-cube4 loader-cube"></div>
<div class="loader-cube3 loader-cube"></div>
</div>
</div>
<!--====== Preloader End ======-->
<!--====== Header Part Start ======-->
<header class="header-two sticky-header">
<div
class="header-navigation"
style="padding-top: 10px; padding-bottom: 7px"
>
<div
class="container-fluid d-flex align-items-center justify-content-between container-1470"
>
<div class="header-left">
<h1 href="index.html" style="color: white">Serverless Registry</h1>
</div>
<div
class="header-right d-flex align-items-center justify-content-end"
>
<div class="site-nav-menu">
<ul class="primary-menu">
<li class="current">
<a class="nav-link" href="index.html">首页</a>
</li>
<li>
<a class="nav-link" href="application.html">应用</a>
</li>
<li>
<a class="nav-link" href="component.html">组件</a>
</li>
<li>
<a class="nav-link" href="plugin.html">插件</a>
</li>
<li>
<a
class="nav-link"
href="https://github.com/Serverless-Devs/Serverless-Devs/blob/master/spec/zh/0.0.2/serverless_registry_model/readme.md"
target="_blank"
>规范</a
>
</li>
<li>
<a class="nav-link" href="faq.html">常见问题</a>
</li>
<li>
<a
href="javascript:translate.changeLanguage('chinese_simplified');"
class="ignore"
>中文</a
>
</li>
<li>
<a
href="javascript:translate.changeLanguage('english');"
onclick="alertfun()"
class="ignore"
>English</a
>
</li>
</ul>
<a href="#0" class="nav-close"><i class="fal fa-times"></i></a>
</div>
<div class="header-extra d-flex align-items-center">
<div class="search-widget">
<a href="#0" class="search-icon"
><i class="fal fa-search"></i
></a>
<div class="search-form">
<form action="search.html" method="GET">
<input
type="search"
placeholder="请输入要搜索的 Serverless Package 关键词"
name="keyword"
/>
</form>
<a href="#0" class="search-close"
><i class="fal fa-times"></i
></a>
</div>
</div>
<div class="offcanvas-widget d-none">
<div class="offcanvas-icon">
<span></span><span></span><span></span>
</div>
</div>
<div class="nav-toggler">
<span></span><span></span><span></span>
</div>
</div>
</div>
</div>
</div>
</header>
<!--====== Header Part End ======-->
<!--====== Banner Start ======-->
<section class="breadcrumb-area">
<div class="container">
<div class="content">
<h2
class="breadd wow fadeInUp text-flow-ellipsis-single"
id="keyword"
></h2>
<ul class="breadcrumb-list wow fadeInUp">
<li><a href="index.html">首页 /</a></li>
<li>搜索结果</li>
</ul>
</div>
</div>
</section>
<!--====== Banner End ======-->
<!--====== Unique Themes Start ======-->
<section class="unique themes product">
<div class="container">
<div class="row" id="itemlist"></div>
</div>
</section>
<!--====== Unique Themes End ======-->
<!--====== Footer Area START ======-->
<footer class="footer-area two">
<div class="container">
<div class="row justify-content-between">
<div class="col-lg-4 col-md-6 wow fadeInUp" data-wow-delay="0.2s">
<div class="footer-box one">
<div class="logo">
<h1 style="color: white">Serverless Registry</h1>
</div>
<p class="text">
Serverless Registry 是 Serverless Devs 社区的衍生品,遵循
Serverless Devs Model 规范,为打造 Serverless 生态基础,繁荣
Serverless 开源生态而努力。正在为成为好用的 Serverless 领域的
NPM,Pypi ... 而努力。
</p>
<div class="social">
<a href="https://github.com/serverless-devs/serverless-devs"
><i class="fab fa-github"></i
></a>
<a href="https://gitee.com/serverless-devs/Serverless-Devs"
><i class="fab fa-git"></i
></a>
<a href="https://www.serverless-devs.com"
><i class="fab fa-page4"></i
></a>
</div>
</div>
</div>
<div class="col-lg-2 col-md-6 wow fadeInUp" data-wow-delay="0.3s">
<div class="footer-box two">
<h4 class="lasthead">相关资源</h4>
<div class="footer-list">
<ul>
<li><a href="about.html"> 关于我们 </a></li>
<li>
<a
href="https://github.com/serverless-devs/serverless-devs"
>
Serverless Devs 仓库
</a>
</li>
<li>
<a
href="https://github.com/Serverless-Devs/Serverless-Devs/blob/master/spec/readme.md"
>
SDM 规范文档
</a>
</li>
<li>
<a
href="https://github.com/Serverless-Devs/Serverless-Devs/discussions"
>
Serverless Devs 社区
</a>
</li>
<li>
<a
href="https://github.com/Serverless-Devs/Serverless-Devs/blob/master/CONTRIBUTORS.md"
>
贡献者列表
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-lg-2 col-md-6 wow fadeInUp" data-wow-delay="0.4s">
<div class="footer-box three">
<h4 class="lasthead">钉钉交流群</h4>
<div class="footer-list">
<img
src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1648814797378_20220401120637498673.png"
/>
</div>
</div>
</div>
<div class="col-lg-2 col-md-6 wow fadeInUp" data-wow-delay="0.5s">
<div class="footer-box none">
<h4 class="lasthead">微信公众号</h4>
<div class="footer-list">
<img
src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1648814758343_20220401120558862369.png"
/>
</div>
</div>
</div>
</div>
</div>
</footer>
<div class="copyright two">
<div class="container">
<div class="row">
<div class="col-12 wow fadeInUp text-center">
<p class="text">Copyright © 2022. Serverless Devs</p>
</div>
</div>
</div>
</div>
<!--====== Footer Area END ======-->
<!--====== Back to top start ======-->
<div class="back-to-top">
<a href="#0"> <i class="fas fa-arrow-up"></i> </a>
</div>
<!--====== Back to top start ======-->
<!--====== Jquery ======-->
<script src="static/js/jquery-3.6.0.min.js"></script>
<!--====== Bootstrap ======-->
<script src="static/js/bootstrap.bundle.min.js"></script>
<!--=== Owl-Carousel ===-->
<script src="static/js/owl.carousel.min.js"></script>
<!--====== Nice Select ======-->
<script src="static/js/jquery.nice-select.min.js"></script>
<!--====== Magnific ======-->
<script src="static/js/jquery.magnific-popup.min.js"></script>
<!--====== Wow ======-->
<script src="static/js/wow.min.js"></script>
<!-- ====== 模版引擎 ====== -->
<script src="vendors/art-template/template-web.js"></script>
<!--====== Main JS ======-->
<script src="static/js/main.js"></script>
<script src="config/URL.js"></script>
<script src="utils/_Get.js"></script>
<script src="utils/_Post.js"></script>
<script src="utils/renderTpl.js"></script>
<script src="utils/splitMaxLenth.js"></script>
<script src="services/downloadV3Plugin.js"></script>
<script src="services/getPackagesSearchForV3.js"></script>
<!-- 注入搜索模板 -->
<script type="text/template" id="searchTpl">
{{each data}}
<div class="col-xl-4 wow fadeInUp" data-wow-delay="{{$value.delayTime}}s" style="visibility: visible; animation-delay: 0.2s; animation-name: fadeInUp;">
<div class="themes-box" style="overflow: hidden;">
{{if $value.package_type === 'v2' }}
<div class="ribbon" data-spm-anchor-id="5176.28448578.0.i154.758e60cczu7hm5">仅维护</div>
{{ /if }}
<div class="main-content">
<h5><a href="details.html?name={{$value.name}}&package_type={{$value.package_type}}" class="text-flow-ellipsis-single">{{$imports.splitMaxLenth($value.name)}}</a> <i class="fas fa-fire" style="float: right; color: orange;"> {{$value.download}} </i></h5>
<div class="last-part">
<div class="right" style="width: 100%">
<p class="text" style="margin-bottom: 10px; width: 100%">
<i class="fas fa-rocket"></i> {{$value.type}}
{{if $value.published_at }}
| <i class="fas fa-calendar"></i> {{$value.published_at}}
{{ /if }}
{{if $value.published_at&&$value.version }}
|
{{ /if }}
{{if $value.version }}
<i class="fas fa-desktop"></i> V{{$value.version}}
{{ /if }}
</p>
<p class="text-flow-ellipsis-multiple" style="height: 70px">
{{$value.description}}
</p>
</div>
</div>
<div class="past-part" style="margin-top: 10px">
<center>
<div class="buton">
<a href="details.html?name={{$value.name}}&package_type={{$value.package_type}}" class="preButton"> <i class="fas fa-book"></i> 查看详情 </a>
{{if $value.zipball_url }}
<a href="{{$value.zipball_url}}" target="_blank" class="download"> <i class="fas fa-download"></i> 下载插件 </a>
{{else}}
<a onclick="downloadPlugin( '{{$value.name}}' )" class="download"> <i class="fas fa-download"></i> 下载插件 </a>
{{ /if }}
</div>
</center>
</div>
</div>
</div>
</div>
{{/each}}
</script>
<script>
// 列表存储数据
var dataList = [];
function downloadPlugin(name) {
downloadV3Plugin(name)
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
}
// V2: 搜索/获取 Package 信息
function getPackagesV2() {
var base_url = BASE_V2_URL
_Post(base_url + "/package/search", `keyword=${getQueryVariable("keyword")}`,
function (result) {
var keys = Object.keys(result);
var times = [0.3, 0.2, 0.1];
for (var i = 0; i < keys.length; i++) {
var item = {};
item.delayTime = times[Math.floor(Math.random() * times.length)];
item.name = result[keys[i]].package;
item.type = {
3: "应用",
2: "插件",
1: "组件",
}[result[keys[i]].type];
item.download = result[keys[i]].download;
item.published_at = result[keys[i]].version.published_at.split("T")[0]
item.version = result[keys[i]].version.tag_name;
item.description = result[keys[i]].description;
item.zipball_url = result[keys[i]].version.zipball_url;
item.package_type = 'v2'; // v2 v3标识
dataList.push(item);
}
return ;
})
}
// V3: 搜索/获取 Package 信息
function getPackagesV3() {
getPackagesSearchForV3(`search=${getQueryVariable("keyword")}`, function (result) {
var keys = Object.keys(result);
var times = [0.3, 0.2, 0.1];
for (var i = 0; i < keys.length; i++) {
var item = {};
item.delayTime = times[Math.floor(Math.random() * times.length)];
item.name = result[keys[i]].name;
item.type = {
'Project': "应用",
'Application': "应用",
'Plugin': "插件",
'Component': "组件",
}[result[keys[i]].type];
item.download = result[keys[i]].download;
item.published_at = result[keys[i]].latest_create.split(" ")[0];
// item.published_at = ''
// item.version = result[keys[i]].version.tag_name;
item.version = '';
item.description = result[keys[i]].description;
// item.zipball_url = result[keys[i]].version.zipball_url;
item.zipball_url = ''
item.package_type = 'v3'; // v2 v3标识
dataList.push(item);
}
return ;
})
}
function main() {
var searchValue = decodeURI(getQueryVariable("keyword"))
document.getElementById("keyword").innerHTML = `搜索词:${searchValue}`;
// 并行调用两个接口
getPackagesV3();
getPackagesV2();
if(dataList && dataList.length > 0){
// @todo 增加去重,如果v2 v3存在相同name应用, 只展示v2应用
// 去重
renderTpl('searchTpl', { data: dataList }, '#itemlist')
}else{
renderTpl('searchTpl', { data: [] }, '#itemlist')
}
}
main();
</script>
<script>
//translate.ignore.tag.push('span'); //翻译时追加上自己想指定忽略的tag标签,凡是在这里面的,都不进行翻译。
//translate.ignore.class.push('test'); //翻译时指定忽略的class name,凡是class name 在这里面的,都不进行翻译。如果不设置默认只有 ignore 这一个
//translate.setAutoDiscriminateLocalLanguage(); //设置用户第一次用时,自动识别其所在国家的语种进行切换
translate.setUseVersion2(); //设置使用v2.x 版本
translate.language.setLocal("chinese_simplified");
translate.selectLanguageTag.show = false;
translate.execute(); //执行翻译初始化操作,显示出select语言选择
</script>
</body>
</html>