-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (82 loc) · 2.99 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PAPAGO</title>
<script src="js/bootstrap/js/Jquery.js"></script>
</head>
<body>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
.test {
height: 600px;
max-width: 600px;
font-size: 40px;
}
</style>
<div align="center">
<img src="img/bg.png" style="margin: 0 auto ">
<img src="PAPAGO.png">
<a id="imgId"><img src="img/btn.png"></a>
</div>
<script language="javascript">
$(function () {
$("#imgId").click(function () {
download();
});
});
function download() {
var cssText =
"#weixin-tip{position: fixed; left:0; top:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); width: 100%; height:100%; z-index: 100;} #weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}";
var u = navigator.userAgent;
console.log(u);
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { // 安卓手机
// 判断使用环境
if (is_weixin()) {
loadHtml();
loadStyleText(cssText);
} else {
window.location.href = "https://github.com/iOSDevLog/PAPAGO/releases/download/v1.0/PAPAGO_V1.0_release_202001161012.apk";
}
} else if (u.indexOf('iPhone') > -1 || u.indexOf('iPad') > -1) { // 苹果手机
window.location.href = "https://apps.apple.com/cn/app/papago-想拍/id1281929214?mt=8";
} else if (u.indexOf('Windows Phone') > -1) {
window.location.href = "https://github.com/iOSDevLog/PAPAGO/releases/download/v1.0/PAPAGO_V1.0_release_202001161012.apk";
}
}
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}
function loadHtml() {
var div = document.createElement('div');
div.id = 'weixin-tip';
div.innerHTML = '<p><img src="live_weixin.png" alt="请在微浏览器打开"/></p>';
document.body.appendChild(div);
}
function loadStyleText(cssText) {
var style = document.createElement('style');
style.rel = 'stylesheet';
style.type = 'text/css';
try {
style.appendChild(document.createTextNode(cssText));
} catch (e) {
style.styleSheet.cssText = cssText; //ie9以下
}
var head = document.getElementsByTagName("head")[0]; //head标签之间加上style样式
head.appendChild(style);
}
</script>
</body>
</html>