<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title>潜江晃晃</title>
<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,minimal-ui">
复制代码
//判断是否下载app及安卓和ios手机
(function(){
var ua = navigator.userAgent.toLowerCase();
var t;
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
var config = {
/*scheme:必须*/
// scheme_IOS: 'https://itunes.apple.com/app/id1190178341',
// scheme_Adr: 'http://47.104.1.9/apk/MJ_3_20.apk',
download_url: document.getElementById('J-download-ios').value,
timeout: 600
};
}else{
var config = {
/*scheme:必须*/
// scheme_IOS: 'https://itunes.apple.com/app/id1190178341',
// scheme_Adr: 'http://47.104.1.9/apk/MJ26.apk',
download_url: document.getElementById('J-download-and').value,
timeout: 600
};
}
function openclient() {
var startTime = Date.now();
var ifr = document.createElement('iframe');
ifr.src = ua.indexOf('os') > 0 ? config.scheme_IOS : config.scheme_Adr;
ifr.style.display = 'none';
document.body.appendChild(ifr);
var t = setTimeout(function() {
var endTime = Date.now();
if (!startTime || endTime - startTime < config.timeout + 200) {
window.location = config.download_url;
} else {
}
}, config.timeout);
window.onblur = function() {
clearTimeout(t);
}
}
window.addEventListener("DOMContentLoaded", function(){
document.getElementById("J-call-app").addEventListener('click',openclient,false);
}, false);
//获取房间号
function UrlParameters(){
var urlIndex=window.location.href.indexOf("?");
if(urlIndex)
{
var parameters=window.location.href.substring(urlIndex+1);
if(parameters)
{
var arrayParam=parameters.split("&"); //参数数组
var index;var name;var value;
for(var i=0;i<arrayParam.length;i++)
{
index=arrayParam[i].indexOf("=");
name=arrayParam[i].substring(0,index);
value=arrayParam[i].substring(index+1);
this[name]=value;
}
}
}
}
//获取房间号打开app进入房间
function openApp() {
var isrefresh = getUrlParam('refresh'); // 获得refresh参数
if(isrefresh == 1) {
return
}
window.location.href = 'com.jhhhmj.mj://?TableKey=888888';
window.setTimeout(function () {
window.location.href += '&refresh=1' // 附加一个特殊参数,用来标识这次刷新不要再调用myapp:// 了
}, 500);
}
//判断是否是微信浏览器
$(document).ready(function(){
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
$('#and img').attr("src","/assets/bsgrid/images/ceshi/ios.png");
$("#and").show();
}else if (/(Android)/i.test(navigator.userAgent)) {
// alert(111)
$('#and img').attr("src","/assets/bsgrid/images/ceshi/and.png");
$("#and").show();
} else {
$('#and img').attr("src","/assets/bsgrid/images/ceshi/and.png");
$("#and").show();
}
}
var urlParams=new UrlParameters();
if(typeof urlParams!="undefined"&&typeof urlParams.TableKey!="undefined"&&urlParams.TableKey!=0){
window.location.href = 'com.jhhhmj.mj://?TableKey='+urlParams.TableKey;
//window.location.href = 'gahhmajiang://TableKey=888888';
}
var browser = {
versions: function () {
var u = navigator.userAgent, app = navigator.appVersion;
return {
trident: u.indexOf('Trident') > -1, //IE内核
presto: u.indexOf('Presto') > -1, //opera内核
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -1, //是否iPad
weixin: u.match(/MicroMessenger/i), //微信浏览器
webApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部
};
}(),
language: (navigator.browserLanguage || navigator.language).toLowerCase()
};
});
})()
复制代码