Skip to content

Commit b541da3

Browse files
committed
Nuked secondary selector.
1 parent cec0819 commit b541da3

File tree

3 files changed

+7
-63
lines changed

3 files changed

+7
-63
lines changed

assets/js/persistence.js

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* exported persistChoices, restoreChoices, cache, readCache */
44

55
/* global config, Store, getURLParam, iso639CodesInverse, pairs, refreshLangList populateSecondaryAnalyzerList,
6-
populateSecondaryGeneratorList, populateSecondarySpellCheckerList, isSubset, handleNewCurrentLang */
6+
populateSecondaryGeneratorList, isSubset, handleNewCurrentLang */
77
/* global srcLangs, dstLangs, recentSrcLangs, recentDstLangs, setCurDstLang, setCurSrcLang, setRecentDstLangs, setRecentSrcLangs, setLocale,
88
curSrcLang, curDstLang, locale */
99

@@ -77,7 +77,6 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
7777
else if(mode === 'spellchecker') {
7878
objects = {
7979
'primarySpellCheckerChoice': $('#primarySpellCheckerMode').val(),
80-
'secondarySpellCheckerChoice': $('#secondarySpellCheckerMode').val(),
8180
'spellCheckerInput': $('#spellCheckerInput').text(),
8281
'instantChecking': $('#instantChecking').val()
8382
};
@@ -131,11 +130,6 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
131130
urlParams.push('choice=' + encodeURIComponent($('#secondaryGeneratorMode').val()));
132131
qVal = $('#morphGeneratorInput').val();
133132
}
134-
else if(hash === '#spellchecking' && $('#secondarySpellCheckerMode').val()) {
135-
urlParams = [];
136-
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellCheckerMode').val()));
137-
qVal = $('#spellCheckerInput').text();
138-
}
139133

140134
var qName /*: string */ = HASH_URL_MAP[hash];
141135

