-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
163 lines (155 loc) · 5.49 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>朱望仔大战大反派</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html,
body {
-ms-touch-action: none;
background: #888888;
padding: 0;
border: 0;
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<div style="margin: auto; width: 100%; height: 100%;" class="egret-player" data-entry-class="Main" data-orientation="auto" data-scale-mode="fixedNarrow" data-frame-rate="30"
data-content-width="640" data-content-height="1136" data-show-paint-rect="false" data-multi-fingered="2" data-show-fps="false"
data-show-log="false" data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9" >
</div>
<script>
!(function () {
var url = window.location.href;
function parseQueryString(url) {
var arr;
var res = {};
//#符号之后的值称为hash,都不会加到request请求中去
url = url.split("#")[0];
//获取queryString 第一个?号后面的全是查询字符串
arr = url.split("?");
arr.shift();
var queryStr = arr.join("?");
//查询字符串为空直接返回 避免出现这样的返回值{"":""}
if (queryStr.trim().length == 0) {
return res;
}
//获取参数
arr = queryStr.split("&");
for (var i = 0; i < arr.length; i++) {
var itemArr = arr[i].split("=");
//第一个=号之前的是name 后面的全是值
var name = itemArr.shift();
var value = itemArr.join("=");
res[name] = value;
}
return res;
}
try {
var playerInfo = JSON.parse(
parseQueryString(window.decodeURIComponent(url)).user
);
} catch (e) {
playerInfo = {};
}
// 以下解决分享问题
// 有参数的地址获取到了信息
// if (playerInfo && playerInfo.openid) {
// // 存储到 localstorage
// window.localStorage.setItem("PlayerInfo", JSON.stringify(playerInfo));
// // 跳转到没参数的
// window.location.href = "https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341/";
// } else {
// // 没参数的,先判断 localstorage 是否有信息
// // 从localstorage获取信息
// var localInfo = window.localStorage.getItem("PlayerInfo");
// if (localInfo !== null) {
// // 解析数据
// localInfo = JSON.parse(localInfo);
// // 判断是否存在openid,不存在就跳去获取信息
// if (localInfo.openid) {
// // 从 localstorage 中获取用户信息
// // 有信息不跳转,赋值到全局
// window["PlayerInfo"] = localInfo;
// } else {
// // 官方服务号跳转地址,不存在获取信息时
// window.location.href = "https://xwfintech.qingke.io/wxapi/connect/oauth2/authorize?redirect_uri=https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341&scope=snsapi_userinfo";
// }
// } else {
// // 官方服务号跳转地址,不存在获取信息时
// window.location.href = "https://xwfintech.qingke.io/wxapi/connect/oauth2/authorize?redirect_uri=https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341&scope=snsapi_userinfo";
// }
// }
})(window);
var loadScript = function (list, callback) {
var loaded = 0;
var loadNext = function () {
loadSingleScript(list[loaded], function () {
loaded++;
if (loaded >= list.length) {
callback();
} else {
loadNext();
}
});
};
loadNext();
};
var loadSingleScript = function (src, callback) {
var s = document.createElement("script");
s.async = false;
s.src = src;
s.addEventListener(
"load",
function () {
s.parentNode.removeChild(s);
s.removeEventListener("load", arguments.callee, false);
callback();
},
false
);
document.body.appendChild(s);
};
var xhr = new XMLHttpRequest();
xhr.open("GET", "./manifest.json?v=" + Math.random(), true);
xhr.addEventListener("load", function () {
var manifest = JSON.parse(xhr.response);
var list = manifest.initial.concat(manifest.game);
loadScript(list, function () {
/**
* {
* "renderMode":, //Engine rendering mode, "canvas" or "webgl"
* "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
* "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
* "calculateCanvasScaleFactor": //a function return canvas scale factor
* }
**/
egret.runEgret({
renderMode: "webgl",
audioType: 2,
calculateCanvasScaleFactor: function (context) {
var backingStore =
context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio ||
1;
return (window.devicePixelRatio || 1) / backingStore;
},
});
});
});
xhr.send(null);
</script>
</body>
</html>