Skip to content

Commit 83da88d

Browse files
committed
Fix review comments.
1 parent 1f1165c commit 83da88d

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ JSFILES= \
4747
assets/js/analyzer.js \
4848
assets/js/generator.js \
4949
assets/js/sandbox.js \
50-
assets/js/spellchecker.js
50+
assets/js/spellchecker.js
5151

5252
build/js/config.js: $(CONFIG) tools/read-conf.py build/js/.d
5353
./tools/read-conf.py -c $< js > $@

assets/js/localization.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var localizedLanguageCodes /*: {[string]: string} */ = {}, localizedLanguageName
1313

1414
/* global config, getPairs, getGenerators, getAnalyzers, persistChoices, getURLParam, cache, ajaxSend, ajaxComplete, sendEvent,
1515
srcLangs, dstLangs, generators, analyzers, readCache, modeEnabled, populateTranslationList, populateGeneratorList,
16-
populateAnalyzerList, analyzerData, generatorData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique
16+
populateAnalyzerList, analyzerData, generatorData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique,
1717
getSpellers */
1818

1919
var dynamicLocalizations /*: {[lang: string]: {[string]: string}} */ = {
@@ -57,7 +57,7 @@ $(document).ready(function () {
5757
'translation': getPairs,
5858
'generation': getGenerators,
5959
'analyzation': getAnalyzers,
60-
'spellchecker': getSpellers
60+
'spellchecking': getSpellers
6161
};
6262
var deferredItems = [getLocale(), getLocales()];
6363
if(config.ENABLED_MODES) {

assets/js/persistence.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var URL_PARAM_Q_LIMIT = 1300,
1414
'#webpageTranslation': 'qP',
1515
'#analyzation': 'qA',
1616
'#generation': 'qG',
17-
'#spellchecker': 'qS'
17+
'#spellchecking': 'qS'
1818
};
1919

2020
var store = new Store(config.HTML_URL);
@@ -131,7 +131,7 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
131131
urlParams.push('choice=' + encodeURIComponent($('#secondaryGeneratorMode').val()));
132132
qVal = $('#morphGeneratorInput').val();
133133
}
134-
else if(hash === '#spellchecker' && $('#secondarySpellCheckerMode').val()) {
134+
else if(hash === '#spellchecking' && $('#secondarySpellCheckerMode').val()) {
135135
urlParams = [];
136136
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellCheckerMode').val()));
137137
qVal = $('#spellCheckerInput').text();

assets/js/spellchecker.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @flow
2+
13
var spellers = {}, spellerData = {};
24
var currentSpellCheckerRequest;
35

@@ -46,7 +48,7 @@ function getSpellers() {
4648
return deferred.promise();
4749
}
4850

49-
if(modeEnabled('spellchecker')) {
51+
if(modeEnabled('spellchecking')) {
5052
$(document).ready(function () {
5153
restoreChoices('spellchecker');
5254
var timer, timeout = 2000;
@@ -214,17 +216,17 @@ function check() {
214216
success: function (data) {
215217
var originalWordsIndex = 0;
216218
for(var tokenIndex = 0; tokenIndex < data.length; tokenIndex++) {
217-
if(data[tokenIndex]['known'] === true) { // eslint-disable-line dot-notation
218-
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' ' + splitWords[originalWordsIndex]);
219+
if(data[tokenIndex].known === true) {
220+
$('#spellCheckerInput').html($('#spellCheckerInput').html() + ' ' + splitWords[originalWordsIndex]);
219221
originalWordsIndex++;
220222
continue;
221223
}
222-
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' <span class="spellError" id=' +
224+
$('#spellCheckerInput').html($('#spellCheckerInput').html() + ' <span class="spellError" id=' +
223225
splitWords[originalWordsIndex] + '>' + splitWords[originalWordsIndex] + '</span>');
224226
content[splitWords[originalWordsIndex]] = '<div class="list-group">';
225-
for(var sugg = 0; sugg < data[tokenIndex]['sugg'].length; sugg++) { // eslint-disable-line dot-notation
227+
for(var sugg = 0; sugg < data[tokenIndex].sugg.length; sugg++) {
226228
content[splitWords[originalWordsIndex]] += '<a href="#" class="list-group-item">' +
227-
data[tokenIndex]['sugg'][sugg][0] + '</a>'; // eslint-disable-line dot-notation
229+
data[tokenIndex].sugg[sugg][0] + '</a>';
228230
content[splitWords[originalWordsIndex]] += '</div>';
229231
}
230232
$('.spellError').each(function () {
@@ -248,7 +250,10 @@ function handleSpellCheckerErrorResponse(jqXHR) {
248250
}
249251

250252
function spellCheckerNotAvailable(data) {
251-
$('#spellCheckerInput').append($('<div></div>').text(' '));
252253
$('#spellCheckerInput').append($('<div></div>').text(data.message));
253254
$('#spellCheckerInput').append($('<div></div>').text(data.explanation));
254255
}
256+
257+
/*:: import {modeEnabled, ajaxSend, ajaxComplete, filterLangList, callApy} from "./util.js" */
258+
/*:: import {persistChoices, restoreChoices} from "./persistence.js" */
259+
/*:: import {readCache, cache} from "./persistence.js" */

index.html.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<li><a href="#translation" id="translationTarget" data-mode="translation" data-text="Translation" class="hide">Translation</a></li>
101101
<li><a href="#analyzation" data-mode="analyzation" data-text="Morphological_Analysis" class="hide">Morphological analysis</a></li>
102102
<li><a href="#generation" data-mode="generation" data-text="Morphological_Generation" class="hide">Morphological generation</a></li>
103-
<li><a href="#spellchecker" data-mode="spellchecker" data-text="Spell_Checker">Spell checker</a></li>
103+
<li><a href="#spellchecking" data-mode="spellchecking" data-text="Spell_Checking">Spell checking</a></li>
104104
<li><a href="#sandbox" data-mode="sandbox" data-text="APy_Sandbox" class="hide">APy sandbox</a></li>
105105
</ul>
106106
</div>
@@ -329,21 +329,21 @@
329329
</form>
330330
<div id="morphGenOutput" class="outputContainer"></div>
331331
</div>
332-
<div class="modeContainer" id="spellcheckerContainer">
333-
<h2 class="visible-xs" data-text="Spell_Checker">Spell Checker</h2>
332+
<div class="modeContainer" id="spellcheckingContainer">
333+
<h2 class="visible-xs" data-text="Spell_Checking">Spell Checking</h2>
334334
<form class="form-horizontal" role="form" id="spellCheckerForm">
335335
<fieldset>
336336
<legend data-text="Spell_Checker_Help"></legend>
337337
<div class="form-group">
338338
<label for="primarySpellCheckerMode" class="col-sm-2 control-label" data-text="Language">Language</label>
339339
<div class="col-sm-3">
340340
<select class="form-control spellCheckerMode" id="primarySpellCheckerMode" name="primarySpellCheckerMode">
341-
<option> </option>
341+
<option></option>
342342
</select>
343343
</div>
344344
<div class="col-sm-4">
345345
<select class="form-control spellCheckerMode" id="secondarySpellCheckerMode" name="secondarySpellCheckerMode">
346-
<option> </option>
346+
<option></option>
347347
</select>
348348
</div>
349349
</div>

0 commit comments

Comments
 (0)