pay.js 684 Bytes
/**
 * 支付页面
 * @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;