function loadCricket(t) {
matches = [];
$.ajax({
url: "https://sports.ndtv.com/multisportsapi/?methodtype=3&client=4&sport=1&league=0&timezone=0530&language=en&gamestate=4",
dataType: "jsonp",
callback: "cb",
callbackParameter: "callback",
jsonpCallback: "cb",
cache: true,
success: function (e) {
if (
((matches = $.grep(e.matches, function (e, a) {
return e.game_id == t;
})),
matches)
) {
"true" == matches[0].participants[0].now
? (score = matches[0].participants[0].value.includes("&") ? $.trim(matches[0].participants[0].value.split("&")[1]).split(" ") : matches[0].participants[0].value.split(" "))
: (score = matches[0].participants[1].value.includes("&") ? $.trim(matches[0].participants[1].value.split("&")[1]).split(" ") : matches[0].participants[1].value.split(" "));
var a,
s = score[0] + (score[1].includes("dec") ? "d" : ""),
n = score[1].includes("dec") ? score[2].replace("(", "").replace(")", "") : score[1].replace("(", "").replace(")", ""),
i = s + "OVR " + n + "";
a =
"" != matches[0].participants[0].value && "" != matches[0].participants[1].value
? matches[0].event_sub_status
: parseFloat(n) > 3 && "match ended" == matches[0].event_status.toLowerCase()
? matches[0].event_sub_status
: "match yet to begin" == matches[0].event_status.toLowerCase()
? matches[0].event_sub_status
: matches[0].event_status;
var r = "";
if (
((r =
"false" == matches[0].event_is_daynight
? "1" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Morning Session"
: "2" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Post Lunch Session"
: "3" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Post Tea Session"
: matches[0].event_name + ", Day " + matches[0].event_day + ("" != matches[0].participants[0].value && "" != matches[0].participants[1].value ? "," + matches[0].event_status : "")
: "1" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Morning Session"
: "2" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Post Tea Session"
: "3" == matches[0].event_session && "play in progress" == matches[0].event_status.toLowerCase()
? " Post Dinner Session"
: matches[0].event_name + ", Day " + matches[0].event_day + ("" != matches[0].participants[0].value && "" != matches[0].participants[1].value ? ", " + matches[0].event_status : "")),
"test" == matches[0].event_format.toLowerCase())
)
$(".mini_score h4").text(r);
else {
var l = matches[0].event_name;
$(".mini_score h4").text(l);
}
"true" == matches[0].participants[0].now
? ($("#activeTeam").html(matches[0].participants[0].short_name), $("#nonActiveTeam").html(matches[0].participants[1].short_name))
: ($("#activeTeam").html(matches[0].participants[1].short_name), $("#nonActiveTeam").html(matches[0].participants[0].short_name)),
$(".score_veiw").html(i),
$(".score_report").html(a.replace(matches[0].participants[0].name, matches[0].participants[0].short_name).replace(matches[0].participants[1].name, matches[0].participants[1].short_name));
}
},
error: function (t, e, a) { },
});
}
function loadCricketPlyers(t) {
var e = "",
a = "";
$.ajax({
url: "https://sports.ndtv.com/multisportsapi/?methodtype=3&client=4&sport=1&league=0&timezone=0530&language=en&gamestate=4",
dataType: "jsonp",
callback: "cb",
callbackParameter: "callback",
jsonpCallback: "cb",
cache: true,
success: function (s) {
if (
((matches = $.grep(s.matches, function (e, a) {
return e.game_id == t;
})),
matches)
) {
if ("true" == matches[0].participants[0].now) {
if (
(matches[0].participants[0].players_involved.forEach(function (t, a) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
e +=
'
' +
s +
(t.name.includes("*") ? "*" : "") +
' | ' +
r[0] +
' | ' +
r[1].replace("(", "").replace(")", "") +
" |
";
}),
matches[0].participants[1].players_involved.forEach(function (t, e) {
if (t.name.includes("*")) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
a += '' + s + ' | ' + r[0] + ' | ' + r[1].replace("(", "").replace(")", "") + " |
";
}
}),
"" == a)
) {
var n = (r = matches[0].participants[1].players_involved[0].name).split(" "),
i = 0;
(r = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (r += ("" == r ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (r += ("" == r ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
c = matches[0].participants[1].players_involved[0].value.split(" ");
a += '' + r + ' | ' + c[0] + ' | ' + c[1].replace("(", "").replace(")", "") + " |
";
}
} else if (
(matches[0].participants[1].players_involved.forEach(function (t, a) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
e +=
'' +
s +
(t.name.includes("*") ? "*" : "") +
' | ' +
r[0] +
' | ' +
r[1].replace("(", "").replace(")", "") +
" |
";
}),
matches[0].participants[0].players_involved.forEach(function (t, e) {
if (t.name.includes("*")) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
a += '' + s + ' | ' + r[0] + ' | ' + r[1].replace("(", "").replace(")", "") + " |
";
}
}),
"" == a)
) {
var r = matches[0].participants[0].players_involved[0].name,
n = r.split(" "),
i = 0;
(r = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1) ? (r += ("" == r ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t)) : (r += ("" == r ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var c = matches[0].participants[0].players_involved[0].value.split(" ");
a += '' + r + ' | ' + c[0] + ' | ' + c[1].replace("(", "").replace(")", "") + " |
";
}
$("#tblBatsman tr").has("td").remove(), $("#tblBowler tr").has("td").remove(), $("#tblBatsman").append(e), $("#tblBowler").append(a);
}
},
error: function (t, e, a) { },
});
}
function loadCricketPlyersWithUpcoming(t) {
var e = "",
a = "";
$.ajax({
url: "https://sports.ndtv.com/multisportsapi/?methodtype=3&client=4&sport=1&league=0&timezone=0530&language=en&gamestate=4",
dataType: "jsonp",
callback: "cb",
callbackParameter: "callback",
cache: true,
jsonpCallback: "cb",
success: function (s) {
if (
((matches = $.grep(s.matches, function (e, a) {
return e.game_id == t;
})),
matches && "Match Ended" != matches[0].event_status && matches[0].participants[0].players_involved.length > 0 && matches[0].participants[1].players_involved.length > 0)
) {
if ("true" == matches[0].participants[0].now) {
if (
(matches[0].participants[0].players_involved.forEach(function (t, a) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
e +=
'' +
s +
(t.name.includes("*") ? "*" : "") +
' | ' +
r[0] +
' | ' +
r[1].replace("(", "").replace(")", "") +
" |
";
}),
matches[0].participants[1].players_involved.forEach(function (t, e) {
if (t.name.includes("*")) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
a += '' + s + ' | ' + r[0] + ' | ' + r[1].replace("(", "").replace(")", "") + " |
";
}
}),
"" == a)
) {
var n = (r = matches[0].participants[1].players_involved[0].name).split(" "),
i = 0;
(r = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (r += ("" == r ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (r += ("" == r ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
c = matches[0].participants[1].players_involved[0].value.split(" ");
a += '' + r + ' | ' + c[0] + ' | ' + c[1].replace("(", "").replace(")", "") + " |
";
}
} else if (
(matches[0].participants[1].players_involved.forEach(function (t, a) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
e +=
'' +
s +
(t.name.includes("*") ? "*" : "") +
' | ' +
r[0] +
' | ' +
r[1].replace("(", "").replace(")", "") +
" |
";
}),
matches[0].participants[0].players_involved.forEach(function (t, e) {
if (t.name.includes("*")) {
var s = t.name,
n = s.split(" "),
i = 0;
(s = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1)
? (s += ("" == s ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t))
: (s += ("" == s ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var r = t.value.split(" ");
a += '' + s + ' | ' + r[0] + ' | ' + r[1].replace("(", "").replace(")", "") + " |
";
}
}),
"" == a)
) {
var r = matches[0].participants[0].players_involved[0].name,
n = r.split(" "),
i = 0;
(r = ""),
n.forEach(function (t, e) {
t.includes("*") ||
(i < n.length - (t.includes("*") ? 2 : 1) ? (r += ("" == r ? "" : " ") + (t.length > 9 ? t.substring(0, 1).toUpperCase() : t)) : (r += ("" == r ? "" : " ") + (t.length > 6 ? t.substring(0, 5) + ".." : t))),
i++;
});
var c = matches[0].participants[0].players_involved[0].value.split(" ");
a += '' + r + ' | ' + c[0] + ' | ' + c[1].replace("(", "").replace(")", "") + " |
";
}
$("#tblBatsman tr").has("td").remove(), $("#tblBowler tr").has("td").remove(), $("#tblBatsman").append(e), $("#tblBowler").append(a);
} else if ("Match Ended" == matches[0].event_status) {
matches = $.grep(s.matches, function (t, e) {
return "U" == t.event_state;
});
var l = "",
p = "";
try {
null != matches[0].participants[0].now && "true" == matches[0].participants[0].now
? ((l = matches[0].participants[0].short_name), (p = matches[0].participants[1].short_name))
: ((l = matches[0].participants[1].short_name), (p = matches[0].participants[0].short_name));
} catch (t) { }
var d = matches[0].venue_name.split(","),
h = matches[0].event_sub_status;
h = h.replace(matches[0].participants[0].name, matches[0].participants[0].short_name).replace(matches[0].participants[1].name, matches[0].participants[1].short_name);
var m = "",
o = new Date(Date.parse(matches[0].start_date));
(m += '"),
(m += ' ' + dateFormat(o, "mmm, dd yyyy") + "" + dateFormat(o, "HH:MM") + " (IST)
"),
(m += '' + ("" != h ? h : d[1]) + "
"),
(m += ""),
$(".mini_score").html(m);
}
},
error: function (t, e, a) { },
});
}
var dateFormat = (function () {
var t = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
e = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
a = /[^-+\dA-Z]/g,
s = function (t, e) {
for (t = String(t), e = e || 2; t.length < e;) t = "0" + t;
return t;
};
return function (n, i, r) {
var c = dateFormat;
if ((1 != arguments.length || "[object String]" != Object.prototype.toString.call(n) || /\d/.test(n) || ((i = n), (n = void 0)), (n = n ? new Date(n) : new Date()), isNaN(n))) throw SyntaxError("invalid date");
"UTC:" == (i = String(c.masks[i] || i || c.masks.default)).slice(0, 4) && ((i = i.slice(4)), (r = !0));
var l = r ? "getUTC" : "get",
p = n[l + "Date"](),
d = n[l + "Day"](),
h = n[l + "Month"](),
m = n[l + "FullYear"](),
o = n[l + "Hours"](),
u = n[l + "Minutes"](),
v = n[l + "Seconds"](),
g = n[l + "Milliseconds"](),
y = r ? 0 : n.getTimezoneOffset(),
f = {
d: p,
dd: s(p),
ddd: c.i18n.dayNames[d],
dddd: c.i18n.dayNames[d + 7],
m: h + 1,
mm: s(h + 1),
mmm: c.i18n.monthNames[h],
mmmm: c.i18n.monthNames[h + 12],
yy: String(m).slice(2),
yyyy: m,
h: o % 12 || 12,
hh: s(o % 12 || 12),
H: o,
HH: s(o),
M: u,
MM: s(u),
s: v,
ss: s(v),
l: s(g, 3),
L: s(g > 99 ? Math.round(g / 10) : g),
t: 12 > o ? "a" : "p",
tt: 12 > o ? "am" : "pm",
T: 12 > o ? "A" : "P",
TT: 12 > o ? "AM" : "PM",
Z: r ? "UTC" : (String(n).match(e) || [""]).pop().replace(a, ""),
o: (y > 0 ? "-" : "+") + s(100 * Math.floor(Math.abs(y) / 60) + (Math.abs(y) % 60), 4),
S: ["th", "st", "nd", "rd"][p % 10 > 3 ? 0 : (((p % 100) - (p % 10) != 10) * p) % 10],
};
return i.replace(t, function (t) {
return t in f ? f[t] : t.slice(1, t.length - 1);
});
};
})();
(dateFormat.masks = {
default: "ddd mmm dd yyyy HH:MM:ss",
shortDate: "m/d/yy",
mediumDate: "mmm d, yyyy",
longDate: "mmmm d, yyyy",
fullDate: "dddd, mmmm d, yyyy",
shortTime: "h:MM TT",
mediumTime: "h:MM:ss TT",
longTime: "h:MM:ss TT Z",
isoDate: "yyyy-mm-dd",
isoTime: "HH:MM:ss",
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",
}),
(dateFormat.i18n = {
dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
}),
(Date.prototype.format = function (t, e) {
return dateFormat(this, t, e);
});