Skip to content

Instantly share code, notes, and snippets.

@sglessard
Created April 15, 2020 18:41
Show Gist options
  • Select an option

  • Save sglessard/e6ce95e7aa230bcc83098053642cbae6 to your computer and use it in GitHub Desktop.

Select an option

Save sglessard/e6ce95e7aa230bcc83098053642cbae6 to your computer and use it in GitHub Desktop.
crossword highlightClue
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