Here is my JSFiddle: https://jsfiddle.net/y6pnq7k5/3/
Sorry if it's too much code, I tried to narrow it down.
The main functions to look at are generatorClicked() and progressBarAnimation().
When you click on the boxes (for example fire spell tome), I have a progress bar animation that goes across the div. The problem is that if you spam click the div it will reset the progress bar back at the start, and because this is meant to be an idle game the progress bar should not be affected until it has finished it's job. One solution I've tried are disabling pointer events via style:
var isClicked = true;
document.GetElementByID(this.id).style.pointerEvents = 'none';
//progress bar animation - after it's done isClicked = false
if(!isClicked) {
document.GetElementByID(this.id).style.pointerEvents = 'auto';
}
This had issues with either the progress bar not being clickable after the first progress bar finished, or it would still allow the click spam to reset the bar, depending on where I made isClicked false.
I've also tried creating a shield like the top answer in this post
Which just stopped the progress bar from moving at all.
I don't have any libraries, just vanilla JS. I know that my implementation of this progress bar animation is also dubious, but even if I refactor it I still would need the progress bar to not be affected by subsequent clicks as it will affect the gameplay.