Fetching more content…
Fetching more content…
“,
““,
““,
];
function displayNativeAds() {
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1520416573698-0’); });
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1520507866383-0’); });
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1520507954168-0’); });
}
//to place ads on 3rd, 8th, 13th (and so on) positions
var index = 2;
//generating native Ads div array
var nativeAdsDiv = {};
for(var i=0; i
‘);
storiesList.insertAdjacentHTML(‘beforeend’, ‘
End Page ‘ + pageNumber + ‘
‘);
window.addEventListener(“scroll”, onWindowScroll);
function onWindowScroll(e) {
var st = window.pageYOffset || document.documentElement.scrollTop;
if (!infiniteScrollRequestInProgress) {
if (st > lastScrollTop) {
direction = ‘down’;
}
else if (st = contentHeight || yOffset 1 ? min_page -1 : min_page);
if(page_to_be_fetched > 1) {
timelineLoadingDivTop.style.display = ‘block’;
}
}
if(page_to_be_fetched > max_page || page_to_be_fetched -1 ? postType : “News”;
var category = “Scroll: ” + type;
if (typeof ga_event == ‘function’ && data.trim() != ”) {
ga_event(category, action, label);
}
if(pageNumber === 1) {
displayNativeAds();
if(true) {
} else {
console.log(“Loading native ad mobile”);
// googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1473000475873-0’); });
// googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1473000515456-0’); });
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1502174353462-0’); })
console.log(“Loaded”);
}
}
if (data.trim() != ”) {
pageNumber = page_to_be_fetched;
if(direction == ‘down’)
{
max_page += 1;
storiesList.insertAdjacentHTML(‘beforeend’, ‘
Start Page ‘+ pageNumber +’
‘);
storiesList.insertAdjacentHTML(‘beforeend’, data);
storiesList.insertAdjacentHTML(‘beforeend’, ‘
End Page ‘+ pageNumber +’
‘);
timelineLoadingDivBottom.style.display = ‘none’;
}
else if(direction == ‘up’)
{
if(min_page > 1)
min_page -= 1;
storiesList.insertAdjacentHTML(‘afterbegin’, ‘
End Page ‘+ pageNumber +’
‘);
storiesList.insertAdjacentHTML(‘afterbegin’, data);
storiesList.insertAdjacentHTML(‘afterbegin’, ‘
Start Page ‘+ pageNumber +’
‘);
timelineLoadingDivTop.style.display = ‘none’;
}
infiniteScrollRequestInProgress = false;
} else {
timelineLoadingDivTop.style.display = ‘none’;
timelineLoadingDivBottom.style.display = ‘none’;
}
removeDuplicateStories();
refreshScores();
// This is done so that the argument value gets corrected in case the user loads the feed by giving page as param and then switches the feed.
window.scrollTo(window.scrollX, window.scrollY + 1);
}, function (error) {
console.log(error);
infiniteScrollRequestInProgress = false;
timelineLoadingDivTop.style.display = ‘none’;
timelineLoadingDivBottom.style.display = ‘none’;
});
}
else {
infiniteScrollRequestInProgress = false;
}
}
}
}
function checkVisible(elm) {
var rect = elm.getBoundingClientRect();
var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
return !(rect.bottom = 0);
}
function updateURL(page_no) {
var querystring = window.location.search;
var hash = window.location.hash;
//remove hash (and any trailing #) from url
var url = window.location.href.replace(hash, ”).replace(/#+$/,”);
if(querystring != ”)
{
url = url.replace(querystring, ‘?page=’+page_no);
}
else
{
url += ‘?page=’+page_no;
}
url += hash;
if(window.location.href != url) {
window.history.replaceState(“visible_page”, “Page ” + page_no, url);
}
return url;
}
function updateLinksAndMeta(page_no) {
//update title and meta description
if(page_no == 1)
{ //remove page no
document.title = (document.title).replace(/Page [0-9]+ – /g, “”);
if(meta_description) {
meta_description.content = (meta_description.content).replace(/Page [0-9]+ – /g, “”);
}
}
else if(page_no > 1)
{
if((document.title).match(/Page [0-9]+/g) != null) {
document.title = (document.title).replace(/Page [0-9]+/g, “Page ” + page_no);
}
else {
document.title = ‘Page ‘ + page_no + ‘ – ‘ + document.title;
}
if(meta_description) {
if((meta_description.content).match(/Page [0-9]+/g) != null) {
meta_description.content = (meta_description.content).replace(/Page [0-9]+/g, “Page ” + page_no);
}
else {
meta_description.content = ‘Page ‘ + page_no + ‘ – ‘ + meta_description.content;
}
}
}
if(canonical) {
//update rel canonical
canonical.href = (canonical.href).split(‘?’)[0] + ‘?page=’ + page_no;
//update rel next
if(next_link)
{ next_link.href = (canonical.href).split(‘?’)[0] + ‘?page=’ + (page_no + 1);
}
//update rel prev
if(prev_link == null)
{
prev_link = document.createElement(‘link’);
prev_link.rel = ‘prev’;
prev_link.id = ‘prev-link’;
head.appendChild(prev_link);
}
if(page_no == 2) {
prev_link.href = (canonical.href).split(‘?’)[0];
}
else if(page_no = 0 || data.match_status.indexOf(“PEN”) >= 0) {
apostrophe = ” “;
}
story.innerHTML = data.match_status + apostrophe + data.match_localteam_name_short + ‘ ‘ + data.match_localteam_score + ‘-‘ + data.match_visitorteam_score +
‘ ‘ + data.match_visitorteam_name_short;
}
}
function updateCricketScore(story, data) {
data = JSON.parse(data);
var match = data[‘score_strip’][0][‘currently_batting’] ? data[‘score_strip’][0] : null;
if (match == null) {
match = data[‘score_strip’][1][‘currently_batting’] ? data[‘score_strip’][1] : null;
}
if (match != null) {
story.innerHTML = match[‘short_name’] + ‘ ‘ + match[‘score’];
} else {
story.innerHTML = data[‘score_strip’][0][‘short_name’] + ‘ vs ‘ + data[‘score_strip’][1][‘short_name’] + ‘ | YET TO START’;
}
}
function refreshScores() {
var stories = $all(‘[data-scoreid]’);
for (var i = 0; i
‘ +
” +
‘
‘ +
‘
‘ +
‘
‘ +
‘
‘ +
”;
}
this.pointsTable.innerHTML = ” + ”;
if (“” === “true” && “1”) {
this.widget.style.width = “702px”;
this.widget.querySelector(‘.keeda_widget_tab_content.pointstable table’).style.width = ‘661px’;
}
}
FootballWidget.prototype.toggleTabMenu = function() {
if (this.matchContainer.className.match(/active/g)) {
this.showTabMenu(‘points’);
} else {
this.showTabMenu(‘matches’);
}
}
FootballWidget.prototype.showTabMenu = function(menuType) {
if (menuType == ‘matches’) {
this.pointsTable.style.display = “none”;
this.matchContainer.style.display = “block”;
this.pointsTable.className = this.pointsTable.className.replace(/active/g, “”);
this.pointsTab.className = this.pointsTab.className.replace(/selected/g, “”);
this.matchContainer.className += ” active”;
this.matchesTab.className += ” selected”;
this.matchDayMenu.style.display = “block”;
} else if (menuType == ‘points’) {
this.pointsTable.style.display = “block”;
this.matchContainer.style.display = “none”;
this.matchContainer.className = this.matchContainer.className.replace(/active/g, “”);
this.matchesTab.className = this.matchesTab.className.replace(/selected/g, “”);
this.pointsTable.className += ” active”;
this.pointsTab.className += ” selected”;
this.matchDayMenu.style.display = “none”;
}
}
FootballWidget.prototype.populateMatchListing = function(matchListing) {
Widget.prototype.populateMatchListing.call(this, matchListing);
var self = this;
var matchListingHTML = “”;
var prevMatchDaySlug = matchListing.tournament_matches[0].prev_matchday_slug;
if(prevMatchDaySlug && this.isScoreCarousel) {
prevMatchDaySlug = prevMatchDaySlug.replace(/[- _]+/g, ‘ ‘);
prevMatchDaySlug = prevMatchDaySlug.charAt(0).toUpperCase() + prevMatchDaySlug.slice(1);
matchListingHTML = ”
}
if(!this.isScoreCarousel)
{
if (this.selectedEventSlug != ‘featured’ && matchListing.tournament_matches) {
this.currentMatchDay = matchListing.tournament_matches[0].matchday_slug;
this.showLeagueMenuItems(matchListing.tournament_matches[0].matchday);
if (matchListing.tournament_matches[0].prev_matchday_slug) {
this.previousMatchDay = matchListing.tournament_matches[0].prev_matchday_slug;
this.widget.querySelector(‘.keeda_football_previous_match_day’).style.display = “inline-block”;
} else {
this.widget.querySelector(‘.keeda_football_previous_match_day’).style.display = “none”;
}
if (matchListing.tournament_matches[0].next_matchday_slug) {
this.nextMatchDay = matchListing.tournament_matches[0].next_matchday_slug;
this.widget.querySelector(‘.keeda_football_next_match_day’).style.display = “inline-block”;
} else {
this.widget.querySelector(‘.keeda_football_next_match_day’).style.display = “none”;
}
if (matchListing.tournament_matches[0].has_table === ‘false’) {
this.tabLayout.style.display = “none”;
} else {
this.tabLayout.style.display = “block”;
}
} else {
this.currentMatchDay = “”;
this.hideLeagueMenuItems();
this.previousMatchDay = “”;
this.nextMatchDay = “”;
}
}
if (matchListing.tournament_matches) {
var tournaments = matchListing.tournament_matches;
for (var j = 0; j teamTwoInfo[‘score’]) {
teamOneInfo[‘bold’] = true;
} else if (teamOneInfo[‘score’] ‘;
}
else if (matchStatus == ‘pre’){
matchLink = ”;
}
var scoreElement = self.createScoreElement(matches[i].t1_score, matches[i].t2_score, matchStatus)
if (matches[i].time == ‘PEN’) {
scoreElement = self.createScoreElement(matches[i].lt_pen_score, matches[i].vt_pen_score, matchStatus)
}
if (matches[i].lt_agg_score && matches[i].vt_agg_score && matchStatus == ‘post’) {
if (parseInt(matches[i].lt_agg_score) > parseInt(matches[i].vt_agg_score)) {
teamOneInfo.short_name += ‘*’;
} else if (parseInt(matches[i].lt_agg_score) ‘ +
matchLink +
”;
} else {
var matchDaySlug = matches[i][‘matchday_slug’];
matchDaySlug = matchDaySlug.replace(/[- _]+/g, ‘ ‘);
matchDaySlug = matchDaySlug.charAt(0).toUpperCase() + matchDaySlug.slice(1);
matchHTML = ”;
}
matchListingHTML = matchListingHTML + matchHTML;
}
if(this.isScoreCarousel) {
this.widget.querySelector(‘.keeda_widget’).style.width = (190 * (matches.length) + 110) + “px” ;
console.log( (190 * (matches.length) + 110));
this.cardLength = matches.length;
}
var nextMatchDaySlug = matchListing.tournament_matches[0].next_matchday_slug;
if(nextMatchDaySlug && this.isScoreCarousel) {
nextMatchDaySlug = nextMatchDaySlug.replace(/[- _]+/g, ‘ ‘);
nextMatchDaySlug = nextMatchDaySlug.charAt(0).toUpperCase() + nextMatchDaySlug.slice(1);
matchListingHTML += ”;
}
if(skippedMatches === matches.length) {
matchListingHTML = ‘
No results available yet.
‘;
}
this.matchListing.innerHTML = matchListingHTML;
this.initInitialScroll();
this.updateLiveScoresAndPreLiveScores();
this.reformatWidgetInfoToLocalTime();
}
} else {
this.hideLoader();
this.matchListing.innerHTML = “No matches found”;
}
}
FootballWidget.prototype.showLeagueMenuItems = function(matchDayString) {
this.leagueMenuItems.style.display = “block”;
this.leagueMenuItems.querySelector(‘.keeda_football_match_day_text’).innerHTML = matchDayString;
}
FootballWidget.prototype.hideLeagueMenuItems = function(matchDayString) {
this.leagueMenuItems.style.display = “none”;
}
FootballWidget.prototype.createTeamDivElement = function(teamInfo) {
var teamShortName = teamInfo.short_name;
if (teamInfo.bold == true) {
teamShortName = ‘‘ + teamInfo.short_name + ‘‘;
}
if(!this.isScoreCarousel) {
if (teamInfo.team == “one”) {
return ”
} else {
return ”
}
} else {
return ”
}
}
FootballWidget.prototype.createScoreElement = function(score1, score2, matchStatus) {
if (matchStatus == “live” || matchStatus == “post”) {
return ”
} else {
return “”;
}
}
FootballWidget.prototype.createLeagueTitleElement = function(leagueTitle, leagueSlug) {
return ”;
};
FootballWidget.prototype.createWidgetInfo = function(info, matchStatus, datetime, isPostponed) {
var matchInfo = “”;
if (matchStatus == ‘live’) {
matchInfo = ”
} else if (matchStatus == ‘post’) {
matchInfo = ”
} else if (matchStatus == ‘pre’) {
var matchTime;
if(!this.isScoreCarousel) {
matchTime = this.getReadableHumanDate(datetime);
} else {
matchTime = “Starts ” + this.getReadableHumanDate(datetime) + ‘, ‘ + this.formatAMPM(datetime);
}
matchInfo = ”
}
if (isPostponed) {
matchInfo = ”
}
return matchInfo;
}
FootballWidget.prototype.createMatchTimeElement = function(datetime, matchStatus, isPostponed) {
if (isPostponed) {
return ”
}
if (matchStatus == ‘pre’) {
return ”
}
return “”
}
FootballWidget.prototype.changeFixturesLink = function(eventSlug) {
Widget.prototype.changeFixturesLink.call(this, eventSlug);
if (eventSlug == ‘featured’) {
this.widget.querySelector(‘.keeda_widget_all_fixtures’).style.display = ‘none’;
this.widget.querySelector(‘.keeda_widget_all_fixtures a’).setAttribute(‘href’, ‘/football/schedule’);
} else {
if (“” === “true”) {
if (this.widget.querySelector(‘.keeda_widget_all_fixtures’)) {
this.widget.querySelector(‘.keeda_widget_all_fixtures’).style.display = ‘none’;
}
}
}
}
FootballWidget.prototype.fetchAndPopulateData = function(eventSlug, eventName, matchDay) {
this.selectedEventName = eventName;
this.selectedEventSlug = eventSlug;
if(!this.isScoreCarousel) {
this.pointsTable.style.display = “none”;
this.pointsTable.innerHTML = “”;
this.showTabMenu(‘matches’);
if (this.selectedEventSlug == ‘international-football’) {
this.tabLayout.style.display = “none”;
}
}
Widget.prototype.fetchAndPopulateData.call(this, eventSlug, eventName, matchDay);
}
FootballWidget.prototype.updateDateStringOnDayChange = function() {
var date = new Date();
var dateString = date.getDate() + ‘-‘ + (date.getMonth() + 1) + ‘-‘ + date.getFullYear();
if (dateString != this.currentDateString) {
var dateElements = this.matchListing.getElementsByClassName(‘keeda_widget_info football’)
for (var i = 0; i ‘ + data.match_status.replace(/(d+$)/, “$1′”) + ”
} else if (currentMatchStatus == ‘post’) {
liveMatchElement.querySelector(‘.keeda_widget_info.football’).innerHTML = data.match_status;
}
if(!this.isScoreCarousel)
{
var scoreElement = liveMatchElement.querySelector(‘.keeda_widget_score.football’);
if (scoreElement) {
scoreElement.innerHTML = score;
} else {
var teamGroupElement = liveMatchElement.querySelector(‘.keeda_widget_team_group’);
teamGroupElement.innerHTML = teamGroupElement.innerHTML + ”;
}
} else {
var scoreElementOne = liveMatchElement.querySelectorAll(‘.keeda_widget_score.football’)[0]
var scoreElementTwo = liveMatchElement.querySelectorAll(‘.keeda_widget_score.football’)[1];
scoreElementOne.innerHTML = data.match_localteam_score;
scoreElementTwo.innerHTML = data.match_visitorteam_score;
}
var matchId = liveMatchElement.getAttribute(‘data-match-id’);
if (!liveMatchElement.querySelector(‘.keeda_football_match_link’).getAttribute(‘href’)) {
liveMatchElement.querySelector(‘.keeda_football_match_link’).setAttribute(‘href’, ‘/live-football-score/’ + matchId);
}
}
}
FootballWidget.prototype.loadEventData = function(target) {
Widget.prototype.loadEventData.call(this, target);
};
FootballWidget.prototype.toggleMenu = function() {
Widget.prototype.toggleMenu.call(this);
}
FootballWidget.prototype.openDropDownMenu = function() {
Widget.prototype.openDropDownMenu.call(this);
}
FootballWidget.prototype.closeDropDownMenu = function() {
Widget.prototype.closeDropDownMenu.call(this);
}
FootballWidget.prototype.searchDropDownList = function(event) {
Widget.prototype.searchDropDownList.call(this, event);
}
FootballWidget.prototype.fetchPointsTable = function(cb) {
var pointsTableAPI = this.contentAPIBase + this.selectedEventSlug + ‘/table’;
this.getRequest(pointsTableAPI, cb);
}
FootballWidget.prototype.reformatWidgetInfoToLocalTime = function() {
if(this.isScoreCarousel) {
return;
}
var widgetElements = this.widget.querySelectorAll(‘.keeda_football_match_list.pre’);
for (var i = 0; i
Advertise with Us
‘ + pointsTable[i].overall_played + ‘ | ‘ + pointsTable[i].overall_wins + ‘ | ‘ + pointsTable[i].overall_draws + ‘ | ‘ + pointsTable[i].overall_points + ‘ |
Be the first to comment