var _mainWebDomain = '//live3.bongdalu808.com/';var _livescoreWebDomain = '//live3.bongdalu808.com/';var _dataWebDomain = '//data.bongdalu808.com/';var _basketballWebDomain = '//basketball.bongdalu808.com/';var _footballWebDomain = '//football1.bongdalu808.com/';var _cmsWebDomain = 'https://tips.bongdalu808.com/';var _infoWebDomain = '//football1.bongdalu808.com/';var _touchWebDomain = '//www.bongdalu42.com/';var _freeWebDomain = '//free.bongdalulink.com/';var _freeAppDomain = '//www.bongdpro.com/';var _domain = 'bongdalu808';var _tail = 'com';var _defaultOddsType = '5';var _defaultTimeZone = '7';var _leagueNameIdx = '8';var _isNewOddsTxt = '1';var _upDownColorType = '0';var _oddsOrder = '1-3-2';var _moduleKey = 'Vn';var _websocket = true;var _wsUrl = 'live3.bongdalu808.com:9800';var _cdnWebDomain = '//img_cms.thscore.fun/';var _substationType = 0;var _isForApp = false;var _needToken = false;; var ICONFONT = { DETAIL: "", LINEUP: "", ANALYSIS: "", ODDS: "", FLASH: "", FLASHON: "", BASKETBALL: "", HIGHLIGHT: "", FLASH_LQ: "", FLASHON_LQ: "", FAV_MATCH: "", FAV_LEAGUE: "" } var ODDSTYPE = { NONE : 0, //让球 AH : 1, //欧赔 OP : 2, //大小 OU : 3, //角球大小 CORNEROU : 4, //波胆 BODAN : 5, //欧洲让分 EUROAH : 6, //双色彩 DOUBLECHANCE : 7 } Object.freeze(ODDSTYPE); //篮球盘口类型 var LQHANDICAP = { //第一节 FIRST : 1, //第二节 SECOND : 2, //上半场 HALF : 3, //第三节 THREE : 4, //第四节 FOUR : 5, //全场 FULL : 6, //滚球 RUNNING : 7 } Object.freeze(LQHANDICAP);; var headtime = new Date(); var timeZone = new Date().getTimezoneOffset() / -60; function _$(id) { return document.getElementById(id); } function _$$(name) { return document.getElementsByName(name); } 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 (typeof (_appModule) != 'undefined' && (_appModule == "Ind" || _appModule == "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 clearCookie(name) { writeCookie(name, "", new Date()); } 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; } function WriteSession(name, value) { window.sessionStorage.setItem(name, value); } function GetSession(name) { return window.sessionStorage.getItem(name) } 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 MM_showHideLayers() { //v6.0 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; } if (v == "none" || v == "block") { obj.display = v; } else { obj.visibility = v; } } } function getIENumber() { var ieNum = 0; try { if (document.all && typeof (document.documentMode) != "undefined") ieNum = document.documentMode; return ieNum; } catch (e) { ieNum = 0; return ieNum; } } function getNodeContent(node) { if (!node) return null; var ret = node.textContent; if (!ret) return node.text; else return ret; } var startani_C, startani_A, startani_B, pop_TC; var oPopup; try { oPopup = window.createPopup(); } catch (e) { } /*进球弹窗*/ function ShowCHWindow(str, matchnum) { imagewidth = 460; /*imageheight = 28 + 27 * matchnum;*/ imageheight = 28 + 27; x = 280; x = (screen.width - imagewidth) / 2; y = 1; oPopupBody = oPopup.document.body; oPopupBody.innerHTML = str; oPopupBody.style.cursor = "pointer"; oPopupBody.title = "Hit to close"; oPopupBody.onclick = dismisspopup; oPopupBody.oncontextmenu = dismisspopup; pop_TC = 40; pop(); } function pop() { try { oPopup.show(x, y, imagewidth, imageheight); startani_A = setTimeout("pop()", 300); //显示15秒 if (pop_TC < 0) { dismisspopup(); }; pop_TC = pop_TC - 1; } catch (e) { } } function dismisspopup() { clearTimeout(startani_A); oPopup.hide(); } var goal = 0, goalTime; function ShowCHWindow123(str) { document.getElementById("div_goal").innerHTML = str; document.getElementById("div_goal").style.display = ""; document.getElementById('div_goal').style.left = (document.body.parentElement.offsetWidth / 2 - 230) + "px"; goal = 20; window.clearTimeout(goalTime); showTime(); } function showTime(opt) { if (opt == 1) { goal = -1; } if (goal < 0) { document.getElementById("div_goal").innerHTML = ""; document.getElementById("div_goal").style.display = "none"; window.clearTimeout(goalTime); return; } goal -= 1; goalTime = window.setTimeout("showTime()", 1000); } function convertIntToTimeText(t1, t2, t3, t4, t5, t6, type) { var ot = new Date(t1, t2, t3, t4, t5, t6); t = ToLocalTime(ot); var str = "" + timeToText(ToLocalTime(ot), 14) + ""; if (type == 1) { str = "" + timeToText(ToLocalTime(ot), 6) + ""; } else if (type == 2) { str = "" + timeToText(ToLocalTime(ot), 16) + ""; } else if (type == 3) { str = "" + timeToText(ToLocalTime(ot), 21) + ""; } else if (type == 4) { str = "" + timeToText(ToLocalTime(ot), 19) + ""; } document.write(str); } //去除Html标签(连带标签里面内容) function skipHtmlTagBoth(str) { if (str != null) str = str.replace(/<.*>.*<\/.*>/gi, ""); return str; } //去除Html标签(保留标签里面内容) function skipHtmlTag(str) { if (str != null) str = str.replace(/<[^>]+>/g, ""); return str; } function isTouch() { return (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent)); } function OpenMobile() { if (!CheckEmpty(_touchWebDomain)) { if (_appModule == "Pt" || _appModule == "World" || _appModule == "Kor" || _appModule == "Bola" || _appModule == "Ind") { /* 统计两端流转用 */ window.open(_touchWebDomain + "?from=pc") } else { window.open(_touchWebDomain); } } } function OpenFreeApp() { if (!CheckEmpty(_freeAppDomain)) window.open(_freeAppDomain); } function OpenFbSclass(ID) { if (ID == null || ID == '' || ID == 0) return false; window.open(_footballWebDomain + "leagueinfo/" + ID); } function goFbInfoRank(id) { if (id == null) return false; window.open(_footballWebDomain + "standing/" + id); } function goBkInfoRank(id) { if (id == null) return false; window.open(_basketballWebDomain + "standing/" + id); } 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 GetLocalTime(t) { var t1 = t.split(","); var t2 = new Date(t1[0], t1[1], t1[2], t1[3], t1[4], t1[5]); return new Date(Date.UTC(t2.getFullYear(), t2.getMonth(), t2.getDate(), t2.getHours(), t2.getMinutes(), t2.getSeconds())); } //时间类型转换 function TransferTimeType(curType) { if (curType == 1) { return 13; } else if (curType == 2) { return 18; } else if (curType == 3) { return 2; } else if (curType == 4) { return 4; } else if (curType == 6) { return 6; } else if (curType == 7) { return 7; } else if (curType == 20) { return 20; } else if (curType == 30) { return 3; } else { return 1; } } function formatDate(t, type) { var strTime = ""; var t1 = t.split(","); var t2 = new Date(t1[0], eval(t1[1]), t1[2], t1[3], t1[4], t1[5]); t2 = new Date(Date.UTC(t2.getFullYear(), t2.getMonth(), t2.getDate(), t2.getHours(), t2.getMinutes(), t2.getSeconds())); strTime = timeToText(t2, TransferTimeType(type)); document.write(strTime); } function formatTime2(t) { var h = t.getHours(); var m = t.getMinutes(); var result = ""; if (h < 10) h = "0" + h; if (m < 10) m = "0" + m; return h + ":" + m; } //兼容三种日期格式[2019,4,30,07,00,00],[2019,5-1,30,07,00,00],[2019-4-30 07:00:00] function convertTime(t, moonfix) { 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; } //针对yyyyMMdd这种格式字符窜转为日期 function ParseTime(t, isUtc) { var strTime = ""; var t1 = new Date(t.substr(0, 4), parseInt(t.substr(4, 2).replace(/0(\d)/, "$1")) - 1, t.substr(6, 2), t.substr(8, 2), t.substr(10, 2)); var localT = new Date(t1.getTime() + (_timeZone * 60 * 60000) - (8 * 3600000)); if (isUtc) { localT = new Date(t1.getTime() + (_timeZone * 60 * 60000)); } strTime = localT; if (strTime) { return strTime; } return t; } function dateToTime(time) { var tReg = /(\d{2})-(\d{1,2})-(\d{1,2})([\s\d\:]*)/; if (tReg.test(time)) { time = ("20" + time).replaceAll("-", "/"); return timeToText(new Date(time), 2); } return time; } function timeToText(t2, type) { type = type || 0; var fmts = [ "dd-MM-yyyy hh:mm:ss",/*0*/ "dd-MM-yyyy hh:mm:ss",/*1*/ "dd-MM-yyyy",/*2*/ "dd-MM",/*3*/ "hh:mm",/*4*/ "t2 dd",/*5*/ "dd-MM hh:mm",/*6*/ "dd-MM-yy",/*7*/ "yyyy",/*8*/ "dd.MM.yyyy",/*9*/ "t2 dd hh:mm",/*10*/ "hh:mm,ww,dd-MM-yyyy",/*11*/ "dd-MM-yyyy(w)",/*12*/ "dd-MM-yyyy hh:mm w",/*13*/ "dd-MM hh:mm",/*14*/ "dd-MM hh:mm",/*15*/ "dd-MM-yy",/*16*/ "dd-MM-yyyy",/*17*/ "dd-MM-yyyy hh:mm",/*18*/ "d-M-yyyy hh:mm",/*19*/ "yyyy.MM.dd hh:mm",/*20*/ "M-d hh:mm", /*21*/ "dd t2 yyyy,hh:mm", /*22*/ "dd/MM/yyyy hh:mm" /*23*/ ]; return dateFtt(fmts[type] || fmts[0], t2); } function setTimeByFormat() { var elems = document.querySelectorAll("[data-time]"); for (var i = 0; i < elems.length; i++) { var elem = elems[i], t2; t2 = getTimeByUtcStr(elem.getAttribute("data-time")); elem.innerHTML = timeToText(t2, elem.getAttribute("data-fmt")); } } function setPublishTime() { $("[data-pubtime]").each(function () { var pubTime = this.getAttribute("data-pubtime"); this.innerHTML = publishTimeDesc(pubTime, this.getAttribute("data-fmt")); }); } function publishTimeDesc(dtSplit, format) { var time = null; if (dtSplit instanceof Date) { time = dtSplit; } else { time = getTimeByUtcStr(dtSplit); } var timeZoneHour = -((new Date()).getTimezoneOffset() / 60); var customTimeZone = getCookie("Time_Zone"); if (customTimeZone != undefined && customTimeZone != "") { timeZoneHour = customTimeZone; } //time和now均为utc+所选时区的时间,直接求差即可 var d1 = new Date(); var d2 = new Date(d1.getUTCFullYear(), d1.getUTCMonth(), d1.getUTCDate(), d1.getUTCHours(), d1.getUTCMinutes(), d1.getUTCSeconds()); var now = new Date(d2.getTime() + (timeZoneHour * 60 * 60000)); var t_jb = _locModel.T.T_JustBefore || "Just now"; var t_hb = _locModel.T.T_FM_HoursBefore || "{0} Hours Ago"; var t_mb = _locModel.T.T_FM_MinutesBefore || "{0} Minutes Ago"; var timespan = (now - time) / (3600 * 1000); if (timespan < 0.1) { return t_jb; } else if (timespan < 1) { return t_mb.replace("{0}", (parseFloat(timespan).toFixed(2) * 60).toFixed(0)); } else if (timespan < 24) { return t_hb.replace("{0}", parseInt(timespan)); } return timeToText(time, format); } //2015,01,01,12,30,00 function getTimeByUtcStr(val) { var t = splitTime(val); var timeZoneHour = -((new Date()).getTimezoneOffset() / 60); var customTimeZone = getCookie("Time_Zone"); if (customTimeZone != undefined && customTimeZone != "") { timeZoneHour = customTimeZone; } var t2 = new Date(t[0], t[1], t[2], t[3], t[4], t[5]); t2 = new Date(t2.getFullYear(), t2.getMonth(), t2.getDate(), t2.getHours(), t2.getMinutes(), t2.getSeconds()); t2 = new Date(t2.getTime() + (timeZoneHour * 60 * 60000)); return t2; } //兼容三种日期格式[2019,4,30,07,00,00],[2019,5-1,30,07,00,00],[2019-4-30 07:00:00] function splitTime(t) { var d = 0; if (t.indexOf(':') != -1) { t = t.replace(/(-|\s|:)/g, ","); d = 1; } var t = t.split(","); t[1] = eval(t[1]) - d; return t; } var _months2 = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_S_Jan) != "undefined") ? [_locModel.T.T_S_Jan, _locModel.T.T_S_Feb, _locModel.T.T_S_Mar, _locModel.T.T_S_Apr, _locModel.T.T_S_May, _locModel.T.T_S_Jun, _locModel.T.T_S_Jul, _locModel.T.T_S_Aug, _locModel.T.T_S_Sep, _locModel.T.T_S_Oct, _locModel.T.T_S_Nov, _locModel.T.T_S_Dec] : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var _months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var _weeks = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_Sunday) != "undefined") ? [_locModel.T.T_Sunday, _locModel.T.T_Monday, _locModel.T.T_Tuesday, _locModel.T.T_Wednesday, _locModel.T.T_Thursday, _locModel.T.T_Friday, _locModel.T.T_Saturday] : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var _weeks2 = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_S_Sunday) != "undefined") ? [_locModel.T.T_S_Sunday, _locModel.T.T_S_Monday, _locModel.T.T_S_Tuesday, _locModel.T.T_S_Wednesday, _locModel.T.T_S_Thursday, _locModel.T.T_S_Friday, _locModel.T.T_S_Saturday] : ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."]; var _hasInitDateFormat = 0; function dateFtt(fmt, t) { if (_hasInitDateFormat == 0) { _months2 = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_S_Jan) != "undefined") ? [_locModel.T.T_S_Jan, _locModel.T.T_S_Feb, _locModel.T.T_S_Mar, _locModel.T.T_S_Apr, _locModel.T.T_S_May, _locModel.T.T_S_Jun, _locModel.T.T_S_Jul, _locModel.T.T_S_Aug, _locModel.T.T_S_Sep, _locModel.T.T_S_Oct, _locModel.T.T_S_Nov, _locModel.T.T_S_Dec] : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; _weeks = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_Sunday) != "undefined") ? [_locModel.T.T_Sunday, _locModel.T.T_Monday, _locModel.T.T_Tuesday, _locModel.T.T_Wednesday, _locModel.T.T_Thursday, _locModel.T.T_Friday, _locModel.T.T_Saturday] : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; _weeks2 = (typeof (_locModel) != "undefined" && typeof (_locModel.T.T_S_Sunday) != "undefined") ? [_locModel.T.T_S_Sunday, _locModel.T.T_S_Monday, _locModel.T.T_S_Tuesday, _locModel.T.T_S_Wednesday, _locModel.T.T_S_Thursday, _locModel.T.T_S_Friday, _locModel.T.T_S_Saturday] : ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."]; _hasInitDateFormat = 1; } 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 "w+": _weeks[t.getDay()]//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 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 ServiceTimeToLocal(t) { localT = new Date(t * 1000 - (8 * 60 * 60000) + (_timeZone * 60 * 60000)); return localT; } Array.prototype.contains = function (obj) { var i = this.length; while (i--) { if (this[i] == obj) { return true; } } return false; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } function checkExlink(a22) { var spSymbel = "$"; if (a22.indexOf(spSymbel) != -1) { var retArr = a22.split(spSymbel); if (retArr.length == 3) return retArr[0] + retArr[2]; else return retArr[0]; } return a22; } function showExplain(exlist, hometeam, guestteam) { // 广东体育; 1 | 1; 2 | 5; 12 | 90, 1 - 1; 2 - 2; 1, 2 - 2; 5 - 4; 1 //;|1;2|;|90,3-3;2-5;2,2-2;; hometeam = hometeam.replace(/<[^>].*?>/g, ""); guestteam = guestteam.replace(/<[^>].*?>/g, ""); hometeam = hometeam.replace("(N)", ""); guestteam = guestteam.replace("(N)", ""); var explainList = ""; if (exlist != "") { if (exlist.indexOf('|') > -1) { var arrExplain = exlist.split('|'); if (arrExplain[1].split(';')[0] != "") { explainList += _locModel.T.T_KickOff + "("; if (arrExplain[1].split(';')[0] == "1") explainList += hometeam + ")"; else if (arrExplain[1].split(';')[0] == "2") explainList += guestteam + ")"; } if (arrExplain[1].split(';')[1] != "" && window.location.href.toLowerCase().indexOf("asianbookie") == -1 && window.location.href.toLowerCase().indexOf("free") == -1) { if (arrExplain[1].split(';')[1] == "3" || arrExplain[1].split(';')[1] == "4" || arrExplain[1].split(';')[1] == "5") { if (explainList != "") explainList += "
"; explainList += "[Live TV]"; } } if (arrExplain[2].split(';')[0] != "") { if (explainList != "") explainList += "
"; explainList += _locModel.T.T_Corner + "(" + arrExplain[2].split(';')[0] + ") | "; explainList += _locModel.T.T_Corner + "(" + arrExplain[2].split(';')[1] + ")"; } var scoresList = arrExplain[3].split(';'); if (scoresList[0] != "") { if (explainList != "") explainList += "
"; explainList += scoresList[0].split(',')[0] + _locModel.T.T_S_Minutes + "[" + scoresList[0].split(',')[1] + "], "; if (scoresList[1] != "") explainList += _locModel.T.T_TwoRounds + "[" + scoresList[1] + "], "; if (scoresList[2] != "") { if (scoresList[2].split(',')[0] == "1") explainList += "120" + _locModel.T.T_S_Minutes + "[" + scoresList[2].split(',')[1] + "], "; else explainList += _locModel.T.T_ST_Ot + "[" + scoresList[2].split(',')[1] + "], "; } if (scoresList[3] != "") explainList += _locModel.T.T_Explain_Pen + "[" + scoresList[3] + "], "; if (scoresList[4] != "") { if (scoresList[4] == "1") explainList += hometeam + " " + _locModel.T.T_Win; else if (scoresList[4] == "2") explainList += guestteam + " " + _locModel.T.T_Win; } } } } return explainList; } if (!window.ActiveXObject) { HTMLElement.prototype.insertAdjacentElement = function (where, parsedNode) { if (parsedNode) { switch (where) { case "beforeBegin": this.parentNode.insertBefore(parsedNode, this); break; case "afterBegin": this.insertBefore(parsedNode, this.firstChild); break; case "beforeEnd": this.appendChild(parsedNode); break; case "afterEnd": if (this.nextSibling) this.parentNode.insertBefore(parsedNode, this.nextSibling); else this.parentNode.appendChild(parsedNode); break; } } } } 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 getPageHeight() { var pageHeight = window.innerHeight; if (typeof pageWindth != "number") { if (document.compatMode == "CSS1Compat") { pageHeight = document.documentElement.clientHeight; } else { pageHeight = document.body.clientHeight; } } return pageHeight; } 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] }; } 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); } var X2 = {} //my namespace:) X2.Eval = function (code) { if (!!(window.attachEvent && !window.opera)) { //ie execScript(code); } else { //not ie window.eval(code); } } 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; } }; var _handicapTypeArray = ["/-", "+/-", "/*", "让/受让"]; var _handicapType = 1; var _handicapAccept = "-"; var _handicapGive = ""; var _ouTrimEndZero = true; 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 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]; } } initHandicap(); 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 Goal2GoalCn2(goal) { return Goal2GoalCn(goal); } 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))]; /*if (_ouTrimEndZero) return parseFloat(newGoal).toString();*/ return newGoal } } function Goal2Num(goal) { if (typeof (goal) == "undefined") return ""; if (!isNaN(goal) || goal.indexOf("/") == -1) return parseFloat(goal); var isMinus = false; if (goal.indexOf("-") > -1) isMinus = true; goal = goal.replace("+", "").replace("-", ""); var nums = goal.split('/'); goal = (parseFloat(nums[0]) + parseFloat(nums[1])) / 2; return isMinus ? (0 - goal) : goal; } function insertAfter(newEl, targetEl) { var parentEl = targetEl.parentNode; if (parentEl.lastChild == targetEl) { parentEl.appendChild(newEl); } else { parentEl.insertBefore(newEl, targetEl.nextSibling); } } function IsMobile() { if (navigator.userAgent.toLowerCase().indexOf("android") != -1 || navigator.userAgent.toLowerCase().indexOf("iphone") != -1 || navigator.userAgent.toLowerCase().indexOf("mobile") != -1) return true; else return false; } var _cnzzLoaded = false; var _cnzzUrls = new Array(); function showCountDefer(opt) { if (_cnzzLoaded) return; var allCnzz = document.getElementById("allCnzz"); allCnzz.removeChild(allCnzz.firstChild); for (var i = 0; i < _cnzzUrls.length; i++) { addScript(allCnzz, _cnzzUrls[i]); } _cnzzLoaded = true; } function addScript(container, url) { var s = document.createElement("script"); s.src = url; container.appendChild(s, "script"); } function GetBasketState(state, type) { var rs; switch (state) { case -5: rs = _locModel.T.T_ST_Postp; break; case -4: rs = _locModel.T.T_ST_Cancel; break; case -3: rs = "" + _locModel.T.T_ST_Interrupt + ""; break; case -2: rs = "" + _locModel.T.T_ST_Pend + ""; break; case -1: rs = "" + _locModel.T.T_ST_Finish + ""; break; case 0: rs = " "; break; case 1: rs = _locModel.T.T_ST_Qtr1; break; case 2: rs = _locModel.T.T_ST_Qtr2; break; case 3: rs = type == 2 ? _locModel.T.T_ST_Qtr2 : _locModel.T.T_ST_Qtr3; break; case 4: rs = _locModel.T.T_ST_Qtr4; break; case 5: rs = _locModel.T.T_ST_Ot; break; case 6: rs = _locModel.T.T_ST_Ot; break; case 7: rs = _locModel.T.T_ST_Ot; break; case 50: rs = _locModel.T.T_ST_Halftime; break; } return rs; } function OpenBkSclass(ID) { if (ID == null || ID == '' || ID == 0) return false; window.open(_basketballWebDomain + "leagueinfo/" + ID); } //获取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); } //不影响原来的onload情况下添加新的事件 function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function () { oldonload(); func(); } } } function NoDataHtml(type) { if (type == 2) { return "
" + _locModel.T.T_Tip_NoMatch + "
"; } else { return "
" + _locModel.T.T_Tip_NoData + "
"; } } //暗黑模式相关 function LoadDark() { var dark = getCookie("dark_mode") == null ? dark_mode : getCookie("dark_mode"); if (GetSession("dark_mode") != null && GetSession("dark_mode") != '') dark = GetSession("dark_mode"); if (document.getElementsByTagName("body").length > 0) { if (dark != null && dark == 1) { document.getElementsByTagName("body")[0].classList.add("dark"); if (document.getElementById("flash") != null) window.frames["flash"].contentWindow.document.body.classList.add("dark"); if (document.getElementById("flashIframe") != null) window.frames["flashIframe"].contentWindow.document.body.classList.add("dark"); } else { document.getElementsByTagName("body")[0].classList.remove("dark"); if (document.getElementById("flash") != null) window.frames["flash"].contentWindow.document.body.classList.remove("dark"); if (document.getElementById("flashIframe") != null) window.frames["flashIframe"].contentWindow.document.body.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 = dark_mode; if (dark == 1) { if (document.getElementById("DarkModeCheck")) document.getElementById("DarkModeCheck").checked = true; } if (document.getElementById("DarkModeCheck")) document.getElementById("DarkModeCheck").style.display = ""; } function setGoalCnFormat(elmId) { if (elmId == null) return; var elems = document.querySelectorAll("#" + elmId + " [data-o]"); if (elems == null || elems.length == 0) return; for (var i = 0; i < elems.length; i++) { var elem = elems[i], odd; if (!elem.innerHTML.trim() || elem.getAttribute("data-o")) { t2 = Goal2GoalCn(elem.getAttribute("data-o")); elem.innerHTML = t2; } } } function CheckEmpty(str) { if (typeof (str) == 'undefined' || str == 'undefined' || !str || !/[^\s]/.test(str)) { return true; } else { return false; } } function BomHelper() { this.ie = ""; this.firefox = ""; this.chrome = ""; this.opera = ""; this.safari = ""; this.operaMini = ""; this.uc = ""; this.ios = ""; this.android = {}; this.pc = ""; this.kv = function (k, v, i) { return { key: k, value: v, opt: i || 1 }; }; } //检测浏览器版本,并保存 BomHelper.prototype.checkBrowerType = function () { var ua = navigator.userAgent.toLowerCase(), s, rkv; var rdic = [ this.kv('ie', /msie ([\d.]+)/), this.kv('qq', /qq\/([\d.]+)/i), this.kv('firefox', /firefox\/([\d.]+)/i), this.kv('uc', /ucbrowser\/([\d.]+)/i), this.kv('operaMini', /opera[\s]mini.([\d.]+)/i), this.kv('opera', /opera[\s]mini.([\d.]+)/i), this.kv('chrome', /chrome\/([\d.]+)/i),//chrome for android this.kv('crios', /crios\/([\d.]+)/i),//chrome for ios this.kv('safari', /version\/([\d.]+).*safari/i), ]; for (var i = 0; i < rdic.length; i++) { rkv = rdic[i]; if ((s = ua.match(rkv.value))) { this[rkv.key] = s[1]; break; } } } BomHelper.prototype.checkPlatform = function (s) { var ua = navigator.userAgent.toLowerCase(), rkv; if (/(iphone|ipad|ipod|ios)/i.test(ua)) { this.ios = (s = ua.match(/(?:iphone|ipad|itouch).* os (\d+)_[\d]/)) ? s[1] : "1"; } else if (/android/i.test(ua)) { this.android.version = ((s = ua.match(/(?:android) ([\d\.]+);/))) ? s[1] : "1"; var rdic = [ this.kv('huawei', /(huawei|honorbln)/i), this.kv('oppo', /oppo/i), this.kv('vivo', /vivo/i), this.kv("xiaomi", /(miui|xiaomi)/i), this.kv("meizu", /;[\s]+mz-/i), this.kv("original", /android/), ]; for (var i = 0; i < rdic.length; i++) { rkv = rdic[i]; if ((s = ua.match(rkv.value))) { this.android[rkv.key] = 1; break; } } } else this.pc = "pc"; } //获取ajax对象 BomHelper.prototype.ajaxObj = function () { var xmlHttp = null; if (this.ie != "") { if (typeof ActiveXObject != "undefined") { return new XMLHttpRequest(); } else { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (ex1) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (ex2) { try { xmlHttp = new XMLHttpRequest(); } catch (ex3) { alert("创建ajax对象失败,本网站只支持ie6以上版本浏览器,请刷新页面重试"); } } } } } else { try { xmlHttp = new XMLHttpRequest(); } catch (ex3) { alert("创建ajax对象失败,请刷新页面重试"); } } return xmlHttp; } //发送ajax的GET请求 BomHelper.prototype.ajaxGet = function (sUrl, fnAjax, isdefer) { if (isdefer == undefined) isdefer = true; 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, isdefer); 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); } //同步获取xml文件 BomHelper.prototype.ajaxXml = function (sUrl, sys, fnAjax) { var xmlHttp = this.ajaxObj(); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) fnAjax(xmlHttp.responseXML, xmlHttp.responseText); } if (sUrl.indexOf("?") == -1) sUrl = sUrl + "?flesh=" + Math.random(); else sUrl = sUrl + "&flesh=" + Math.random(); xmlHttp.open("GET", sUrl, sys); xmlHttp.send(null); } //若是IE7以上版本,则要求它使用IE7 BomHelper.prototype.useIE7 = function () { document.write(""); } var bomHelper = new BomHelper(); bomHelper.checkBrowerType(); bomHelper.checkPlatform(); //bomHelper.timezoneHours = findCookie("zoneOffset") ? (parseInt(findCookie("zoneOffset"))) : -(new Date().getTimezoneOffset() / 60); String.prototype.Trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); } //登陆相关 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; } } //替换单引号为中文单引号,防止部分带单引号数据引起js异常 function escapeChar(str) { //str = str.replace(/\'/g, "\\\'"); str = str.replace(/\'/g, "´"); return str; } function createXml(str) { if (document.all) { var xmlDom = new ActiveXObject("Microsoft.XMLDOM") xmlDom.loadXML(str) return xmlDom } else return new DOMParser().parseFromString(str, "text/xml") } function oddsCompare(oval, val) { oval = oval ? oval.toString() : ""; val = val ? val.toString() : ""; //return 1,0,-1 for float odds, string, or 0/0.5 var n_oval = parseFloat(oval), n_val = parseFloat(val); if (oval && oval.indexOf("/") != -1) n_oval = (oval.indexOf("-") == -1 ? 1 : -1) * (parseFloat(oval.replace("-", "").split("/")[0]) + parseFloat(oval.replace("-").split("/")[1])) / 2; if (oval && oval.indexOf("/") != -1) n_val = (val.indexOf("-") == -1 ? 1 : -1) * (parseFloat(val.replace("-", "").split("/")[0]) + parseFloat(val.replace("-").split("/")[1])) / 2; if (n_val > n_oval) return 1; else if (n_val == n_oval) return 0; return -1; } function showDate(t0, t1, t2, t3, t4, t5) { var t = new Date(t0, t1, t2, t3, t4, t5); var newT = timeToText(ToLocalTime(t), 6); document.write("" + newT + ""); } function getDate(mt) { var mArr = mt.split(","); var t = new Date(mArr[0], eval(mArr[1]), mArr[2], mArr[3], mArr[4], mArr[5]); var newT = timeToText(ToLocalTime(t), 6); return newT; } //打开篮球赛事欧赔详情弹窗 function openLqEuroDetail(scheduleId, companyId, company) { var url = "/nba/oddsdetail/" + scheduleId + "?cid=" + companyId + "&company=" + company; window.open(url, "", "width=470,height=280,top=40,left=100,resizable=yes,scrollbars=yes"); } function switchSlide(elm) { if ($(elm).hasClass("on")) { $(elm).removeClass("on"); } else { $(elm).addClass("on"); } } //加载全局统计 //page: 加载独立统计的页面, 免费调用页不加载总站统计 function loadCnzz(module, page) { var src = new Array(); switch (module) { case "Kor": src.push("https://hm.baidu.com/hm.js?e1d9c0df9e35f494323ddfbd82277559"); break; case "Ng": if (page == "free") { src.push("https://hm.baidu.com/hm.js?5efd491623b40b873bd358921a98b9bd"); } else if (page == "sixMix" || page == "euroOdds" || page == "threeMix" || page == "odds1x2") { src.push("https://hm.baidu.com/hm.js?1e9081fdbfab81573ecb13c42dd9e8f9"); } else if (_isForApp) { src.push("https://hm.baidu.com/hm.js?0499887593fd8230bf848b7c44fd119e"); } else { src.push("https://hm.baidu.com/hm.js?0394be8d23ef30dfa25c2fe6e78fb15b"); } break; case "Thai": if (page == "free") { /*src.push("https://hm.baidu.com/hm.js?b8466919c8d19c155b1b3edb7a103517");*/ src.push("https://hm.baidu.com/hm.js?722573e28f7b9fe1e4843285f3fb4a63"); } else { src.push("https://hm.baidu.com/hm.js?5242f9b8ab7db0f4fb2b72ebcf095aee"); } break; case "Vn": if (page == "free") { if (new RegExp(_freeWebDomain).test(window.location.href)) { src.push("https://hm.baidu.com/hm.js?3f405e68a1a8c3348551dc65a89f0306"); } else { src.push("https://hm.baidu.com/hm.js?67778a0cf669a83a8081aaf63738c3b5"); } } else { src.push("https://hm.baidu.com/hm.js?b4b4d38d2acca9743375d67d21b194a8"); } break; case "World": if (page == "predictions") { src.push("https://hm.baidu.com/hm.js?ecc84300af6163e08400525d643ec018"); } else if (page == "free") { src.push("https://hm.baidu.com/hm.js?170d50b4a6c6e3e00a4fbbfd24d60725"); } else { src.push("https://hm.baidu.com/hm.js?d3eb7da6bdb2680abe54da905866a8f7"); } break; case "Ind": case "Bola": if (page == "free" || window.location.href.indexOf("www.bola020.com") != -1) { src.push("https://hm.baidu.com/hm.js?611ef76c4b99cc9da7339458b2f9bc46"); } else if (_isForApp) { src.push("https://hm.baidu.com/hm.js?2e4cc9113426365bc3c2ebfd27fce3bb"); } else { src.push("https://hm.baidu.com/hm.js?5e4861e04471e78ba4af68975b6af418"); } break; case "Pt": src.push("https://hm.baidu.com/hm.js?b82accf27f602aaa0e2e7c440c842596"); break; } for (var i = 0; i < src.length; i++) { var item = src[i]; var script = document.createElement("script"); script.type = "text/javascript"; script.src = item; document.getElementById("tongji").appendChild(script); } if (typeof (cnzzModel) != "undefined") { loadIndexCnzz(cnzzModel); } } //加载首页和足球赛果独立cnzz function loadIndexCnzz(model) { var src = new Array(); /*-1-2-3是给1-3shtml社媒推广页用的*/ switch (model.module) { case "Kor": if (model.cnz == 1) { src.push("https://hm.baidu.com/hm.js?76886a99e4d07d579205cf483c1ac0ec"); } else if (model.cnz == 3) { src.push("https://hm.baidu.com/hm.js?2e782eadb331abe8c556e6a0b03fb638"); } else if (model.cnz == 2) { src.push("https://hm.baidu.com/hm.js?c1f99c0939d137dcd06db203adbeac28"); } else if (model.cnz == 5) { src.push("https://hm.baidu.com/hm.js?28187798fb5056b75f4f6fcf15ff590f"); } else if (model.cnz == 6) { src.push("https://hm.baidu.com/hm.js?a928fc54952aecdcae36d692d516cdc9"); } else if (model.cnz == 7) { src.push("https://hm.baidu.com/hm.js?726f34cb18edad66a912d365da3ad5f1"); } else if (model.cnz == 10) { src.push("https://hm.baidu.com/hm.js?b4da2c5b3c074f7fa8800a6b1700de3b"); } break; case "Ng": if (model.cnz == 6) { src.push("https://hm.baidu.com/hm.js?8bccb0280e3f6ed086fc60f37fb42c63"); } else if (model.cnz == 7) { src.push("https://hm.baidu.com/hm.js?309c5fee5a5f7abfb08c52029eaf7135"); } else if (model.cnz == 8) { src.push("https://hm.baidu.com/hm.js?0e233d88fc68bc0203927c2840545095"); } else if (model.cnz == 9) { src.push("https://hm.baidu.com/hm.js?2458232562f01b7712d92a58b35ff09d"); } break; case "Thai": if (model.cz == 1) { src.push("https://hm.baidu.com/hm.js?3fb77540779d1ff6153767ddc5ed5243"); } if (model.cnz == 2) { src.push("https://hm.baidu.com/hm.js?6dc9d98b51001ed19d9760b287ff2059"); } else if (model.cnz == 3) { src.push("https://hm.baidu.com/hm.js?ea63e7f36511012fc5858668e320f54d"); } else if (model.cnz == 5) { src.push("https://hm.baidu.com/hm.js?ad9a96dc1790b9a7fffdf6f71322f355"); } else if (model.cnz == 4) { src.push("https://hm.baidu.com/hm.js?e18b755289da9b979ea4a390719eaefd"); } else if (model.cnz == 6) { src.push("https://hm.baidu.com/hm.js?94f139dcf25e0d0511bfc5efc9bd6889"); } break; case "Vn": if (model.cnz == 1) { src.push("https://hm.baidu.com/hm.js?e64df6d433b87cb740880b71374a8f01") } else if (model.cnz == 2) { src.push("https://hm.baidu.com/hm.js?dfc496f39b81c8cb572c350b0c5ed77c"); } else if (model.cnz == 4) { src.push("https://hm.baidu.com/hm.js?6ad9344eb48650fa522dd2e869dcc803"); } else if (model.cnz == 5) { src.push("https://hm.baidu.com/hm.js?4042853ae3eee9357aed73a139fbbd8b"); } else if (model.cnz == 6) { src.push("https://hm.baidu.com/hm.js?4a2b53d70e4dc33e09c954a95739972e"); } else if (model.cnz == 7) { src.push("https://hm.baidu.com/hm.js?5e4a1a935f66b75172bc7590a0224b99"); } else if (model.cnz == 8) { src.push("https://hm.baidu.com/hm.js?d43cb098a34cb0a1cee6a753b97c660e"); } else if (model.cnz == 11) { src.push("https://hm.baidu.com/hm.js?409a3ff81b1c90846c081427452e88bc"); } else if (model.cnz == 12) { src.push("https://hm.baidu.com/hm.js?c59b6cd3cc99dcc40a1de5e635feafcd"); } break; case "World": if (model.cnz == -2) { src.push("https://hm.baidu.com/hm.js?0e19a914c1c8894032f3ae919f0a00b6"); } else if (model.cnz == 1 || model.cnz == 2 || model.cnz == 5 || model.cnz == 6) { src.push("https://hm.baidu.com/hm.js?9afa61a4a2ed5faae347db791a06e36c"); } else if (model.cnz == 3) { src.push("https://hm.baidu.com/hm.js?a7df3261c71d160568524ef2e1b8ccf5"); } break; case "Ind": case "Bola": if (model.cnz == 1) { src.push("https://hm.baidu.com/hm.js?8f6e7f68435a93e0a5f3c09531005a05"); } else if (model.cnz == 2) { src.push("https://hm.baidu.com/hm.js?59f42b11489917270bdae335f62fece9"); } else if (model.cnz == 3) { src.push("https://hm.baidu.com/hm.js?b6bbe9dd615a9f236f288dd42e7a5f73"); } break; case "Pt": if (model.cnz == 2) { src.push("https://hm.baidu.com/hm.js?d535ebac9082d881242e11c3b099093f"); } else if (model.cnz == 3) { src.push("https://hm.baidu.com/hm.js?6b92ff5bd5d8037ae9fa57e3619f5ea9"); } break; } for (var i = 0; i < src.length; i++) { var item = src[i]; var script = document.createElement("script"); script.type = "text/javascript"; script.src = item; document.getElementById("tongji").appendChild(script); } } 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 cancelBubble(evt) { //cancel bubble var e = (evt) ? evt : window.event; if (!e) return; if (window.event) { e.cancelBubble = true; } else { e.stopPropagation(); } }; function handleBackFromBf2(url) { var backUrl = location.href; location.href = url + "?returnurl=" + backUrl; } //比分页用户设置差异化 function settingDiff() { } //区分一二部各站 function departmentDiff() { switch (_appModule) { //一部 case "Ng": case "Vn": case "Kor": case "Ida": return true; //二部 case "Go": case "Thai": case "Ind": return false; } return true; } var soccerInPage = { prefix: "/football/", isSummary: function (id, home, guest, isSelf) { if (typeof (checkInpageVersion) == "function" && checkInpageVersion(id, home, guest, isSelf) == 1) { return true; } return false; }, gethost: function () { return _mainWebDomain.substr(0, _mainWebDomain.length - 1); }, detail: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/match/live-" + id, isSelf ? "_self" : ""); } }, analysis: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/match/h2h-" + id, isSelf ? "_self" : ""); } }, oddscomp: function (id, cid, half, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { var url = this.gethost() + "/oddscomp/" + id; if (half) url += "?half=1"; window.open(url, isSelf ? "_self" : ""); } }, euroodds: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/1x2-odds/" + id, isSelf ? "_self" : ""); } }, ouodds: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/over-under-odds/" + id, isSelf ? "_self" : ""); } }, ahodds: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/asian-handicap-odds/" + id, isSelf ? "_self" : ""); } }, threemix: function (id, cid, ishalf, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { var url = this.gethost() + "/oddscomp/" + id; if (ishalf) { url += "?half=1" } window.open(url, isSelf ? "_self" : ""); } }, textlive: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/textlive/" + id, isSelf ? "_self" : ""); } }, playertech: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(this.gethost() + "/playertech/" + id, isSelf ? "_self" : ""); } }, tipsmatch: function (id, home, guest, sclass, isSelf) { if (!this.isSummary(id, home, guest, isSelf)) { window.open(_cmsWebDomain + "football/match/" + id, isSelf ? "_self" : ""); } } } var basketInPage = { gethost: function () { return _mainWebDomain.substr(0, _mainWebDomain.length - 1); }, analysis: function (id) { window.open(this.gethost() +"/basketball/analysis/" + id); }, oddscomp: function (id) { window.open(this.gethost() +"/oddscompbasket/" + id); }, euroodds: function (id) { window.open(this.gethost() +"/basketball/1x2-" + id); }, playertech: function (id) { window.open(this.gethost() +"/statistics/" + id); } } var soccerDbPage = { domain: typeof (_footballWebDomain) == "undefined" ? "" : (_footballWebDomain += _footballWebDomain.endsWith("/") ? "" : "/"), player: function (id) { window.open(this.domain + "team/player/" + id); }, team: function (id) { window.open(this.domain + "team/summary/" + id); }, league: function (id) { window.open(this.domain + "leagueinfo/" + id); } } var basketballDbPage = { domain: typeof (_basketballWebDomain) == "undefined" ? "" : (_basketballWebDomain += _basketballWebDomain.endsWith("/") ? "" : "/"), player: function (id) { window.open(this.domain + "team/player/" + id); }, team: function (id) { window.open(this.domain + "team/summary/" + id); }, league: function (id) { window.open(this.domain + "leagueinfo/" + id); } } function loadStatsCode() { } function buildTags(htmlTemple, data) { return htmlTemple.replace(/\{\$(\w+)\}/g, function (a, b) { return (b in data) ? data[b] : ""; }); } //更新足球近期赛程包含收藏赛事数量标识 var _counFavMatchTimmer = null; function countFavMatch() { if ($("#favCount")[0]) { if (CheckEmpty(Config.getFavMatchIds() + Config.getFavTeamIds())) { $("#favCount").html(""); $("#favCount").removeClass("fav_count"); } else { $.ajax({ url: "/ajax/FavAjax?type=4", method: "post", success: function (res) { var result = JSON.parse(res); if (result.ErrCode != -1 && !CheckEmpty(result.Data)) { var sids = result.Data.id.split(','); var hids = result.Data.hid.split(','); var gids = result.Data.gid.split(','); var count = 0; var mIds = Config.getFavMatchIds(); var tIds = Config.getFavTeamIds(); if (sids != null && sids.length > 0) { for (var i = 0; i < sids.length; i++) { if (mIds.contains(sids[i]) || tIds.contains(hids[i]) || tIds.contains(gids[i])) { count++; } } } 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 countLqFavMatch() { if (_$("favCount")) { if (CheckEmpty(LqConfig.getFavMatchIds() + LqConfig.getFavTeamIds())) { $("#favCount").html(""); $("#favCount").removeClass("fav_count"); } else { $.ajax({ url: "/ajax/FavAjax?type=14", method: "post", success: function (res) { var result = JSON.parse(res); if (result.ErrCode != -1 && !CheckEmpty(result.Data)) { var sids = result.Data.id.split(','); var hids = result.Data.hid.split(','); var gids = result.Data.gid.split(','); var count = 0; var mIds = LqConfig.getFavMatchIds(); var tIds = LqConfig.getFavTeamIds(); if (sids != null && sids.length > 0) { for (var i = 0; i < sids.length; i++) { if (mIds.contains(sids[i]) || tIds.contains(hids[i]) || tIds.contains(gids[i])) { count++; } } } 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("countLqFavMatch()", 30 * 1000); } } //本地存储相关 var Storage = { enableStorage: function (st) { try { st.setItem("_test", '1'); var ret = (st.getItem("_test") == '1'); st.removeItem("_test"); return ret; } catch (e) { return false; } }, enableLocal: function () { return (typeof (localStorage) != "undefined" && this.enableStorage(localStorage)); }, enableSession: function () { return (typeof (sessionStorage) != "undefined" && this.enableStorage(sessionStorage)); }, getLocal: function (k) { if (this.enableLocal()) return localStorage.getItem(k); else { return unescape(findCookie(k)); } }, setLocal: function (k, v) { if (this.enableLocal()) localStorage.setItem(k, v); else { writeCookie(k, v); } }, getSession: function (k) { if (this.enableSession()) return sessionStorage.getItem(k); else return this.getLocal(k); }, setSession: function (k, v) { if (this.enableSession()) sessionStorage.setItem(k, v); else this.setLocal(k, v); }, // 存储一个数据及其过期时间 setLocalWithExpire: function (key, value, minute) { if (typeof (second) == 'undefined' || CheckEmpty(second)) { //默认一小时 minute == 60; } var data = { value: value, expire: new Date().getTime() + minute * 60000 }; localStorage.setItem(key, JSON.stringify(data)); }, // 获取一个数据,如果已经过期则返回null getLocalWithExpire: function (key) { var dataStr = localStorage.getItem(key); if (!dataStr) return null; var data = JSON.parse(dataStr); if (data.expire && new Date().getTime() > data.expire) { localStorage.removeItem(key); return null; } return data.value; } }; //获取当前时间点的UTC时间 function getUTCTime() { const now = new Date(); const utcNow = new Date(now.getTime() + now.getTimezoneOffset() * 60000); return utcNow } //小数最后抹零 function handleCutZero(n) { var num = n.toString(); let newstr = num; let leng = num.length - num.indexOf('.') - 1; //判断是否有效数 if (num.indexOf('.') > -1) { //循环小数部分 for (let i = leng; i > 0; i--) { //如果newstr末尾有0 if ( newstr.lastIndexOf('0') > -1 && newstr.substr(newstr.length - 1, 1) == 0 ) { let k = newstr.lastIndexOf('0'); //如果小数点后只有一个0 去掉小数点 if (newstr.charAt(k - 1) == '.') { return newstr.substring(0, k - 1); } else { //否则 去掉一个0 newstr = newstr.substring(0, k); } } else { //如果末尾没有0 return newstr; } } } return num; } function switchShowHide(id) { if (_$(id)) { var target = $("#" + id); if (target.is(':hidden')) { target.show(); } else { target.hide(); } } } function appendUrlParameter(url, paramName, paramValue) { var parser = document.createElement('a'); parser.href = url; var hasParams = parser.search.length > 0; if (hasParams) { var params = new URLSearchParams(parser.search); params.set(paramName, paramValue); parser.search = params.toString(); } else { parser.search = '?' + paramName + '=' + paramValue; } return parser.href; } function appOpenBrowserUrl(url) { return appendUrlParameter(url, "openbrowser", "1"); } function checkPiracy() { if (_mainWebDomain.indexOf(location.hostname) == -1 && location.hostname != 'localhost') { var hasChech = getLocalWithExpire('checkPiracy'); if (CheckEmpty(hasChech)) { let domain = location.host; $.post(`/ajax/AddPiratedDomain`, { domain }, function (result) { if (result != 1) { console.log(currDomain, result); } }) setLocalWithExpire('checkPiracy', 1); } } } function getTvLinkTxtUrl(module) { var txturl = "/gf/tvlive/tvlive_fn_fb.txt?"; switch (module) { case "Vn": txturl = "/gf/tvlive/tvlive_vn_fb.txt?"; break; case "Thai": txturl = "/gf/tvlive/tvlive_th_fb.txt?"; break; case "Ng": case "Bola": txturl = "/gf/tvlive/tvlive_en_fb.txt?"; break; case "Kor": txturl = "/gf/tvlive/tvlive_kr_fb.txt?"; break; } return txturl; } //判断元素是否溢出视口 function isOverflowing(element) { var result = { top: false, right: false, bottom: false, left: false }; var rect = element.getBoundingClientRect(); var width = window.innerWidth || document.documentElement.clientWidth; var height = window.innerHeight || document.documentElement.clientHeight; if (rect.top < 0) result.top = true; if (rect.left < 0) result.left = true; if (rect.bottom > height) result.bottom = true; if (rect.right > width) result.right = true; return result; } LoadDark();; var _oddsType = GetOddType();//赔率类型 var _timeZone = GetTimeZone();//时区 $(function () { document.onclick = checkHide; initSetting(); }); 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 defaultTimeZone = 0 - ((new Date()).getTimezoneOffset()) / 60; var detault = defaultTimeZone;//默认是系统时区 var value = getCookie("Time_Zone"); if (value != null && value != "" && value != undefined && !isNaN(value)) detault = parseFloat(value); writeCookie("Default_TimeZone", detault); return detault; } function initSetting() { var _$selectedOddsType = document.getElementById('selectedOddsType'); var _$oddsType = document.getElementById('oddsType_' + _oddsType); if (_$selectedOddsType && _$oddsType) { _$selectedOddsType.innerText = _$oddsType.innerText; } var _$selectedTimeZone = document.getElementById('selectedTimeZone'); var timeCookie = getCookie("Time_Zone"); if (_$selectedTimeZone && (timeCookie == null || timeCookie=='')) { _$selectedTimeZone.innerText = document.getElementById('timeZone_auto').innerText; return; } var _$timeZone = document.getElementById('timeZone_' + _timeZone); if (_$selectedTimeZone && (_$selectedTimeZone && _$timeZone)) { _$selectedTimeZone.innerText = _$timeZone.innerText; } } function overDropDownBG(obj) { obj.style.backgroundColor = "#226204"; } function leaveDropDownBG(obj) { obj.style.backgroundColor = ""; } 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(); setTimeByFormat(); setPublishTime(); } } function changeTopOddsType(value) { if (_oddsType != value) { document.getElementById('selectedOddsType').innerText = document.getElementById('oddsType_' + value).innerText; _oddsType = parseInt(value); SetOddType(value); changeOddsType(); } } //具体的界面需特殊处理则去写个同名方法覆盖 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.innerText = timeToText(ToLocalTime(tData), TransferTimeType(parseInt(timeFormat))); } } //具体的界面需特殊处理则去写个同名方法覆盖 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; var isEu = o.getAttribute("data-e") == true; o.innerText = oTool.changePL(_oddsType, oData, isEu); } } //显示隐藏时区下拉 function showHideTimeZone(o) { var timeZone = document.getElementById('ddlTimeZone'); var isHide = timeZone.style.display == "none"; if (isHide) { if (document.getElementById('chooseOddsType') != null) document.getElementById('chooseOddsType').className = "Choose-tool"; if (document.getElementById('ddlOddsType') != null) 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; } 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 leagueBlockTip = $("#switchLeagueBlock").find(".pop")[0]; var leagueBlockTipBtn = $("#switchLeagueBlock").find(".btn")[0]; var soccerInpageVersionTip = $("#switchVersion").find(".pop")[0]; var soccerInpageVersionBtn = $("#switchVersion").find(".btn")[0]; var otIsHide = ddlOddsType != null ? ddlOddsType.style.display == "none" : ""; var tzIsHide = ddlTimeZone != null ? ddlTimeZone.style.display == "none" : ""; var wbIsHide = ddlWebSite != null ? ddlWebSite.style.display == "none" : ""; var lbIsHide = leagueBlockTip != null ? leagueBlockTip.style.display == "none" : ""; if (otIsHide && tzIsHide && wbIsHide && lbIsHide) return; var src = e.srcElement; if (src == oddsType || src == timeZone || src == website || src == websiteImg || src == chooseOddsType || src == chooseTimeZone || src == chooseOddsType || src == chooseWebSite || src == leagueBlockTip || src == leagueBlockTipBtn || src == soccerInpageVersionTip || src == soccerInpageVersionBtn || src == src.tagName == "I") return; if (ddlOddsType) ddlOddsType.style.display = "none"; if (ddlTimeZone) ddlTimeZone.style.display = "none"; if (ddlWebSite) ddlWebSite.style.display = "none"; if (leagueBlockTip) { leagueBlockTip.style.display = "none"; writeCookie(_leagueBlock.tipCookie, 1, new Date((new Date()).getTime() + 24 * 3600000)) } if (soccerInpageVersionTip) { soccerInpageVersionTip.style.display = "none"; writeShareCookie(_soccerInpageTipCookie, 1, new Date((new Date()).getTime() + 365 * 24 * 3600000)) } if (chooseOddsType) chooseOddsType.className = "Choose-tool"; if (chooseTimeZone) chooseTimeZone.className = "Choose-tool"; if (chooseWebSite) chooseWebSite.className = "Choose-tool"; var icons = $(".icon-font-becareful"); for (var i = 0; i < icons.length; i++) { var icon = $(icons[i]); if ((!icon.is(e.target) && icon.has(e.target).length === 0 && icon.find(".ext").css("display") != "none")) { icon.find(".ext").hide(); return; } } } //翻新旧关注cookie !(function () { var leaCookie = getCookie("MyGames_LeagueID"); if (leaCookie && leaCookie.indexOf("_") != -1) { var leaIdArr = leaCookie.split("_"); var newLeaCookie = new Array(); leaIdArr.forEach((id) => { if (id) newLeaCookie.push(id); }); document.cookie = "MyGames_LeagueID=;path=/;expires=" + new Date((new Date()).getTime() + -10 * 3600000).toGMTString(); var newLeaCookie2 = getCookie("MyGames_LeagueID") ? "," + getCookie("MyGames_LeagueID") : "";; writeShareCookie("MyGames_LeagueID", newLeaCookie.join(",") + newLeaCookie2 + new Date((new Date()).getTime() + 7 * 24 * 3600000)); } var matchCookie = getCookie("MyGames_MatchID"); if (matchCookie && matchCookie.indexOf("_") != -1) { var matchIdArr = matchCookie.split("_"); var newMatchCookie = new Array(); matchIdArr.forEach((id) => { if (id) newMatchCookie.push(id); }); document.cookie = "MyGames_MatchID=;path=/;expires=" + new Date((new Date()).getTime() + -10 * 3600000).toGMTString(); var newMatchCookie2 = getCookie("MyGames_MatchID") ? "," + getCookie("MyGames_MatchID") : ""; writeShareCookie("MyGames_MatchID", newMatchCookie.join(",") + newMatchCookie2, new Date((new Date()).getTime() + 7 * 24 * 3600000)); } var matchCookie = getCookie("MyNBA_MatchID"); if (matchCookie && matchCookie.indexOf("_") != -1) { var matchIdArr = matchCookie.split("_"); var newMatchCookie = new Array(); matchIdArr.forEach((id) => { if (id) newMatchCookie.push(id); }); document.cookie = "MyNBA_MatchID=;path=/;expires=" + new Date((new Date()).getTime() + -10 * 3600000).toGMTString(); var newMatchCookie2 = getCookie("MyGames_LQ_MatchID") ? "," + getCookie("MyGames_LQ_MatchID") : ""; writeShareCookie("MyGames_LQ_MatchID", newMatchCookie.join(",") + newMatchCookie2, new Date((new Date()).getTime() + 7 * 24 * 3600000)); } })() ; function getBkHdpDetailUrl(sclassId, teamId, matchSeason, halfOrAll) { var url = _basketballWebDomain + "team/handicapdetail?sclassid=" + sclassId + "&teamid=" + teamId + "&matchseason=" + matchSeason + "&halforall=" + halfOrAll; return url; } function getBkOuDetailUrl(sclassId, teamId, matchSeason, halfOrAll) { var url = _basketballWebDomain + "team/ouhandicapdetail?sclassid=" + sclassId + "&teamid=" + teamId + "&matchseason=" + matchSeason + "&halforall=" + halfOrAll; return url; } function getFbTeamUrl(teamId) { var url = _footballWebDomain + "team/summary/" + teamId; return url; } function openFbTeam(teamId) { window.open(getFbTeamUrl(teamId)); } function getFbPanluUrl(scheduleId, companyId) { var url = "/soccer/oddsstats/" + scheduleId; if (typeof (companyId) != "undefined" && companyId != '') url += "?cid=" + companyId; return url; } function openFbPanlu(scheduleId, companyId) { window.open(getFbPanluUrl(scheduleId, companyId),'', 'scrollbars=yes,resizable=yes,width=662, height=650,left=50,top=100'); } function getHistoryCornerUrl(scheduleId) { var url = "/history/corner/" + scheduleId; return url; } function openHistoryCornerUrl(scheduleId) { window.open(getHistoryCornerUrl(scheduleId)); } function getBk2in1OddsUrl(scheduleId,t,cid) { var url = "/2in1odds/" + scheduleId + "?t=" + t; if (cid) { url += "&cid=" + cid; } return url; } function getBkOddsDetail(scheduleId, cid, flag) { var url = "/nba/oddsdetail/" + scheduleId + "?cid=" + cid ; if (flag) { url += "&flag=" + flag; } return url; } function getFb1x2OddsHistory(scheduleId, cid, companyName, r1, r2) { var url = "/1x2/oddshistory/" + scheduleId + "?cid=" + cid + "&company=" + companyName.replaceAll(" ", "").toLowerCase() + "&r1=" + r1.replaceAll(" ", "").toLowerCase() + "&r2=" + r2.replaceAll(" ", "").toLowerCase(); return url; } function getEuroOddsUrl(cid, companyName) { var url = "/football/1x2/?id=" + cid + "&company" + companyName.replace("Mansion88.com", "M88"); return url; } function openTreeMix() { } function getLeaUrl(sclassId, sclassName) { var url = _footballWebDomain + "leagueinfo/" + sclassId ; return url; } function openLeaUrl(sclassId, sclassName) { window.open(getLeaUrl(sclassId, sclassName)); } function getMatchTipsUrl(id) { var url = _cmsWebDomain + "football/match/" + id; return url; } function openMatchTipsUrl(id) { window.open(getMatchTipsUrl(id)); } function getBkLeaUrl(sclassId, sclassName) { var url = _basketballWebDomain + "leagueinfo/" + sclassId; return url; } function openBkLeaUrl(id) { window.open(getBkLeaUrl(id)); } //足球首页初始展示的赛事类型 function GetFilterOption() { return 1; } //赛事排序类型 function GetOrderbyOption() { return "time"; }; /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(this,(function(e){"use strict";var t=(e,t,i,n)=>{let a=65535&e|0,r=e>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{a=a+t[n++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16|0};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var n=(e,t,n,a)=>{const r=i,o=a+n;e^=-1;for(let i=a;i>>8^r[255&(e^t[i])];return-1^e};const a=16209;var r=function(e,t){let i,n,r,o,s,l,d,f,c,h,u,w,b,m,k,_,g,p,v,x,y,E,R,A;const Z=e.state;i=e.next_in,R=e.input,n=i+(e.avail_in-5),r=e.next_out,A=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),l=Z.dmax,d=Z.wsize,f=Z.whave,c=Z.wnext,h=Z.window,u=Z.hold,w=Z.bits,b=Z.lencode,m=Z.distcode,k=(1<>>24,u>>>=p,w-=p,p=g>>>16&255,0===p)A[r++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=b[(65535&g)+(u&(1<>>=p,w-=p),w<15&&(u+=R[i++]<>>24,u>>>=p,w-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=m[(65535&g)+(u&(1<l){e.msg="invalid distance too far back",Z.mode=a;break e}if(u>>>=p,w-=p,p=r-o,x>p){if(p=x-p,p>f&&Z.sane){e.msg="invalid distance too far back",Z.mode=a;break e}if(y=0,E=h,0===c){if(y+=d-p,p2;)A[r++]=E[y++],A[r++]=E[y++],A[r++]=E[y++],v-=3;v&&(A[r++]=E[y++],v>1&&(A[r++]=E[y++]))}else{y=r-x;do{A[r++]=A[y++],A[r++]=A[y++],A[r++]=A[y++],v-=3}while(v>2);v&&(A[r++]=A[y++],v>1&&(A[r++]=A[y++]))}break}}break}}while(i>3,i-=v,w-=v<<3,u&=(1<{const u=h.bits;let w,b,m,k,_,g,p=0,v=0,x=0,y=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=null;const U=new Uint16Array(16),D=new Uint16Array(16);let I,B,N,C=null;for(p=0;p<=o;p++)U[p]=0;for(v=0;v=1&&0===U[y];y--);if(E>y&&(E=y),0===y)return a[r++]=20971520,a[r++]=20971520,h.bits=1,0;for(x=1;x0&&(0===e||1!==y))return-1;for(D[1]=0,p=1;p852||2===e&&S>592)return 1;for(;;){I=p-A,c[v]+1=g?(B=C[c[v]-g],N=O[c[v]-g]):(B=96,N=0),w=1<>A)+b]=I<<24|B<<16|N|0}while(0!==b);for(w=1<>=1;if(0!==w?(T&=w-1,T+=w):T=0,v++,0==--U[p]){if(p===y)break;p=t[i+c[v]]}if(p>E&&(T&k)!==m){for(0===A&&(A=E),_+=x,R=p-A,Z=1<852||2===e&&S>592)return 1;m=T&k,a[m]=E<<24|R<<16|_-r|0}}return 0!==T&&(a[_+T]=p-A<<24|64<<16|0),h.bits=E,0},h={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:u,Z_BLOCK:w,Z_TREES:b,Z_OK:m,Z_STREAM_END:k,Z_NEED_DICT:_,Z_STREAM_ERROR:g,Z_DATA_ERROR:p,Z_MEM_ERROR:v,Z_BUF_ERROR:x,Z_DEFLATED:y}=h,E=16180,R=16190,A=16191,Z=16192,S=16194,T=16199,O=16200,U=16206,D=16209,I=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const N=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},C=e=>{if(N(e))return g;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=E,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,m},z=e=>{if(N(e))return g;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,C(e)},F=(e,t)=>{let i;if(N(e))return g;const n=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?g:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,z(e))},L=(e,t)=>{if(!e)return g;const i=new B;e.state=i,i.strm=e,i.window=null,i.mode=E;const n=F(e,t);return n!==m&&(e.state=null),n};let M,H,j=!0;const K=e=>{if(j){M=new Int32Array(512),H=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(c(1,e.lens,0,288,M,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;c(2,e.lens,0,32,H,0,e.work,{bits:5}),j=!1}e.lencode=M,e.lenbits=9,e.distcode=H,e.distbits=5},P=(e,t,i,n)=>{let a;const r=e.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>n&&(a=n),r.window.set(t.subarray(i-n,i-n+a),r.wnext),(n-=a)?(r.window.set(t.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whaveL(e,15),inflateInit2:L,inflate:(e,i)=>{let a,o,s,l,d,f,h,B,C,z,F,L,M,H,j,Y,G,X,W,q,J,Q,V=0;const $=new Uint8Array(4);let ee,te;const ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(N(e)||!e.output||!e.input&&0!==e.avail_in)return g;a=e.state,a.mode===A&&(a.mode=Z),d=e.next_out,s=e.output,h=e.avail_out,l=e.next_in,o=e.input,f=e.avail_in,B=a.hold,C=a.bits,z=f,F=h,Q=m;e:for(;;)switch(a.mode){case E:if(0===a.wrap){a.mode=Z;break}for(;C<16;){if(0===f)break e;f--,B+=o[l++]<>>8&255,a.check=n(a.check,$,2,0),B=0,C=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&B)<<8)+(B>>8))%31){e.msg="incorrect header check",a.mode=D;break}if((15&B)!==y){e.msg="unknown compression method",a.mode=D;break}if(B>>>=4,C-=4,J=8+(15&B),0===a.wbits&&(a.wbits=J),J>15||J>a.wbits){e.msg="invalid window size",a.mode=D;break}a.dmax=1<>8&1),512&a.flags&&4&a.wrap&&($[0]=255&B,$[1]=B>>>8&255,a.check=n(a.check,$,2,0)),B=0,C=0,a.mode=16182;case 16182:for(;C<32;){if(0===f)break e;f--,B+=o[l++]<>>8&255,$[2]=B>>>16&255,$[3]=B>>>24&255,a.check=n(a.check,$,4,0)),B=0,C=0,a.mode=16183;case 16183:for(;C<16;){if(0===f)break e;f--,B+=o[l++]<>8),512&a.flags&&4&a.wrap&&($[0]=255&B,$[1]=B>>>8&255,a.check=n(a.check,$,2,0)),B=0,C=0,a.mode=16184;case 16184:if(1024&a.flags){for(;C<16;){if(0===f)break e;f--,B+=o[l++]<>>8&255,a.check=n(a.check,$,2,0)),B=0,C=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(L=a.length,L>f&&(L=f),L&&(a.head&&(J=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(o.subarray(l,l+L),J)),512&a.flags&&4&a.wrap&&(a.check=n(a.check,o,L,l)),f-=L,l+=L,a.length-=L),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===f)break e;L=0;do{J=o[l+L++],a.head&&J&&a.length<65536&&(a.head.name+=String.fromCharCode(J))}while(J&&L>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=A;break;case 16189:for(;C<32;){if(0===f)break e;f--,B+=o[l++]<>>=7&C,C-=7&C,a.mode=U;break}for(;C<3;){if(0===f)break e;f--,B+=o[l++]<>>=1,C-=1,3&B){case 0:a.mode=16193;break;case 1:if(K(a),a.mode=T,i===b){B>>>=2,C-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=D}B>>>=2,C-=2;break;case 16193:for(B>>>=7&C,C-=7&C;C<32;){if(0===f)break e;f--,B+=o[l++]<>>16^65535)){e.msg="invalid stored block lengths",a.mode=D;break}if(a.length=65535&B,B=0,C=0,a.mode=S,i===b)break e;case S:a.mode=16195;case 16195:if(L=a.length,L){if(L>f&&(L=f),L>h&&(L=h),0===L)break e;s.set(o.subarray(l,l+L),d),f-=L,l+=L,h-=L,d+=L,a.length-=L;break}a.mode=A;break;case 16196:for(;C<14;){if(0===f)break e;f--,B+=o[l++]<>>=5,C-=5,a.ndist=1+(31&B),B>>>=5,C-=5,a.ncode=4+(15&B),B>>>=4,C-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=D;break}a.have=0,a.mode=16197;case 16197:for(;a.have>>=3,C-=3}for(;a.have<19;)a.lens[ie[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,ee={bits:a.lenbits},Q=c(0,a.lens,0,19,a.lencode,0,a.work,ee),a.lenbits=ee.bits,Q){e.msg="invalid code lengths set",a.mode=D;break}a.have=0,a.mode=16198;case 16198:for(;a.have>>24,Y=V>>>16&255,G=65535&V,!(j<=C);){if(0===f)break e;f--,B+=o[l++]<>>=j,C-=j,a.lens[a.have++]=G;else{if(16===G){for(te=j+2;C>>=j,C-=j,0===a.have){e.msg="invalid bit length repeat",a.mode=D;break}J=a.lens[a.have-1],L=3+(3&B),B>>>=2,C-=2}else if(17===G){for(te=j+3;C>>=j,C-=j,J=0,L=3+(7&B),B>>>=3,C-=3}else{for(te=j+7;C>>=j,C-=j,J=0,L=11+(127&B),B>>>=7,C-=7}if(a.have+L>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=D;break}for(;L--;)a.lens[a.have++]=J}}if(a.mode===D)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=D;break}if(a.lenbits=9,ee={bits:a.lenbits},Q=c(1,a.lens,0,a.nlen,a.lencode,0,a.work,ee),a.lenbits=ee.bits,Q){e.msg="invalid literal/lengths set",a.mode=D;break}if(a.distbits=6,a.distcode=a.distdyn,ee={bits:a.distbits},Q=c(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,ee),a.distbits=ee.bits,Q){e.msg="invalid distances set",a.mode=D;break}if(a.mode=T,i===b)break e;case T:a.mode=O;case O:if(f>=6&&h>=258){e.next_out=d,e.avail_out=h,e.next_in=l,e.avail_in=f,a.hold=B,a.bits=C,r(e,F),d=e.next_out,s=e.output,h=e.avail_out,l=e.next_in,o=e.input,f=e.avail_in,B=a.hold,C=a.bits,a.mode===A&&(a.back=-1);break}for(a.back=0;V=a.lencode[B&(1<>>24,Y=V>>>16&255,G=65535&V,!(j<=C);){if(0===f)break e;f--,B+=o[l++]<>X)],j=V>>>24,Y=V>>>16&255,G=65535&V,!(X+j<=C);){if(0===f)break e;f--,B+=o[l++]<>>=X,C-=X,a.back+=X}if(B>>>=j,C-=j,a.back+=j,a.length=G,0===Y){a.mode=16205;break}if(32&Y){a.back=-1,a.mode=A;break}if(64&Y){e.msg="invalid literal/length code",a.mode=D;break}a.extra=15&Y,a.mode=16201;case 16201:if(a.extra){for(te=a.extra;C>>=a.extra,C-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;V=a.distcode[B&(1<>>24,Y=V>>>16&255,G=65535&V,!(j<=C);){if(0===f)break e;f--,B+=o[l++]<>X)],j=V>>>24,Y=V>>>16&255,G=65535&V,!(X+j<=C);){if(0===f)break e;f--,B+=o[l++]<>>=X,C-=X,a.back+=X}if(B>>>=j,C-=j,a.back+=j,64&Y){e.msg="invalid distance code",a.mode=D;break}a.offset=G,a.extra=15&Y,a.mode=16203;case 16203:if(a.extra){for(te=a.extra;C>>=a.extra,C-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=D;break}a.mode=16204;case 16204:if(0===h)break e;if(L=F-h,a.offset>L){if(L=a.offset-L,L>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=D;break}L>a.wnext?(L-=a.wnext,M=a.wsize-L):M=a.wnext-L,L>a.length&&(L=a.length),H=a.window}else H=s,M=d-a.offset,L=a.length;L>h&&(L=h),h-=L,a.length-=L;do{s[d++]=H[M++]}while(--L);0===a.length&&(a.mode=O);break;case 16205:if(0===h)break e;s[d++]=a.length,h--,a.mode=O;break;case U:if(a.wrap){for(;C<32;){if(0===f)break e;f--,B|=o[l++]<{if(N(e))return g;let t=e.state;return t.window&&(t.window=null),e.state=null,m},inflateGetHeader:(e,t)=>{if(N(e))return g;const i=e.state;return 0==(2&i.wrap)?g:(i.head=t,t.done=!1,m)},inflateSetDictionary:(e,i)=>{const n=i.length;let a,r,o;return N(e)?g:(a=e.state,0!==a.wrap&&a.mode!==R?g:a.mode===R&&(r=1,r=t(r,i,n,0),r!==a.check)?p:(o=P(e,i,n,n),o?(a.mode=16210,v):(a.havedict=1,m)))},inflateInfo:"pako inflate (from Nodeca project)"};const G=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var X=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)G(i,t)&&(e[t]=i[t])}}return e},W=e=>{let t=0;for(let i=0,n=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;J[254]=J[254]=1;var Q=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,n,a,r,o=e.length,s=0;for(a=0;a>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t},V=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,a;const r=new Array(2*i);for(a=0,n=0;n4)r[a++]=65533,n+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&n1?r[a++]=65533:t<65536?r[a++]=t:(t-=65536,r[a++]=55296|t>>10&1023,r[a++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&q)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let n=0;n{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+J[e[i]]>t?i:t},ee={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};var te=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};var ie=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const ne=Object.prototype.toString,{Z_NO_FLUSH:ae,Z_FINISH:re,Z_OK:oe,Z_STREAM_END:se,Z_NEED_DICT:le,Z_STREAM_ERROR:de,Z_DATA_ERROR:fe,Z_MEM_ERROR:ce}=h;function he(e){this.options=X({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new te,this.strm.avail_out=0;let i=Y.inflateInit2(this.strm,t.windowBits);if(i!==oe)throw new Error(ee[i]);if(this.header=new ie,Y.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Q(t.dictionary):"[object ArrayBuffer]"===ne.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Y.inflateSetDictionary(this.strm,t.dictionary),i!==oe)))throw new Error(ee[i])}function ue(e,t){const i=new he(t);if(i.push(e),i.err)throw i.msg||ee[i.err];return i.result}he.prototype.push=function(e,t){const i=this.strm,n=this.options.chunkSize,a=this.options.dictionary;let r,o,s;if(this.ended)return!1;for(o=t===~~t?t:!0===t?re:ae,"[object ArrayBuffer]"===ne.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=Y.inflate(i,o),r===le&&a&&(r=Y.inflateSetDictionary(i,a),r===oe?r=Y.inflate(i,o):r===fe&&(r=le));i.avail_in>0&&r===se&&i.state.wrap>0&&0!==e[i.next_in];)Y.inflateReset(i),r=Y.inflate(i,o);switch(r){case de:case fe:case le:case ce:return this.onEnd(r),this.ended=!0,!1}if(s=i.avail_out,i.next_out&&(0===i.avail_out||r===se))if("string"===this.options.to){let e=$(i.output,i.next_out),t=i.next_out-e,a=V(i.output,e);i.next_out=t,i.avail_out=n-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(a)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==oe||0!==s){if(r===se)return r=Y.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},he.prototype.onData=function(e){this.chunks.push(e)},he.prototype.onEnd=function(e){e===oe&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=W(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var we=he,be=ue,me=function(e,t){return(t=t||{}).raw=!0,ue(e,t)},ke=ue,_e=h,ge={Inflate:we,inflate:be,inflateRaw:me,ungzip:ke,constants:_e};e.Inflate=we,e.constants=_e,e.default=ge,e.inflate=be,e.inflateRaw=me,e.ungzip=ke,Object.defineProperty(e,"__esModule",{value:!0})})); ; var wsUtil = { //wsUrl: `ws://${_wsUrl}/stream?channels={0}`, //测试 wsUrl: `wss://${_wsUrl}/stream?channels={0}&&token={1}`, token: "", socket: null, wsIntervalId: null, wstimeout: 5000, wstimer: null, tokenCacheKey : "WebSocketToken", channels: null, wsHandler: function () { }, //收到通知及数据后回调处理 startHandler: function () { }, //ws异常,启用轮询 stopHandler: function () { }, //ws恢复,停止轮询 getToken: function () { return new Promise((resolve, reject) => { var cacheToken = ''; if (Storage.enableLocal) { cacheToken = Storage.getLocalWithExpire(wsUtil.tokenCacheKey); } if (cacheToken != null && cacheToken != "") { resolve(cacheToken); } else { $.get("/ajax/getwebsockettoken?rnum=" + Math.random(), function (result) { if (result) { if (Storage.enableLocal) { Storage.setLocalWithExpire(wsUtil.tokenCacheKey, result, 1); } resolve(result) } else { reject("getTokn fail!") } }) } }) }, connectWs: function (channels, wsHandler, startHandler, stopHandler) { if (channels) this.channels = channels; if (wsHandler) this.wsHandler = wsHandler; if (startHandler) this.startHandler = startHandler; if (stopHandler) this.stopHandler = stopHandler; if (this.token == "") { this.getToken().then(data => { //console.log("获取token") this.token = data; this.createWs() }) } else { this.createWs() } }, createWs: function () { var self = this; if (this.socket == null || this.socket.readyState != WebSocket.OPEN || this.socket.readyState != WebSocket.CONNECTING) { var url = this.wsUrl.replace("{0}", encodeURIComponent(this.channels.join(','))).replace("{1}", this.token); this.socket = new WebSocket(url); this.wstimer = setTimeout(() => { self.socket.close(); console.log("ws timeout"); }, this.wstimeout) this.socket.onmessage = function (event) { var data = event.data; if (data == "ok") return; let reader = new FileReader(); reader.readAsArrayBuffer(data, "utf-8"); reader.onload = function () { var json = JSON.parse(pako.inflate(reader.result, { to: "string" })); if (json != undefined) { self.wsHandler(json) } } } this.socket.onopen = function (event) { if (self.wstimer) clearTimeout(self.wstimer) console.log("ws open"); self.updateState(); } this.socket.onclose = function (event) { if (self.wstimer) clearTimeout(self.wstimer) console.log("ws close"); self.token = ""; //token失效 self.updateState(); } this.socket.onerror = function (event) { if (self.wstimer) clearTimeout(self.wstimer) console.log("ws error"); } } }, updateState: function () { var self = this; function disable() { self.startHandler(); if (!self.wsIntervalId) { self.wsIntervalId = setInterval(() => { self.connectWs() }, 30 * 1000) //写成箭头函数,否则this指向不明确 } } function enable() { self.stopHandler(); if (self.wsIntervalId) { clearInterval(self.wsIntervalId); self.wsIntervalId = null; } } if (!this.socket) { disable(); } else { switch (this.socket.readyState) { case WebSocket.CLOSED: disable(); //console.log("WebSocket已关闭"); break; case WebSocket.CLOSING: disable(); //console.log("WS关闭中..."); break; case WebSocket.CONNECTING: disable(); //console.log("WebSocket连接中..."); break; case WebSocket.OPEN: enable(); //console.log("WebSocket已打开"); break; default: disable(); //console.log("未知 WebSocket 状态: ",socket.readyState); break; } } }, changeChannel: function (channels) { //切换订阅的频道 this.channels = channels; if (!this.socket || this.socket.readyState !== WebSocket.OPEN) { console.log("socket not connected"); return } var data = { type: 0, channels: channels } //发送给服务端的数据格式:{"type":0,"channels":["zqlivechange","lqlivechange","change_xml","change2_xml","nba_xml"]} this.socket.send(JSON.stringify(data)); }, closeWs: function (data) { this.socket.close(); } };