pay.js
684 Bytes
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
/**
* 支付页面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/03
*/
function isWXOpen() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
return true;
} else {
return false;
}
}
function hideWeChatPay() {
var payApps = document.getElementsByClassName('app');
[].forEach.call(payApps, function(app, index) {
if (app.innerHTML.indexOf('微信') !== -1) {
app.parentNode.style.display = 'none';
return false;
}
});
}
function handleForWX() {
if (!isWXOpen()) {
hideWeChatPay();
}
}
window.onload = handleForWX;