Skip to content

Commit

Permalink
Fix wrong secondary selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
JPJPJPOPOP committed Jan 8, 2018
1 parent 20f3b39 commit 2f53ae9
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions assets/js/spellchecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,6 @@ if(modeEnabled('spellchecking')) {
});
}

function populateSecondarySpellCheckerList() {
var group = analyzers[$('#primarySpellCheckerMode').val()];
$('#secondarySpellCheckerMode').empty();

if(group) {
if(group.length <= 1) {
$('#secondarySpellCheckerMode').fadeOut('fast');
}
else {
$('#secondarySpellCheckerMode').fadeIn('fast');
}

group.sort(function (a, b) {
return a.length - b.length;
});

for(var i = 0; i < group.length; i++) {
var lang = group[i];
var langDisplay = lang.indexOf('-') !== -1
? getLangByCode(lang.split('-')[0]) + '-' + getLangByCode(lang.split('-')[1])
: getLangByCode(lang);
$('#secondarySpellCheckerMode').append($('<option></option').val(lang).text(langDisplay));
}
}
else {
$('#secondarySpellCheckerMode').fadeOut('fast');
}
}

function populatePrimarySpellCheckerList(data /*: {} */) {
$('.spellCheckerMode').empty();

Expand Down Expand Up @@ -198,6 +169,35 @@ function populatePrimarySpellCheckerList(data /*: {} */) {
restoreChoices('spellerchecker');
}

function populateSecondarySpellCheckerList() {
var group = spellers[$('#primarySpellCheckerMode').val()];
$('#secondarySpellCheckerMode').empty();

if(group) {
if(group.length <= 1) {
$('#secondarySpellCheckerMode').fadeOut('fast');
}
else {
$('#secondarySpellCheckerMode').fadeIn('fast');
}

group.sort(function (a, b) {
return a.length - b.length;
});

for(var i = 0; i < group.length; i++) {
var lang = group[i];
var langDisplay = lang.indexOf('-') !== -1
? getLangByCode(lang.split('-')[0]) + '-' + getLangByCode(lang.split('-')[1])
: getLangByCode(lang);
$('#secondarySpellCheckerMode').append($('<option></option').val(lang).text(langDisplay));
}
}
else {
$('#secondarySpellCheckerMode').fadeOut('fast');
}
}

function check() {
if(currentSpellCheckerRequest) {
currentSpellCheckerRequest.abort();
Expand Down

0 comments on commit 2f53ae9

Please sign in to comment.