diff --git a/public/scripts/stages.js b/public/scripts/stages.js index 7ca1137f..015049f9 100644 --- a/public/scripts/stages.js +++ b/public/scripts/stages.js @@ -88,7 +88,7 @@ const stages = [ name: 'fa-bacon', }, ], - startDisabled: false, + startDisabled: true, completed: false, back: 4, next: 6, @@ -185,6 +185,9 @@ const handleStage = stageData => { case 4: handleStage4(stageData.id); break; + case 5: + handleStage5(stageData.id); + break; case 6: handleStage6(stageData.id); break; @@ -210,6 +213,8 @@ const stageReset = stageData => { $('#stage-icon').droppable('disable'); break; case 5: + $('#stage-icon').css('opacity', '1'); + $('#stage-icon').off('click'); break; case 6: $('#tileGroup').remove(); @@ -278,6 +283,22 @@ const handleStage4 = id => { }); }; +const handleStage5 = id => { + let totalClicksRequired = 3; + let clickCount = 1; + let opacityCalculator = 1; + $('#stage-icon').click(() => { + clickCount++; + opacityCalculator -= 1 / totalClicksRequired; + $('#stage-icon').css('opacity', `${opacityCalculator.toString()}`); + if (clickCount > totalClicksRequired) { + stages[id].completed = true; + enable('stage-btn-next'); + } + }); +}; + + const handleStage6 = id => { // generates stage HTML $('#stage_container').prepend($('
', { id: 'tileGroup' }));