Most Runs in Bangladesh Premier League 2023
Publish date: 2024-06-13
", "" ].join("") .replace("$$COLUMN_TEXT$$", input.columnText); } function prepareTeamColumn(input) { var containerOpen = ""; var containerClose = "
"; if (input.teamSlug) { containerOpen = ""; containerClose = ""; } if (input.qualified) { containerOpen = containerOpen.replaceAll("points-table-team", "points-table-team qualified"); } var teamAssetImage = generateTeamAssetImage(input.teamSlug, "cricket", [ input.teamFlag, defaultTeamFlag ]); return [ "", containerOpen, "", " $$TEAM_NAME$$ ", containerClose, " | " ].join("") .replaceAll("$$TEAM_FLAG_SIZE$$", teamLogoSize) .replaceAll("$$TEAM_SLUG$$", input.teamSlug) .replaceAll("$$RANK$$", input.rank) .replaceAll("$$TEAM_FLAG_SRC$$", "data:image/svg+xml;charset=utf-8,") .replaceAll("$$TEAM_FLAGS$$", teamAssetImage) .replaceAll("$$TEAM_FLAG_PARAMS$$", "?w=" + teamLogoSize * 4) .replaceAll("$$TEAM_NAME$$", input.teamName); } function prepareTabularData(groupedData) { var rows = []; groupedData.forEach(function(standing) { var columns = []; columns.push(prepareTextColumn({ columnText: standing.position })); columns.push(prepareTeamColumn({ teamSlug: standing.team_slug, rank: standing.position, teamFlag: standing.team_flag, teamName: standing.team_short_name, qualified: !!standing.qualified })); columns.push(prepareTextColumn({ columnText: standing.played })); columns.push(prepareTextColumn({ columnText: standing.won })); columns.push(prepareTextColumn({ columnText: standing.lost })); columns.push(prepareTextColumn({ columnText: standing.tied })); columns.push(prepareTextColumn({ columnText: standing.points, classes: "selected" })); columns.push(prepareTextColumn({ columnText: standing.nrr })); rows.push([ "", columns.join("\n"), "
" ].join("")); }); return rows.join("\n"); } function onTeamNameClicked(e) { var target = e.target.closest("a.points-table-team"); if (!target) return; var destinationUrl = target.getAttribute("href"); if (!destinationUrl) return; var teamName = target.innerText; trackGAEvent("TEAM_NAME_CLICKED", { section: "points_table_widget", destination_url: destinationUrl, taem_name: teamName }); } function initGroupSwitcher() { var groupSwitcherContainer = container.querySelector(".tournament-points-table-groups"); if (!groupSwitcherContainer) return; var onGroupSwitcherClicked = function(e) { var groupContainer = e.target.closest(".tournament-points-table-groups"); if (!groupContainer) return; removeClass(groupContainer.querySelector(".points-table-group-switcher.active"), "active"); var currentGroup = e.target.closest(".points-table-group-switcher"); addClass(currentGroup, "active"); var groupTitleToActive = currentGroup.dataset["groupTitle"]; var groupContainers = container.querySelectorAll(".tournament-points-table-group-table"); groupContainers.forEach(function(groupContainer) { var groupTitle = groupContainer.dataset["groupTitle"]; if (groupTitleToActive == groupTitle) { removeClass(groupContainer, "hidden"); } else { addClass(groupContainer, "hidden"); } }); } groupSwitcherContainer.querySelectorAll(".points-table-group-switcher").forEach(function(groupSwitcher) { groupSwitcher.addEventListener("click", onGroupSwitcherClicked); }); } function initAnalytics(tableContainer) { var tableBody = tableContainer.querySelector("tbody"); if (tableBody) { tableBody.querySelectorAll("a.points-table-team").forEach(function(teamAnchor) { teamAnchor.addEventListener("click", onTeamNameClicked); }); } } function init() { if (!container) return; var groupContainers = container.querySelectorAll(".tournament-points-table-group-table"); if (!groupContainers.length) return; initGroupSwitcher(); groupContainers.forEach(function(groupContainer) { initAnalytics(groupContainer); }); var intShowOnlyXRows = Number(showOnlyXRows || 0); var shouldLimitXRows = !Number.isNaN(intShowOnlyXRows) && intShowOnlyXRows > 0; var refreshData = function() { getRefreshedDataByAjax(function(response) { try { if (!response) return; if (!response["table"]) return; if (!response["table"][0]) return; if (!response["table"][0]["table"]) return; var pointsTableData = response["table"][0]["table"]; var pointsTableDataByGroup = {}; pointsTableData.forEach(function(group) { pointsTableDataByGroup[group.group_name] = group["group"]; }); groupContainers.forEach(function(groupContainer) { var groupTitle = groupContainer.dataset["groupTitle"]; var groupData = pointsTableDataByGroup[groupTitle]; if (Array.isArray(groupData) && groupData.length) { var tableBody = groupContainer.querySelector("table.keeda-data-table tbody"); if (tableBody) { if (shouldLimitXRows) { groupData = groupData.slice(0, intShowOnlyXRows); } var pointsTableDataForDom = prepareTabularData(groupData); tableBody.innerHTML = pointsTableDataForDom; window.dispatchEvent(new CustomEvent("custom:sk:utils:lazyLoadAssetImages")); initAnalytics(groupContainer); } } }); setTimeout(refreshData, REFRESH_INTERVAL_SECONDS * 1000); } catch (err) { console.error("Error while preparing points table DOM data", err); } }); } refreshData(); } window.addEventListener("DOMContentLoaded", init); })();ncG1vNJzZmivp6x7tLzOq6uso5WasaJ6wqikaJ%2BfZK%2BiusalmJ2do516sb7EpqCeql2hsqKz1J5mpqejqXqzwc2s