jeawin-astro 3.0.99 → 3.0.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -35,6 +35,15 @@ const medias = [
|
|
|
35
35
|
seo_title
|
|
36
36
|
)}&url=${encodeURIComponent(canonical)}`,
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" height="${
|
|
40
|
+
16 * multiple
|
|
41
|
+
}" width="${
|
|
42
|
+
14 * multiple
|
|
43
|
+
}" viewBox="0 0 448 512"><path d="M194.4 211.7a53.3 53.3 0 1 0 59.3 88.7a53.3 53.3 0 1 0-59.3-88.7m142.3-68.4c-5.2-5.2-11.5-9.3-18.4-12c-18.1-7.1-57.6-6.8-83.1-6.5c-4.1 0-7.9.1-11.2.1s-7.2 0-11.4-.1c-25.5-.3-64.8-.7-82.9 6.5c-6.9 2.7-13.1 6.8-18.4 12s-9.3 11.5-12 18.4c-7.1 18.1-6.7 57.7-6.5 83.2c0 4.1.1 7.9.1 11.1s0 7-.1 11.1c-.2 25.5-.6 65.1 6.5 83.2c2.7 6.9 6.8 13.1 12 18.4s11.5 9.3 18.4 12c18.1 7.1 57.6 6.8 83.1 6.5c4.1 0 7.9-.1 11.2-.1s7.2 0 11.4.1c25.5.3 64.8.7 82.9-6.5c6.9-2.7 13.1-6.8 18.4-12s9.3-11.5 12-18.4c7.2-18 6.8-57.4 6.5-83c0-4.2-.1-8.1-.1-11.4s0-7.1.1-11.4c.3-25.5.7-64.9-6.5-83c-2.7-6.9-6.8-13.1-12-18.4zm-67.1 44.5a82 82 0 1 1-91.2 136.4a82 82 0 1 1 91.1-136.4zm29.2-1.3c-3.1-2.1-5.6-5.1-7.1-8.6s-1.8-7.3-1.1-11.1s2.6-7.1 5.2-9.8s6.1-4.5 9.8-5.2s7.6-.4 11.1 1.1s6.5 3.9 8.6 7s3.2 6.8 3.2 10.6c0 2.5-.5 5-1.4 7.3s-2.4 4.4-4.1 6.2s-3.9 3.2-6.2 4.2s-4.8 1.5-7.3 1.5c-3.8 0-7.5-1.1-10.6-3.2zM448 96c0-35.3-28.7-64-64-64H64C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64zm-91 293c-18.7 18.7-41.4 24.6-67 25.9c-26.4 1.5-105.6 1.5-132 0c-25.6-1.3-48.3-7.2-67-25.9s-24.6-41.4-25.8-67c-1.5-26.4-1.5-105.6 0-132c1.3-25.6 7.1-48.3 25.8-67s41.5-24.6 67-25.8c26.4-1.5 105.6-1.5 132 0c25.6 1.3 48.3 7.1 67 25.8s24.6 41.4 25.8 67c1.5 26.3 1.5 105.4 0 131.9c-1.3 25.6-7.1 48.3-25.8 67z"/></svg>`,
|
|
44
|
+
title: render_lang(all_langs, "share on instagram"),
|
|
45
|
+
url: `https://www.instagram.com/?url=${encodeURIComponent(canonical)}`
|
|
46
|
+
},
|
|
38
47
|
{
|
|
39
48
|
icon: `<svg xmlns="http://www.w3.org/2000/svg" height="${
|
|
40
49
|
16 * multiple
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
<deepseek-swiper>
|
|
4
|
+
<div class="jw-swiper-container">
|
|
5
|
+
<div class="jw-swiper-wrapper">
|
|
6
|
+
<div class="jw-swiper-slide">
|
|
7
|
+
<img src="https://picsum.photos/1200/400?random=1" alt="Slide 1">
|
|
8
|
+
<div class="jw-slide-content">
|
|
9
|
+
<h2>第一张幻灯片</h2>
|
|
10
|
+
<p>这是使用纯JavaScript实现的响应式轮播图</p>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="jw-swiper-slide">
|
|
14
|
+
<img src="https://picsum.photos/1200/400?random=2" alt="Slide 2">
|
|
15
|
+
<div class="jw-slide-content">
|
|
16
|
+
<h2>第二张幻灯片</h2>
|
|
17
|
+
<p>支持自动播放、导航按钮和分页指示器</p>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="jw-swiper-slide">
|
|
21
|
+
<img src="https://picsum.photos/1200/400?random=3" alt="Slide 3">
|
|
22
|
+
<div class="jw-slide-content">
|
|
23
|
+
<h2>第三张幻灯片</h2>
|
|
24
|
+
<p>完全响应式,适应不同屏幕尺寸</p>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="jw-swiper-slide">
|
|
28
|
+
<img src="https://picsum.photos/1200/400?random=4" alt="Slide 4">
|
|
29
|
+
<div class="jw-slide-content">
|
|
30
|
+
<h2>第四张幻灯片</h2>
|
|
31
|
+
<p>无依赖,纯JavaScript实现</p>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- 导航按钮 -->
|
|
37
|
+
<div class="jw-swiper-button-prev">❮</div>
|
|
38
|
+
<div class="jw-swiper-button-next">❯</div>
|
|
39
|
+
|
|
40
|
+
<!-- 分页指示器 -->
|
|
41
|
+
<div class="jw-swiper-pagination">
|
|
42
|
+
<div class="jw-swiper-pagination-bullet active"></div>
|
|
43
|
+
<div class="jw-swiper-pagination-bullet"></div>
|
|
44
|
+
<div class="jw-swiper-pagination-bullet"></div>
|
|
45
|
+
<div class="jw-swiper-pagination-bullet"></div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</deepseek-swiper>
|
|
49
|
+
<style>
|
|
50
|
+
.jw-swiper-container {
|
|
51
|
+
position: relative;
|
|
52
|
+
width: 100%;
|
|
53
|
+
/* max-width: 1200px; */
|
|
54
|
+
margin: 0 auto;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
/* border-radius: 8px; */
|
|
57
|
+
/* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.jw-swiper-wrapper {
|
|
61
|
+
display: flex;
|
|
62
|
+
transition: transform 0.5s ease;
|
|
63
|
+
/* height: 400px; */
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.jw-swiper-slide {
|
|
67
|
+
min-width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
position: relative;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.jw-swiper-slide img {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
object-fit: cover;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.jw-slide-content {
|
|
79
|
+
position: absolute;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
right: 0;
|
|
83
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
|
|
84
|
+
color: white;
|
|
85
|
+
padding: 30px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.jw-slide-content h2 {
|
|
89
|
+
margin-bottom: 10px;
|
|
90
|
+
font-size: 24px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.jw-swiper-button-prev,
|
|
94
|
+
.jw-swiper-button-next {
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 50%;
|
|
97
|
+
transform: translateY(-50%);
|
|
98
|
+
width: 40px;
|
|
99
|
+
height: 40px;
|
|
100
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
align-items: center;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
z-index: 10;
|
|
107
|
+
transition: all 0.3s ease;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.jw-swiper-button-prev:hover,
|
|
111
|
+
.jw-swiper-button-next:hover {
|
|
112
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.jw-swiper-button-prev {
|
|
116
|
+
left: 20px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.jw-swiper-button-next {
|
|
120
|
+
right: 20px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.jw-swiper-pagination {
|
|
124
|
+
position: absolute;
|
|
125
|
+
bottom: 20px;
|
|
126
|
+
left: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
gap: 8px;
|
|
131
|
+
z-index: 10;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.jw-swiper-pagination-bullet {
|
|
135
|
+
width: 12px;
|
|
136
|
+
height: 12px;
|
|
137
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
138
|
+
border-radius: 50%;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
transition: all 0.3s ease;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.jw-swiper-pagination-bullet.active {
|
|
144
|
+
background-color: white;
|
|
145
|
+
transform: scale(1.2);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@media (max-width: 768px) {
|
|
149
|
+
.jw-swiper-wrapper {
|
|
150
|
+
height: 300px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.jw-slide-content {
|
|
154
|
+
padding: 15px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.jw-slide-content h2 {
|
|
158
|
+
font-size: 18px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.jw-swiper-button-prev,
|
|
162
|
+
.jw-swiper-button-next {
|
|
163
|
+
width: 30px;
|
|
164
|
+
height: 30px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
168
|
+
<script>
|
|
169
|
+
class DeepseekSwiper extends HTMLElement{
|
|
170
|
+
container: any
|
|
171
|
+
wrapper: any
|
|
172
|
+
slides: any
|
|
173
|
+
prevBtn: any
|
|
174
|
+
nextBtn:any
|
|
175
|
+
pagination: any
|
|
176
|
+
bullets: any
|
|
177
|
+
|
|
178
|
+
currentIndex: number = 0
|
|
179
|
+
isTransitioning: boolean = false
|
|
180
|
+
autoPlayInterval: any
|
|
181
|
+
autoPlayDelay: number = 0
|
|
182
|
+
touchStartX: number = 0
|
|
183
|
+
touchEndX: number = 0
|
|
184
|
+
|
|
185
|
+
constructor(){
|
|
186
|
+
super();
|
|
187
|
+
this.container = this.querySelector('.jw-swiper-container');
|
|
188
|
+
this.wrapper = this.container.querySelector('.jw-swiper-wrapper');
|
|
189
|
+
this.slides = Array.from(this.container.querySelectorAll('.jw-swiper-slide'));
|
|
190
|
+
this.prevBtn = this.container.querySelector('.jw-swiper-button-prev');
|
|
191
|
+
this.nextBtn = this.container.querySelector('.jw-swiper-button-next');
|
|
192
|
+
this.pagination = this.container.querySelector('.jw-swiper-pagination');
|
|
193
|
+
|
|
194
|
+
this.currentIndex = 0;
|
|
195
|
+
this.isTransitioning = false;
|
|
196
|
+
this.autoPlayInterval = null;
|
|
197
|
+
this.autoPlayDelay = 5000; // 5秒自动播放
|
|
198
|
+
this.touchStartX = 0;
|
|
199
|
+
this.touchEndX = 0;
|
|
200
|
+
this.init();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
init() {console.log('init');
|
|
204
|
+
// 创建分页指示器
|
|
205
|
+
this.createPagination();
|
|
206
|
+
|
|
207
|
+
// 设置初始位置
|
|
208
|
+
this.updateSliderPosition();
|
|
209
|
+
|
|
210
|
+
// 添加事件监听
|
|
211
|
+
this.addEventListeners();
|
|
212
|
+
|
|
213
|
+
// 开始自动播放
|
|
214
|
+
this.startAutoPlay();
|
|
215
|
+
|
|
216
|
+
// 响应式调整
|
|
217
|
+
window.addEventListener('resize', this.handleResize.bind(this));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
createPagination() {
|
|
221
|
+
this.slides.forEach((_: any, index: number) => {
|
|
222
|
+
const bullet = document.createElement('div');
|
|
223
|
+
bullet.classList.add('jw-swiper-pagination-bullet');
|
|
224
|
+
if (index === this.currentIndex) {
|
|
225
|
+
bullet.classList.add('active');
|
|
226
|
+
}
|
|
227
|
+
bullet.addEventListener('click', () => {
|
|
228
|
+
this.goToSlide(index);
|
|
229
|
+
});
|
|
230
|
+
this.pagination.appendChild(bullet);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
this.bullets = Array.from(this.pagination.querySelectorAll('.jw-swiper-pagination-bullet'));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
addEventListeners() {
|
|
237
|
+
// 导航按钮
|
|
238
|
+
this.prevBtn.addEventListener('click', this.goToPrevSlide.bind(this));
|
|
239
|
+
this.nextBtn.addEventListener('click', this.goToNextSlide.bind(this));
|
|
240
|
+
|
|
241
|
+
// 触摸事件
|
|
242
|
+
this.container.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
243
|
+
this.container.addEventListener('touchend', this.handleTouchEnd.bind(this), { passive: true });
|
|
244
|
+
|
|
245
|
+
// 鼠标悬停暂停自动播放
|
|
246
|
+
this.container.addEventListener('mouseenter', this.stopAutoPlay.bind(this));
|
|
247
|
+
this.container.addEventListener('mouseleave', this.startAutoPlay.bind(this));
|
|
248
|
+
|
|
249
|
+
// 过渡结束事件
|
|
250
|
+
this.wrapper.addEventListener('transitionend', () => {
|
|
251
|
+
this.isTransitioning = false;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
handleTouchStart(e: any) {
|
|
256
|
+
this.touchStartX = e.changedTouches[0].screenX;
|
|
257
|
+
this.stopAutoPlay();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
handleTouchEnd(e: any) {
|
|
261
|
+
this.touchEndX = e.changedTouches[0].screenX;
|
|
262
|
+
this.handleSwipe();
|
|
263
|
+
this.startAutoPlay();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
handleSwipe() {
|
|
267
|
+
const threshold = 50; // 滑动阈值
|
|
268
|
+
const difference = this.touchStartX - this.touchEndX;
|
|
269
|
+
|
|
270
|
+
if (difference > threshold) {
|
|
271
|
+
// 向左滑动 - 下一张
|
|
272
|
+
this.goToNextSlide();
|
|
273
|
+
} else if (difference < -threshold) {
|
|
274
|
+
// 向右滑动 - 上一张
|
|
275
|
+
this.goToPrevSlide();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
goToPrevSlide() {
|
|
280
|
+
if (this.isTransitioning) return;
|
|
281
|
+
|
|
282
|
+
this.currentIndex = (this.currentIndex - 1 + this.slides.length) % this.slides.length;
|
|
283
|
+
this.updateSlider();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
goToNextSlide() {
|
|
287
|
+
if (this.isTransitioning) return;
|
|
288
|
+
|
|
289
|
+
this.currentIndex = (this.currentIndex + 1) % this.slides.length;
|
|
290
|
+
this.updateSlider();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
goToSlide(index: number) {
|
|
294
|
+
if (this.isTransitioning || index === this.currentIndex) return;
|
|
295
|
+
|
|
296
|
+
this.currentIndex = index;
|
|
297
|
+
this.updateSlider();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
updateSlider() {
|
|
301
|
+
this.isTransitioning = true;
|
|
302
|
+
this.updateSliderPosition();
|
|
303
|
+
this.updatePagination();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
updateSliderPosition() {
|
|
307
|
+
this.wrapper.style.transform = `translateX(-${this.currentIndex * 100}%)`;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
updatePagination() {
|
|
311
|
+
this.bullets.forEach((bullet: any, index: number) => {
|
|
312
|
+
if (index === this.currentIndex) {
|
|
313
|
+
bullet.classList.add('active');
|
|
314
|
+
} else {
|
|
315
|
+
bullet.classList.remove('active');
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
startAutoPlay() {
|
|
321
|
+
if (this.autoPlayInterval) {
|
|
322
|
+
clearInterval(this.autoPlayInterval);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
this.autoPlayInterval = setInterval(() => {
|
|
326
|
+
this.goToNextSlide();
|
|
327
|
+
}, this.autoPlayDelay);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
stopAutoPlay() {
|
|
331
|
+
if (this.autoPlayInterval) {
|
|
332
|
+
clearInterval(this.autoPlayInterval);
|
|
333
|
+
this.autoPlayInterval = null;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
handleResize() {
|
|
338
|
+
// 响应式调整
|
|
339
|
+
this.updateSliderPosition();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
customElements.define('deepseek-swiper', DeepseekSwiper);
|
|
344
|
+
</script>
|
|
@@ -14,19 +14,21 @@ export const GET:APIRoute = async ({site, locals}) => {
|
|
|
14
14
|
});
|
|
15
15
|
// console.log(node_results);
|
|
16
16
|
const site_options = locals.site_options;
|
|
17
|
+
const siteinfo = locals.siteinfo;
|
|
17
18
|
|
|
18
19
|
let items: any = [];
|
|
19
20
|
node_results.nodes.forEach((node: any) => {
|
|
21
|
+
let link = render_url(node.node_url, locals.base, null, locals.url_suffix);
|
|
20
22
|
items.push({
|
|
21
23
|
title: node.node_title,
|
|
22
24
|
pubDate: dayjs.unix(node.node_created).format('YYYY-MM-DD HH:mm:ss'),
|
|
23
25
|
description: node.content,
|
|
24
|
-
link:
|
|
26
|
+
link: link.indexOf('?') !== -1 ? `${link}&utm_source=rss` : `${link}?utm_source=rss`
|
|
25
27
|
})
|
|
26
28
|
})
|
|
27
29
|
|
|
28
30
|
return rss({
|
|
29
|
-
title: site_options.sitename,
|
|
31
|
+
title: site_options.sitename ? `${site_options.sitename}(${siteinfo.site_uri})` : siteinfo.site_uri,
|
|
30
32
|
description: site_options.seo_description,
|
|
31
33
|
site: String(site),
|
|
32
34
|
items:items,
|