function rightSide() {
this.Decrypt2 = function(data) {
var b = (7 * (data - 6) % 10 + 10) % 10;
return b.toString();
}
this.Decrypt = function(playerID) {
playerID = playerID.toString();
var arrID = new Array();
for (var i = 0; i < playerID.length; i = i + 1) {
var a = playerID.substr(i, 1);
switch (a) {
case "0": arrID.push(this.Decrypt2(0)); break;
case "4": arrID.push(this.Decrypt2(1)); break;
case "5": arrID.push(this.Decrypt2(2)); break;
case "3": arrID.push(this.Decrypt2(3)); break;
case "6": arrID.push(this.Decrypt2(4)); break;
case "9": arrID.push(this.Decrypt2(5)); break;
case "7": arrID.push(this.Decrypt2(6)); break;
case "1": arrID.push(this.Decrypt2(7)); break;
case "2": arrID.push(this.Decrypt2(8)); break;
case "8": arrID.push(this.Decrypt2(9)); break;
}
}
return arrID.join('');
}
// //守门员
// this.ShowGoalkeeper = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("
Goalkeeper
");
// arrHtml1.push("");
// for (var i = 0; i < goalkeeper.length; i++) {
// var oneRecord = goalkeeper[i];
// arrHtml1.push("" + oneRecord[1] + " " + ShowCaptain(oneRecord) + "" + oneRecord[2 + lang] + " ");
// }
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// //后卫
// this.ShowRearguard = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("Defender
");
// arrHtml1.push("");
// for (var i = 0; i < rearguard.length; i++) {
// var oneRecord = rearguard[i];
// arrHtml1.push("" + oneRecord[1] + " " + ShowCaptain(oneRecord) + "" + oneRecord[2 + lang] + " ")
// }
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// //中场
// this.ShowMidfielder = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("Midfielder
");
// arrHtml1.push("");
// for (var i = 0; i < midfielder.length; i++) {
// var oneRecord = midfielder[i];
// arrHtml1.push("" + oneRecord[1] + " " + ShowCaptain(oneRecord) + "" + oneRecord[2 + lang] + " ")
// }
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// //前锋
// this.ShowVanguard = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("Striker
");
// arrHtml1.push("");
// for (var i = 0; i < vanguard.length; i++) {
// var oneRecord = vanguard[i];
// arrHtml1.push("" + oneRecord[1] + " " + ShowCaptain(oneRecord) + "" + oneRecord[2 + lang] + " ")
// }
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// //转会:转出
// this.ShowTurnOut = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("Departure
");
// arrHtml1.push("");
// arrHtml1.push(" No Information ");
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// //转会:转入
// this.ShowTurnIn = function() {
// var arrHtml1 = new Array();
// arrHtml1.push("Join in
");
// arrHtml1.push("");
// arrHtml1.push(" No Information ");
// arrHtml1.push("
");
// return arrHtml1.join('');
// }
// function ShowCaptain(oneRecord) {
// if (Object.prototype.toString.call(oneRecord) !== '[object Array]' || oneRecord.length < 6) {
// return '';
// }
// var imageUlr = "/images/"
// switch (oneRecord[5]) {
// case 1: return ' '; break;
// case 5: return ' '; break;
// }
// return '';
// }
// //document.getElementById("i_right").innerHTML = "" + this.ShowGoalkeeper() + this.ShowRearguard() + this.ShowMidfielder() + this.ShowVanguard() + this.ShowTurnOut() + this.ShowTurnIn() + "
";
}
//头部信息
function mainTitle(teamDetail) {
var ri = new rightSide();
var coachID = 0, coachName = "";
if (window.coach && window.coach.length) {
coachID = ri.Decrypt(coach[0][0]);
coachName = coach[0][2] || coach[0][4];
}
var mainDiv = document.getElementById("mainTitle");
var address = teamDetail[15] && !/[\u4E00-\u9FA5]/.test(teamDetail[15]) ? teamDetail[15] : "";//忽略中文
var coachUrl = teamDetail[13];
//修正部分不是http开头的网址
if (coachUrl !== null && coachUrl.indexOf("www") == 0) {
coachUrl = "//" + coachUrl;
}
mainDiv.innerHTML = _$("tplMainTitle").innerHTML.format(
/*0*/(teamDetail[4] == "" ? _teamIcon : changeGif("/Image/team/" + teamDetail[4]) + "?" + Math.floor(Math.random() * 10)),
/*1*/teamDetail[3] == "" ? teamDetail[2] : teamDetail[3],
/*2*/_moduleKey == 'thai' || _moduleKey == 'vn' ? teamDetail[2] : "",
/*3*/handleEmpty(teamDetail[7]),
/*4*/handleEmpty(teamDetail[10]),
/*5*/handleEmpty(teamDetail[11]),
/*6*/handleEmpty(dateToTime(teamDetail[12])),
/*7*/"",
/*8*/(coachID == 0 ? handleEmpty(coachName) : "" + handleEmpty(coachName) + " "),
/*9*/coachUrl,
/*10*/!teamDetail[13] ? "hide" : "",
/*11*/handleEmpty(address));
try {
if (typeof (forLoc) != "undefined" && forLoc) {
var indItem = document.getElementById("introduce1");
if (indItem && teamDetail[14] != "") indItem.innerHTML = teamDetail[14]; //把不需要显示球队简介的id给去掉则抛出异常
else {
if (document.getElementById("introduce_div")) document.getElementById("introduce_div").style.display = "none";
}
}
else {
var indItem = document.getElementById("introduce");
if(indItem) indItem.style.display = "none";
}
guiderBar();
} catch (e) { }
//初始化关注图标
if (Config.getFavTeamIds().indexOf(teamDetail[0].toString()) != -1) {
$("#favTeamIcon").addClass("on");
$("#favTeamIcon").html(_locModel.T.T_Btn_Following + " ");
};
}
function guiderBar() {
if (!_$("guiderBarList")) return;
var html = new Array();
html.push(getGuiderLi("/", _locModel.T.T_Database));
if (typeof (arrLeague) != "undefined" && arrLeague[0]) {
if (arrLeague[0] == 91) html.push(getGuiderLi("/fifa.html", arrLeague[3], 1)); //国家队转到世界排名页面
else html.push(getGuiderLi("/leagueinfo/" + arrLeague[0] + ".html", arrLeague[3], 1));
}
document.getElementById('guiderBarList').innerHTML = html.join('');
}
function getGuiderLi(link, title, lastf) {
return [
'',
'',
title == '' ? '' : '' + title + ' ',
' '
].join('');
}
function handleEmpty(str) {
if (CheckEmpty(str)) {
return "-";
} else {
return str;
}
};
var withOdds = _moduleKey == 'go' || _moduleKey == 'vn' || _moduleKey == "bola";
function GetTeamSche(TeamID, PageNo, FirstLoad) {
this.GetLetGoals = function (letGoals) {
if (letGoals == "")
return "";
var newLetGoals = letGoals.split("|")[1].split("/");
var result = "";
/*双减号,去除一个*/
if (newLetGoals[1] && newLetGoals[0].indexOf("-") != -1 && newLetGoals[1].indexOf("-") != -1)
result = newLetGoals[0] + newLetGoals[1].replace("-", "/");
else
result = letGoals.split("|")[1];
if (letGoals.indexOf("受") != -1)
return "" + result + " ";
else
return "" + result + " ";
}
this.GetResultColor = function (result) {
if (result == "")
return "";
if (result == "输" || result == "负")
return "" + _locModel.T.T_S_Loss + " " ;
else if (result == "赢" || result == "胜")
return "" + _locModel.T.T_S_Win +" ";
else
return "" + _locModel.T.T_S_Draw + " ";
}
bomHelper.ajaxGet("/ajax/TeamScheAjax?TeamID=" + TeamID + "&pageNo=" + PageNo, function(data) {
try {
eval(data);
var autoPage = FirstLoad == 1 && PageNo == 1 ? true : false;
var arrHtml = new Array();
arrHtml.push("");
arrHtml.push(_$("tplHeader").innerHTML);
var ifshowCol = 20, resultCol = 23;
if (_moduleKey == 'ida' || _moduleKey == 'ng' || _moduleKey == 'bola') {
ifshowCol = 24;
}
if (_moduleKey == 'vn') {
ifshowCol = 22;
resultCol = 23;
}
if (_moduleKey == 'thai' || _moduleKey == 'ind' || _moduleKey == 'kr' || _moduleKey == 'pt') {
resultCol = 21;
}
var sclassNameMap = new Map();
if (countSum != null && countSum.length > 0) {
for (var i = 0; i < countSum.length; i++) {
if (countSum[i][0] != 0) {
sclassNameMap.set(countSum[i][0], countSum[i][1]);
}
}
}
for (var i = 0; i < teamPageData.length; i++) {
var oneRecord = teamPageData[i];
var hName = escapeChar(oneRecord[13]);
var gName = escapeChar(oneRecord[16]);
var lfName = escapeChar(oneRecord[10]);
var hNameClass = oneRecord[4] == TeamID ? "curTeam" : "othTeam";
var gNameClass = oneRecord[5] == TeamID ? "curTeam" : "othTeam";
//var oddsTd = withOdds ? "" + this.GetLetGoals(oneRecord[20]) + " " + this.GetResultColor(oneRecord[21]) + " " : "";
var sclassLink = oneRecord[8 + lang];
var linkUrl = "/leagueinfo/" + oneRecord[1];
if (oneRecord[ifshowCol] == 1) {
sclassLink = "" + sclassLink + " ";
}
var sclassFullName = sclassNameMap.get(oneRecord[1].toString());
var time = oneRecord[3].replace(/\/+/g, "-");
var icon = "";
if ((new Date() - timeFromE8(time)) / (36 * 100000) > -7 * 24) {
icon = " ";
}
//数组格式0赛程ID,1联赛ID,2联赛颜色,3时间,4主队ID,5客队ID,6比分,7半场比分,8联赛简体名,9联赛繁体名,10联赛英文名,11主队简体,12主队繁体,13主队英文,14客队简体,15客队繁体,16客队英文,17主红,18客红
arrHtml.push(" " + sclassLink + " " + timeToText(timeFromE8(time), 10) + " " + oneRecord[11 + lang] + " " + (oneRecord[17] > 0 ? "" + oneRecord[17] : "") + " " + GetState(oneRecord[6]) + " " + (oneRecord[7] != "" ? "(" + oneRecord[7]+")" : "") + "" + oneRecord[14 + lang] + " " + (oneRecord[18] > 0 ? "" + oneRecord[18] : "") + " "
//+ oddsTd
+ "" + this.GetResultColor(oneRecord[resultCol]) + " "
+ "" + icon + " ");
if (autoPage && (teamPageData.length < 25 || oneRecord[6] != "")) autoPage = false;
}
if (autoPage) GetTeamSche(TeamID, 2, false);
arrHtml.push("
");
if (_moduleKey == "sagor" || _moduleKey == "tyso") {
arrHtml.push("")
} else {
arrHtml.push("" + _locModel.T.T_Page_First + "
" + "" + _locModel.T.T_Page + " " + ("
") + "" + _locModel.T.T_Page_Last + " ")
}
document.getElementById("main_dt").innerHTML = arrHtml.join('');
fillPageSelect(teamPageInfo[0], teamPageInfo[1])
} catch (e) {
}
});
}
function fillPageSelect(totalPage, curPage) {
for (var i = 1; i < totalPage + 1; i++) {
$('#pageIndexSelect').get(0).options.add(new Option(i, i));
if (curPage == i) {
$('#pageIndexSelect').val(i);
}
}
}
function GetState(state) {
var name = state;
switch (state) {
case "取消": name = _locModel.T.T_Stat_S_Cancel; break;
case "待定": name = _locModel.T.T_Stat_S_Pending; break;
case "腰斩": name = _locModel.T.T_Stat_S_Abd; break;
case "中断": name = _locModel.T.T_Stat_S_Pause; break;
case "推迟": name = _locModel.T.T_Stat_Postp; break;
}
//if (name.indexOf('-') != -1) {
// name = setScoreColor(name);
//}
return name;
}
function SearchTeamSche(TeamID) {
var pageNo = document.getElementById("pageIndexSelect").value;
GetTeamSche(TeamID, pageNo);
}
//设置比分颜色
function setScoreColor(score) {
if (score.indexOf('-') == -1)
return score;
var leftScore = parseInt(score.split("-")[0]);
var rightScore = parseInt(score.split("-")[1]);
if (leftScore > rightScore)
return "" + leftScore + " -" + rightScore + " ";
if (leftScore < rightScore)
return "" + leftScore + "- " + rightScore + " ";
return "" + leftScore + "- " + rightScore + " ";
};
function MathHelp() {
this.Sum = function(list) {
return eval(list.join("+"));
}
this.Avg = function(list, fixed) {
return Divide(this.Sum(list), list.length, fixed);
}
this.Divide = function(dividend, divisor, fixed) {
if (isNaN(divisor) || divisor == 0 || dividend == 0)
return 0;
var reValue = dividend / divisor;
if (isNaN(fixed))
return reValue;
else return reValue.toFixed(fixed);
}
}
Number.prototype.toFixed = function (s) {
changenum = (parseInt(this * Math.pow(10, s) + 0.5) / Math.pow(10, s)).toString();
return changenum;
}
function VerifyHelp() {
this.IsArray=function(o) {
return Object.prototype.toString.call(o) === '[object Array]';
}
this.IsNum=function (s) {
if (s != null && s != "") {
return !isNaN(s);
}
return false;
}
}
function $_(q, o) {
if (typeof (q) !== 'string' || q == '') return [];
var ss = q.split(' ');
var attr = '';
var s = ss[0].split(':')[0];
if (s != ss[0])
attr = ss[0].split(':')[1];
var val = s.split('[')[0];
if (val != s)
val = s.split('[')[1].replace(/[",\]]/g, '');
else
val = '';
s = s.split('[')[0];
var obj = [];
var sObj = null;
o = o || document;
switch (s.charAt(0)) {
case '#':
sObj = document.getElementById(s.substr(1));
if (sObj) obj.push(sObj);
break;
case '.':
var l = o.getElementsByTagName('*');
var c = s.substr(1);
for (var i = 0; i < l.length; i++)
if (l[i].className.search('\\b' + c + '\\b') != -1) obj.push(l[i]);
break;
default:
obj = o.getElementsByTagName(s);
break;
}
if (val) {
var l = [];
var a = val.split('=');
for (var i = 0; i < obj.length; i++) {
switch (a.length) {
case 1: if (obj[i].getAttribute(a[0]) != null) l.push(obj[i]); break;
case 2: if (obj[i].getAttribute(a[0]) == a[1]) l.push(obj[i]); break;
}
}
obj = l;
}
if (attr) {
var l = [];
for (var i = 0; i < obj.length; i++)
if (obj[i][attr]) l.push(obj[i]);
obj = l;
}
if (ss.length > 1) {
var l = [];
for (var i = 0; i < obj.length; i++) {
var ll = arguments.callee(q.substr(ss[0].length + 1), obj[i]);
if (ll.tagName) l.push(ll);
else
for (var j = 0; j < ll.length; j++) l.push(ll[j]);
}
obj = l;
}
if (sObj && ss.length == 1) {
obj = sObj;
if (obj) obj.length = 1;
} else {
var l = [];
for (var i = 0; i < obj.length; i++) obj[i].$isAdd = false;
for (var i = 0; i < obj.length; i++) {
if (!obj[i].$isAdd) {
obj[i].$isAdd = true;
l.push(obj[i]);
}
}
obj = l;
}
return obj;
};