Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
collectionStats.totalDuration += currentVideo.duration;
carouselSlide.push(currentVideo);
if ((j > 0 && (j + 1) % 3 == 0) || j == videosLen - 1) {
carouselSlides.push({
videos: carouselSlide
});
carouselSlide = [];
}
}
currentActivity.collection._carouselSlides = carouselSlides;
// format
collectionStats.likes = Util.integerCommaFormat(collectionStats.likes);
collectionStats.views = Util.integerCommaFormat(collectionStats.views);
collectionStats.adoptions = Util.integerCommaFormat(collectionStats.adoptions);
collectionStats.totalDuration = Util.secondsToHMSFormat(collectionStats.totalDuration);
currentActivity.collection._collectionStats = collectionStats;
}
}
},
collectionStats.totalDuration += currentVideo.duration;
carouselSlide.push(currentVideo);
if ((j > 0 && (j + 1) % 4 == 0) || j == videosLen - 1) {
carouselSlides.push({
videos: carouselSlide
});
carouselSlide = [];
}
}
currentActivity.collection._carouselSlides = carouselSlides;
// format
collectionStats.likes = Util.integerCommaFormat(collectionStats.likes);
collectionStats.views = Util.integerCommaFormat(collectionStats.views);
collectionStats.adoptions = Util.integerCommaFormat(collectionStats.adoptions);
collectionStats.totalDuration = Util.secondsToHMSFormat(collectionStats.totalDuration);
currentActivity.collection._collectionStats = collectionStats;
}
}
},
carouselSlide.push(currentVideo);
if ((j > 0 && (j + 1) % 4 == 0) || j == videosLen - 1) {
carouselSlides.push({
videos: carouselSlide
});
carouselSlide = [];
}
}
currentActivity.collection._carouselSlides = carouselSlides;
// format
collectionStats.likes = Util.integerCommaFormat(collectionStats.likes);
collectionStats.views = Util.integerCommaFormat(collectionStats.views);
collectionStats.adoptions = Util.integerCommaFormat(collectionStats.adoptions);
collectionStats.totalDuration = Util.secondsToHMSFormat(collectionStats.totalDuration);
currentActivity.collection._collectionStats = collectionStats;
}
}
},
var $rightValue;
var $statIndicator;
var i = 0;
var len = $statBarWrappers.length;
for (; i < len; i++) {
var $currentStatBarWrapper = $statBarWrappers.eq(i);
$statBar = $currentStatBarWrapper.find('.js-stat-bar');
var leftValue = $statBar.data('leftValue');
var rightValue = $statBar.data('rightValue');
$leftValue = $currentStatBarWrapper.find('.js-left-value');
$rightValue = $currentStatBarWrapper.find('.js-right-value');
$leftValue.html(Util.integerCommaFormat(leftValue));
$rightValue.html(Util.integerCommaFormat(rightValue));
$statIndicator = $currentStatBarWrapper.find('.js-stat-indicator');
// for basic width setting, use this line instead
// $statIndicator.css('width', ((leftValue * 100) / (leftValue + rightValue)) + '%');
// otherwise, this can be used to animate the effect
$statIndicator.animate({
width: ((leftValue * 100) / (leftValue + rightValue)) + '%'
}, 2000);
}
},
}
else{
adoptions = Util.integerAbbreviatedFormat(collectionData.adoptions);
}
var views = ''
if (collectionData.views < 10000){
views = Util.integerCommaFormat(collectionData.views);
}
else{
views = Util.integerAbbreviatedFormat(collectionData.views);
}
var likes = ''
if (collectionData.likes < 10000){
likes = Util.integerCommaFormat(collectionData.likes);
}
else{
likes = Util.integerAbbreviatedFormat(collectionData.likes);
}
return {
time: Util.secondsToHMSFormat(time),
adoptions: adoptions,
views: views,
likes: likes
};
},
}
var i = 0;
var len = videos.length;
for (; i < len; i++) {
var currentVideo = videos[i];
time += currentVideo.duration;
adoptions += currentVideo.adoptions;
views += currentVideo.offlineViews + currentVideo.onlineViews;
likes += currentVideo.onlineLikes;
}
return {
time: Util.secondsToHMSFormat(time),
adoptions: Util.integerCommaFormat(adoptions),
views: Util.integerCommaFormat(views),
likes: Util.integerCommaFormat(likes)
};
},
if (!videos) {
throw new Error('CollectionViewController._getCollectionStats(): trying to get collection stats on an object with no videos array');
}
var i = 0;
var len = videos.length;
for (; i < len; i++) {
var currentVideo = videos[i];
time += currentVideo.duration;
}
return {
time: Util.secondsToHMSFormat(time),
adoptions: Util.integerCommaFormat(collectionData.adoptions),
views: Util.integerCommaFormat(collectionData.views),
likes: Util.integerCommaFormat(collectionData.likes)
};
},
if (!videos) {
throw new Error('CollectionViewController._getCollectionStats(): trying to get collection stats on an object with no videos array');
}
var i = 0;
var len = videos.length;
for (; i < len; i++) {
var currentVideo = videos[i];
time += currentVideo.duration;
}
return {
time: Util.secondsToHMSFormat(time),
adoptions: Util.integerCommaFormat(collectionData.adoptions),
views: Util.integerCommaFormat(collectionData.views),
likes: Util.integerCommaFormat(collectionData.likes)
};
},
throw new Error('CollectionViewController._getCollectionStats(): trying to get collection stats on an object with no videos array');
}
var i = 0;
var len = videos.length;
for (; i < len; i++) {
var currentVideo = videos[i];
time += currentVideo.duration;
}
return {
time: Util.secondsToHMSFormat(time),
adoptions: Util.integerCommaFormat(collectionData.adoptions),
views: Util.integerCommaFormat(collectionData.views),
likes: Util.integerCommaFormat(collectionData.likes)
};
},
updateTotalCount: function(totalCount) {
this._state.totalCount = totalCount;
jQuery('.js-comment-count').html(Util.integerCommaFormat(totalCount));
},