From 250b0b8d41bfac18eaec2081788097b7b13df706 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sun, 23 Jan 2022 16:10:38 +0530 Subject: [PATCH] code refactoring --- index.html | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index d9a1aa8..f66ecf5 100644 --- a/index.html +++ b/index.html @@ -616,7 +616,8 @@
- +
@@ -1341,7 +1342,7 @@ if (noOfContributors === 2) break } - if (noOfContributors < 2) { + if (noOfContributors < 2 && !contributors.hasOwnProperty(myFloID)) { contentCard.querySelector('.content__author').textContent = `2 Contributors` } floGlobals.currentArticle.uniqueEntries[entry.origin].iterations.push(genDataVC) @@ -1439,7 +1440,7 @@ easing: 'ease', } const selectedContentSize = selectedContent.size - getRef('selected_entries_no').textContent = `${selectedContentSize} selected` + getRef('selected_entries_no').textContent = `${selectedContentSize} selected for download` if (selectedContentSize === 1 && !isContentSelected) { getRef('article_name_wrapper').classList.remove('hide-completely') getRef('selected_content_options').classList.add('hide-completely') @@ -13063,24 +13064,24 @@ ], animOptions).onfinish = e => e.target.cancel() } }) - function animateLikeCount(voteCount = 1) { + function animateLikeCount(voteCount = 1, articleID) { const animOptions = { fill: 'forwards', duration: 150, ease: 'easing', } - totalVotes += voteCount + floGlobals.appObjects.articles[articleID].votes += voteCount getRef('like_count').animate(slideOutUp, animOptions) .onfinish = (e) => { e.target.cancel() } const tempCount = document.createElement('div') tempCount.classList.add('temp-count') - tempCount.textContent = getRelativeCount(totalVotes) + tempCount.textContent = floGlobals.appObjects.articles[articleID].votes getRef('like_count').after(tempCount) tempCount.animate(slideInUp, animOptions) .onfinish = () => { - getRef('like_count').textContent = getRelativeCount(totalVotes) + getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes tempCount.remove() } } @@ -13183,14 +13184,6 @@ animateTo(getRef('sign_up'), slideInLeft, animOptions) } } - function getRelativeCount(count) { - if (count < 1000) - return count - else if (count < 1000000) - return parseFloat((count / 1000).toFixed(1)) + 'K' - else if (count < 1000000000) - return parseFloat((count / 1000000).toFixed(1)) + 'M' - } function goToSignIn() { const animOptions = { fill: 'forwards', @@ -13218,30 +13211,23 @@