summaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-26 10:11:23 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-26 10:11:23 -0800
commit55dd9b1e6b06401e5a5f523fce1f3d6c1db4d9da (patch)
tree6895213af2f287bc317daa24516dc54c3f1cc0f1 /ext/bg/js/options-form.js
parent465a8e21c0a9d7b2d1e704ab9a42b5f662fd82d3 (diff)
delete unused dictionary deletion code
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js35
1 files changed, 8 insertions, 27 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 7824164c..ae0491a2 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -171,7 +171,6 @@ function populateDictionaries(options) {
updateVisibility(options);
$('.dict-enabled, .dict-priority').change(onOptionsChanged);
- $('.dict-delete').click(onDictionaryDelete);
}).catch(showDictionaryError).then(() => {
showDictionarySpinner(false);
if (dictCount === 0) {
@@ -197,33 +196,12 @@ function onDictionaryPurge(e) {
}).then(options => {
options.dictionaries = {};
return optionsSave(options).then(() => {
- yomichan().setOptions(options);
populateDictionaries(options);
+ yomichan().setOptions(options);
});
});
}
-function onDictionaryDelete() {
- showDictionaryError(null);
- showDictionarySpinner(true);
-
- const dictGroup = $(this).closest('.dict-group');
- const dictProgress = dictGroup.find('.dict-delete-progress').show();
- const dictControls = dictGroup.find('.dict-group-controls').hide();
- const setProgress = percent => {
- dictProgress.find('.progress-bar').css('width', `${percent}%`);
- };
-
- setProgress(0.0);
-
- database().deleteDictionary(dictGroup.data('title'), (total, current) => setProgress(current / total * 100.0)).catch(showDictionaryError).then(() => {
- showDictionarySpinner(false);
- dictProgress.hide();
- dictControls.show();
- return optionsLoad().then(populateDictionaries);
- });
-}
-
function onDictionaryImport() {
showDictionaryError(null);
showDictionarySpinner(true);
@@ -231,9 +209,7 @@ function onDictionaryImport() {
const dictUrl = $('#dict-url');
const dictImporter = $('#dict-importer').hide();
const dictProgress = $('#dict-import-progress').show();
- const setProgress = percent => {
- dictProgress.find('.progress-bar').css('width', `${percent}%`);
- };
+ const setProgress = percent => dictProgress.find('.progress-bar').css('width', `${percent}%`);
setProgress(0.0);
@@ -389,7 +365,12 @@ function onOptionsChanged(e) {
return optionsSave(optionsNew).then(() => {
yomichan().setOptions(optionsNew);
updateVisibility(optionsNew);
- if (optionsNew.anki.enable !== optionsOld.anki.enable || optionsNew.anki.server !== optionsOld.anki.server) {
+
+ const ankiUpdated =
+ optionsNew.anki.enable !== optionsOld.anki.enable ||
+ optionsNew.anki.server !== optionsOld.anki.server;
+
+ if (ankiUpdated) {
showAnkiError(null);
showAnkiSpinner(true);
return populateAnkiDeckAndModel(optionsNew);