var _themeColor = "#226204"; //站点主题色
var _leagueIcon = "/images/leagueicon.png";
var _teamIcon = "/images/teamicon.png";
var _playerIcon = "/images/playericon.png";
function _$(id) {
return document.getElementById(id);
}
function MM_showHideLayers() { //v6.0
// if (window.ActiveXObject) {
var i, p, v, obj, args = MM_showHideLayers.arguments;
for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
v = args[i + 2];
if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v; }
obj.visibility = v;
}
}
function MM_findObj(n, d) { //v4.01
var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n); return x;
}
function getElementPos(elementId, elem) {
var ua = navigator.userAgent.toLowerCase();
var isOpera = (ua.indexOf('opera') != -1);
var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof
var el = document.getElementById(elementId);
if (elem) el = elem;
if (el.parentNode === null || el.style.display == 'none') {
return false;
}
var parent = null;
var pos = [];
var box;
if (el.getBoundingClientRect) //IE
{
box = el.getBoundingClientRect();
var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
return { x: box.left + scrollLeft, y: box.top + scrollTop };
} else if (document.getBoxObjectFor) // gecko
{
box = document.getBoxObjectFor(el);
var borderLeft = (el.style.borderLeftWidth) ? parseInt(el.style.borderLeftWidth) : 0;
var borderTop = (el.style.borderTopWidth) ? parseInt(el.style.borderTopWidth) : 0;
pos = [box.x - borderLeft, box.y - borderTop];
} else // safari & opera
{
pos = [el.offsetLeft, el.offsetTop];
parent = el.offsetParent;
if (parent != el) {
while (parent) {
pos[0] += parent.offsetLeft;
pos[1] += parent.offsetTop;
parent = parent.offsetParent;
}
}
if (ua.indexOf('opera') != -1 || (ua.indexOf('safari') != -1 && el.style.position == 'absolute')) {
pos[0] -= document.body.offsetLeft;
pos[1] -= document.body.offsetTop;
}
}
if (el.parentNode) {
parent = el.parentNode;
} else {
parent = null;
}
while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') { // account for any scrolled ancestors
pos[0] -= parent.scrollLeft;
pos[1] -= parent.scrollTop;
if (parent.parentNode) {
parent = parent.parentNode;
} else {
parent = null;
}
}
return { x: pos[0], y: pos[1] };
}
String.prototype.format = function () {
var args = arguments;
return this.replace(
/\{([\d]+)\}/g,
function ($1, $2) {
return args[$2];
}
);
};
function timeToText(t2, type) {
type = type || 0;
var fmts = [
"dd-MM-yyyy hh:mm",/*0*/
"dd-MM-yyyy",/*1*/
"dd-MM",/*2*/
"hh:mm",/*3*/
"t2 dd",/*4*/
"dd-MM hh:mm",/*5*/
"dd-MM-yy",/*6*/
"yyyy",/*7*/
"t2.dd",/*8*/
"dd-MM,yyyy hh:mm"/*9*/,
"dd-MM-yyyy hh:mm",/*10*/
"dd-MM
hh:mm",/*11*/
];
return dateFtt(fmts[type] || fmts[0], t2);
}
function dateToTime(time) {
var tReg = /(\d{4})-(\d{1,2})-(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[3] + "-" + arr[2] + "-" + arr[1] + arr[4];
}
tReg = /(\d{4})\/(\d{1,2})\/(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[3] + "-" + arr[2] + "-" + arr[1] + arr[4];
}
tReg = /^(\d{1,2})-(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[2] + "-" + arr[1] + arr[3];
}
return time;
}
function utTeam(id, s) {
//en/team/summary
//en/team/teamsche
return '/team/{0}/{1}'.format((s ? 'teamsche' : 'summary'), id);
}
function utLea(id) {
return '/leagueinfo/{0}'.format(id);
}
function extend(org, ex, b) {
//b: 0: replace org prop, 1: not replace org prop
if (org && ex) {
for (var k in ex) {
if (!b || !org.hasOwnProperty(k)) {
org[k] = ex[k];
}
}
}
return org;
}
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return unescape(arr[2]);
return null;
}
function writeCookie(name, value, expireVal) {
if (_moduleKey == "ind" || _moduleKey == "bola") {
writeShareCookie(name, value, expireVal);
return;
}
var expire = expireVal;
var hours = 365;
if (expire == undefined)
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = ";path=/;expires=" + expire.toGMTString();
document.cookie = name + "=" + escape(value) + expire;
}
function getDoMain() {
var arrDoms = location.href.split("/")[2].split(".");
var isNum = /^\d+$/;
if (isNum.test(arrDoms[1]))
return arrDoms[0] + "." + arrDoms[1] + "." + arrDoms[2] + "." + arrDoms[3].split(":")[0];
else
return arrDoms[1] + "." + arrDoms[2];
}
//写跨子域cookie
function writeShareCookie(name, value, expireVal) {
var expire = expireVal;
var hours = 365;
if (expire == undefined)
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = ";path=/;expires=" + expire.toGMTString() + ";domain=" + getDoMain();
document.cookie = name + "=" + escape(value) + expire;
}
//内存cookie,周期为浏览器关闭前
function WriteTmpCookie(name, value) {
document.cookie = name + "=" + escape(value) + ";path=/;expires=-1";
}
function WriteSession(name, value) {
window.sessionStorage.setItem(name, value);
}
function GetSession(name) {
return window.sessionStorage.getItem(name)
}
var FloatHelper = {
DecimalLength: function (num) { //The length of the decimal
var eSplit = num.toString().split(/[eE]/);
var len = (eSplit[0].split('.')[1] || '').length - Number(eSplit[1] || 0);
return len > 0 ? len : 0;
},
Operator: function (arg1, arg2, sign) {//sign:1 is subtraction, 2 is multiplication, 3 is division, others are addition
var r1 = this.DecimalLength(arg1), r2 = this.DecimalLength(arg2);
var n = Math.max(r1, r2);
var m = Math.pow(10, n);
switch (sign) {
case "*": case 2: n = r1 + r2, rv = ((arg1 * Math.pow(10, r1)) * (arg2 * Math.pow(10, r2))) / Math.pow(10, n); break;
case "/": case 3:
if (n < 3) n = 3;
rv = (arg1 * m) / (arg2 * m);
break;
case "%": case 4: rv = ((arg1 * m) % (arg2 * m)) / m; break;
case "-": case 1: rv = (arg1 * m - arg2 * m) / m; break;
default: rv = (arg1 * m + arg2 * m) / m; break;//"+"
}
return parseFloat(rv.toFixed(n));
}
}
var oTool = {
USJson: { 0.22: -450, 0.28: -350, 0.33: -300, 0.36: -275, 0.38: -267, 0.44: -225, 0.47: -212.5, 0.53: -187.5, 0.57: -175, 0.62: -162.5, 0.63: -160, 0.66: -150, 0.72: -137.5, 0.83: -120, 0.88: -114, 0.91: -110, 0.95: -105 },
fractionJson: { 0.22: "2/9", 0.28: "2/7", 0.33: "1/3", 0.36: "4/11", 0.38: "3/8", 0.44: "4/9", 0.47: "40/85", 0.53: "8/15", 0.57: "4/7", 0.62: "8/13", 0.63: "5/8", 0.66: "4/6", 0.72: "8/11", 0.83: "5/6", 0.88: "7/8", 0.91: "10/11", 0.95: "20/21" },
getPL: function (ot, hVal, pVal, gVal, isEu) {
if (isEu && ot != 3 && ot != '3' && ot != 6 && ot != '6') return [this.toFixZero(hVal), this.toFixZero(pVal), this.toFixZero(gVal)];
switch (ot) {
case 1: case '1'://HK
return [hVal, pVal, gVal];
break;
case 2: case '2'://Ind
if (isEu) return [hVal, pVal, gVal];
return [this.toIN(hVal), pVal, this.toIN(gVal)];
break;
case 3: case '3'://US
if (isEu) return [this.toUSEu(hVal), this.toUSEu(pVal), this.toUSEu(gVal)];
return [this.toUS(hVal), pVal, this.toUS(gVal)];
break;
case 4: case '4'://Europe
return [this.toEU(hVal), pVal, this.toEU(gVal)];
break;
case 5: case '5'://ML
if (isEu) return [hVal, pVal, gVal];
return [this.toML(hVal), pVal, this.toML(gVal)];
break;
case 6: case '6'://Fraciton
if (isEu) return [this.toFractionEu(hVal), this.toFractionEu(pVal), this.toFractionEu(gVal)];
return [this.toFraction(hVal), pVal, this.toFraction(gVal)];
break;
}
},
changePL: function (ot, val, isEu) {
if (!parseFloat(val)) return val;
if (isEu && ot != 3 && ot != '3' && ot != 6 && ot != '6') return this.toFixZero(val);
switch (ot) {
case 1: case '1'://HK
return this.toFixZero(val);
break;
case 2: case '2'://Ind
return this.toIN(val);
break;
case 3: case '3'://US
if (isEu) return this.toUSEu(val);
return this.toUS(val);
break;
case 4: case '4'://Europe
return this.toEU(val);
break;
case 5: case '5'://ML
return this.toML(val);
break;
case 6: case '6'://Fraciton
if (isEu) return this.toFractionEu(val);
return this.toFraction(val);
break;
}
},
toIN: function (val) {
if (!val) return "";
var fVal = parseFloat(val);
var p = this.countDecimal(fVal) > 2 ? 3 : 2;
return (fVal < 1) ? (0 - 1 / fVal).toFixed(p) : this.toFixZero(val);
},
toML: function (val) {
if (!val) return "";
var fVal = parseFloat(val);
var p = this.countDecimal(fVal) > 2 ? 3 : 2;
return (fVal > 1) ? (0 - 1 / fVal).toFixed(p) : this.toFixZero(val);
},
toEU: function (val) {
if (!val) return "";
var fVal = parseFloat(val);
var p = this.countDecimal(fVal) > 2 ? 3 : 2;
return (fVal + 1).toFixed(p);
},
toUS: function (val) {
if (!val) return "";
var fVal = parseFloat(val);
var p = this.countDecimal(fVal) > 2 ? 3 : 2;
var oJson = oTool.USJson;
if (fVal in oJson)
return oJson[fVal];
var res = 0;
if (fVal <= 0)
res = 0;
else if (fVal < 1)
res = Math.round(0 - 100 * ((1 / fVal).toFixed(p)));
else
res = Math.round(100 * fVal);
return res > 0 ? "+" + res : res;
},
toUSEu: function (val) {
if (!val) return "";
var fVal = parseFloat(val);
var p = this.countDecimal(fVal) > 2 ? 3 : 2;
if (!fVal || isNaN(fVal)) return "";
fVal = FloatHelper.Operator(fVal, 1, "-");
var oJson = oTool.USJson;
if (fVal in oJson)
return oJson[fVal];
if (fVal == 0) return "0";
var res = 0;
if (fVal < 1)
res = Math.round(0 - 100 * ((1 / fVal).toFixed(p)));
else
res = Math.round(100 * fVal);
return res > 0 ? "+" + res : res;
},
toFraction: function (val) {//Fractional conversion
var fVal = parseFloat(val);
if (fVal.toString() == "NaN") return "";
var f = fVal < 0;
if (f) fVal = Math.abs(fVal);
var fra = { n: 0, m: 1 };//n/m
var num = 0;
if (fVal > 1)
fVal = FloatHelper.Operator(fVal, num = fVal | 0, "-");
var oJson = oTool.fractionJson;
if (fVal in oJson) {
var arr = oJson[fVal].split("/");
fra.n = parseInt(arr[0]);
fra.m = parseInt(arr[1]);
}
else if (fVal > 0) {
var GCD = function (a, b) { return b == 0 ? a : GCD(b, a % b); }//Greatest Common Divisor
var m = Math.pow(10, FloatHelper.DecimalLength(fVal));
var n = parseInt(fVal * m);
var d = GCD(m, n);
fra.n = n / d;
fra.m = m / d;
}
return (f ? "-" : "") + (num * fra.m + fra.n) + "/" + fra.m;
},
toFractionEu: function (val) {//Fractional conversion
var fVal = parseFloat(val);
if (fVal.toString() == "NaN") return "";
fVal = FloatHelper.Operator(fVal, 1, "-");
var f = fVal < 0;
if (f) fVal = Math.abs(fVal);
var fra = { n: 0, m: 1 };//n/m
var num = 0;
if (fVal > 1)
fVal = FloatHelper.Operator(fVal, num = fVal | 0, "-");
var oJson = oTool.fractionJson;
if (fVal in oJson) {
var arr = oJson[fVal].split("/");
fra.n = parseInt(arr[0]);
fra.m = parseInt(arr[1]);
}
else if (fVal > 0) {
var GCD = function (a, b) { return b == 0 ? a : GCD(b, a % b); }//Greatest Common Divisor
var m = Math.pow(10, FloatHelper.DecimalLength(fVal));
var n = parseInt(fVal * m);
var d = GCD(m, n);
fra.n = n / d;
fra.m = m / d;
}
return (f ? "-" : "") + (num * fra.m + fra.n) + "/" + fra.m;
},
toFixZero: function (val, num) {
if (!num) {
num = this.countDecimal(val) > 2 ? 3 : 2;
}
var fVal = parseFloat(val);
if (fVal.toString() == "NaN") return val;
return fVal.toFixed(num)
},
countDecimal: function (num) {
var match = ('' + num).match(/\.(\d+)$/);
if (match === null) {
return 0;
}
return match[1].length;
}
};
//不影响原来的onload情况下添加新的事件
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function () {
oldonload();
func();
}
}
}
//暗黑模式相关
function LoadDark() {
var dark = getCookie("dark_mode") == null ? dark_mode : getCookie("dark_mode");
if (document.getElementsByTagName("body").length > 0) {
if (dark != null && dark == 1) {
document.getElementsByTagName("body")[0].classList.add("dark");
} else {
document.getElementsByTagName("body")[0].classList.remove("dark");
}
} else {
addLoadEvent(LoadDark);
}
}
var dark_mode = getQueryVariable("darkmode") != false ? getQueryVariable("darkmode") : 0;
function SwithcDark() {
if (document.getElementById("DarkModeCheck").checked) {
dark_mode = 1;
writeShareCookie("dark_mode", 1);
}
else {
dark_mode = 0;
writeShareCookie("dark_mode", 0);
}
LoadDark();
}
function SyncDarkCheck() {
var dark = getCookie("dark_mode");
if (dark != null && dark == 1) {
if (document.getElementById("DarkModeCheck")) document.getElementById("DarkModeCheck").checked = true;
}
if (document.getElementById("DarkModeCheck")) document.getElementById("DarkModeCheck").style.display = "";
}
function OpenMobile() {
window.open(_touchWebDomain);
}
function OpenFreeApp() {
window.open(_appWebDomain);
}
//获取URL参数
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) { return pair[1]; }
}
return (false);
}
//登陆相关
var ssoAvataUrl = "/sso/ssologinpcjs/";
function GetAvatar(ssoHost) {
addScript(document.head, ssoHost + ssoAvataUrl);
}
function LoginSuccess() {
RefreshIcon();
}
function RefreshIcon() {
if (window.ssoContent) {
if (document.getElementById('login_icon')) document.getElementById('login_icon').innerHTML = ssoContent;
}
}
function addScript(container, url) {
var s = document.createElement("script");
s.src = url;
container.appendChild(s, "script");
}
function changeGif(url) {
return url;
}
//#region 头部赔率、时区下拉选择框相关
var _defaultOddsType = _config.defaultOddsFormat || 4;
var _defaultTimeZone = 0 - ((new Date()).getTimezoneOffset()) / 60;
function SetOddType(type) {
writeShareCookie("Odds_Type", type);
}
function GetOddType() {
var detault = _defaultOddsType;//默认是赔率类型
var oddsType = getCookie("Odds_Type");
if (!oddsType != null && oddsType != "" && oddsType != undefined && !isNaN(oddsType)) detault = parseInt(oddsType);
return detault;
}
function SetTimeZone(value) {
writeShareCookie("Time_Zone", value);
}
function GetTimeZone() {
var detault = _defaultTimeZone;//默认是时区
var value = getCookie("Time_Zone");
if (value != null && value != "" && value != undefined && !isNaN(value)) detault = parseFloat(value);
return detault;
}
var _oddsType = GetOddType();//赔率类型
var _timeZone = GetTimeZone();//时区
function changeTopOddsType(value) {
if (_oddsType != value) {
document.getElementById('selectedOddsType').innerText = document.getElementById('oddsType_' + value).innerText;
_oddsType = parseInt(value);
SetOddType(value);
changeOddsType();
}
}
//具体的界面需特殊处理则去写个同名方法覆盖
function changeOddsType(value) {
var oddsData = document.getElementsByName("oddsData");
for (var i = 0; i < oddsData.length; i++) {
var o = oddsData[i];
var oData = o.getAttribute("data-o");
if (!oData) continue;
o.innerText = oTool.changePL(_oddsType, oData);
}
}
//显示隐藏时区下拉
function showHideTimeZone(o) {
var timeZone = document.getElementById('ddlTimeZone');
var isHide = timeZone.style.display == "none";
if (isHide) {
document.getElementById('chooseOddsType').className = "Choose-tool";
document.getElementById('ddlOddsType').style.display = "none";
o.className = "Choose-tool on";
timeZone.style.display = "";
}
else {
o.className = "Choose-tool";
timeZone.style.display = "none";
}
}
//显示隐藏赔率下拉
function showHideOddsType(o) {
var oddsType = document.getElementById('ddlOddsType');
var isHide = oddsType.style.display == "none";
if (isHide) {
document.getElementById('chooseTimeZone').className = "Choose-tool";
document.getElementById('ddlTimeZone').style.display = "none";
o.className = "Choose-tool on";
oddsType.style.display = "";
}
else {
o.className = "Choose-tool";
oddsType.style.display = "none";
}
}
//显示隐藏切换网站下拉
function showHideLangueWebSite(o) {
var webSite = document.getElementById('ddlBolaWebSite');
var isHide = webSite.style.display == "none";
if (isHide) {
document.getElementById('chooseTimeZone').className = "Choose-tool";
document.getElementById('ddlTimeZone').style.display = "none";
document.getElementById('chooseOddsType').className = "Choose-tool";
document.getElementById('ddlOddsType').style.display = "none";
if (document.getElementById('chooseBolaWebSite')) {
document.getElementById('chooseBolaWebSite').className = "Choose-tool";
document.getElementById('ddlBolaWebSite').style.display = "none";
}
o.className = "Choose-tool on";
webSite.style.display = "";
}
else {
o.className = "Choose-tool";
webSite.style.display = "none";
}
}
function GotoLangueWebSite(langValInt, domain, returnUrl) {
writeShareCookie("bolaValInt", langValInt);
window.location.href = domain + returnUrl;
}
document.onclick = checkHide;
function checkHide(e) {
var oddsType = document.getElementById('selectedOddsType');
var timeZone = document.getElementById('selectedTimeZone');
var website = document.getElementById("selectedBolaWebSite");
var websiteImg = document.getElementById("countryImg");
var ddlOddsType = document.getElementById('ddlOddsType');
var ddlTimeZone = document.getElementById('ddlTimeZone');
var ddlWebSite = document.getElementById("ddlBolaWebSite");
var chooseOddsType = document.getElementById('chooseOddsType');
var chooseTimeZone = document.getElementById('chooseTimeZone');
var chooseWebSite = document.getElementById("chooseBolaWebSite");
var otIsHide = ddlOddsType.style.display == "none";
var tzIsHide = ddlTimeZone.style.display == "none";
var wbIsHide = ddlWebSite != null ? ddlWebSite.style.display == "none" : "";
if (otIsHide && tzIsHide && wbIsHide) return;
var src = e.srcElement;
if (src == oddsType || src == timeZone || src == website || src == websiteImg || src == chooseOddsType || src == chooseTimeZone || src == chooseOddsType || src == chooseWebSite || src && src.tagName == "I") return;
if (ddlOddsType) ddlOddsType.style.display = "none";
if (ddlTimeZone) ddlTimeZone.style.display = "none";
if (ddlWebSite) ddlWebSite.style.display = "none";
if (chooseOddsType) chooseOddsType.className = "Choose-tool";
if (chooseTimeZone) chooseTimeZone.className = "Choose-tool";
if (chooseWebSite) chooseWebSite.className = "Choose-tool";
}
function changeTopTimeZone(value) {
if (_timeZone !== value || document.getElementById('selectedTimeZone').innerText == document.getElementById("timeZone_auto").innerText) {
var isAuto = (value === ''); //是否自动获取
if (isAuto) {
SetTimeZone(''); //自动获取先设null,防止取到上次选择的时区
value = GetTimeZone();
}
var elem = isAuto ? 'timeZone_auto' : 'timeZone_' + value;
document.getElementById('selectedTimeZone').innerText = document.getElementById(elem).innerText;
_timeZone = parseFloat(value);
if (!isAuto) SetTimeZone(value);
changeTimeZone();
}
}
//具体的界面需特殊处理则去写个同名方法覆盖
function changeTimeZone(value) {
var timeData = document.getElementsByName("timeData");
for (var i = 0; i < timeData.length; i++) {
var t = timeData[i];
var tData = t.getAttribute("data-t");
if (!tData) continue;
var timeFormat = t.getAttribute("data-tf");
if (!timeFormat) timeFormat = "0";
t.innerHTML = timeToText(timeFromE8(tData), timeFormat);
}
if (document.getElementById("lastUpdateTime") && lastUpdateTime && typeof (lastUpdateTime) == "string") {
document.getElementById("lastUpdateTime").innerHTML = _locModel.T.T_LastUpdate + timeToText(timeFromE8(lastUpdateTime));
}
}
//#endregion 头部赔率、时区下拉选择框相关
function handleBackFromBf2(url) {
var backUrl = location.href;
location.href = url + "?returnurl=" + backUrl;
}
function returnTop() {
var top = getTopHeight();
var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; //滚动条总高度
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; //可视区域高度
var bottom = scrollHeight - top - windowHeight; //滚动条距底部距离
var rt = document.getElementById("backTop");
var rb = document.getElementById("toBottom");
if (top > 150) {
rt.style.display = "";
}
else rt.style.display = "none";
if (bottom == 0 && rb) {
rb.style.display = "none";
}
else if (rb) rb.style.display = "";
setTimeout("returnTop();", 100);
}
//TODO:做到配置文件
var _handicapTypeArray = ["/-", "+/-", "/*", "让/受让"];
var _handicapType = 1;
var _handicapAccept = "-";
var _handicapGive = "";
var _ouTrimEndZero = true;
function SetHandicapType(type) {
writeShareCookie("Handicap_Type", type);
}
function GetHandicapType() {
var detault = 1;
var handicapType = getCookie("Handicap_Type");
if (handicapType) detault = parseInt(handicapType);
return detault;
}
function initHandicap() {
_handicapType = GetHandicapType();
if (_handicapType <= _handicapTypeArray.length) {
_handicapGive = _handicapTypeArray[_handicapType - 1].split('/')[0];
_handicapAccept = _handicapTypeArray[_handicapType - 1].split('/')[1];
}
}
//加载弹窗定时器
function loadTimeout() {
this.index = "";
this.index2 = "";
this.start = function () {
this.index = window.setTimeout(() => document.getElementById("loading").textContent = _locModel.T.T_Tip_Reload, 10000);
this.index2 = window.setTimeout(() => {
document.getElementById("loading").style.display = 'none';
document.getElementById("delayShow").style.display = '';
}, 13000);
}
this.end = function () {
window.clearTimeout(this.index);
window.clearTimeout(this.index2);
document.getElementById("loading").style.display = 'none';
document.getElementById("delayShow").style.display = '';
}
}
var _loadTip = new loadTimeout();
initHandicap();
var _share = {
facebook: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://www.facebook.com/sharer.php?u=" + encodeURIComponent(u) + "&t=" + encodeURIComponent(t));
},
twitter: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://twitter.com/share/?text=" + encodeURIComponent(t) + "&url=" + _share.encodeUrlWithUnicode(u));
},
telegram: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://t.me/share/url?url=" + _share.encodeUrlWithUnicode(u) + "&text=" + encodeURIComponent(t));
},
encodeUrlWithUnicode: function (u) {
var reg = /([\u0100-\uFFFF]+)/g;
var sp = u.split(reg);
var url = "";
for (var i = 0; i < sp.length; i++) {
if (reg.test(sp[i]))
url += encodeURIComponent(encodeURIComponent(sp[i]));
else
url += encodeURIComponent(sp[i]);
}
return url;
},
};
var _share = {
facebook: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://www.facebook.com/sharer.php?u=" + encodeURIComponent(u) + "&t=" + encodeURIComponent(t));
},
twitter: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://twitter.com/share/?text=" + encodeURIComponent(t) + "&url=" + _share.encodeUrlWithUnicode(u));
},
telegram: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://t.me/share/url?url=" + _share.encodeUrlWithUnicode(u) + "&text=" + encodeURIComponent(t));
},
blogger: function (url, title) {
var u = url || location.href;
var t = title || "";
window.open("https://share.naver.com/web/shareView.nhn?url=" + encodeURIComponent(u) + "&title=" + encodeURIComponent(_share.trim(title, location.host)));
},
encodeUrlWithUnicode: function (u) {
var reg = /([\u0100-\uFFFF]+)/g;
var sp = u.split(reg);
var url = "";
for (var i = 0; i < sp.length; i++) {
if (reg.test(sp[i]))
url += encodeURIComponent(encodeURIComponent(sp[i]));
else
url += encodeURIComponent(sp[i]);
}
return url;
},
trim: function (str) {
var defaultVal = arguments[arguments.length - 1];
if (!str)
return defaultVal;
return str.replace(/^\s+|\s+$/gm, '') || defaultVal;
}
};
//比分站赔率内页
function openOddsComp(sId) {
var url = _livescoreWebDomain + "oddscomp/" + sId;
if (typeof (selectCompanyId) != "undefined")
url += "?cid=" + selectCompanyId;
window.open(url);
}
//比分站3in1内页
function open3in1Odds(sId) {
var url = _livescoreWebDomain + "oddscomp/" + sId;
if (typeof (selectCompanyId) != "undefined") {
url += "?cid=" + selectCompanyId;
}
url += "#3in1OddsDiv";
window.open(url);
}
//翻译转换
function translatePhase(lcStr) {
return lcStr;
}
//替换单引号为中文单引号,防止部分带单引号数据引起js异常
function escapeChar(str) {
//str = str.replace(/\'/g, "\\\'");
str = str.replace(/\'/g, "´");
return str;
}
var soccerInPage = {
isSummary: function (id, home, guest, isSelf) {
if (typeof (checkInpageVersion) == "function" && checkInpageVersion(id, home, guest, isSelf) == 1) {
return true;
}
return false;
},
analysis: function (id, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
window.open(_livescoreWebDomain + "match/h2h-" + id);
}
},
detail: function (id, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
window.open(_livescoreWebDomain + "match/live-" + id);
}
},
oddscomp: function (id, cid, half, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
var url = "oddscomp/" + id;
if (cid)
url += "?cid=" + cid;
window.open(_livescoreWebDomain + url);
}
},
}
//收藏联赛
function favLeague(id) {
var favLeague = Config.getFavLeagueIds();
var index = favLeague.indexOf(id.toString());
if ($("#favLeagueIcon").hasClass("on")) {
if (index != -1) {
favLeague.splice(index, 1);
Config.setFavLeagueIds(favLeague);
}
$("#favLeagueIcon").removeClass("on");
$("#favLeagueIcon").html(_locModel.T.T_Btn_Follow + "");
} else {
if (index == -1) {
favLeague.push(id.toString());
Config.setFavLeagueIds(favLeague);
}
$("#favLeagueIcon").addClass("on");
$("#favLeagueIcon").html(_locModel.T.T_Btn_Following + "");
}
}
//收藏球队
function favTeam(id) {
var favTeam = Config.getFavTeamIds();
var index = favTeam.indexOf(id.toString());
if ($("#favTeamIcon").hasClass("on")) {
if (index != -1) {
favTeam.splice(index, 1);
Config.setFavTeamIds(favTeam);
}
$("#favTeamIcon").removeClass("on");
$("#favTeamIcon").html(_locModel.T.T_Btn_Follow + "");
} else {
if (index == -1) {
favTeam.push(id.toString());
Config.setFavTeamIds(favTeam);
}
$("#favTeamIcon").addClass("on");
$("#favTeamIcon").html(_locModel.T.T_Btn_Following + "");
}
}
//更新近期赛程包含收藏赛事数量标识
var _counFavMatchTimmer = null;
function countFavMatch() {
if (_$("favCount")) {
$.ajax({
url: "/ajax/favmatchcountajax",
method: "post",
data: {
mIds: Config.getFavMatchIds().join(","),
tIds: Config.getFavTeamIds().join(",")
},
success(res) {
var count = parseInt(res);
if (count == 0) {
$("#favCount").html("");
$("#favCount").removeClass("fav_count");
} else if (count > 99) {
$("#favCount").html("99+");
$("#favCount").addClass("fav_count");
} else {
$("#favCount").html(count);
$("#favCount").addClass("fav_count");
}
}
});
clearTimeout(_counFavMatchTimmer);
_counFavMatchTimmer = window.setTimeout("countFavMatch()", 30 * 1000);
}
}
function CheckEmpty(str) {
if (typeof (str) == 'undefined' || str == 'undefined' || !str || !/[^\s]/.test(str)) {
return true;
} else {
return false;
}
}
var GoalCn = ["0", "0/{0}0.5", "{0}0.5", "{0}0.5/1", "{0}1", "{0}1/1.5", "{0}1.5", "{0}1.5/2", "{0}2", "{0}2/2.5", "{0}2.5", "{0}2.5/3", "{0}3", "{0}3/3.5", "{0}3.5", "{0}3.5/4", "{0}4", "{0}4/4.5", "{0}4.5", "{0}4.5/5", "{0}5", "{0}5/5.5", "{0}5.5", "{0}5.5/6", "{0}6", "{0}6/6.5", "{0}6.5", "{0}6.5/7", "{0}7", "{0}7/7.5", "{0}7.5", "{0}7.5/8", "{0}8", "{0}8/8.5", "{0}8.5", "{0}8.5/9", "{0}9", "{0}9/9.5", "{0}9.5", "{0}9.5/10", "{0}10", "{0}10/10.5", "{0}10.5", "{0}10.5/11", "{0}11", "{0}11/11.5", "{0}11.5", "{0}11.5/12", "{0}12", "{0}12/12.5", "{0}12.5", "{0}12.5/13", "{0}13", "{0}13/13.5", "{0}13.5", "{0}13.5/14", "{0}14"];
var GoalCnOU = ["0", "0/0.5", "0.5", "0.5/1", "1", "1/1.5", "1.5", "1.5/2", "2", "2/2.5", "2.5", "2.5/3", "3", "3/3.5", "3.5", "3.5/4", "4", "4/4.5", "4.5", "4.5/5", "5", "5/5.5", "5.5", "5.5/6", "6", "6/6.5", "6.5", "6.5/7", "7", "7/7.5", "7.5", "7.5/8", "8", "8/8.5", "8.5", "8.5/9", "9", "9/9.5", "9.5", "9.5/10", "10", "10/10.5", "10.5", "10.5/11", "11", "11/11.5", "11.5", "11.5/12", "12", "12/12.5", "12.5", "12.5/13", "13", "13/13.5", "13.5", "13.5/14", "14"];
function Goal2GoalCn(goal) { //handicap conversion
if ((!goal && goal != "0") || isNaN(goal))
return "";
else {
if (goal > 14) return _handicapGive + Math.abs(goal);
if (goal < -14) return _handicapAccept + Math.abs(goal);
var i = Math.abs(parseInt(goal * 4));
if (goal >= 0) return GoalCn[i].replace("{0}", _handicapGive);
else return GoalCn[i].replace("{0}", _handicapAccept);
}
}
function Goal2CnOU(goal) { //ou conversion
if ((!goal && goal != "0") || isNaN(goal))
return "";
else {
if (goal > 14 || goal < -14) return _ouTrimEndZero ? parseFloat(goal).toString() : goal;
var newGoal = GoalCnOU[Math.abs(parseInt(goal * 4))];
return newGoal
}
}
function handicapToFloat(goal) {
if (goal == null || goal + "" == "")
return "";
var goals = goal.split("/");
if (goals.length == 1) {
return parseFloat(goal);
}
else {
return (parseFloat(goals[0]) + parseFloat(goals[1])) / 2;
}
}
LoadDark();
/*======================== 二站相关 Start ========================*/
function switchShowHide(id) {
if (_$(id)) {
var target = $("#" + id);
if (target.is(':hidden')) {
target.show();
}
else {
target.hide();
}
}
}
//头部足球联赛下拉框
function showFBLeagueDroplist(show, event) {
show = typeof (show) == "undefined" ? !$('#fb_league_plane').is(":visible") : show;
if (show) {
$('#fb_league_plane').slideDown('fast');
$('#ball1_Db').find('span:first').removeClass('icon-down');
$('#ball1_Db').find('span:first').addClass('icon-up');
} else {
$('#fb_league_plane').slideUp('fast');
$('#ball1_Db').find('span:first').removeClass('icon-up');
$('#ball1_Db').find('span:first').addClass('icon-down');
}
if (event && event.currentTarget.tagName == "SPAN") event.preventDefault();
}
//头部篮球联赛下拉框
function showLQLeagueDroplist(show, event) {
show = typeof (show) == "undefined" ? !$('#bk_league_plane').is(":visible") : show;
if (show) {
$('#bk_league_plane').slideDown('fast');
$('#ball2_Db').find('span:first').removeClass('icon-down');
$('#ball2_Db').find('span:first').addClass('icon-up');
} else {
$('#bk_league_plane').slideUp('fast');
$('#ball2_Db').find('span:first').removeClass('icon-up');
$('#ball2_Db').find('span:first').addClass('icon-down');
}
if (event && event.currentTarget.tagName == "SPAN") event.preventDefault();
}
/*======================== 二站相关 End ========================*/
;
function BomHelper() {
this.ie = "";
this.firefox = "";
this.chrome = "";
this.opera = "";
this.safari = "";
}
//检测浏览器版本,并保存
BomHelper.prototype.checkBrowerType = function () {
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? this.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? this.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? this.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? this.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? this.safari = s[1] : 0;
}
//获取ajax对象
BomHelper.prototype.ajaxObj = function () {
if (typeof XMLHttpRequest != "undefined") return new XMLHttpRequest();
var xmlHttp = null;
if (this.ie != "") {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (ex1) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex2) {
alert("创建ajax对象失败,本网站只支持ie6以上版本浏览器,请刷新页面重试");
}
}
} else {
try {
xmlHttp = new XMLHttpRequest();
} catch (ex3) {
alert("创建ajax对象失败,请刷新页面重试");
}
}
return xmlHttp;
}
//发送ajax的GET请求
BomHelper.prototype.ajaxGet = function (sUrl, fnAjax) {
var xmlHttp = this.ajaxObj();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4)
fnAjax(xmlHttp.responseText);
}
if (sUrl.indexOf("?") == -1)
sUrl = sUrl + "?flesh=" + Math.random();
else
sUrl = sUrl + "&flesh=" + Math.random();
xmlHttp.open("GET", sUrl, true);
xmlHttp.send(null);
}
//发送ajax的post请求
BomHelper.prototype.ajaxPost = function (sUrl, sPostData, fnAjax) {
var xmlHttp = this.ajaxObj();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4)
fnAjax(xmlHttp.responseText);
}
if (sPostData == "")
sPostData = sPostData + "flesh=" + Math.random();
else
sPostData = sPostData + "&flesh=" + Math.random();
xmlHttp.open("POST", sUrl, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(sPostData);
}
//若是IE7以上版本,则要求它使用IE7
BomHelper.prototype.useIE7 = function () {
document.write("");
}
BomHelper.prototype.SetAttributeClass = function (dom, className) {
if (bomHelper.ie != "" && parseFloat(bomHelper.ie) < 8)
dom.setAttribute("className", className);
else dom.setAttribute("class", className);
}
var bomHelper = new BomHelper();
bomHelper.checkBrowerType();
//JS去除空格
String.prototype.Trim = function () {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//
function Q(id) {
this.obj = document.getElementById(id);
}
Q.prototype.GetValue = function () {
return this.obj.value.Trim();
}
Q.prototype.SetValue = function (val) {
this.obj.value = val;
}
Q.prototype.GetSelectedValue = function () {
return this.obj.options[this.obj.selectedIndex].value;
}
Q.prototype.SetSelectedIndex = function (index) {
this.obj.options[index].selected = true;
}
Q.prototype.SetSelectedByVal = function (val) {
var len = this.obj.options.length;
for (var i = 0; i < len; i++) {
if (this.obj.options[i].value == val) {
this.SetSelectedIndex(i);
break;
}
}
}
Q.prototype.AddSelectItem = function (value, text) {
this.obj.options.add(new Option(text, value));
}
Q.prototype.RemoveItem = function (index) {
this.obj.options.remove(index);
}
Q.prototype.RemoveItemByVal = function (val) {
for (var i = 0; i < this.obj.options.length; i++) {
if (this.obj.options[i].value == val) {
this.obj.options.remove(i);
break;
}
}
}
Q.prototype.RemoveAllItems = function () {
for (var i = this.obj.options.length - 1; i >= 0; i--) {
this.obj.options.remove(i);
}
}
var zXml = {
useActiveX: (typeof ActiveXObject != "undefined"),
useXmlHttp: (typeof XMLHttpRequest != "undefined")
};
zXml.ARR_XMLHTTP_VERS = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
function zXmlHttp() { }
zXmlHttp.createRequest = function () {
if (zXml.useXmlHttp) return new XMLHttpRequest();
if (zXml.useActiveX) {
if (!zXml.XMLHTTP_VER) {
for (var i = 0; i < zXml.ARR_XMLHTTP_VERS.length; i++) {
try {
new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);
zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[i];
break;
} catch (oError) { }
}
}
if (zXml.XMLHTTP_VER) return new ActiveXObject(zXml.XMLHTTP_VER);
}
alert("Sorry,XML object unsupported by your computer,please setup XML object or change explorer.");
};
function buildTags(tpl, data) {
return tpl.replace(/>[\s\n\r]+<").replace(/\{\$(\w+)\}/g, function (a, b) {
return (b in data) ? data[b] : "";
});
};
/*
js操作css注意:关于位置的css必须必须要加上"px"这个像素单位
*/
function DomHelper() {
this.obj = null;
}
//获取该对象所有子节点的类型,
DomHelper.prototype.childNodesType = function (obj) {
var arrChildNodes = new Array();
var childNodes = obj.childNodes;
for (var i = 0; i < childNodes.length; i++) {
arrChildNodes[i] = childNodes[i].nodeType;
}
return arrChildNodes;
}
//根据节点类型和节点的属性获取该节点的引用
DomHelper.prototype.getElementByAttr = function (oParentNode, sNodeLable, sAttr) {
var oElements = oParentNode.getElementsByTagName(sNodeLable);
var sAttrName = sAttr.split(":")[0];
var sAttrValue = sAttr.split(":")[1];
var oElement = null;
for (var i = 0; i < oElements.length; i++) {
if (oElements[i].getAttribute(sAttrName) == sAttrValue) {
oElement = oElements[i];
break;
}
}
return oElement;
}
DomHelper.prototype.getElementsByAttr = function (oParentNode, sNodeLable, sAttr) {
var oElements = oParentNode.getElementsByTagName(sNodeLable);
var sAttrName = sAttr.split(":")[0];
var sAttrValue = sAttr.split(":")[1];
var arrElements = new Array();
for (var i = 0; i < oElements.length; i++) {
if (oElements[i].getAttribute(sAttrName) == sAttrValue) {
arrElements.push(oElements[i]);
}
}
return arrElements;
}
//添加事件
DomHelper.prototype.addEvent = function (obj, event, fnHandle) {
if (bomHelper.ie != "") {
obj.attachEvent("on" + event, fnHandle);
} else if (bomHelper.firefox != "" || bomHelper.chrome != "") {
obj.addEventListener(event, fnHandle, false);
} else {
obj["on" + event] = fnHandle;
}
}
//删除事件
DomHelper.prototype.delEvent = function (obj, event, fnHandle) {
if (bomHelper.ie != "") {
obj.detachEvent("on" + event, fnHandle);
} else if (bomHelper.firefox != "" || bomHelper.chrome != "") {
obj.removeEventListener(event, fnHandle, false);
} else {
obj["on" + event] = null;
}
}
//格式化事件
DomHelper.prototype.formatEvent = function (oEvent) {
if (bomHelper.ie != "") {
oEvent = window.event;
oEvent.charCode = (oEvent.type == "keypress") ? oEvent.keyCode : 0;
oEvent.phase = 2;
oEvent.isChar = (oEvent.charCode > 0);
oEvent.pageX = oEvent.clientX + document.body.scrollLeft;
oEvent.pageY = oEvent.clientY + document.body.scrollTop;
oEvent.preventDefault = function () {
this.returnValue = false;//阻止窗口的默认事件,如oncontextmenu来阻止鼠标右键
}
if (oEvent.type == "mouseout")
oEvent.relatedTarget = oEvent.toElement;
else if (oEvent.type == "mouseover")
oEvent.relatedTarget = oEvent.fromElement;
oEvent.stopPropagation = function () {
this.cancelBubble = true;//阻止冒泡事件
}
oEvent.target = oEvent.srcElement;
oEvent.time = (new Date()).getTime();
}
return oEvent;
}
//去除firefox、chrome等浏览器的无用文本节点
DomHelper.prototype.formatChildNode = function (oNode) {
if (bomHelper.ie != "") return;//若为IE则不执行下面的代码
var arrChildNodes = oNode.childNodes;
for (var i = arrChildNodes.length - 1; i >= 0; i--) {
if (arrChildNodes[i].nodeType == 3) {
oNode.removeChild(arrChildNodes[i]);
}
}
}
//获取某元素相对于body的坐标
DomHelper.prototype.getPosition = function (obj) {
var _o = obj;
var _left = "0px";
var _top = "0px";
var _width = "0px";
var _height = "0px";
_width = _o.offsetWidth;
_height = _o.offsetHeight;
_left = _o.offsetLeft;
_top = _o.offsetTop;
while (true) {
_o = _o.offsetParent;
if (_o == (document.body && null)) break;
_left += _o.offsetLeft;
_top += _o.offsetTop;
}
return { "left": _left, "top": _top, "width": _width, "height": _height };
}
var domHelper = new DomHelper();
function getTopHeight() {
var adTop = 0;
if (document.documentElement && document.documentElement.scrollTop)
adTop = document.documentElement.scrollTop;
else if (document.body)
adTop = document.body.scrollTop
else
adTop = window.pageYOffset;
return adTop;
}
//function returnTop(opt) {
// var top = getTopHeight();
// var rt = document.getElementById("returnTop");
// rt.style.position = "fixed";
// if (top > 150 && document.body.parentElement.offsetWidth > 1024 || opt) {
// rt.style.display = "";
// //rt.style.top = (700)+"px";
// rt.style.bottom = '10%';
// rt.style.left = (540 + document.body.parentElement.offsetWidth / 2) + "px";
// }
// else rt.style.display = "none";
// setTimeout("returnTop(" + (opt ? opt : "") + ");", 100);
//};
var _locModel = _locModel || { T: 0 };
var _months = new Array(
_locModel.T.T_January || "January",
_locModel.T.T_February || "February",
_locModel.T.T_March || "March",
_locModel.T.T_April || "April",
_locModel.T.T_May || "May",
_locModel.T.T_June || "June",
_locModel.T.T_July || "July",
_locModel.T.T_August || "August",
_locModel.T.T_September || "September",
_locModel.T.T_October || "October",
_locModel.T.T_November || "November",
_locModel.T.T_December || "December");
var _months2 = new Array(
_locModel.T.T_S_January || "Jan.",
_locModel.T.T_S_February || "Feb.",
_locModel.T.T_S_March || "Mar.",
_locModel.T.T_S_April || "Apr.",
_locModel.T.T_S_May || "May.",
_locModel.T.T_S_June || "Jun.",
_locModel.T.T_S_July || "Jul.",
_locModel.T.T_S_August || "Aug.",
_locModel.T.T_S_September || "Sep.",
_locModel.T.T_S_October || "Oct.",
_locModel.T.T_S_November || "Nov.",
_locModel.T.T_S_December || "Dec.");
var _weeks = new Array(_locModel.T.T_Sunday || "Sunday",
_locModel.T.T_Monday || "Monday",
_locModel.T.T_Tuesday || "Tuesday",
_locModel.T.T_Wednesday || "Wednesday",
_locModel.T.T_Thursday || "Thursday",
_locModel.T.T_Friday || "Friday",
_locModel.T.T_Saturday || "Saturday");
var _weeks2 = new Array(_locModel.T.T_S_Sunday || "Sun.",
_locModel.T.T_S_Monday || "Mon.",
_locModel.T.T_S_Tuesday || "Tue.",
_locModel.T.T_S_Wednesday || "Wed.",
_locModel.T.T_S_Thursday || "Thu.",
_locModel.T.T_S_Friday || "Fri.",
_locModel.T.T_S_Saturday || "Sat.");
function timeFromE8(s) {
var sps = s.split(/[\s-\:](\d+)[\s-\:]?/g);
var t1 = new Date(parseInt(sps[0]), parseInt(sps[1]) - 1, parseInt(sps[2]), parseInt(sps[3]), parseInt(sps[4]));
var localT = new Date(t1.getTime() - 8 * 3600000 + _timeZone * 60 * 60000);
return localT;
}
function ToLocalTime(t) {
t = typeof (t) != 'string' ? new Date(t) : new Date(t.replace(/-/g, '/')); //兼容旧苹果横杠日期格式报错问题
var localT = new Date(t.getTime() + (_timeZone * 60 * 60000));
return localT;
}
function dateFtt(fmt, t) {
var o = {
"M+": t.getMonth() + 1,//month
"d+": t.getDate(),//day
"h+": t.getHours(),//hours
"m+": t.getMinutes(),//minutes
"s+": t.getSeconds(),//second
"t1": _months[t.getMonth()],//month name
"t2": _months2[t.getMonth()],//simp month
"w1": _weeks[t.getDay()],//week
"w2": _weeks2[t.getDay()],//simp week
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (t.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1 || /[tw]/.test(k)) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function ShowMatchTime(matchTime) {
var localT = timeFromE8(matchTime);
return timeToText(localT, 2) + "" + timeToText(localT,3);
}
function ShowMatchTime2(matchTime) {
var localT = timeFromE8(matchTime);
return timeToText(localT, 0);
}
//兼容三种日期格式[2019,4,30,07,00,00],[2019,5-1,30,07,00,00],[2019-4-30 07:00:00]
function convertTime(t, moonfix) {
if (t.indexOf("GMT") != -1) return new Date(t);
var d = moonfix == 1 ? 1 : 0;
if (t.indexOf(':') != -1) {
t = t.replace(/-/g, ",").replace(/\ /g, ",").replace(/:/g, ",");
d = 1;
}
var t = t.split(",");
t[1] = eval(t[1]) - d;
var t2 = new Date(t[0], t[1], t[2], t[3], t[4]);
return t2;
};
var _favMatchKey = "MyGames_MatchID";
var _favLeagueKey = "MyGames_LeagueID";
var _favTeamKey = "MyGames_TeamID";
var _maxFavLength = 2600;
var Config = {};
Config.getFavMatchIds = function () {
let Ids = getCookie(_favMatchKey);
return (!Ids ? new Array() : Ids.split(","));
}
Config.setFavMatchIds = function (ids) {
while (ids.toString().length > _maxFavLength) {
ids.splice(0, 1);
}
let idsStr = ids.join(",");
writeShareCookie(_favMatchKey, idsStr, new Date((new Date()).getTime() + 15 * 24 * 3600000));
countFavMatch();
}
Config.getFavLeagueIds = function () {
let Ids = getCookie(_favLeagueKey);
return (!Ids ? new Array() : Ids.split(","));
}
Config.setFavLeagueIds = function (ids) {
while (ids.toString().length > _maxFavLength) {
ids.splice(0, 1);
}
let idsStr = ids.join(",");
writeShareCookie(_favLeagueKey, idsStr, new Date((new Date()).getTime() + 15 * 24 * 3600000));
countFavMatch();
}
Config.getFavTeamIds = function () {
let Ids = getCookie(_favTeamKey);
return (!Ids ? new Array() : Ids.split(","));
}
Config.setFavTeamIds = function (ids) {
while (ids.toString().length > _maxFavLength) {
ids.splice(0, 1);
}
let idsStr = ids.join(",");
writeShareCookie(_favTeamKey, idsStr, new Date((new Date()).getTime() + 15 * 24 * 3600000));
countFavMatch();
}
var _soccerInpageVersionCookie = "Soccer_SummaryInpage";
Config.isSummaryInpage = function () {
let val = getCookie(_soccerInpageVersionCookie);
if (!CheckEmpty(val) && val == 1) {
return true;
} else {
return false;
}
};
var _themeColor = "#00407d"; //站点主题色
function timeToText(t2, type) {
type = type || 0;
var fmts = [
"dd-MM-yyyy hh:mm",/*0*/
"dd-MM-yyyy",/*1*/
"dd-MM",/*2*/
"hh:mm",/*3*/
"t2 dd",/*4*/
"dd-MM hh:mm",/*5*/
"dd-MM-yy",/*6*/
"yyyy",/*7*/
"t2.dd",/*8*/
"dd-MM,yyyy hh:mm"/*9*/,
"dd-MM-yyyy hh:mm",/*10*/
"dd-MM
hh:mm",/*11*/
];
return dateFtt(fmts[type] || fmts[0], t2);
}
function dateToTime(time) {
var tReg = /(\d{4})-(\d{1,2})-(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[3] + "-" + arr[2] + "-" + arr[1] + arr[4];
}
tReg = /(\d{4})\/(\d{1,2})\/(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[3] + "-" + arr[2] + "-" + arr[1] + arr[4];
}
tReg = /^(\d{1,2})-(\d{1,2})([\s\d\:]*)/;
if (tReg.test(time)) {
var arr = time.match(tReg);
return arr[2] + "-" + arr[1] + arr[3];
}
return time;
}
soccerInPage = {
prefix: "football/",
isSummary: function (id, home, guest, isSelf) {
if (typeof (checkInpageVersion) == "function" && checkInpageVersion(id, home, guest, isSelf) == 1) {
return true;
}
return false;
},
formatinfo: function (home, guest, sclass) {
var str = _livescoreWebDomain + this.prefix + (sclass + " " + home + " vs " + guest).replace(/\s/g, "-").replace(/[\?,\#,\&,\/,\%]/g, "").replace(/\.$/, "").toLowerCase();
return str;
},
detail: function (id, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
var url = this.formatinfo(home, guest, sclass) + "/live-" + id;
window.open(url);
}
},
analysis: function (id, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
var url = this.formatinfo(home, guest, sclass) + "/h2h-" + id;
window.open(url);
}
},
oddscomp: function (id, cid, home, guest, sclass, isSelf) {
if (!this.isSummary(id, home, guest, isSelf)) {
var url = this.formatinfo(home, guest, sclass) + "/oddscomp-" + id;
if (cid)
url += "?cid=" + cid;
else if (typeof (selectCompanyId) != "undefined")
url += "?cid=" + selectCompanyId;
window.open(url);
}
},
}
function checkInpageVersion(id, hn, gn, isSelf) {
if (Config.isSummaryInpage()) {
window.open(_livescoreWebDomain + "football/" + (hn + "-vs-" + gn).replace(/\s/g, "-").toLowerCase() + "/summary-" + id, isSelf ? "_self" : "");
return 1;
}
return 0;
};
var isShow = false;
var _adLoc = 0;
initLocation();
function initLocation() {
var ipCheckUrl = "/ajax/IpChecker/?" + Date.parse(new Date());
bomHelper.ajaxGet(ipCheckUrl, function (data) {
var result = data;
if (result != "") {
if (parseInt(result) == 1)
isShow = true;
_adLoc = parseInt(result);
if (isShow && document.getElementById("topAdDiv") && typeof (getAdHtml) == "function") {
document.getElementById("topAdDiv").innerHTML = getAdHtml("top", "top", "");
}
}
});
}
;
;