‘;
});
pollOptions.innerHTML = pollOptionsDom;
pollCount.innerHTML = totalVotes + ‘ votes’;
if (totalVotes > 10)
pollCount.classList.remove(“hidden”);
}
function trackBetsTodayPollImpression() {
var intersectionObserverForArticlePoll = new IntersectionObserver(
function(entries)
entries.forEach(function(entry) );
,
threshold: [0.75]
);
if (pollIds.length > 0)
pollIds.forEach(function(pollId)
var pollEl = document.querySelector(‘[data-poll-id=”‘ + pollId + ‘”]’);
if (pollEl)
intersectionObserverForArticlePoll.observe(pollEl);
);
}
trackBetsTodayPollImpression();
var postPolls = document.querySelectorAll(“.bets-today-poll”);
if (postPolls) {
postPolls.forEach(function(poll) {
var pollId = poll.getAttribute(“data-poll-id”);
var totalVotes = parseInt(poll.getAttribute(“data-total-votes”)) || 0;
var pollOptionsDom = “”;
var pollOptions = document.querySelector(‘#bets-today-poll-template’);
var pollCount = document.querySelector(“.bets-today-poll-total-votes[data-poll-id='” + pollId + “‘]”);
if (!POLLS_BY_ID[pollId])
POLLS_BY_ID[pollId] = ;
if (pollOptions) {
var pollOptionsContent = document.importNode(pollOptions.content, true);
var options = poll.getElementsByClassName(“option-container”);
var totalVotes = parseInt(poll.getAttribute(“data-total-votes”)) || 0;
var percentageMap = ;
if (totalVotes > 0)
for (var i = 0; i insertBefore(modalRatingPopup, appFooter);
function sendFeedback(event)
var feedbackFormContent = event.target.parentNode;
var feedbackForm = feedbackFormContent.querySelector(‘.rating-feedback-form’);
var feedbackText = feedbackForm.querySelector(‘.post-rating-feedback-note textarea’) && feedbackForm.querySelector(‘.post-rating-feedback-note textarea’).value;
var feedbackType = feedbackForm.querySelector(‘.rating-feedback-type’);
var ratingValue = parseInt(feedbackForm.querySelector(‘#start’ + (ratingIndex + 1)).getAttribute(‘data-rating’));
// TODO: implement logic here
modalRatingPopup.parentNode.removeChild(modalRatingPopup);
function openRatingModal(event)
event.preventDefault();
var modalOptions = modalRatingPopup.querySelector(‘.feedback-options’);
for (var i = 0; i < modalOptions.children.length; i++)
modalOptions.children[i].classList.remove(‘active’);
if (event && event.target)
var modalClose = modalRatingPopup.querySelector(‘.close’);
modalClose.addEventListener(‘click’, function() modalRatingPopup.parentNode.removeChild(modalRatingPopup); );
var modalSubmit = modalRatingPopup.querySelector(‘.submit-feedback-form’);
modalSubmit.addEventListener(‘click’, sendFeedback);
var ratingStars = modalRatingPopup.querySelectorAll(‘.rating-star’);
ratingStars.forEach(function(star, index)
star.addEventListener(‘click’, function(event)
event && event.preventDefault();
ratingIndex = index;
openRatingModal(event);
);
);