-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
196 lines (187 loc) · 5.75 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>虎师罗盘</title>
<link rel="stylesheet" type="text/css" href="./css/style.css" />
<style type="text/css">
.tools #fold {
display: none;
}
</style>
</head>
<body id="capture">
<div class="scroll">
<!-- header -->
<div class="header">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/logo2.png">
</div>
<!-- top-tool -->
<div class="top-tool">
<div class="gradienter">
<span class="dot"></span>
</div>
<div class="weather">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/weather.png">
</div>
</div>
<!-- pan -->
<div class="pan">
<!-- jia&jian -->
<div class="jia_btn">+</div>
<div class="jian_btn">-</div>
<!-- line -->
<span class="line line-heng"></span>
<span class="line line-shu"></span>
<img class="main-pan" id="compass" style="transform: rotate(0deg);" src="http://ii.sinelinked.com/miniProgramAssets/compass/pan.png">
<img class="deg-img" src="./img/a2.png" alt="" srcset="">
<img class="zhen-img" src="./img/a3.png" alt="" srcset="">
</div>
<!-- tools -->
<ul class="tools">
<li id="switch">
<div class="top">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/001.png">
</div>
<p>模式</p>
</li>
<li id="lock">
<div class="top">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/004.png">
</div>
<p>锁定</p>
</li>
<li id="manual">
<div class="top">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/005.png">
</div>
<p>手动</p>
</li>
<li id="fold">
<div class="top">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/003.png">
</div>
<p>收起</p>
</li>
<li id="change">
<div class="top">
<img src="http://ii.sinelinked.com/miniProgramAssets/compass/002.png">
</div>
<p>换盘</p>
</li>
</ul>
<div id="info">
<p class="info-t">
<strong>方位:</strong><span class="fangwei"></span> <strong>度数:</strong><span
class="deg"></span>
</p>
<p class="info-t">
<strong>经度:</strong><span class="jingdu"></span> <strong>纬度:</strong><span class="weidu"></span>
</p>
</div>
<div id="allmap"></div>
</div>
<!-- switchs -->
<script src="js/switch.js" type="text/javascript" charset="utf-8"></script>
<script src="js/index.js" type="text/javascript" charset="utf-8"></script>
<script>
(function(T, h, i, n, k, P, a, g, e) {
g = function() {
P = h.createElement(i);
a = h.getElementsByTagName(i)[0];
P.src = k;
P.charset = "utf-8";
P.async = 1;
a.parentNode.insertBefore(P, a)
};
T["ThinkPageWeatherWidgetObject"] = n;
T[n] || (T[n] = function() {
(T[n].q = T[n].q || []).push(arguments)
});
T[n].l = +new Date();
if (T.attachEvent) {
T.attachEvent("onload", g)
} else {
T.addEventListener("load", g, false)
}
}(window, document, "script", "tpwidget", "//widget.seniverse.com/widget/chameleon.js"))
</script>
<script>
tpwidget("init", {
"flavor": "bubble",
"location": "WX4FBXXFKE4F",
"geolocation": "enabled",
"position": "top-left",
"margin": "10px 10px",
"language": "zh-chs",
"unit": "c",
"theme": "black",
"uid": "U3B80E39C7",
"hash": "68532161673f581383c0fa1582acb536"
});
var change = document.getElementById('change')
var compass = document.getElementById('compass')
var panBg = [
'http://ii.sinelinked.com/miniProgramAssets/compass/pan-map-yellow.png',
'http://ii.sinelinked.com/miniProgramAssets/compass/pan-map.png',
'http://ii.sinelinked.com/miniProgramAssets/compass/pan.png'
]
var num = 0
change.addEventListener('touchstart', function() {
this.children[0].classList.add('active')
})
change.addEventListener('touchend', function() {
num++
if (num >= panBg.length) {
num = 0
}
compass.src = panBg[num]
this.children[0].classList.remove('active')
})
// 天气
var weather = document.querySelector('.weather')
var tpwthwidt
weather.addEventListener('touchstart', function() {
if (tpwthwidt) {
tpwthwidt.style.display = 'block'
} else {
tpwidget("show");
}
setTimeout(function() {
tpwthwidt = document.querySelector('.tpwthwidt')
if (tpwthwidt) {
tpwthwidt.style.display = 'none'
}
}, 5000)
})
// 截屏
// document.onclick = function(){
// html2canvas(document.querySelector("#capture")).then(canvas => {
// // document.body.appendChild(canvas)
// var imgUri = canvas.toDataURL();
// console.log(imgUri);
// });
// }
</script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=FdGp9hXQHaWCaXy6wohRZFWZFjQP791a"></script>
<script type="text/javascript">
var map = new BMap.Map("allmap");
var point = new BMap.Point(116.331398, 39.897445);
map.centerAndZoom(point, 12);
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
var mk = new BMap.Marker(r.point);
map.addOverlay(mk);
map.panTo(r.point);
console.log('您的位置:' + (r.point.lng).toFixed(5) + ',' + r.point.lat);
document.querySelector(".jingdu").innerHTML = (r.point.lng).toFixed(3);
document.querySelector(".weidu").innerHTML = (r.point.lat).toFixed(3);
} else {
console.log('failed' + this.getStatus());
}
});
</script>
</body>
</html>