@@ -282,15 +276,9 @@ function restoreChoices(mode /*: string */) {
282276
}
283277
else if(mode === 'spellchecker') {
284278
if(store.able()) {
285-
var primarySpellCheckerChoice = store.get('primarySpellCheckerChoice', ''),
286-
secondarySpellCheckerChoice = store.get('secondarySpellCheckerChoice', '');
287-
if(store.has('primarySpellCheckerChoice') && store.has('secondarySpellCheckerChoice')) {
279+
var primarySpellCheckerChoice = store.get('primarySpellCheckerChoice', '');
280+
if(store.has('primarySpellCheckerChoice')) {
288281
$('#primarySpellCheckerMode option[value="' + primarySpellCheckerChoice + '"]').prop('selected', true);
289-
populateSecondarySpellCheckerList();
290-
$('#secondarySpellCheckerMode option[value="' + secondarySpellCheckerChoice + '"]').prop('selected', true);
291-
}
292-
else {
293-
populateSecondarySpellCheckerList();
294282
}
295283
if(store.has('spellCheckerInput')) {
296284
$('#spellCheckerInput').text(String(store.get('spellCheckerInput')));
@@ -299,12 +287,8 @@ function restoreChoices(mode /*: string */) {
299287
}
300288

301289
if(getURLParam('choice')) {
302-
choice = getURLParam('choice').split('-');
303-
$('#primarySpellCheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
304-
populateSecondarySpellCheckerList();
305-
if(choice.length === 2) {
306-
$('#secondarySpellCheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
307-
}
290+
choice = getURLParam('choice');
291+
$('#primarySpellCheckerMode option[value="' + choice + '"]').prop('selected', true);
308292
}
309293
}
310294
else if(mode === 'localization') {
@@ -330,6 +314,5 @@ function restoreChoices(mode /*: string */) {
330314
/*:: import {iso639Codes, iso639CodesInverse, locale, setLocale} from "./localization.js" */
331315
/*:: import {populateSecondaryGeneratorList} from "./generator.js" */
332316
/*:: import {populateSecondaryAnalyzerList} from "./analyzer.js" */
333-
/*:: import {populateSecondarySpellCheckerList} from "./spellchecker.js" */
334317
/*:: import {getURLParam, isSubset} from "./util.js" */
335318
/*:: import {Store} from "./store.js" */

assets/js/spellchecker.js

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var spellers = {}, spellerData = {};
44
var currentSpellCheckerRequest;
55

6-
/* exported getSpellers, populateSecondarySpellCheckerList */
6+
/* exported getSpellers */
77
/* global config, modeEnabled, persistChoices, readCache, ajaxSend, ajaxComplete, filterLangPairList, allowedLang, cache,
88
localizeInterface, getLangByCode, restoreChoices, callApy */
99
/* global ENTER_KEY_CODE */
@@ -69,15 +69,10 @@ if(modeEnabled('spellchecking')) {
6969
});
7070

7171
$('#primarySpellCheckerMode').change(function () {
72-
populateSecondarySpellCheckerList();
7372
localizeInterface();
7473
persistChoices('spellchecker');
7574
});
7675

77-
$('#secondarySpellCheckerMode').change(function () {
78-
persistChoices('spellchecker');
79-
});
80-
8176
$('#spellCheckerInput').keydown(function (e /*: JQueryKeyEventObject */) {
8277
if(e.keyCode === ENTER_KEY_CODE && !e.shiftKey) {
8378
e.preventDefault();
@@ -169,35 +164,6 @@ function populatePrimarySpellCheckerList(data /*: {} */) {
169164
restoreChoices('spellerchecker');
170165
}
171166

172-
function populateSecondarySpellCheckerList() {
173-
var group = spellers[$('#primarySpellCheckerMode').val()];
174-
$('#secondarySpellCheckerMode').empty();
175-
176-
if(group) {
177-
if(group.length <= 1) {
178-
$('#secondarySpellCheckerMode').fadeOut('fast');
179-
}
180-
else {
181-
$('#secondarySpellCheckerMode').fadeIn('fast');
182-
}
183-
184-
group.sort(function (a, b) {
185-
return a.length - b.length;
186-
});
187-
188-
for(var i = 0; i < group.length; i++) {
189-
var lang = group[i];
190-
var langDisplay = lang.indexOf('-') !== -1
191-
? getLangByCode(lang.split('-')[0]) + '-' + getLangByCode(lang.split('-')[1])
192-
: getLangByCode(lang);
193-
$('#secondarySpellCheckerMode').append($('<option></option').val(lang).text(langDisplay));
194-
}
195-
}
196-
else {
197-
$('#secondarySpellCheckerMode').fadeOut('fast');
198-
}
199-
}
200-
201167
function check() {
202168
if(currentSpellCheckerRequest) {
203169
currentSpellCheckerRequest.abort();
@@ -261,7 +227,7 @@ function spellCheckerNotAvailable(data) {
261227
$('#spellCheckerInput').append($('<div></div>').text(data.explanation));
262228
}
263229

264-
/*:: export {getSpellers, populateSecondarySpellCheckerList} */
230+
/*:: export {getSpellers} */
265231

266232
/*:: import {modeEnabled, ajaxSend, ajaxComplete, allowedLang, filterLangPairList, callApy, ENTER_KEY_CODE} from "./util.js" */
267233
/*:: import {persistChoices, restoreChoices} from "./persistence.js" */

index.html.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,6 @@
341341
<option></option>
342342
</select>
343343
</div>
344-
<div class="col-sm-4">
345-
<select class="form-control spellCheckerMode" id="secondarySpellCheckerMode" name="secondarySpellCheckerMode">
346-
<option></option>
347-
</select>
348-
</div>
349344
</div>
350345
<div class="form-group">
351346
<label for="spellCheckerInput" class="col-sm-2 control-label" data-text="Input_Text">Input Text</label>

0 commit comments

Comments
 (0)