Skip to content

Commit

Permalink
feat: implement bag random for srabbit feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeg committed Oct 13, 2024
1 parent 06e9b2f commit 7ece629
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions public/views/1p/jdish.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
'Facepalm!',
'This is a new low',
"I'm not mad, just disappointed",
'Wow just wow',
'Wow... just wow',
'We need to talk',
'You did WHAT?!',
'Congratulations, you broke reality',
Expand Down Expand Up @@ -537,12 +537,19 @@
if (animId) cancelAnimationFrame(animId);
if (disappearId) clearTimeout(disappearId);

const feedbacks = Object.values(srabbit_ratings).find(
const feedbackObj = Object.values(srabbit_ratings).find(
rating => rating.score === grade
).feedbacks;
if (!feedbacks) return;
);
if (!feedbackObj) return;
if (
!feedbackObj.idx ||
feedbackObj.idx >= feedbackObj.feedbacks.length
) {
feedbackObj.idx = 0;
shuffle(feedbackObj.feedbacks);
}
const feedback = feedbackObj.feedbacks[feedbackObj.idx++];

const feedback = shuffle(feedbacks)[0];
gradeText = document.createElement('div');
gradeText.classList.add('srabbit_rating');

Expand Down

0 comments on commit 7ece629

Please sign in to comment.