Skip to content

Commit 7583760

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

File tree

4 files changed

+95
-93
lines changed

4 files changed

+95
-93
lines changed

assets/css/translation.css

Lines changed: 5 additions & 5 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,12 +97,12 @@ 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 */
105-
border: 0;
104+
.spellCheckerListItem {
105+
border: 0
106106
cursor: pointer;
107107
padding: 4px 10px;
108108
}

assets/js/persistence.js

Lines changed: 20 additions & 20 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

@@ -75,9 +75,9 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
7575
}
7676
else if(mode === 'spellchecker') {
7777
objects = {
78-
'primarySpellcheckerChoice': $('#primarySpellcheckerMode').val(),
79-
'secondarySpellcheckerChoice': $('#secondarySpellcheckerMode').val(),
80-
'spellcheckerInput': $('#spellcheckerInput').text(),
78+
'primarySpellCheckerChoice': $('#primarySpellCheckerMode').val(),
79+
'secondarySpellCheckerChoice': $('#secondarySpellCheckerMode').val(),
80+
'spellCheckerInput': $('#spellCheckerInput').text(),
8181
'instantChecking': $('#instantChecking').val()
8282
};
8383
}
@@ -130,10 +130,10 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
130130
urlParams.push('choice=' + encodeURIComponent($('#secondaryGeneratorMode').val()));
131131
qVal = $('#morphGeneratorInput').val();
132132
}
133-
else if(hash === '#spellchecker' && $('#secondarySpellcheckerMode').val()) {
133+
else if(hash === '#spellchecker' && $('#secondarySpellCheckerMode').val()) {
134134
urlParams = [];
135-
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellcheckerMode').val()));
136-
qVal = $('#spellcheckerInput').text();
135+
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellCheckerMode').val()));
136+
qVal = $('#spellCheckerInput').text();
137137
}
138138

139139
var qName /*: string */ = HASH_URL_MAP[hash];
@@ -281,28 +281,28 @@ function restoreChoices(mode /*: string */) {
281281
}
282282
else if(mode === 'spellchecker') {
283283
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);
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);
290290
}
291291
else {
292-
populateSecondarySpellcheckerList();
292+
populateSecondarySpellCheckerList();
293293
}
294-
if(store.has('spellcheckerInput')) {
295-
$('#spellcheckerInput').text(store.get('spellcheckerInput'));
294+
if(store.has('spellCheckerInput')) {
295+
$('#spellCheckerInput').text(store.get('spellCheckerInput'));
296296
$('#instantChecking').prop('checked', store.get('instantChecking', true));
297297
}
298298
}
299299

300300
if(getURLParam('choice')) {
301301
choice = getURLParam('choice').split('-');
302-
$('#primarySpellcheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
303-
populateSecondarySpellcheckerList();
302+
$('#primarySpellCheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
303+
populateSecondarySpellCheckerList();
304304
if(choice.length === 2) {
305-
$('#secondarySpellcheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
305+
$('#secondarySpellCheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
306306
}
307307
}
308308
}
@@ -329,6 +329,6 @@ function restoreChoices(mode /*: string */) {
329329
/*:: import {iso639Codes, iso639CodesInverse, locale, setLocale} from "./localization.js" */
330330
/*:: import {populateSecondaryGeneratorList} from "./generator.js" */
331331
/*:: import {populateSecondaryAnalyzerList} from "./analyzer.js" */
332-
/*:: import {populateSecondarySpellcheckerList} from "./spellchecker.js" */
332+
/*:: import {populateSecondarySpellCheckerList} from "./spellchecker.js" */
333333
/*:: import {getURLParam, isSubset} from "./util.js" */
334334
/*:: import {Store} from "./store.js" */

assets/js/spellchecker.js

Lines changed: 64 additions & 62 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,47 +199,19 @@ 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()
213-
},
214-
success: function (data) {
215-
var originalWordsIndex = 0;
216-
for(var tokenIndex = 0; tokenIndex < data.length; tokenIndex++) {
217-
if(data[tokenIndex].known === true) {
218-
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' ' + splitWords[originalWordsIndex]);
219-
originalWordsIndex++;
220-
continue;
221-
}
222-
$('#spellcheckerInput').html($('#spellcheckerInput').html() + ' <span class="spellError" id=' +
223-
splitWords[originalWordsIndex] + '>' + splitWords[originalWordsIndex] + '</span>');
224-
content[splitWords[originalWordsIndex]] = '<div class="list-group">';
225-
for(var sugg = 0; sugg < data[tokenIndex].sugg.length; sugg++) {
226-
content[splitWords[originalWordsIndex]] += '<a href="#" class="list-group-item">' +
227-
data[tokenIndex].sugg[sugg][0] + '</a>';
228-
content[splitWords[originalWordsIndex]] += '</div>';
229-
}
230-
$('.spellError').each(function () {
231-
var currentTokenId = this.id;
232-
$(this).popover({
233-
animation: false,
234-
placement: 'bottom',
235-
trigger: 'manual',
236-
html: true,
237-
content: content[currentTokenId]
238-
});
239-
});
240-
originalWordsIndex++;
241-
}
212+
'lang': $('#primarySpellCheckerMode').val()
242213
},
214+
success: handleSpellCheckerSuccessResponse,
243215
error: handleSpellCheckerErrorResponse,
244216
complete: function () {
245217
ajaxComplete();
@@ -248,12 +220,42 @@ function check() {
248220
}, '/speller', true);
249221
}
250222

223+
function handleSpellCheckerSuccessResponse(data) {
224+
var originalWordsIndex = 0;
225+
for(var tokenIndex = 0; tokenIndex < data.length; tokenIndex++) {
226+
if(data[tokenIndex].known === true) {
227+
$('#spellCheckerInput').html($('#spellCheckerInput').html() + ' ' + splitWords[originalWordsIndex]);
228+
originalWordsIndex++;
229+
continue;
230+
}
231+
$('#spellCheckerInput').html($('#spellCheckerInput').html() + ' <span class="spellError" id=' +
232+
splitWords[originalWordsIndex] + '>' + splitWords[originalWordsIndex] + '</span>');
233+
content[splitWords[originalWordsIndex]] = '<div class="spellCheckerList">';
234+
for(var sugg = 0; sugg < data[tokenIndex].sugg.length; sugg++) {
235+
content[splitWords[originalWordsIndex]] += '<a href="#" class="spellCheckerListItem">' +
236+
data[tokenIndex].sugg[sugg][0] + '</a>';
237+
content[splitWords[originalWordsIndex]] += '</div>';
238+
}
239+
$('.spellError').each(function () {
240+
var currentTokenId = this.id;
241+
$(this).popover({
242+
animation: false,
243+
placement: 'bottom',
244+
trigger: 'manual',
245+
html: true,
246+
content: content[currentTokenId]
247+
});
248+
});
249+
originalWordsIndex++;
250+
}
251+
}
252+
251253
function handleSpellCheckerErrorResponse(jqXHR) {
252254
spellCheckerNotAvailable(jqXHR.responseJSON);
253255
}
254256

255257
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));
258+
$('#spellCheckerInput').append($('<div></div>').text(' '));
259+
$('#spellCheckerInput').append($('<div></div>').text(data.message));
260+
$('#spellCheckerInput').append($('<div></div>').text(data.explanation));
259261
}

0 commit comments

Comments
 (0)