Created
April 15, 2020 18:41
-
-
Save sglessard/e6ce95e7aa230bcc83098053642cbae6 to your computer and use it in GitHub Desktop.
crossword highlightClue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| highlightClue: function() { | |
| var clue; | |
| $('.clues-active').removeClass('clues-active'); | |
| $('#puzzle-clues li' + '[data-position=' + activePosition + ']').addClass('clues-active'); | |
| if (mode === 'interacting') { | |
| clue = $('#puzzle-clues li' + '[data-position=' + activePosition + ']'); | |
| activeClueIndex = $(clueLiEls).index(clue); | |
| // If all input have been filled, strike the clue | |
| let inputs = $('.position-' + activePosition + ' input'); | |
| currVal = $('.position-' + activePosition + ' input').map(function() { | |
| return $(this) | |
| .val() | |
| .toLowerCase(); | |
| }) | |
| .get() | |
| .join(''); | |
| if (currVal.length === inputs.length) { | |
| clue.addClass('clue-done'); | |
| } else { | |
| clue.removeClass('clue-done'); | |
| } | |
| } | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment