var filter = { state: 0, middleague:new Array(), league: new Array(), country: new Array(), odds: new Array(), condition:"" }; //用于确定筛选
var tmpfilter = { state: 0, league: new Array(), country: new Array(), odds: new Array(), condition: "" }; //用于计算筛选数
var isLeftInit = 0;
var leagueSIndex = _leagueNameIdx, leagueLIndex = 7;
var countryIndex = 23;
var isFromSch = false;
var FbMatchTimeKey = "FootBallMatchTimeKey";
var FbFilterKey = "FootBallFilterKey";
var FbFilterTypeKey = "FootBallFilterTypeKey";
var minMatchTime = 0;
function InitIndexNum() {
if (typeof (isResult) != "undefined" && isResult) {
FbMatchTimeKey = "FootBallMatchTimeKey_R";
FbFilterKey = "FootBallFilterKey_R";
FbFilterTypeKey = "FootBallFilterTypeKey_R";
}
else if (typeof (isSchedule) != "undefined" && isSchedule) {
leagueSIndex = 2;
leagueLIndex = 8;
countryIndex = 20;
isFromSch = true;
FbMatchTimeKey = "FootBallMatchTimeKey_2";
FbFilterKey = "FootBallFilterKey_2";
FbFilterTypeKey = "FootBallFilterTypeKey_2";
}
}
// 点取消后按原来的筛选恢复选择
function SelectReset(type) {
SelectAll(1);
SelectAll(2);
//SelectAll(3);
//ClearOddsSelect();
if (filter != null) {
$("input:radio[name='selectType'][value='0']").prop("checked", true);
$("input:radio[name='selectType2'][value='0']").prop("checked", true);
if (type == 1) $('[id^=countryContent_]').show();
if (type == 2) $('[id^=leaguesContent_]').show();
if (filter.state != 0 && type == 1) {
$("input:radio[name='selectType'][value='" + filter.state + "']").prop("checked", true);
} else if (filter.state != 0 && type == 2) {
$("input:radio[name='selectType2'][value='" + filter.state + "']").prop("checked", true);
}
if (type == 1 && filter.league != null && filter.league.length > 0) {
for (var i = 0; i < filter.league.length; i++) {
if (document.getElementById("myleague_" + filter.league[i])) document.getElementById("myleague_" + filter.league[i]).checked = false;
}
leagueFilterCount();
}
if (type == 2 && filter.country != null && filter.country.length > 0) {
for (var i = 0; i < filter.country.length; i++) {
if (document.getElementById("mycountry_" + filter.country[i])) document.getElementById("mycountry_" + filter.country[i]).checked = false;
}
}
if (type == 3) {
//如果当前筛选是赔率,则恢复
if (filter.odds != null && filter.odds.length > 0) {
ClearOddsSelect();
for (var i = 0; i < filter.odds.length; i++) {
$("input:checkbox[name='filterOdds'][value='" + filter.odds[i] + "']").prop("checked", true);
}
} else {
//如果不是,则全选
$("input:checkbox[name='filterOdds']").prop("checked", true);
}
}
if (type == 4) {
$("input:radio[name='filterCid']").prop("checked", false);
if (filter.condition != null && filter.condition != "") {
getCondition();
} else {
if (document.getElementById("conditionNum"))document.getElementById("conditionNum").innerHTML = 0;
}
}
if (type < 3) HideByState();
if (type > 2) {
$('[id^=countryContent_]').show();
$('[id^=leaguesContent_]').show();
if (_leaSortting && !isFromSch) {
SyncLeaSorting(0);
/*SyncLeaSorting(1);*/
}
}
}
}
//选择赛事状态时隐藏没有的联赛或国家
function HideByState(type) {
if ($('input[name="selectType"]')[0] && _$("myleague2").innerHTML != "") {
fillMiddleLeague();
$('[id^=leaguesContent_]').hide();
var filterState = type == undefined ? $('input[name="selectType"]:checked').val() : type;
FilterType = filterState;
if (filterState == 0) {
$("[id^=lcGu_]").show();
$('[id^=leaguesContent_]').show();
$("span[id^=numtip_]").show();
$("span[id^=numtip2_]").hide();
} else {
var num = 0;
var matchState = 0;
var showed = false;
for (var i = 1; i <= matchcount; i++) {
//状态过滤
matchState = parseInt(A[i][8]);
if (filterState == 1 && matchState > 0 || filterState == 2 && matchState == -1 || filterState == 3 && matchState == 0 || filterState == 4 && A[i][20] == "True") {
var leaId = B[A[i][1]][0];
showed = $('#leaguesContent_' + leaId)[0].style.display != "none";
if (showed) {
num = parseInt($("#numtip2_" + leaId)[0].getAttribute("num")) + 1;
$("#numtip2_" + leaId).attr("num", num);
$("#numtip2_" + leaId).html("[" + num + "]");
} else {
$('#leaguesContent_' + leaId).show();
$("#numtip2_" + leaId).attr("num", 1);
$("#numtip2_" + leaId).html("[" + 1 + "]");
$("#numtip2_" + leaId).show();
$("#numtip_" + leaId).hide();
}
}
}
}
leagueFilterCount();
displayCountryTitle();
}
}
function SyncLeaSorting(sortBy) {
if (_leaSortting) {
var id = sortBy == 1 ? "countryListDiv" : "myleague2";
var myLea = document.getElementById(id);
var uls = myLea.getElementsByTagName("ul");
for (var i = 0; i < uls.length; i++) {
var groupId = uls[i].getAttribute("name");
var ulId = uls[i].id;
var lis = uls[i].getElementsByTagName("li");
var counter = 0;
for (var j = 0; j < lis.length; j++) {
if (lis[j].style.display != "none")
counter++;
}
if (document.getElementById(groupId))document.getElementById(groupId).style.display = (counter == 0 ? "none" : "");
if (document.getElementById(ulId))document.getElementById(ulId).style.display = (counter == 0 ? "none" : "");
}
leagueFilterCount();
firstCodeMenu();
}
}
//按照选择进行过滤
function DoFilter(type) {
//清空旧选择
filter.league = new Array();
filter.country = new Array();
filter.odds = new Array();
filter.state = 0;
filter.condition = "";
var countryFilter = new Array();
var oddsFilter = new Array();
var conditionIdList = "";
// 隐藏无赛事提示
if ($("#noMatchTip")[0]) {
$("#noMatchTip").html("");
}
if (type == 1) {
//if ($('input:checkbox[name=filterLea]:checked').length == 0) {
// alert('No Match Data.');
// return;
//}
filter.state = $('input[name="selectType"]:checked').val();
$('input:checkbox[name=filterLea]:not(:checked)').each(function () {
filter.league.push($(this).val());
});
SelectReset(1);
SelectAll(2);
SelectAll(3);
SelectAll(4);
if (filter.league.length > 0) {
$("input:radio[name='filterCid']").prop("checked", false);
}
filter.middleague = filter.league.concat();
}
if (type == 2) {
//if ($('input:checkbox[name=filterCoun]:checked').length == 0) {
// alert('No Match Data.');
// return;
//}
filter.state = $('input[name="selectType2"]:checked').val();
$('input:checkbox[name=filterCoun]:not(:checked)').each(function () {
filter.country.push($(this).val());
countryFilter.push(C[$(this).val()][0]);
});
SelectReset(2);
SelectAll(1);
SelectAll(3);
SelectAll(4);
if (filter.country.length > 0) {
$("input:radio[name='filterCid']").prop("checked", false);
}
}
if (type == 3) {
//if ($('input:checkbox[name=filterOdds]:checked').length == 0) {
// alert('No Match Data.');
// return;
//}
$('input:checkbox[name=filterOdds]:checked').each(function () {
filter.odds.push($(this).val());
});
var odds = filter.odds;
if (odds != null && odds.length > 0) {
for (var k = 0; k < odds.length; k++) {
var otype = odds[k].split('_')[0];
var ovalue = odds[k].split('_')[1];
var arrLoc = otype == "h" ? hsLetGoal.items(ovalue).split(',') : hsBigSmallGoal.items(ovalue).split(',');
if (arrLoc != null) {
for (var j = 0; j < arrLoc.length; j++) {
if (oddsFilter.indexOf(arrLoc[j]) == -1) {
oddsFilter.push(arrLoc[j]);
}
}
}
}
}
SelectReset(4);
}
if (type == 4) {
filter.condition = $('input[name="filterCid"]:checked').val();
SelectReset(3);
if (!CheckEmpty(filter.condition) && !CheckEmpty(hsCondition)) conditionIdList = hsCondition.items(filter.condition);
else return;
}
var i, j;
var hh = 0;
//先全部隐藏,按过滤器内容放出
var trs = document.getElementById("table_live").getElementsByTagName("tr");
for (var i = 1; i < trs.length; i++) {
if (trs[i].getAttribute("index") != null) {
trs[i].style.display = "none";
if (trs[i + 1]) trs[i + 1].style.display = "none";
if (!isFromSch && trs[i + 2]) trs[i + 2].style.display = "none";
}
}
if (orderby == "league") {
if ($('.Leaguestitle')) $('.Leaguestitle').hide();
}
for (var i = 1; i <= matchcount; i++) {
var isShow = true;
//热门过滤
//if (B[A[i][1]][4] == 0) {
// if (type == 4 && B[A[i][1]][4] == 0) isShow = false;
//}
//状态过滤
if (filter.state == 1 && parseInt(A[i][8]) <= 0 || filter.state == 2 && A[i][8] != "-1" || filter.state == 3 && A[i][8] != "0" || filter.state == 4 && A[i][20] != "True") {
isShow = false;
}
//联赛过滤
if (type == 1 && isShow) {
if (filter.league != null && filter.league.length > 0) {
if (filter.league.indexOf(B[A[i][1]][0].toString()) != -1) isShow = false;
}
}
//国家过滤
if (type == 2 && isShow) {
if (countryFilter != null && countryFilter.length > 0) {
if (countryFilter.indexOf(A[i][countryIndex]) != -1) isShow = false;
}
}
//赔率过滤
if (type == 3 && isShow) {
if (oddsFilter != null && oddsFilter.length > 0) {
if (oddsFilter.indexOf(i.toString()) == -1) isShow = false;
} else {
isShow = false;
}
}
//条件过滤
if (type == 4 && isShow) {
if (conditionIdList != null && conditionIdList != "") {
if (conditionIdList.indexOf(A[i][0]) == -1) isShow = false;
}
}
if (isShow) {
var elem = null;
elem = document.getElementById("tr1_" + A[i][0]);
if (elem) elem.style.display = "";
elem = document.getElementById("tr2_" + A[i][0]);
if (elem) {
if ((typeof (_showRemark) != "undefined" && _showRemark) && (!isFromSch && hasExplain(i)) || (isFromSch && (A[i][19] != "" || A[i][21] != ""))) {
elem.style.display = "";
} else {
elem.style.display = "none";
}
}
if (orderby == "league" && document.getElementById("tr_" + A[i][1])) document.getElementById("tr_" + A[i][1]).style.display = "";
}
else
hh = hh + 1;
}
if (document.getElementById("hiddencount"))document.getElementById("hiddencount").innerHTML = hh;
SyncMatchClass();
if (typeof HandleDateTitle != "undefined" && HandleDateTitle instanceof Function) HandleDateTitle();
if (typeof InitFlashShow != "undefined" && InitFlashShow instanceof Function) InitFlashShow();
if (document.getElementById("topLine")) {
if (matchcount > 0 && matchcount == hh) {
$("#topLine").show();
} else {
$("#topLine").hide();
}
if (typeof (HandleTitle) == "function") HandleTitle();
}
if (typeof (reorderAd) == "function") reorderAd();
if (type > 0 && type < 5) {
SetFilterCookie(type);
if (typeof (FilterOptionType) != "undefined") FilterOptionType = 0;
writeCookie(FilterCacheKey, 0);
}
if (typeof (InitTipsNum) != "undefined") InitTipsNum();
if (typeof (InitHeadShow) != "undefined") InitHeadShow();
if (typeof (isSchedule) == "undefined") hideResultTr();
if (typeof InitGroupTitleDisplay == "function") InitGroupTitleDisplay();
if (typeof reorderNotice == "function") reorderNotice();
}
// 联赛\国家 反选
function SelectOthers(type) {
if (type == 1) {
var inputs = document.getElementById("myleague2").getElementsByTagName("input");
filter.middleague = new Array();
for (var i = 1; i <= sclasscount; i++) {
//if (Bf_simply_disp && B[i][4] == 0) continue;
var obj = document.getElementById("myleague_" + B[i][0]);
if (typeof (obj) == "undefined" || obj == null || (i > 1 && B[i][0] == B[i - 1][0]))
continue;
obj.checked = !obj.checked;
if (!obj.checked) filter.middleague.push(B[i][0].toString());
}
leagueFilterCount();
//CountFilter(1);
} else if (type == 2) {
var inputs = document.getElementById("countryListDiv").getElementsByTagName("input");
if (C != undefined && C != null && C.length > 0) {
for (var i = 0; i < C.length; i++) {
var obj = document.getElementById("mycountry_" + i);
if (typeof (obj) == "undefined" || obj == null) continue;
obj.checked = !obj.checked;
}
}
//CountFilter(2);
} else if (type == 3) {
var inputs = document.getElementById("goalTable").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
var obj = document.getElementById("myodds_" + i);
if (typeof (obj) == "undefined" || obj == null) continue;
obj.checked = !obj.checked;
}
OddsFilterCount();
//CountFilter(3);
}
}
// 联赛\国家 全选
function SelectAll(type) {
var i, j, inputs;
if (type == 4) {
//赛程页没有赔率筛选弹窗
if (document.getElementById("filterList") == null) return;
//赔率连胜筛选初始状态是清空,不是全选,特殊处理
inputs = document.getElementById("filterList").getElementsByTagName("input");
for (var j = 0; j < inputs.length; j++)
inputs[j].checked = false;
_$("conditionNum").innerHTML = "0";
return;
} else if (type == 1) {
if (document.getElementById("myleague2") == null) return;
inputs = document.getElementById("myleague2").getElementsByTagName("input");
filter.middleague = new Array();
}
else if (type == 2) {
if (document.getElementById("countryListDiv") == null) return;
inputs = document.getElementById("countryListDiv").getElementsByTagName("input");
} else if (type == 3) {
//赛程页没有赔率筛选弹窗
if (document.getElementById("goalTable") == null) return;
inputs = document.getElementById("goalTable").getElementsByTagName("input");
}
for (var i = 0; i < inputs.length; i++)
inputs[i].checked = true;
if (type == 1) {
leagueFilterCount();
} else if (type == 3) {
OddsFilterCount();
}
//CountFilter(type);
}
//勾选热门联赛
function SelectHotLeague() {
if (_$("myleague2")) {
filter.league = new Array();
filter.middleague = new Array();
var checkboxs = _$("myleague2").getElementsByTagName("input");
for (var i = 0; i < checkboxs.length; i++) {
if (checkboxs[i].hasAttribute("hot")) {
checkboxs[i].checked = true;
} else {
checkboxs[i].checked = false;
filter.league.push(checkboxs[i].value);
filter.middleague.push(checkboxs[i].value);
}
}
HideByState();
leagueFilterCount();
displayCountryTitle();
}
}
function InitAllOption() {
SelectAll(1);
SelectAll(2);
SelectAll(3);
SelectAll(4);
HideByState();
if (_leaSortting && !isFromSch) {
SyncLeaSorting(0);
/*SyncLeaSorting(1);*/
}
}
function InitHotOption() {
SelectHotLeague();
SelectAll(3);
HideByState();
if (_leaSortting && !isFromSch) {
SyncLeaSorting(0);
}
}
//清除赔率选项
function ClearOddsSelect() {
var inputs;
if (document.getElementById("goalTable")) {
inputs = document.getElementById("goalTable").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++)
inputs[i].checked = false;
}
}
// 联赛选项生成
function MakeSclass() {
InitIndexNum();
var leaguehtml = new Array();
leaguehtml.push("
');
isShow = (A[n][29] == 1 && matchState != 0);
if (A[n][27]) isShow = true;
var cornerIsShow = (isShow ? "" : "none");
beginHeight += (isShow ? 44 : 0);
html.push('
');
html.push("
" + _locModel.T.T_TIL_CornerDetail + "
");
html.push('
');
html.push('');
html.push('
');
html.push('| ' + (typeof (arrCornerCount[0]) == "undefined" ? A[n][27] : arrCornerCount[0]) + ' | ');
html.push('' + _locModel.T.T_FullTime + ' | ');
html.push('' + (typeof (arrCornerCount[1]) == "undefined" ? A[n][28] : arrCornerCount[1]) + ' | ');
html.push('
');
html.push('');
html.push('| ' + (typeof (arrCornerCount[2]) == "undefined" ? " " : arrCornerCount[2]) + ' | ');
html.push('' + _locModel.T.T_HalfTime + ' | ');
html.push('' + (typeof (arrCornerCount[3]) == "undefined" ? " " : arrCornerCount[3]) + ' | ');
html.push('
');
html.push("
");
var obj = document.getElementById('sbOddsCorner');
var pos = getElementPos("sound");
//var contentHeight = (goalIsShow == "none" && cornerIsShow == "none" ? 0 : beginHeight + (arrDetail != null && arrDetail[0] != "" ? arrDetail.length * 18 : 0));
obj.style.left = (document.body.clientWidth / 2 - 220) + "px";
var scrollTop = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
if (scrollTop == 0) {
if (pos.y - event.clientY < 260)
obj.style.top = (event.clientY - obj.clientHeight) + "px";
else if (event.clientY - 240 <= 0) {
obj.style.top = event.clientY + "px";
}
else obj.style.top = (event.clientY - obj.clientHeight) + "px";
}
else {
if (event.clientY < obj.clientHeight)
obj.style.top = (scrollTop + event.clientY) + "px";
else
obj.style.top = (scrollTop + event.clientY - obj.clientHeight) + "px";
}
obj.style.width = "400px";
if (goalIsShow == "none" && cornerIsShow == "none") {
obj.style.width = "180px";
html = [];
html.push("
| " + _locModel.T.T_PH_NoCornerData + " |
");
obj.style.left = (document.body.clientWidth / 2 + 20) + "px"
}
obj.innerHTML = html.join("");
document.getElementById("ifShowCorner").value = 1;
MM_showHideLayers('sbOddsCorner', '', 'show');
showCornerCont++;
}
// odds window
function changeData(odds) {
if (typeof (odds) == "undefined" || odds == "")
return "";
var tmp = odds;
var arrd = odds.toString().split(".");
if (arrd.length > 1) {
if (arrd[1].length == 1)
tmp = tmp + "0";
}
else
tmp = tmp + ".00";
return tmp;
}
function getStrDiv(odds1, odds2) {
if (typeof (odds1) == "undefined" || odds1 + "" == "")
return "";
var retVal;
var tmp = changeData(odds1);
if (parseFloat(odds1) > parseFloat(odds2))
retVal = '
' + tmp + '
';
else if (parseFloat(odds1) < parseFloat(odds2))
retVal = '
' + tmp + '
';
else
retVal = tmp;
return retVal;
}
function getStrDiv2(goal1, goal2, t) {
if (typeof (goal1) == "undefined" || goal1 + "" == "")
return "";
var tmp = "", retVal;
if (t == 1) tmp = Goal2GoalCn(goal1);
else tmp = Goal2GoalCn(goal1);
if (parseFloat(goal1) != parseFloat(goal2))
retVal = '
' + tmp + '
';
else
retVal = tmp;
return retVal;
}
function SelectMenu(menuId) {
$('#li_ShowAll').removeClass('on');
$('#li_FilterHot').removeClass('on');
//$('#li_MyGame').removeClass('on');
$('.filterLi').removeClass('on');
$('#' + menuId).addClass('on');
var selOption = 0;
if (menuId == 'li_FilterHot') selOption = 1;
else if (menuId == 'li_MyGame') selOption = 8;
selectMenu = selOption;
sessionStorage.setItem("SelectMenu", selOption);
}
//统计当前隐藏数
function CountHidden() {
var show = 0;
var trs = document.getElementById("table_live").getElementsByTagName("tr");
for (var i = 1; i < trs.length; i++) {
if (trs[i].getAttribute("index") != null) {
if (trs[i].style.display != "none") show++;
}
}
document.getElementById("hiddencount").innerHTML = matchcount - show;
}
if (Bf_simply_disp) {
document.getElementById("ShowAllSel").getElementsByTagName("option")[1].selected = true;
}
function getTipsList() {
$.get("/ajax/GetTipsCount", result => {
var list = JSON.parse(result);
if (list == null) return;
for (let i = 0; i < list.length; i++) {
let { id, topicCount } = list[i]
let index = $(`#tr1_${id}`).attr("index")
if (!index) continue;
let state = A[index][8]
if (state == 0 && topicCount > 0) {
$(`#score_${id}`).html(`
${topicCount}
` + _locModel.T.T_Sub_Tips + `
`)
//$(`#score_${id}`).html(`
${topicCount + " " + _locModel.T.T_Sub_Tips}`)
}
}
})
}
function toMatch(index) {
cancelBubble()
let mid = A[index][0]
var hTeam = escapeChar(skipHtmlTagBoth(A[index][4]));
var gTeam = escapeChar(skipHtmlTagBoth(A[index][5]));
let leagueIndex = A[index][1]
var lfName = escapeChar(skipHtmlTagBoth(B[leagueIndex][2]));
soccerInPage.tipsmatch(mid, hTeam, gTeam, lfName)
}
//webscoket
function openWebsocket() {
var channels = ["change_xml"];
wsUtil.connectWs(channels, function (data) {
if (data["change_xml"] != undefined) {
var list = data["change_xml"].split("!");
refresh(list, 1)
}
}, function () {
//console.log("轮询启动");
if (scorePolling) window.clearTimeout(scorePolling);
scorePolling = window.setTimeout("getxml()", 4000);
}, function () {
//console.log("轮询关闭");
if (scorePolling) window.clearTimeout(scorePolling);
})
}
function refreshBfToken() {
if (_bfToken != '') {
$.post("/ajax/RefreshBfToken", { token: _bfToken }, function (result) {
if (result != '') {
_bfToken = result;
}
})
window.setTimeout("refreshBfToken()", 60 * 1000);
}
}
//-----------------------直播相关代码----------------------------//
function OpenTvLink(id) {
if (tvLinkList != null) {
var linkObj = tvLinkList.filter(t => t.scheduleId == id);
if (linkObj != null && linkObj.length > 0) {
var linkUrl = linkObj[0].linkList[0];
if (_isForApp) {
linkUrl = appOpenBrowserUrl(linkUrl)
}
window.open(linkUrl);
}
}
}
function TvLinkObj(data) {
var arr = data.split('^');
this.scheduleId = arr[0];
this.linkList = new Array();
for (var i = 1; i <= arr.length; i++) {
if (arr[i] != "" && arr[i] != undefined) {
this.linkList.push(arr[i]);
}
}
}
function InitTvLink() {
tvLinkList = new Array();
var txturl = getTvLinkTxtUrl(_appModule);
tvLinkHttp.open("get", txturl + Date.parse(new Date()), false);
tvLinkHttp.send(null);
var data = tvLinkHttp.responseText;
if (data == "") return;
var dataArr = data.split("$");
tvLinkChangeTime = dataArr[0];
if (dataArr[1] == "") return;
var linkArr = dataArr[1].split("!");
keyMatch = dataArr[2].split(",");
for (var i = 0; i < linkArr.length; i++) {
var link = new TvLinkObj(linkArr[i]);
var tr = $("#tr1_" + link.scheduleId);
if (tr[0]) {
var index = parseInt(tr.attr("index"));
var state = A[index][8];
if (state > -1) {
if (state > 0) $("#mt_" + link.scheduleId).hide();
$("#tvLink_" + link.scheduleId).html("

");
}
}
tvLinkList.push(link);
}
}
$(document).ready(function () {
refreshBfToken();
});
//function changeMainDomain() {
// if (window.self !== window.top && _appModule == "World") { //open by iframe
// //domain
// var domain = "";
// var url = document.referrer;
// var arrDoms = url.split("/")[2].split(".");
// var isNum = /^\d+$/;
// domain = isNum.test(arrDoms[1]) ? `${arrDoms[0]}.${arrDoms[1]}.${arrDoms[2]}.${arrDoms[3].split(":")[0]}` : arrDoms.join('.') //ip/domain
// if (domain == 'www.livescore.red') {
// _mainWebDomain = '//www.goaloo8.com/';
// _livescoreWebDomain = '//www.goaloo8.com/';
// _touchWebDomain = '//m1.goaloo8.com/';
// } else {
// _mainWebDomain = '//www.goaloo18.com/';
// _livescoreWebDomain = '//www.goaloo18.com/';
// _touchWebDomain = '//m1.goaloo18.com/';
// }
// }
//}
//changeMainDomain();
;
function SwithcDarkFree() {
if (document.getElementById("DarkModeCheck").checked) {
dark_mode = 1;
WriteSession("dark_mode", 1);
}
else {
dark_mode = 0;
WriteSession("dark_mode", 0);
}
LoadDark();
}
function SyncDarkCheckFree() {
var dark = GetSession("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 = "";
}
SyncDarkCheckFree();
$(document).ready(function () {
specialHide();
checkWhiteList();
});
function specialHide() {
var mode = getQueryVariable("mode");
if (mode == null || mode == '') {
mode = sessionStorage.getItem("HideMode");
}
if (mode != null && mode == "hide") {
$(".needHide").hide();
sessionStorage.setItem("HideMode", mode);
} else if (mode == "deephide") {
$(".needHide").hide();
$(".deepHide").hide();
sessionStorage.setItem("HideMode", mode);
}
else if (mode == "show") {
$(".needHide").show();
$(".deepHide").show();
sessionStorage.setItem("HideMode", mode);
}
}
var _leaSortting = false;
function initSortLea() {
if (document.getElementById("cbbSortLea") && document.getElementById("cbbSortLea").checked) {
_leaSortting = true;
MakeSclassWithSorting();
HideByState(1);
SyncLeaSorting(0);
}
}
//sort leagues list
function SortList(elem, sortBy) {
var byCountry = $("#cbbSortLeaByCountry")[0].checked;
var byFirstCode = $("#cbbSortLea")[0] ? $("#cbbSortLea")[0].checked : false;
if (byCountry) {
_leaSortting = true;
MakeSclassWithSortingByCountry();
}
else if (byFirstCode) {
_leaSortting = true;
MakeSclassWithSorting();
}
else {
_leaSortting = false;
MakeSclass();
}
if (byCountry) {
writeCookie(FilterCountryKey, 1);
} else {
writeCookie(FilterCountryKey, 0);
}
HideByState();
SyncLeaSorting(0);
InitHeadShow();
}
//无完场赛事隐藏Result分隔栏
function hideResultTr() {
if (orderby == "league" || $("#resultSplit").length == 0) return;
var ifShow = false;
for (var i = 0; i < finishMatchList.length; i++) {
if ($("#tr1_" + finishMatchList[i])[0].style.display != "none" && ((myGamesID.indexOf(finishMatchList[i]) == -1 && isFavTop) || !isFavTop)) {
ifShow = true;
break;
}
}
$("#resultSplit")[0].style.display = !ifShow ? "none" : "";
}
var soccerInPage = {
isSummary: function (id) {
if (typeof (checkInpageVersion) == "function" && checkInpageVersion(id) == 1) {
return true;
}
return false;
},
gethost: function () {
return _mainWebDomain.substr(0, _mainWebDomain.length - 1);
},
detail: function (id) {
if (!this.isSummary(id)) {
window.open(this.gethost() + "/match/live-" + id);
}
},
analysis: function (id) {
if (!this.isSummary(id)) {
window.open(this.gethost() + "/match/h2h-" + id);
}
},
oddscomp: function (id) {
if (!this.isSummary(id)) {
var url = "/oddscomp/" + id;
window.open(this.gethost() + url);
}
},
euroodds: function (id) {
window.open(this.gethost() + "/1x2-odds/" + id);
},
ouodds: function (id) {
window.open(this.gethost() + "/over-under-odds/" + id);
},
ahodds: function (id) {
window.open(this.gethost() + "/asian-handicap-odds/" + id);
},
threemix: function (id, cid, ishalf) {
var url = "/oddscomp/" + id;
if (ishalf) {
url += "?half=1"
}
window.open(this.gethost() + url);
},
textlive: function (id) {
window.open(this.gethost() + "/textlive/" + id);
},
playertech: function (id) {
window.open(this.gethost() + "/playertech/" + id);
},
panluWin: function (id, cid) {
var panluUrl = this.gethost() + "/soccer/oddsstats/" + id;
if (typeof (cid) != "undefined" && cid != '') url += "?cid=" + cid;
window.open(panluUrl, '', 'scrollbars=yes,resizable=yes,width=662, height=650,left=50,top=100');
},
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);
},
textlive: function (id) {
window.open(this.gethost() + "/statistics/" + id + "?showtxt=1");
}
}
function callLeagueFilterWin() {
if ($("#showoptional2").css("visibility") == "visible") {
$("#showoptional2").css("visibility", "hidden");
} else {
$("#showoptional2").css("visibility", "visible");
leagueFilterCount();
}
}
function teamClickEvent(i) {
if (_appModule == "World") {
var hTeam = escapeChar(skipHtmlTagBoth(A[i][4]));
var gTeam = escapeChar(skipHtmlTagBoth(A[i][5]));
var lfName = escapeChar(skipHtmlTagBoth(B[A[i][1]][2]));
if (matchIsBegin(parseInt(A[i][8]))) {
soccerInPage.detail(A[i][0], hTeam, gTeam, lfName);
} else {
soccerInPage.analysis(A[i][0], hTeam, gTeam, lfName);
}
} else {
if (matchIsBegin(parseInt(A[i][8]))) {
soccerInPage.detail(A[i][0]);
} else {
soccerInPage.analysis(A[i][0]);
}
}
}
function matchIsBegin(state) {
let begin = false;
state = parseInt(state);
if (state > 0 || state == -1 || state == -13) {
begin = true;
}
return begin;
}
function reorderNotice() {
var jumpLink = _livescoreWebDomain;
/*if (_appModule != "Pt" && _appModule != "Kor") {
jumpLink = _cmsWebDomain + "rewards";
}*/
var template = "
| " + _locModel.T.T_Free_Drainage + " |
";
var notices = $(".notice");
for (var i = 0; i < notices.length; i++) {
notices[i].parentNode.removeChild(notices[i]);
}
var rows = $("[id^=tr1_]:visible");
for (var i = 0; i < rows.length; i++) {
if (i == 0) {
var index = parseInt(rows[i].getAttribute("index"));
var tr = _$("tr2_" + A[index][0]);
insertAfter($(template)[0], tr);
}
if (i == 1) break;
}
}
function showAllMatch() {
writeCookie("Hidden_MatchID", "_");
location.href = '/free/freesoccer/?type=all';
}
//初始化头部显示
function InitHeadShow() {
if (orderby == "time") return;
var titleList = $(".Leaguestitle");
if (titleList == null && titleList.length == 0) return;
var arrtName = "leaIndex";
var arrtValue = "";
for (var i = 0; i < titleList.length; i++) {
arrtValue = titleList[i].getAttribute(arrtName);
var trList = $('tr[index][' + arrtName + '="' + arrtValue + '"]');
var isShow = false;
if (trList != null && trList.length > 0) {
for (var j = 0; j < trList.length; j++) {
if (trList[j].style.display != "none" && (orderby != 'time' || trList[j].getAttribute("istop") != 1)) {
isShow = true;
break;
}
}
}
if (isShow) titleList[i].style.display = "";
else titleList[i].style.display = "none";
}
reorderNotice();
}
function openMainDomain() {
window.open(_mainWebDomain + "/freemap");
}
function checkWhiteList() {
if (window.self !== window.top) { //open by iframe
//domain
var domain = "";
var url = document.referrer;
var arrDoms = url.split("/")[2].split(".");
var isNum = /^\d+$/;
domain = isNum.test(arrDoms[1]) ? `${arrDoms[0]}.${arrDoms[1]}.${arrDoms[2]}.${arrDoms[3].split(":")[0]}` : arrDoms.join('.') //ip/domain
if (domain == location.host) {
return;
}
//check
$.post(`/ajax/checkwhitelist`, { domain }, function (result) {
console.log(url, domain, result)
if (result != 1) {
//not on white list
$("#wlbox").show();
$("#wlshadow").show();
$("body").css("overflow", "hidden")
}
})
}
else if (_freeWebDomain.indexOf(location.host) == -1) {
$("#wlbox").show();
$("#wlshadow").show();
$("body").css("overflow", "hidden")
}
}
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('|');
var scoresList = arrExplain[3].split(';');
if (scoresList[0] != "") {
// 90分钟
/*explainList += scoresList[0].split(',')[0] + _locModel.T.T_S_Minutes + "[" + scoresList[0].split(',')[1] + "], ";*/
// 两回合
if (scoresList[1] != "")
explainList += _locModel.T.T_TwoRounds + "[" + scoresList[1] + "], ";
// 120分钟
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 += _locModel.T.T_Home + " " + _locModel.T.T_Win;
else if (scoresList[4] == "2") explainList += _locModel.T.T_Away + " " + _locModel.T.T_Win;
}
}
}
}
return explainList;
};