Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Deconflicted #176
  • Loading branch information
JPJPJPOPOP committed Jan 21, 2018
commit 2582df3336267bad22770aa12f91d97a2ea30b9d
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ JSFILES= \
assets/js/translator.js \
assets/js/analyzer.js \
assets/js/generator.js \
assets/js/sandbox.js
assets/js/sandbox.js \
assets/js/spellchecker.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

Copy link
Contributor Author

@JPJPJPOPOP JPJPJPOPOP Jan 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sushain97 this is weird, it looks fine in the actual file, but looks wrong here.


build/js/config.js: $(CONFIG) tools/read-conf.py build/js/.d
./tools/read-conf.py -c $< js > $@
Expand Down
30 changes: 30 additions & 0 deletions assets/css/translation.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ html[dir='rtl'] #srcLanguages {
clear: both;
}

/* Spell Checker */

#spellcheckerInput {
display: block;
height: 131px;
overflow: auto;
resize: both;
}

.spellcheckVisible .spellError {
border-bottom: 1px solid #f00;
}

.popover-content { /* sass-lint:disable-line class-name-format */
max-height: 190px;
overflow: auto;
padding: 0;
width: 110%;
}

.list-group { /* sass-lint:disable-line class-name-format */
margin-bottom: 0;
}

.list-group-item { /* sass-lint:disable-line class-name-format */
border: 0;
cursor: pointer;
padding: 4px 10px;
}

#translatedWebpage {
border: 1px solid #ccc;
border-radius: 4px;
Expand Down
11 changes: 9 additions & 2 deletions assets/js/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ var localizedLanguageCodes /*: {[string]: string} */ = {}, localizedLanguageName

/* global config, getPairs, getGenerators, getAnalyzers, persistChoices, getURLParam, cache, ajaxSend, ajaxComplete, sendEvent,
srcLangs, dstLangs, generators, analyzers, readCache, modeEnabled, populateTranslationList, populateGeneratorList,
populateAnalyzerList, analyzerData, generatorData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique */
populateAnalyzerList, analyzerData, generatorData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a comma?

getSpellers */

var dynamicLocalizations /*: {[lang: string]: {[string]: string}} */ = {
'fallback': {
Expand Down Expand Up @@ -52,7 +53,12 @@ $(document).ready(function () {
iso639CodesInverse[language] = code;
});

var possibleItems = {'translation': getPairs, 'generation': getGenerators, 'analyzation': getAnalyzers};
var possibleItems = {
'translation': getPairs,
'generation': getGenerators,
'analyzation': getAnalyzers,
'spellchecker': getSpellers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just me or is something off, shouldn't it be 'spell checking'? Otherwise, 'translation' would be 'translator', etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and in other analagous places)

};
var deferredItems = [getLocale(), getLocales()];
if(config.ENABLED_MODES) {
$.each(config.ENABLED_MODES, function () {
Expand Down Expand Up @@ -427,3 +433,4 @@ function setLocale(newLocale /*: string */) {
/*:: import {generatorData, generators, getGenerators, populateGeneratorList} from "./generator.js" */
/*:: import {analyzerData, analyzers, getAnalyzers, populateAnalyzerList} from "./analyzer.js" */
/*:: import {cache, persistChoices, readCache, restoreChoices} from "./persistence.js" */
/*:: import {getSpellers} from "./spellchecker.js" */
43 changes: 42 additions & 1 deletion assets/js/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* exported persistChoices, restoreChoices, cache, readCache */

/* global config, Store, getURLParam, iso639CodesInverse, pairs, refreshLangList populateSecondaryAnalyzerList,
populateSecondaryGeneratorList, isSubset, handleNewCurrentLang */
populateSecondaryGeneratorList, populateSecondarySpellcheckerList, isSubset, handleNewCurrentLang */
/* global srcLangs, dstLangs, recentSrcLangs, recentDstLangs, setCurDstLang, setCurSrcLang, setRecentDstLangs, setRecentSrcLangs, setLocale,
curSrcLang, curDstLang, locale */

Expand Down Expand Up @@ -74,6 +74,14 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
'generatorInput': $('#morphGeneratorInput').val()
};
}
else if(mode === 'spellchecker') {
objects = {
'primarySpellcheckerChoice': $('#primarySpellcheckerMode').val(),
'secondarySpellcheckerChoice': $('#secondarySpellcheckerMode').val(),
'spellcheckerInput': $('#spellcheckerInput').text(),
'instantChecking': $('#instantChecking').val()
};
}
else if(mode === 'localization') {
objects = {
'locale': $('.localeSelect').val()
Expand Down Expand Up @@ -123,6 +131,11 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
urlParams.push('choice=' + encodeURIComponent($('#secondaryGeneratorMode').val()));
qVal = $('#morphGeneratorInput').val();
}
else if(hash === '#spellchecker' && $('#secondarySpellcheckerMode').val()) {
urlParams = [];
urlParams.push('choice=' + encodeURIComponent($('#secondarySpellcheckerMode').val()));
qVal = $('#spellcheckerInput').text();
}

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

Expand Down Expand Up @@ -267,6 +280,33 @@ function restoreChoices(mode /*: string */) {
$('#morphGeneratorInput').val(decodeURIComponent(getURLParam('qG')));
}
}
else if(mode === 'spellchecker') {
if(store.able()) {
var primarySpellcheckerChoice = store.get('primarySpellcheckerChoice', ''),
secondarySpellcheckerChoice = store.get('secondarySpellcheckerChoice', '');
if(store.has('primarySpellcheckerChoice') && store.has('secondarySpellcheckerChoice')) {
$('#primarySpellcheckerMode option[value="' + primarySpellcheckerChoice + '"]').prop('selected', true);
populateSecondarySpellcheckerList();
$('#secondarySpellcheckerMode option[value="' + secondarySpellcheckerChoice + '"]').prop('selected', true);
}
else {
populateSecondarySpellcheckerList();
}
if(store.has('spellcheckerInput')) {
$('#spellcheckerInput').text(store.get('spellcheckerInput'));
$('#instantChecking').prop('checked', store.get('instantChecking', true));
}
}

if(getURLParam('choice')) {
choice = getURLParam('choice').split('-');
$('#primarySpellcheckerMode option[value="' + choice[0] + '"]').prop('selected', true);
populateSecondarySpellcheckerList();
if(choice.length === 2) {
$('#secondarySpellcheckerMode option[value="' + choice.join('-') + '"]').prop('selected', true);
}
}
}
else if(mode === 'localization') {
if(store.able()) {
setLocale(store.get('locale', ''));
Expand All @@ -290,5 +330,6 @@ function restoreChoices(mode /*: string */) {
/*:: import {iso639Codes, iso639CodesInverse, locale, setLocale} from "./localization.js" */
/*:: import {populateSecondaryGeneratorList} from "./generator.js" */
/*:: import {populateSecondaryAnalyzerList} from "./analyzer.js" */
/*:: import {populateSecondarySpellcheckerList} from "./spellchecker.js" */
/*:: import {getURLParam, isSubset} from "./util.js" */
/*:: import {Store} from "./store.js" */
Loading