This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
456 lines (436 loc) · 17.1 KB
/
index.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
<meta name="viewport" content="width=device-width, initial-scale=1">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Apex S17大佐点互动地图</title>
<link rel="icon" href="./images/icons/Rat_master_x128.ico">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<link rel="stylesheet" href="index.css">
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<div class="sidebar">
<button id="sideopenbutton">◄</button>
<div id="sidebarbox">
<div id="show-name"><h1>Apex 17赛季<br>大佐点互动地图</h1></div>
<div id="show-coord"><h2>作者:xunfeng <a href="https://space.bilibili.com/290304729" target="_blank" rel="noopener noreferrer">B站主页</a></h2></div>
<div id="show-link1"><h3>发布视频:</h3></div>
<div id="show-link2"><iframe src="//player.bilibili.com/player.html?aid=401614022&bvid=BV1So4y1T7BJ&cid=1142752817&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe></div>
<div id="show-img"></div>
</div>
</div>
<div class="newsbar">
<button id="newsopenbutton">×</button>
<div id="newsbox">
<div id="newsline"><h1>通 知</h1></div>
<div id="newsline"><h3>网站地址即将更换至:<a href="https://apexratmap.owonet.work/" target="_blank" rel="noopener noreferrer">https://apexratmap.owonet.work/</a></h3></div>
</div>
</div>
<div class="map" id='map'></div>
<script>
$("#sideopenbutton").attr("open1",0);
$("#sideopenbutton").click(function (e){
e.stopPropagation();
if($("#sideopenbutton").attr("open1")==0){
open();
}else{
close();
}
});
$(".sidebar").click(function () {
event.stopPropagation();
});
$("#newsopenbutton").attr("open1",1);
$("#newsopenbutton").click(function (e){
e.stopPropagation();
if($("#newsopenbutton").attr("open1")==0){
news_open();
}else{
news_close();
}
});
$(".newsbar").click(function () {
event.stopPropagation();
});
var web_url;
web_url = window.location.href;
console.log(web_url);
if(web_url == "https://apexratmap.owonet.work/")
{
news_close();
};
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?f2cad731b22c8cb072adac5dd1cd90d4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
//组
var group_WorldsEdge = L.layerGroup();
var group_Olympus = L.layerGroup();
var group_KingsCanyon = L.layerGroup();
var group_StormPoint = L.layerGroup();
var group_BrokenMoon = L.layerGroup();
var ring_WorldsEdge = L.layerGroup();
var ring_Olympus = L.layerGroup();
var ring_KingsCanyon = L.layerGroup();
var ring_StormPoint = L.layerGroup();
var ring_BrokenMoon = L.layerGroup();
var dotgroup_WorldsEdge = L.layerGroup();
var dotgroup_Olympus = L.layerGroup();
var dotgroup_KingsCanyon = L.layerGroup();
var dotgroup_StormPoint = L.layerGroup();
var dotgroup_BrokenMoon = L.layerGroup();
var dotgroup = L.layerGroup();
var ringgroup = L.layerGroup();
const bounds = [[0, 0], [4256, 4256]];
const ring_Opacity_green = 0.2;
const ring_Opacity_red = 0.3;
var firstopen = true;
var data1 = {}, data2 = {}, data3 = {};
//世界尽头
map_WorldsEdge = L.imageOverlay('./images/maps/世界尽头.jpg', bounds).addTo(group_WorldsEdge);
green_WorldsEdge = L.imageOverlay('./images/rings/WorldsEdge/green.png', bounds).addTo(ring_WorldsEdge).setOpacity(ring_Opacity_green);
red_WorldsEdge = L.imageOverlay('./images/rings/WorldsEdge/red.png', bounds).addTo(ring_WorldsEdge).setOpacity(ring_Opacity_red);
//奥林匹斯
map_Olympus = L.imageOverlay('./images/maps/奥林匹斯.jpg', bounds).addTo(group_Olympus);
green_Olympus = L.imageOverlay('./images/rings/Olympus/green.png', bounds).addTo(ring_Olympus).setOpacity(ring_Opacity_green);
red_Olympus = L.imageOverlay('./images/rings/Olympus/red.png', bounds).addTo(ring_Olympus).setOpacity(ring_Opacity_red);
//诸王峡谷
map_KingsCanyon = L.imageOverlay('./images/maps/诸王峡谷.jpg', bounds).addTo(group_KingsCanyon);
green_KingsCanyon = L.imageOverlay('./images/rings/KingsCanyon/green.png', bounds).addTo(ring_KingsCanyon).setOpacity(ring_Opacity_green);
red_KingsCanyon = L.imageOverlay('./images/rings/KingsCanyon/red.png', bounds).addTo(ring_KingsCanyon).setOpacity(ring_Opacity_red);
//风暴点
map_StormPoint = L.imageOverlay('./images/maps/风暴点.jpg', bounds).addTo(group_StormPoint);
green_StormPoint = L.imageOverlay('./images/rings/StormPoint/green.png', bounds).addTo(ring_StormPoint).setOpacity(ring_Opacity_green);
red_StormPoint = L.imageOverlay('./images/rings/StormPoint/red.png', bounds).addTo(ring_StormPoint).setOpacity(ring_Opacity_red);
//残月
map_BrokenMoon = L.imageOverlay('./images/maps/残月.jpg', bounds).addTo(group_BrokenMoon);
green_BrokenMoon = L.imageOverlay('./images/rings/BrokenMoon/green.png', bounds).addTo(ring_BrokenMoon).setOpacity(ring_Opacity_green);
red_BrokenMoon = L.imageOverlay('./images/rings/BrokenMoon/red.png', bounds).addTo(ring_BrokenMoon).setOpacity(ring_Opacity_red);
//坐标点
const dotIcon = L.Icon.extend({
options:{
iconSize: [10, 10], // size of the icon
//popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor
}
});
const red_dot = new dotIcon({iconUrl: './images/icons/red_dot.png'});
//打开侧边栏
function open() {
if($("#sideopenbutton").attr("open1")==0){
$("#sideopenbutton").attr("open1",1);
$("#sideopenbutton").html("►");
$(".sidebar").toggleClass("sidebar-open");
}
}
//关闭侧边栏
function close(){
if($("#sideopenbutton").attr("open1")==1){
$("#sideopenbutton").attr("open1",0);
$("#sideopenbutton").html("◄");
$(".sidebar").toggleClass("sidebar-open");
}
}
function news_open(){
if($("#newsopenbutton").attr("open1")==0){
$("#newsopenbutton").attr("open1",1);
$("#newsopenbutton").html("×");
$(".newsbar").toggleClass("newsbar-open");
}
}
function news_close(){
if($("#newsopenbutton").attr("open1")==1){
$("#newsopenbutton").attr("open1",0);
$("#newsopenbutton").html("");
$(".newsbar").toggleClass("newsbar-open");
}
}
//加点入组函数
function addDot2Group(num,data,group) {
for(i=0;i<data.length;i++){
if(data[i]["Link"] != ''){
var html = data[i]["Name"]+'<br><a href="'+data[i]["Link"]+'" target="_blank" rel="noopener noreferrer">'+data[i]["Link_str"]+'</a>';
}
else{
var html = data[i]["Name"]+'<br>暂无视频';
}
if(data[i]["Link2"] != ''){
html+='<br><a href="'+data[i]["Link2"]+'" target="_blank" rel="noopener noreferrer">'+data[i]["Link_str2"]+'</a>';
}
var coord_str = data[i]["Coord"];
var coord_str_list = coord_str.split(',');
var coord = [Number(coord_str_list[0]),Number(coord_str_list[1])];
window['dot_'+num+'_'+i]=L.marker(coord, {
icon: red_dot,
riseOnHover: true,
attribution: num+','+i
})
.addTo(group)
.bindPopup(html,{
offset: [0,0],
closeOnClick: false
}).bindTooltip(html,{
direction: 'top',
sticky: true
})
.on('click', e=>{
id = e.sourceTarget.getAttribution()
var id_list = id.split(',');
document.getElementById('show-name').innerHTML = '<h1>'+eval("data"+id_list[0]+'['+id_list[1]+']["Name"]')+'</h1>';
document.getElementById('show-coord').innerHTML = '<h2>坐标:<br>('+eval("data"+id_list[0]+'['+id_list[1]+']["Coord"]')+')</h2>';
if(eval("data"+id_list[0]+'['+id_list[1]+']["Link"]') != ''){
var link = '<br><a href="'+eval("data"+id_list[0]+'['+id_list[1]+']["Link"]')+'" target="_blank" rel="noopener noreferrer">'+eval("data"+id_list[0]+'['+id_list[1]+']["Link_str"]')+'</a>';
}
else{
var link = '<br>暂无视频';
}
if(eval("data"+id_list[0]+'['+id_list[1]+']["Link"]') != ''){
link+='<br><a href="'+eval("data"+id_list[0]+'['+id_list[1]+']["Link2"]')+'" target="_blank" rel="noopener noreferrer">'+eval("data"+id_list[0]+'['+id_list[1]+']["Link_str2"]')+'</a>';
}
document.getElementById('show-link2').innerHTML = '';
document.getElementById('show-link1').innerHTML = '<h3>视频链接:'+link+'</h3>';
open();
});
}
console.log("成功加载了"+data.length+"个点");
}
//json读取
//世界尽头
var url1 = "https://xunfengawa.github.io//locs/WorldsEdge.json";
var request1 = new XMLHttpRequest();
request1.open("get", url1);
request1.send(null);
request1.onload = function () {
if (request1.status == 200) {
data1 = JSON.parse(request1.responseText);
addDot2Group(1,data1,dotgroup_WorldsEdge);
}
}
//奥林匹斯
var url2 = "https://xunfengawa.github.io//locs/Olympus.json";
var request2 = new XMLHttpRequest();
request2.open("get", url2);
request2.send(null);
request2.onload = function () {
if (request2.status == 200) {
data2 = JSON.parse(request2.responseText);
addDot2Group(2,data2,dotgroup_Olympus);
}
}
//诸王峡谷
var url3 = "https://xunfengawa.github.io//locs/KingsCanyon.json";
var request3 = new XMLHttpRequest();
request3.open("get", url3);
request3.send(null);
request3.onload = function () {
if (request3.status == 200) {
data3 = JSON.parse(request3.responseText);
addDot2Group(3,data3,dotgroup_KingsCanyon);
}
}
//风暴点
var url4 = "https://xunfengawa.github.io//locs/StormPoint.json";
var request4 = new XMLHttpRequest();
request4.open("get", url4);
request4.send(null);
request4.onload = function () {
if (request4.status == 200) {
data4 = JSON.parse(request4.responseText);
addDot2Group(4,data4,dotgroup_StormPoint);
}
}
//残月
var url5 = "https://xunfengawa.github.io//locs/BrokenMoon.json";
var request5 = new XMLHttpRequest();
request5.open("get", url5);
request5.send(null);
request5.onload = function () {
if (request5.status == 200) {
data5 = JSON.parse(request5.responseText);
addDot2Group(5,data5,dotgroup_BrokenMoon);
}
}
//地图加载
dotgroup = dotgroup_WorldsEdge;
ringgroup = ring_WorldsEdge;
const map = L.map('map',{
minZoom: -2.5,
maxZoom: 4,
zoomSnap: 0.5,
zoomDelta: 0.5,
crs: L.CRS.Simple,
layers:[group_WorldsEdge],
attributionControl: false
});
map.on('load', e=>{
console.log('欢迎使用Apex大佐互动地图')
if($("#sideopenbutton").attr("open1")==0 && firstopen){
open();
firstopen = false;
}
});
map.setView([0.0, 0.0],0);
map.addLayer(dotgroup);
map.fitBounds(bounds);
//图层组
var baseMaps = {
"世界尽头": group_WorldsEdge,
"奥林匹斯": group_Olympus,
"诸王峡谷": group_KingsCanyon,
"风暴点": group_StormPoint,
"残月": group_BrokenMoon
};
var overlayMaps = {
//"大佐点": dotgroup,
//"缩圈范围": ringgroup
};
//控件
var layerControl = L.control.layers(baseMaps, overlayMaps,{
collapsed: false,
position: 'topleft'
}).addTo(map);
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
//events
map.on('click', e=>{
var lat = e.latlng.lat;
var lng = e.latlng.lng;
var string_latlng = '[' + lat.toFixed(3) + ','+ lng.toFixed(3) + ']';
if (lat<=4256&&lng<=4256&&lat>=0&&lng>=0){
L.popup().setLatLng(e.latlng).setContent(string_latlng).openOn(map);
}
});
var flag_dot = true;
var flag_ring = false;
group_WorldsEdge.on('add',(e)=>{
console.log('切换至世界尽头');
layerControl.removeLayer(dotgroup, "大佐点");
layerControl.removeLayer(ringgroup, "缩圈范围");
if (map.hasLayer(dotgroup)){
flag_dot = true;
map.removeLayer(dotgroup);
}
if (map.hasLayer(ringgroup)){
flag_ring = true;
map.removeLayer(ringgroup);
}
dotgroup = dotgroup_WorldsEdge;
ringgroup = ring_WorldsEdge;
if(flag_dot){
map.addLayer(dotgroup);
flag_dot = false;
}
if(flag_ring){
map.addLayer(ringgroup);
flag_ring = false;
}
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
})
group_Olympus.on('add',(e)=>{
console.log('切换至奥林匹斯');
layerControl.removeLayer(dotgroup, "大佐点");
layerControl.removeLayer(ringgroup, "缩圈范围");
if (map.hasLayer(dotgroup)){
flag_dot = true;
map.removeLayer(dotgroup);
}
if (map.hasLayer(ringgroup)){
flag_ring = true;
map.removeLayer(ringgroup);
}
dotgroup = dotgroup_Olympus;
ringgroup = ring_Olympus;
if(flag_dot){
map.addLayer(dotgroup);
flag_dot = false;
}
if(flag_ring){
map.addLayer(ringgroup);
flag_ring = false;
}
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
})
group_KingsCanyon.on('add',(e)=>{
console.log('切换至诸王峡谷');
layerControl.removeLayer(dotgroup, "大佐点");
layerControl.removeLayer(ringgroup, "缩圈范围");
if (map.hasLayer(dotgroup)){
flag_dot = true;
map.removeLayer(dotgroup);
}
if (map.hasLayer(ringgroup)){
flag_ring = true;
map.removeLayer(ringgroup);
}
dotgroup = dotgroup_KingsCanyon;
ringgroup = ring_KingsCanyon;
if(flag_dot){
map.addLayer(dotgroup);
flag_dot = false;
}
if(flag_ring){
map.addLayer(ringgroup);
flag_ring = false;
}
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
})
group_StormPoint.on('add',(e)=>{
console.log('切换至风暴点');
layerControl.removeLayer(dotgroup, "大佐点");
layerControl.removeLayer(ringgroup, "缩圈范围");
if (map.hasLayer(dotgroup)){
flag_dot = true;
map.removeLayer(dotgroup);
}
if (map.hasLayer(ringgroup)){
flag_ring = true;
map.removeLayer(ringgroup);
}
dotgroup = dotgroup_StormPoint;
ringgroup = ring_StormPoint;
if(flag_dot){
map.addLayer(dotgroup);
flag_dot = false;
}
if(flag_ring){
map.addLayer(ringgroup);
flag_ring = false;
}
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
})
group_BrokenMoon.on('add',(e)=>{
console.log('切换至残月');
layerControl.removeLayer(dotgroup, "大佐点");
layerControl.removeLayer(ringgroup, "缩圈范围");
if (map.hasLayer(dotgroup)){
flag_dot = true;
map.removeLayer(dotgroup);
}
if (map.hasLayer(ringgroup)){
flag_ring = true;
map.removeLayer(ringgroup);
}
dotgroup = dotgroup_BrokenMoon;
ringgroup = ring_BrokenMoon;
if(flag_dot){
map.addLayer(dotgroup);
flag_dot = false;
}
if(flag_ring){
map.addLayer(ringgroup);
flag_ring = false;
}
layerControl.addOverlay(dotgroup, "大佐点");
layerControl.addOverlay(ringgroup, "缩圈范围");
})
</script>
</body>
</html>