Skip to content

Commit 1f1165c

Browse files
committed
Fix names.
1 parent 9e67f03 commit 1f1165c

File tree

4 files changed

+71
-74
lines changed

4 files changed

+71
-74
lines changed

assets/css/translation.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ html[dir='rtl'] #srcLanguages {
7979

8080
/* Spell Checker */
8181

82-
#spellcheckerInput {
82+
#spellCheckerInput {
8383
display: block;
8484
height: 131px;
8585
overflow: auto;
8686
resize: both;
8787
}
8888

89-
.spellcheckVisible .spellError {
89+
.spellCheckerVisible .spellError {
9090
border-bottom: 1px solid #f00;
9191
}
9292

@@ -97,13 +97,14 @@ html[dir='rtl'] #srcLanguages {
9797
width: 110%;
9898
}
9999

100-
.list-group { /* sass-lint:disable-line class-name-format */
100+
.spellCheckerList {
101101
margin-bottom: 0;
102102
}
103103

104-
.list-group-item { /* sass-lint:disable-line class-name-format */
104+
.spellCheckerListItem {
105105
border: 0;
106106
cursor: pointer;
107+
display: block;
107108
padding: 4px 10px;
108109
}
109110

assets/js/persistence.js

Lines changed: 22 additions & 21 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, populateSecondarySpellCheckerList, isSubset, handleNewCurrentLang */
77
/* global srcLangs, dstLangs, recentSrcLangs, recentDstLangs, setCurDstLang, setCurSrcLang, setRecentDstLangs, setRecentSrcLangs, setLocale,
88
curSrcLang, curDstLang, locale */
99

@@ -13,7 +13,8 @@ var URL_PARAM_Q_LIMIT = 1300,
1313
'#translation': 'q',
1414
'#webpageTranslation': 'qP',
1515
'#analyzation': 'qA',
16-
'#generation': 'qG'
16+
'#generation': 'qG',
17+
'#spellchecker': 'qS'
1718
};
1819

1920
var store = new Store(config.HTML_URL);
@@ -75,9 +76,9 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
7576
}
7677
else if(mode === 'spellchecker') {
7778
objects = {
78-
'primarySpellcheckerChoice': $('#primarySpellcheckerMode').val(),
79-
'secondarySpellcheckerChoice': $('#secondarySpellcheckerMode').val(),
80-
'spellcheckerInput': $('#spellcheckerInput').text(),
79+
'primarySpellCheckerChoice': $('#primarySpellCheckerMode').val(),
80+
'secondarySpellCheckerChoice': $('#secondarySpellCheckerMode').val(),
81+
'spellCheckerInput': $('#spellCheckerInput').text(),
8182
'instantChecking': $('#instantChecking').val()
8283
};
8384
}
@@ -130,10 +131,10 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
130131
urlParams.push('choice=' + encodeURIComponent($('#secondaryGeneratorMode').val()));
131132
qVal = $('#morphGeneratorInput').val();
132133
}
133-
else if(hash === '#spellchecker' && $('#secondarySpellcheckerMode').val()) {
134+
else if(hash === '#spellchecker' && $('#secondarySpellCheckerMode').val()) {
134135
urlParams = [];
135-
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellcheckerMode').val()));
136-
qVal = $('#spellcheckerInput').text();
136+
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellCheckerMode').val()));
137+
qVal = $('#spellCheckerInput').text();
137138
}
138139

139140
var qName /*: string */ = HASH_URL_MAP[hash];
@@ -281,28 +282,28 @@ function restoreChoices(mode /*: string */) {
281282
}
282283
else if(mode === 'spellchecker') {
283284
if(store.able()) {
284-
var primarySpellcheckerChoice = store.get('primarySpellcheckerChoice', ''),
285-
secondarySpellcheckerChoice = store.get('secondarySpellcheckerChoice', '');
286-
if(store.has('primarySpellcheckerChoice') && store.has('secondarySpellcheckerChoice')) {
287-
$('#primarySpellcheckerMode option[value="' + primarySpellcheckerChoice + '"]').prop('selected', true);
288-
populateSecondarySpellcheckerList();
289-
$('#secondarySpellcheckerMode option[value="' + secondarySpellcheckerChoice + '"]').prop('selected', true);
285+
var primarySpellCheckerChoice = store.get('primarySpellCheckerChoice', ''),
286+
secondarySpellCheckerChoice = store.get('secondarySpellCheckerChoice', '');
287+
if(store.has('primarySpellCheckerChoice') && store.has('secondarySpellCheckerChoice')) {
288+
$('#primarySpellCheckerMode option[value="' + primarySpellCheckerChoice + '"]').prop('selected', true);
289+
populateSecondarySpellCheckerList();
290+
$('#secondarySpellCheckerMode option[value="' + secondarySpellCheckerChoice + '"]').prop('selected', true);
290291
}
291292
else {
292-
populateSecondarySpellcheckerList();
293+
populateSecondarySpellCheckerList();
293294
}
294-
if(store.has('spellcheckerInput')) {
295-
$('#spellcheckerInput').text(store.get('spellcheckerInput'));
295+
if(store.has('spellCheckerInput')) {
296+
$('#spellCheckerInput').text(String(store.get('spellCheckerInput')));
296297
$('#instantChecking').prop('checked', store.get('instantChecking', true));
297298
}
298299
}
299300

300301
if(getURLParam('choice')) {
301302
choice = getURLParam('choice').split('-');
302-
$('#primarySpellcheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
303-
populateSecondarySpellcheckerList();
303+
$('#primarySpellCheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
304+
populateSecondarySpellCheckerList();
304305
if(choice.length === 2) {
305-
$('#secondarySpellcheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
306+
$('#secondarySpellCheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
306307
}
307308
}
308309
}
@@ -329,6 +330,6 @@ function restoreChoices(mode /*: string */) {
329330
/*:: import {iso639Codes, iso639CodesInverse, locale, setLocale} from "./localization.js" */
330331
/*:: import {populateSecondaryGeneratorList} from "./generator.js" */
331332
/*:: import {populateSecondaryAnalyzerList} from "./analyzer.js" */
332-
/*:: import {populateSecondarySpellcheckerList} from "./spellchecker.js" */
333+
/*:: import {populateSecondarySpellCheckerList} from "./spellchecker.js" */
333334
/*:: import {getURLParam, isSubset} from "./util.js" */
334335
/*:: import {Store} from "./store.js" */

assets/js/spellchecker.js

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var spellers = {}, spellerData = {};
22
var currentSpellCheckerRequest;
33

4-
/* exported getSpellers, populateSecondarySpellcheckerList */
4+
/* exported getSpellers, populateSecondarySpellCheckerList */
55
/* global config, modeEnabled, persistChoices, readCache, ajaxSend, ajaxComplete, filterLangList, allowedLang, analyzers, cache,
66
localizeInterface, getLangByCode, restoreChoices, callApy */
77
/* global ENTER_KEY_CODE */
@@ -11,14 +11,14 @@ function getSpellers() {
1111

1212
if(config.SPELLERS) {
1313
spellerData = config.SPELLERS;
14-
populatePrimarySpellcheckerList(spellerData);
14+
populatePrimarySpellCheckerList(spellerData);
1515
deferred.resolve();
1616
}
1717
else {
1818
var spellers = readCache('spellers', 'LIST_REQUEST');
1919
if(spellers) {
2020
spellerData = spellers;
21-
populatePrimarySpellcheckerList(spellerData);
21+
populatePrimarySpellCheckerList(spellerData);
2222
deferred.resolve();
2323
}
2424
else {
@@ -28,9 +28,9 @@ function getSpellers() {
2828
beforeSend: ajaxSend,
2929
success: function (data) {
3030
spellerData = data;
31-
populatePrimarySpellcheckerList(spellerData);
31+
populatePrimarySpellCheckerList(spellerData);
3232
cache('spellers', data);
33-
populatePrimarySpellcheckerList(data);
33+
populatePrimarySpellCheckerList(data);
3434
},
3535
error: function () {
3636
console.error('Failed to get available spellers');
@@ -50,12 +50,12 @@ if(modeEnabled('spellchecker')) {
5050
$(document).ready(function () {
5151
restoreChoices('spellchecker');
5252
var timer, timeout = 2000;
53-
$('#spellChekerForm').submit(function () {
53+
$('#spellCheckerForm').submit(function () {
5454
clearTimeout(timer);
5555
check();
5656
});
5757

58-
$('#spellcheckerInput').on('input propertychange', function () {
58+
$('#spellCheckerInput').on('input propertychange', function () {
5959
if(timer && $('#instantChecking').prop('checked')) {
6060
clearTimeout(timer);
6161
}
@@ -66,13 +66,13 @@ if(modeEnabled('spellchecker')) {
6666
}, timeout);
6767
});
6868

69-
$('#primarySpellcheckerMode').change(function () {
70-
populateSecondarySpellcheckerList();
69+
$('#primarySpellCheckerMode').change(function () {
70+
populateSecondarySpellCheckerList();
7171
localizeInterface();
7272
persistChoices('spellchecker');
7373
});
7474

75-
$('#secondarySpellcheckerMode').change(function () {
75+
$('#secondarySpellCheckerMode').change(function () {
7676
persistChoices('spellchecker');
7777
});
7878

@@ -87,20 +87,20 @@ if(modeEnabled('spellchecker')) {
8787
persistChoices('spellchecker');
8888
});
8989

90-
$('#spellcheckerInput').on('input propertychange', function () {
91-
$('#spellcheckerInput').removeClass('spellcheckVisible');
90+
$('#spellCheckerInput').on('input propertychange', function () {
91+
$('#spellCheckerInput').removeClass('spellCheckerVisible');
9292
$('.spellError').each(function () {
9393
$(this).popover('hide');
9494
});
9595
persistChoices('spellchecker');
9696
});
9797

98-
$('#spellcheckerInput').submit(function () {
98+
$('#spellCheckerInput').submit(function () {
9999
clearTimeout(timer);
100100
check();
101101
});
102102

103-
$(document).on('mouseover', '.spellcheckVisible .spellError', function () {
103+
$(document).on('mouseover', '.spellCheckerVisible .spellError', function () {
104104
$('.spellError').each(function () {
105105
$(this).popover('hide');
106106
});
@@ -123,7 +123,7 @@ if(modeEnabled('spellchecker')) {
123123
});
124124
});
125125

126-
$(document).on('click', '.list-group-item', function () {
126+
$(document).on('click', '.spellCheckerListItem', function () {
127127
var e = $(this).parents('.popover').prev();
128128
e.text($(this).text());
129129
e.removeClass('spellError');
@@ -133,16 +133,16 @@ if(modeEnabled('spellchecker')) {
133133
});
134134
}
135135

136-
function populateSecondarySpellcheckerList() {
137-
var group = analyzers[$('#primarySpellcheckerMode').val()];
138-
$('#secondarySpellcheckerMode').empty();
136+
function populateSecondarySpellCheckerList() {
137+
var group = analyzers[$('#primarySpellCheckerMode').val()];
138+
$('#secondarySpellCheckerMode').empty();
139139

140140
if(group) {
141141
if(group.length <= 1) {
142-
$('#secondarySpellcheckerMode').fadeOut('fast');
142+
$('#secondarySpellCheckerMode').fadeOut('fast');
143143
}
144144
else {
145-
$('#secondarySpellcheckerMode').fadeIn('fast');
145+
$('#secondarySpellCheckerMode').fadeIn('fast');
146146
}
147147

148148
group.sort(function (a, b) {
@@ -154,15 +154,15 @@ function populateSecondarySpellcheckerList() {
154154
var langDisplay = lang.indexOf('-') !== -1
155155
? getLangByCode(lang.split('-')[0]) + '-' + getLangByCode(lang.split('-')[1])
156156
: getLangByCode(lang);
157-
$('#secondarySpellcheckerMode').append($('<option></option').val(lang).text(langDisplay));
157+
$('#secondarySpellCheckerMode').append($('<option></option').val(lang).text(langDisplay));
158158
}
159159
}
160160
else {
161-
$('#secondarySpellcheckerMode').fadeOut('fast');
161+
$('#secondarySpellCheckerMode').fadeOut('fast');
162162
}
163163
}
164-
function populatePrimarySpellcheckerList(data) {
165-
$('.spellcheckerMode').empty();
164+
function populatePrimarySpellCheckerList(data) {
165+
$('.spellCheckerMode').empty();
166166

167167
spellers = {};
168168
for(var lang in data) {
@@ -189,7 +189,7 @@ function populatePrimarySpellcheckerList(data) {
189189

190190
for(var i = 0; i < spellerArray.length; i++) {
191191
lang = spellerArray[i][0];
192-
$('#primarySpellcheckerMode').append($('<option></option>').val(lang).text(getLangByCode(lang)));
192+
$('#primarySpellCheckerMode').append($('<option></option>').val(lang).text(getLangByCode(lang)));
193193
}
194194

195195
restoreChoices('spellerchecker');
@@ -199,43 +199,38 @@ function check() {
199199
if(currentSpellCheckerRequest) {
200200
currentSpellCheckerRequest.abort();
201201
}
202-
$('#spellcheckerInput').addClass('spellcheckVisible');
203-
$('#spellcheckerInput').html($('#spellcheckerInput').html().replace(/br/g, '\n')
202+
$('#spellCheckerInput').addClass('spellCheckerVisible');
203+
$('#spellCheckerInput').html($('#spellCheckerInput').html().replace(/br/g, '\n')
204204
.replace(/&nbsp;/g, ' '));
205-
var words = $.trim($('#spellcheckerInput').text());
205+
var words = $.trim($('#spellCheckerInput').text());
206206
var splitWords = words.split(' ');
207207
var content = {};
208-
$('#spellcheckerInput').html('');
208+
$('#spellCheckerInput').html('');
209209
currentSpellCheckerRequest = callApy({
210210
data: {
211211
'q': words,
212-
'lang': $('#primarySpellcheckerMode').val()
212+
'lang': $('#primarySpellCheckerMode').val()
213213
},
214214
success: function (data) {
215215
var originalWordsIndex = 0;
216216
for(var tokenIndex = 0; tokenIndex < data.length; tokenIndex++) {
217-
if(data[tokenIndex].known === true) {
217+
if(data[tokenIndex]['known'] === true) { // eslint-disable-line dot-notation
218218
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' ' + splitWords[originalWordsIndex]);
219219
originalWordsIndex++;
220220
continue;
221221
}
222222
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' <span class="spellError" id=' +
223223
splitWords[originalWordsIndex] + '>' + splitWords[originalWordsIndex] + '</span>');
224224
content[splitWords[originalWordsIndex]] = '<div class="list-group">';
225-
for(var sugg = 0; sugg < data[tokenIndex].sugg.length; sugg++) {
225+
for(var sugg = 0; sugg < data[tokenIndex]['sugg'].length; sugg++) { // eslint-disable-line dot-notation
226226
content[splitWords[originalWordsIndex]] += '<a href="#" class="list-group-item">' +
227-
data[tokenIndex].sugg[sugg][0] + '</a>';
227+
data[tokenIndex]['sugg'][sugg][0] + '</a>'; // eslint-disable-line dot-notation
228228
content[splitWords[originalWordsIndex]] += '</div>';
229229
}
230230
$('.spellError').each(function () {
231231
var currentTokenId = this.id;
232-
$(this).popover({
233-
animation: false,
234-
placement: 'bottom',
235-
trigger: 'manual',
236-
html: true,
237-
content: content[currentTokenId]
238-
});
232+
$(this).popover({animation: false, placement: 'bottom', trigger: 'manual', html: true,
233+
content: content[currentTokenId]});
239234
});
240235
originalWordsIndex++;
241236
}
@@ -253,7 +248,7 @@ function handleSpellCheckerErrorResponse(jqXHR) {
253248
}
254249

255250
function spellCheckerNotAvailable(data) {
256-
$('#spellcheckerInput').append($('<div></div>').text(' '));
257-
$('#spellcheckerInput').append($('<div></div>').text(data.message));
258-
$('#spellcheckerInput').append($('<div></div>').text(data.explanation));
251+
$('#spellCheckerInput').append($('<div></div>').text(' '));
252+
$('#spellCheckerInput').append($('<div></div>').text(data.message));
253+
$('#spellCheckerInput').append($('<div></div>').text(data.explanation));
259254
}

index.html.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,26 +331,26 @@
331331
</div>
332332
<div class="modeContainer" id="spellcheckerContainer">
333333
<h2 class="visible-xs" data-text="Spell_Checker">Spell Checker</h2>
334-
<form class="form-horizontal" role="form" id="spellChekerForm">
334+
<form class="form-horizontal" role="form" id="spellCheckerForm">
335335
<fieldset>
336336
<legend data-text="Spell_Checker_Help"></legend>
337337
<div class="form-group">
338-
<label for="primarySpellcheckerMode" class="col-sm-2 control-label" data-text="Language">Language</label>
338+
<label for="primarySpellCheckerMode" class="col-sm-2 control-label" data-text="Language">Language</label>
339339
<div class="col-sm-3">
340-
<select class="form-control spellcheckerMode" id="primarySpellcheckerMode" name="primarySpellcheckerMode">
340+
<select class="form-control spellCheckerMode" id="primarySpellCheckerMode" name="primarySpellCheckerMode">
341341
<option> </option>
342342
</select>
343343
</div>
344344
<div class="col-sm-4">
345-
<select class="form-control spellcheckerMode" id="secondarySpellcheckerMode" name="secondarySpellcheckerMode">
345+
<select class="form-control spellCheckerMode" id="secondarySpellCheckerMode" name="secondarySpellCheckerMode">
346346
<option> </option>
347347
</select>
348348
</div>
349349
</div>
350350
<div class="form-group">
351-
<label for="spellcheckerInput" class="col-sm-2 control-label" data-text="Input_Text">Input Text</label>
351+
<label for="spellCheckerInput" class="col-sm-2 control-label" data-text="Input_Text">Input Text</label>
352352
<div class="col-sm-10">
353-
<div class="form-control" id="spellcheckerInput" contenteditable spellcheck="false"></div>
353+
<div class="form-control" id="spellCheckerInput" contenteditable spellcheck="false"></div>
354354
</div>
355355
</div>
356356
<div class="col-sm-offset-2 col-sm-7">

0 commit comments

Comments
 (0)