forked from HoloTech/twitch-subathon-timer
-leaderboard scores
- will not work over 1000 points
This commit is contained in:
16
timer.js
16
timer.js
@@ -129,12 +129,15 @@ class TimerRenderer {
|
||||
// Name of user 1
|
||||
this.topusers_user1_name = document.getElementById("GiftUserName1")
|
||||
this.topusers_userdupe1_name = document.getElementById("GiftUserNameDupe1")
|
||||
this.topusers_user1_score = document.getElementById("GiftUserScore1")
|
||||
this.topusers_user2_num = document.getElementById("GiftUserNum2")
|
||||
this.topusers_user2_name = document.getElementById("GiftUserName2")
|
||||
this.topusers_userdupe2_name = document.getElementById("GiftUserNameDupe2")
|
||||
this.topusers_user2_score = document.getElementById("GiftUserScore2")
|
||||
this.topusers_user3_num = document.getElementById("GiftUserNum3")
|
||||
this.topusers_user3_name = document.getElementById("GiftUserName3")
|
||||
this.topusers_userdupe3_name = document.getElementById("GiftUserNameDupe3")
|
||||
this.topusers_user3_score = document.getElementById("GiftUserScore3")
|
||||
|
||||
// -- Animation --
|
||||
// Left-fade wrappers
|
||||
@@ -160,7 +163,7 @@ class TimerRenderer {
|
||||
if (this.scrollboxes[i].id == 'ScrollWrapGoal') {
|
||||
|
||||
// Check if element text overflows
|
||||
if (this.goal_name.getBoundingClientRect().width > (this.scrollboxes[i].getBoundingClientRect().width * .85)) {
|
||||
if (this.goal_name.getBoundingClientRect().width > (this.scrollboxes[i].getBoundingClientRect().width)) {
|
||||
// Toggle animation
|
||||
this.goal_name.classList.add("scrollAnim");
|
||||
this.goal_namedupe.classList.add("scrollAnim");
|
||||
@@ -179,7 +182,7 @@ class TimerRenderer {
|
||||
} else {
|
||||
|
||||
// Check if element text overflows
|
||||
if (this.userboxes[i].getBoundingClientRect().width > (this.scrollboxes[i].getBoundingClientRect().width * .75)) {
|
||||
if (this.userboxes[i].getBoundingClientRect().width > (this.scrollboxes[i].getBoundingClientRect().width * .65)) {
|
||||
// Toggle animation
|
||||
this.userboxes[i].classList.add("scrollAnim");
|
||||
this.userdupeboxes[i].classList.add("scrollAnim");
|
||||
@@ -213,12 +216,15 @@ class TimerRenderer {
|
||||
this.topusers_user1_num.textContent = "1";
|
||||
this.topusers_user1_name.textContent = "Username1024";
|
||||
this.topusers_userdupe1_name.textContent = "Username1024";
|
||||
this.topusers_user1_score.textContent = "0000";
|
||||
this.topusers_user2_num.textContent = "2";
|
||||
this.topusers_user2_name.textContent = "User";
|
||||
this.topusers_userdupe2_name.textContent = "User";
|
||||
this.topusers_user2_score.textContent = "0000";
|
||||
this.topusers_user3_num.textContent = "3";
|
||||
this.topusers_user3_name.textContent = "Username_Very_Super_Long12";
|
||||
this.topusers_userdupe3_name.textContent = "Username_Very_Super_Long12";
|
||||
this.topusers_user3_score.textContent = "0000";
|
||||
}
|
||||
|
||||
// End subathon, change timer color, and show thank you message
|
||||
@@ -308,33 +314,39 @@ class TimerRenderer {
|
||||
this.topusers_user1_num.textContent = "1";
|
||||
this.topusers_user1_name.textContent = users[0].user_name;
|
||||
this.topusers_userdupe1_name.textContent = users[0].user_name;
|
||||
this.topusers_user1_score.textContent = users[0].amount;
|
||||
//this.topusers_user1_name.style.animationDuration = `${this.topusers_user1_name.getBoundingClientRect().width / 50}s`;
|
||||
} else {
|
||||
this.topusers_user1_num.textContent = "1";
|
||||
this.topusers_user1_name.textContent = "";
|
||||
this.topusers_userdupe1_name.textContent = "";
|
||||
this.topusers_user1_score.textContent = "0000";
|
||||
}
|
||||
|
||||
if (users.length >= 2) {
|
||||
this.topusers_user2_num.textContent = "2";
|
||||
this.topusers_user2_name.textContent = users[1].user_name;
|
||||
this.topusers_userdupe2_name.textContent = users[1].user_name;
|
||||
this.topusers_user2_score.textContent = users[1].amount;
|
||||
//this.topusers_user2_name.style.animationDuration = `${this.topusers_user2_name.getBoundingClientRect().width / 50}s`;
|
||||
} else {
|
||||
this.topusers_user2_num.textContent = "2";
|
||||
this.topusers_user2_name.textContent = "";
|
||||
this.topusers_userdupe2_name.textContent = "";
|
||||
this.topusers_user2_score.textContent = "0000";
|
||||
}
|
||||
|
||||
if (users.length >= 3) {
|
||||
this.topusers_user3_num.textContent = "3";
|
||||
this.topusers_user3_name.textContent = users[2].user_name;
|
||||
this.topusers_userdupe3_name.textContent = users[2].user_name;
|
||||
this.topusers_user3_score.textContent = users[2].amount;
|
||||
//this.topusers_user3_name.style.animationDuration = `${this.topusers_user3_name.getBoundingClientRect().width / 50}s`;
|
||||
} else {
|
||||
this.topusers_user3_num.textContent = "3";
|
||||
this.topusers_user3_name.textContent = "";
|
||||
this.topusers_userdupe3_name.textContent = "";
|
||||
this.topusers_user3_score.textContent = "0000";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user