-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrw-map.html
872 lines (753 loc) · 35.8 KB
/
rw-map.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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:image" content="https://rain-world-map-sc.github.io/embed.jpg" />
<meta property="og:type" content="object" />
<meta property="og:title" content="雨世界地图" />
<meta property="og:url" content="https://rain-world-map-sc.github.io" />
<meta property="og:description" content="一个在线互动地图,包括雨世界:倾盆大雨中的每个地区和每个蛞蝓猫。" />
<meta name="keywords" content="雨世界,雨世界地图">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>雨世界地图</title>
<link rel="stylesheet" href="rw.css">
<script src="/global.js"></script>
<script src="/resources/js/console.js"></script>
<link rel="manifest" href="/manifest.json">
<script src="/resources/js/app.js"></script>
<style>
body {
background-color: black;
color: #eee;
}
.bg {
min-height: 100%;
min-width: 1024px;
width: 100%;
height: auto;
position: fixed;
top: 0;
left: 0;
opacity: 0.2;
z-index: -1;
}
h2 {
margin-top: 1em;
font-size: 21px;
font-weight: 500;
border-bottom: 1px solid #aaa;
}
p {
margin-top: 7px;
font-size: 14px;
}
b {
color: #fab;
}
.grey {
color: #A9A4B2;
}
.right {
float: right;
margin: -27px 30px 0 0;
}
.left {
float: left;
margin: -27px 0px 0 95px;
}
.container {
display: flex;
flex-direction: row;
margin: 0 auto;
margin-top: 30px;
padding: 0 15px;
min-width: 1100px;
max-width: 1430px;
}
.left-panel {
padding-right: 15px;
}
.asidebtn {
display: none;
}
.toggleLanguage-ckb {
position: relative;
top: -28px;
padding-left: 6px;
margin-left: 90px;
}
#toggleLanguage {
position: relative;
width: 24px;
height: 24px;
}
#toggleLanguage~label {
left: 4px;
top: -6px;
}
#toggleLanguage::before {
font-size: 1rem;
}
.main {
width: 100%;
color: white !important;
}
.nav {
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
}
.nav ul {
display: flex;
flex-direction: row;
cursor: default;
}
.nav ul li {
height: 33px;
margin: 3px 15px;
line-height: 33px;
text-align: center;
color: #A9A4B2;
}
.nav ul li a {
color: #A9A4B2;
}
.current {
color: #fff !important;
}
/* 边栏样式 */
.aside {
width: 180px;
padding: 10px;
border-radius: 4px;
border: 1px solid #a2a9b1;
font-size: 16px;
font-weight: 500;
}
.aside-mask {
position: sticky;
top: 140px;
}
.aside h2 {
margin-top: 0.5em;
font-size: 18px;
font-weight: 700;
}
.aside h3 {
margin-top: 0.5em;
font-size: 16px;
}
.aside ul li a {
margin-left: 1em;
font-size: 14px;
}
.aside a:hover {
text-decoration: underline;
color: #fff;
}
.tocnumber {
margin-right: 0.3em;
color: #aaa;
}
/* 主体样式 */
.map-body {
padding: 0 1.5em 1.5em 1.5em;
border-radius: 2px;
border: 1px solid #fff6;
background-color: #0004
}
.notice {
background-color: rgba(100, 20, 90, 0.2);
border: 2px solid #D29;
border-radius: 1em;
padding: 0.5em;
margin: 15px 0;
text-align: center;
}
.about {
display: none;
}
.about ul li a {
color: #A9A4B2;
}
@media (max-width: 768px) {
.left-panel {
padding-right: 0;
}
.aside-mask {
display: none;
}
.aside {
width: 280px;
position: fixed;
right: 30px;
top: 30px;
transform: translate(100%, 100%);
transition: transform 0.2s ease-out;
z-index: 1500;
background: rgba(0, 0, 0, 0.8);
}
.asidebtn {
width: 45px;
height: 45px;
position: fixed;
bottom: 60px;
right: 15px;
z-index: 2000;
}
#toggleBtn {
width: 39px;
height: 38px;
background-image: url(/resources/img/aside.png);
background-repeat: no-repeat;
}
.aside-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
}
.asidebtn {
display: block;
}
.aside.show {
transform: translate(0, 0);
transition: transform 0.2s ease-out;
}
.aside.hiding {
transform: translate(100%, 100%);
transition: transform 0.2s ease-in;
}
.container {
min-width: calc(100% - 30px) !important;
}
#footer {
margin-left: 0 !important;
left: 0 !important;
}
}
#indexcontents {
width: 100%;
margin-top: 10px;
display: block;
position: relative;
text-align: center;
font-family: 'Segoe UI';
font-weight: 500;
color: #A9A4B2;
/* menu lightgray */
border-radius: 8px;
border: 2px solid #A9A4B200;
border-color: #4B4653;
}
.indexgroup {
text-align: center;
font-family: 'Segoe UI';
color: #A9A4B2;
/* menu lightgray */
margin: 2%;
margin-top: 2%;
margin-bottom: 3%;
border-radius: 8px;
border: 2px solid #A9A4B200;
border-color: #4B4653;
}
.indexgroup h3,
h4 {
margin: 1.1em
}
.indexgroup figure {
display: inline-block;
border-radius: 8px;
border: 2px solid #A9A4B200;
border-color: white;
background: rgba(0, 0, 0, 0.3);
margin: 15px;
max-width: 350px;
}
.indexgroup figcaption {
text-align: center;
font-family: 'Segoe UI';
font-weight: 600;
color: #A9A4B2;
padding: 10px;
padding-top: 1px;
}
.indexgroup content {
width: auto;
display: flex;
text-align: center;
font-family: 'Segoe UI';
font-weight: 500;
color: #A9A4B2;
padding: 10px;
flex-wrap: wrap;
}
/* 表格样式 */
.indexgroup table {
width: 100%;
border-radius: 7px;
border: 2px solid #A9A4B200;
border-color: #A9A4B2;
align-content: center;
text-align: center;
margin: 1px;
}
.indexgroup tr {
text-align: left;
}
.indexgroup td {
padding: 3px;
border-radius: 8px;
border: 2px solid #A9A4B200;
border-color: #A9A4B2;
max-width: 200px;
min-width: 20px;
}
/* 区域按钮样式 */
button.region-button {
position: relative;
width: 130px;
height: 130px;
background-color: rgba(0, 0, 0, .3);
margin: 15px 4px;
}
#regionlist button.region-button {
margin: 15px 2px 30px 2px;
}
.region-button p {
position: absolute;
left: -2px;
top: 122px;
width: 130px;
text-align: center;
}
.region-button:hover {
opacity: 1.0;
transform: scaleX(1.2) scaleY(1.2);
}
#regionlist-vanilla {
max-width: 828px;
margin: auto;
}
#regionlist {
margin: auto !important;
}
/* expando list, flex that needs wrap on really small displays */
.scuglist-group {
margin-left: auto;
margin-right: auto;
margin-top: 0.8em;
margin-bottom: 0.8em;
width: fit-content;
max-width: 100vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.scuglist-group>div {
width: 150px;
position: relative;
/* re-center after wrap */
margin-left: auto;
margin-right: auto;
padding: 4px;
transition: width 0.4s;
}
.difficulty-btn {
display: inline-block;
width: 38px;
height: 38px;
margin: 4px;
position: relative;
}
#footer {
position: fixed;
margin-bottom: 0.1em;
margin-left: -230px;
bottom: 2%;
left: 50%;
align-content: center;
text-align: center;
font-family: 'Segoe UI';
font-size: 0.8em;
font-weight: 500;
color: #A9A4B2;
/* menu lightgray */
background-color: black;
}
#footer a:link {
color: white;
}
#footer a:visited {
color: #A9A4B2;
/* 页脚颜色 */
}
</style>
</head>
<body>
<div class="container">
<img src="/resources/img/bg.png" class="bg">
<div class="left-panel">
<div class="aside-mask" id="asideMask">
<div class="aside" id="aside">
<h2>索引</h2>
<h3><span class="tocnumber">1.</span><a href="#top" style="font-size: 16px; margin-left: 0;">地图</a>
</h3>
<ul>
<li><a href="#tilenodes"><span class="tocnumber">1.</span>房间节点</a></li>
<li><a href="#roomtags"><span class="tocnumber">2.</span>房间标签</a></li>
<li><a href="#slugcats"><span class="tocnumber">3.</span>蛞蝓猫</a></li>
</ul>
<h3><span class="tocnumber">2.</span><a href="#creatures"
style="font-size: 16px; margin-left: 0;">生物</a>
</h3>
<ul>
<li><a href="#lizards"><span class="tocnumber">2.1</span>蜥蜴</a></li>
<li><a href="#centipedes"><span class="tocnumber">2.2</span>蜈蚣</a></li>
<li><a href="#rot"><span class="tocnumber">2.3</span>腐化生物(香菇)</a></li>
<li><a href="#spiders"><span class="tocnumber">2.4</span>蜘蛛</a></li>
<li><a href="#creatureattributes"><span class="tocnumber">2.5</span>生物属性</a></li>
</ul>
<h3><span class="tocnumber">3.</span><a href="#placedobjects"
style="font-size: 16px; margin-left: 0;">放置的物体</a>
</h3>
<ul>
<li><a href="#placedcreatures"><span class="tocnumber">3.1</span>放置的生物</a></li>
<li><a href="#consumable"><span class="tocnumber">3.2</span>消耗品</a></li>
<li><a href="#non-consumable"><span class="tocnumber">3.1</span>非消耗品</a></li>
<li><a href="#mechanicalobjects"><span class="tocnumber">3.4</span>机械</a></li>
<li><a href="#decorativeobjects"><span class="tocnumber">3.4</span>装饰</a></li>
</ul>
<h2>wiki相关</h2>
<ul>
<h3><span class="tocnumber">1.</span> 推荐阅读</h3>
<li><a href="https://rainworld.miraheze.org/wiki/Controls/zh-hans" target="_blank">
<span class="tocnumber">1.1</span>操控</a></li>
<li><a href="https://rainworld.miraheze.org/wiki/Rain/zh-hans" target="_blank">
<span class="tocnumber">1.2</span>暴雨</a></li>
<li><a href="https://rainworld.miraheze.org/wiki/Hibernation/zh-hans" target="_blank">
<span class="tocnumber">1.3</span>雨眠</a></li>
<li><a href="https://rainworld.miraheze.org/wiki/Regions/zh-hans" target="_blank">
<span class="tocnumber">1.4</span>区域</a></li>
<li><a href="https://rainworld.miraheze.org/wiki/Food/zh-hans" target="_blank">
<span class="tocnumber">1.5</span>食物</a></li>
<p>更多可见 <a href="https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans"
target="_blank">雨世界wiki</a></p>
</ul>
</div>
</div>
</div>
<div class="main">
<div class="mortalcat">
<div class="nav">
<ul>
<li class="current">| 首页 |</li>
<li><a href="https://rainworldmods.miraheze.org/wiki/Main_Page" target="_blank">| 雨世界模组wiki
|</a></li>
<li>| 关于 |</li>
</ul>
</div>
<div class="map-body">
<!-- 地图 -->
<div class="maps item">
<h2 id="top">雨世界地图</h2>
<p>这里是雨世界地图,希望能对你有帮助ヽ(´•ω•`)、</p>
<!-- 警告 -->
<div class="notice">
<div
style="display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 125%;">
<img alt="Slugcat no right.png" src="/resources/img/Slugcat_no_right.png">
<img alt="Large DLC icon.png" src="/resources/img/Large_DLC_icon.png">
<span>游戏剧透警告</span>
</div><br>
<span style="font-size: 80%"">此地图可能会影响你的游戏体验,请理性使用</span></div>
<p>部分参考于 <a href=" https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans"
target="_blank"><b>雨世界wiki</b></a>
如有问题可以前往 <a href="https://blog.xiowo.net/posts/1b7c" target="_blank"><b>Mo的记事簿</b></a>
指出 | 如果你想详细的了解雨世界你可以查阅
<a href="https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans" target="_blank">
<b>雨世界wiki</b></a> ( ‵▽′)ψ
</p>
<p>为缓解GitHub问题,地图支持PWA以及内置加速源,但是请尽量使用自己的加速服务。加速地图办法见:
<a href="https://blog.xiowo.net/posts/1b7c/#无法访问-x2F-访问过慢解决办法"
target="_blank"><b>传送门</b></a>
</p>
<!-- 区域地图 -->
<h2 id="RegionMap">区域地图</h2>
<p class="right grey">Downpour</p>
<form action="map.html" method="GET">
<div class="regionlist-group">
<div id="regionlist-vanilla">
</div>
<input type="hidden" name="slugcat" value="white">
</div>
<script>
var region_order = ['SU', 'HI', 'DS', 'CC', 'GW', 'SH', 'SL', 'SI', 'LF', 'UW', 'SS', 'SB'];
// dumped region dicts from running the generateGeoJSON scripts
var region = { "CC": "烟囱天棚", "DS": "排水系统", "GW": "垃圾堆", "HI": "工业区", "LF": "农场阵列", "SB": "地下", "SH": "阴影城堡", "SI": "天空群岛", "SL": "海岸线", "SS": "五块卵石", "SU": "郊区", "UW": "外缘" };
var html = "";
// vanilla go in a special order
for (var r of region_order) {
html += '<button class="region-button rw-ui rw-text" name="region" value="' + r + '"><img src="./resources/img/' + region[r].toUpperCase() + '.png" onerror="this.onerror=null;this.src=\'./resources/img/none.webp\';"><p>' + region[r].toUpperCase() + '</p></button>'
}
document.getElementById('regionlist-vanilla').innerHTML = html;
</script>
</form>
<!-- 倾盆大雨 & 模组地图 -->
<h2 id="DownpourMap">倾盆大雨</h2>
<p class="right grey">1.9.07b</p>
<form>
<div class="scuglist-group">
<div id="downpour"></div>
</div>
</form>
<h2 id="ModMap">模组地图</h2>
<span class="toggleLanguage-ckb">
<input type="checkbox" class="rw-ui rw-ui-ckb toggleLanguage-ckb"
id="toggleLanguage" onclick="toggleLanguage()">
<label class="rw-text">显示为中文</label>
</span>
<p class="right grey">mod-map</p>
<form action="mod-map/map.html" method="GET">
<div class="regionlist-group">
<div id="regionlist"></div>
<input type="hidden" name="slugcat" value="white" required />
</div>
</form>
<script>
// 倾盆大雨
let slugcats = {};
getJsonObject("slugcats.json", function (json) {
slugcats = json;
var html = "";
for (const slugcatName in slugcats) {
var icon = "72_unknown";
if (slugcatName in icon_by_name) {
icon = icon_by_name[slugcatName];
} else {
console.log("missing icon for " + slugcatName);
}
html += `
<label class="difficulty-btn">
<input type="radio" class="rw-ui" name="difficulties" onclick="selectDifficulty('${slugcatName}');" autocomplete="off">
<img src="./resources/icons/${icon}.png">
</label>`;
document.getElementById('downpour').innerHTML = html;
}
}, true);
function selectDifficulty(slugName) {
window.location.href = `map.html?slugcat=${slugName}®ion=${slugcats[slugName].startingRegion}&room=${slugcats[slugName].startingRoom}`;
}
// 模组地图
let regions = {};
let displayChinese = false; // 控制是否显示中文的标记
// 加载初始语言选择状态
window.addEventListener("load", () => {
displayChinese = localStorage.getItem('displayChinese') === 'true';
console.log('Loaded from localStorage:', localStorage.getItem('displayChinese')); // 调试:打印从 localStorage 中读取的值
const checkbox = document.getElementById("toggleLanguage");
checkbox.checked = displayChinese; // 确保复选框状态与 localStorage 中的值同步
renderRegions(); // 确保页面渲染与复选框状态一致
});
function getJsonObject(url, callback, async = true) {
fetch(url)
.then(response => response.json())
.then(data => callback(data))
.catch(error => console.error('Error:', error));
}
// 切换语言显示并记住用户的选择
function toggleLanguage() {
displayChinese = document.getElementById("toggleLanguage").checked;
localStorage.setItem('displayChinese', displayChinese); // 保存用户选择到 localStorage
renderRegions(); // 更新区域显示的语言
}
// 加载 regions.json 数据并渲染模组地图区域
getJsonObject("mod-map/regions.json", function (json) {
regions = json;
renderRegions();
}, true);
// 渲染模组地图区域按钮的函数
function renderRegions() {
let html = "";
const regionListSorted = Object.keys(regions).sort((a, b) => regions[a]["name"]?.toLowerCase().localeCompare(regions[b]["name"]?.toLowerCase()));
for (const r of regionListSorted) {
const region = regions[r];
// 如果区域的 cname 不存在,设置默认值为 name,name不存在则设置为"unknown"
const regionName = displayChinese ? (region["cname"] || region["name"] || "UNKNOWN") : (region["name"] || "UNKNOWN");
html += `
<button class="region-button rw-ui rw-text" name="region" value="${r}">
<img src="./resources/img/${region["name"]}.webp" onerror="this.onerror=null;this.src='./resources/img/none.webp';">
<p>${regionName.toUpperCase()} (${r})</p>
</button>`;
}
const regionlist = document.getElementById('regionlist');
regionlist.innerHTML = html;
// 动态调整 regionlist 宽度
adjustRegionListWidth();
}
// 动态调整 regionlist 和 regionlist-vanilla 的宽度的函数
function adjustRegionListWidth() {
const regionlist = document.getElementById('regionlist');
const regionlistVanilla = document.getElementById('regionlist-vanilla');
const mapBody = document.querySelector('.map-body');
const button = document.querySelector('.region-button');
if (mapBody && button) {
const mapBodyWidth = mapBody.clientWidth;
const buttonWidth = button.offsetWidth + parseFloat(getComputedStyle(button).marginLeft) + parseFloat(getComputedStyle(button).marginRight);
// 计算每行能容纳多少个按钮
const buttonsPerRow = Math.floor(mapBodyWidth / buttonWidth);
// 计算 regionlist 和 regionlist-vanilla 的宽度
const newWidth = `${buttonsPerRow * buttonWidth}px`;
regionlist.style.width = newWidth;
regionlistVanilla.style.width = newWidth; // 同步修改 regionlist-vanilla 的宽度
}
}
// 当窗口大小变化时,重新计算宽度
window.addEventListener("resize", adjustRegionListWidth);
// 侧栏移动端适配
document.addEventListener('DOMContentLoaded', function () {
const toggleBtn = document.getElementById('toggleBtn');
const aside = document.getElementById('aside');
const asideMask = document.getElementById('asideMask');
// 切换按钮点击事件:显示或隐藏侧边栏
toggleBtn.addEventListener('click', function () {
if (aside.style.display === 'none') {
aside.style.display = 'block';
asideMask.style.display = 'block';
setTimeout(() => {
aside.classList.remove('hiding'); // 确保隐藏类已移除
aside.classList.add('show'); // 添加显示动画
}, 10); // 延时添加类确保动画生效
} else {
aside.classList.remove('show'); // 移除显示动画类
aside.classList.add('hiding'); // 添加隐藏动画类
setTimeout(() => {
aside.style.display = 'none';
asideMask.style.display = 'none';
}, 500); // 动画持续时间后隐藏
}
});
// 点击遮罩层事件:隐藏侧边栏
asideMask.addEventListener('click', function () {
aside.classList.remove('show');
aside.classList.add('hiding');
setTimeout(() => {
aside.style.display = 'none';
asideMask.style.display = 'none';
}, 500); // 动画持续时间后隐藏遮罩层
});
});
</script>
</div>
<!-- 关于 -->
<div class="about item">
<h2>关于</h2>
<p>这个是我在学习html和css的时候做的,修改和参考自以下优秀的开源项目</p>
参考项目:
<ul>
<li>- <a href="https://henpemaz.github.io/Rain-World-Interactive-Map/"
target="_blank">Rain World Interactive
Map</a>
</li>
<li>- <a href="https://rain-world-map.github.io/" target="_blank">Rain World
Map</a>
</li>
<li>- <a href="https://rain-world-downpour-map.github.io/" target="_blank">Rain
World
Downpour Map</a></li>
<li>- <a href="https://alduris.github.io/mod-map/" target="_blank">Rain World Mod
Map</a>
</li>
</ul>
用到的资源:
<ul>
<p>背景素材</p>
<li>- <a href="https://rainworldgame.com/" target="_blank">Rain World</a>
</li>
<p>图片素材</p>
<li>- <a href="https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans"
target="_blank">Rain World Wiki</a>
</li>
<li>- <a href="https://rain-world-map.github.io/" target="_blank">Rain World
Map</a></li>
</ul>
关于雨世界和这个地图你可以查看:
<ul>
<li>- <a href="https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans#关于雨世界"
target="_blank">关于雨世界</a></li>
<li>- <a href="https://blog.xiowo.net/posts/1b7c" target="_blank">关于地图</a></li>
</ul>
</div>
<!-- 地图信息 -->
<h2>地图信息</h2>
<p>这里是一些地图、生物、物品、蛞蝓猫的一些信息</p>
<div class="asidebtn">
<button class="rw-ui" id="toggleBtn"></button>
</div>
<article id="indexcontents"></article>
<script src="/resources/js/map-item.js"></script>
</div>
</div>
</div>
<div id="footer"> <a href="https://github.com/xiowo/rain-world-map-SimplifiedChinese"
target="_blank">GitHub</a> 上的代码 | 图标和样式来自于
<a href="https://rainworld.miraheze.org/wiki/Rain_World_Wiki/zh-hans" target="_blank">雨世界wiki</a> |
由 <a href="https://github.com/xiowo/" target="_blank">MortalCat</a> 修改 | 本站支持
<a href="https://developer.mozilla.org/zh-CN/docs/Web/Progressive_web_apps" target="_blank">PWA</a>
| <a href="https://store.steampowered.com/app/312520/Rain_World/" target="_blank">雨世界</a> 是
<a href="https://twitter.com/VideocultMedia" target="_blank">Videocult</a> 的财产
</div>
<script>
// 获取元素
var tab_list = document.querySelector('.nav');
var lis = tab_list.querySelectorAll('li');
var items = document.querySelectorAll('.item');
// 过滤掉包含 <a> 标签的 li 元素
var filteredLis = Array.from(lis).filter(li => !li.querySelector('a'));
// 为每个有效的 li 元素设置索引
for (var i = 0; i < filteredLis.length; i++) {
filteredLis[i].setAttribute('index', i);
}
// 为每个有效的 li 元素绑定点击事件
for (var i = 0; i < filteredLis.length; i++) {
filteredLis[i].onclick = function () {
// 清除所有 li 的 class
for (var j = 0; j < filteredLis.length; j++) {
filteredLis[j].className = '';
}
// 添加当前 li 的 class
this.className = 'current';
// 获取当前 li 的索引
var index = this.getAttribute('index');
console.log("Selected index:", index);
// 确保 index 是有效的
if (index < 0 || index >= items.length) {
console.error("Invalid index:", index);
return;
}
// 隐藏所有 .item 元素
for (var j = 0; j < items.length; j++) {
items[j].style.display = 'none';
}
// 显示对应索引的 .item 元素
items[index].style.display = 'block';
}
}
</script>
</body>
<script>
// 检测浏览器是否支持SW
if (navigator.serviceWorker != null) {
navigator.serviceWorker.register('sw.js')
.then(function (registartion) {
console.log('支持sw:', registartion.scope)
})
}
</script>
</html>