diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-11 20:44:53 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-11 20:44:53 -0800 |
commit | c574ef4bc035947aac304b19101a791db3a8b91f (patch) | |
tree | f2724b44d6a2a85956e3184da18b15692ad47d4d /ext | |
parent | 5c1c894df936fde38a351c8c7db6a6e323f4331c (diff) | |
parent | ed1b1d91812fcb7283c39415ee7d11330b969b28 (diff) |
Merge branch 'master' into dev
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/background.html | 1 | ||||
-rw-r--r-- | ext/bg/js/options-form.js | 20 | ||||
-rw-r--r-- | ext/bg/js/options.js | 6 | ||||
-rw-r--r-- | ext/bg/js/yomichan.js | 3 | ||||
-rw-r--r-- | ext/bg/options.html | 18 | ||||
-rw-r--r-- | ext/manifest.json | 5 |
6 files changed, 8 insertions, 45 deletions
diff --git a/ext/bg/background.html b/ext/bg/background.html index 49fc6d0f..3ecfa3dc 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -4,7 +4,6 @@ <script src="../lib/handlebars.min.js"></script> <script src="../lib/dexie.min.js"></script> <script src="../lib/wanakana.min.js"></script> - <script src="js/ankiweb.js"></script> <script src="js/ankiconnect.js"></script> <script src="js/ankinull.js"></script> <script src="js/templates.js"></script> diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index 957f4ce5..8cffb2f7 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -40,8 +40,6 @@ function getFormValues() { optsNew.scanLength = parseInt($('#scan-length').val(), 10); optsNew.ankiMethod = $('#anki-method').val(); - optsNew.ankiUsername = $('#anki-username').val(); - optsNew.ankiPassword = $('#anki-password').val(); optsNew.ankiCardTags = $('#anki-card-tags').val().split(/[,; ]+/); optsNew.sentenceExtent = parseInt($('#sentence-extent').val(), 10); optsNew.ankiTermDeck = $('#anki-term-deck').val(); @@ -68,13 +66,8 @@ function getFormValues() { function updateVisibility(opts) { switch (opts.ankiMethod) { - case 'ankiweb': - $('#anki-general').show(); - $('.anki-login').show(); - break; case 'ankiconnect': $('#anki-general').show(); - $('.anki-login').hide(); break; default: $('#anki-general').hide(); @@ -104,8 +97,6 @@ $(document).ready(() => { $('#scan-length').val(opts.scanLength); $('#anki-method').val(opts.ankiMethod); - $('#anki-username').val(opts.ankiUsername); - $('#anki-password').val(opts.ankiPassword); $('#anki-card-tags').val(opts.ankiCardTags.join(' ')); $('#sentence-extent').val(opts.sentenceExtent); @@ -433,16 +424,7 @@ function onOptionsChanged(e) { return saveOptions(optsNew).then(() => { yomichan().setOptions(optsNew); updateVisibility(optsNew); - - const loginChanged = - optsNew.ankiUsername !== optsOld.ankiUsername || - optsNew.ankiPassword !== optsOld.ankiPassword; - - if (loginChanged && optsNew.ankiMethod === 'ankiweb') { - showAnkiError(null); - showAnkiSpinner(true); - return anki().logout().then(() => populateAnkiDeckAndModel(optsNew)); - } else if (optsNew.ankiMethod !== optsOld.ankiMethod) { + if (optsNew.ankiMethod !== optsOld.ankiMethod) { showAnkiError(null); showAnkiSpinner(true); return populateAnkiDeckAndModel(optsNew); diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 822f5a16..2f0bd189 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -45,8 +45,6 @@ function sanitizeOptions(options) { dictionaries: {}, ankiMethod: 'disabled', - ankiUsername: '', - ankiPassword: '', ankiCardTags: ['yomichan'], sentenceExtent: 200, @@ -64,6 +62,10 @@ function sanitizeOptions(options) { } } + if (options.ankiMethod === 'ankiweb') { + options.ankiMethod = 'disabled'; + } + return options; } diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index 41b55352..2cdcf1c8 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -95,9 +95,6 @@ class Yomichan { this.options = options; switch (options.ankiMethod) { - case 'ankiweb': - this.anki = new AnkiWeb(options.ankiUsername, options.ankiPassword); - break; case 'ankiconnect': this.anki = new AnkiConnect(); break; diff --git a/ext/bg/options.html b/ext/bg/options.html index bc0302a2..6bf6fb7b 100644 --- a/ext/bg/options.html +++ b/ext/bg/options.html @@ -128,9 +128,8 @@ <p class="help-block"> Yomichan features automatic flashcard creation for <a href="http://ankisrs.net/">Anki</a>, a free application - designed to help you retain knowledge. While the <a href="https://foosoft.net/projects/anki-connect/">AnkiConnect</a> plugin - offers the best experience, it is also possible to create flashcards through <a href="https://ankiweb.net/">AnkiWeb</a>, - provided you already have an account. + designed to help you retain knowledge. This functionality requires prior installation of the + <a href="https://foosoft.net/projects/anki-connect/">AnkiConnect</a> plugin. </p> <div class="alert alert-danger" id="anki-error"> @@ -143,23 +142,10 @@ <select class="form-control" id="anki-method"> <option value="disabled">Disabled (no auto flashcard creation)</option> <option value="ankiconnect">AnkiConnect (requires the AnkiConnect plugin)</option> - <option value="ankiweb">AnkiWeb (requires an account on AnkiWeb)</option> </select> </div> <div id="anki-general"> - <div class="row"> - <div class="form-group anki-login col-xs-6"> - <label for="anki-username">Username</label> - <input type="text" id="anki-username" class="form-control anki-credential"> - </div> - - <div class="form-group anki-login col-xs-6"> - <label for="anki-password">Password</label> - <input type="password" id="anki-password" class="form-control anki-credential"> - </div> - </div> - <div class="form-group"> <label for="anki-card-tags">Card tags (comma or space separated)</label> <input type="text" id="anki-card-tags" class="form-control"> diff --git a/ext/manifest.json b/ext/manifest.json index 9bb01c21..90663696 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Yomichan", - "version": "1.0.1", + "version": "1.0.3", "description": "Japanese dictionary with Anki integration", "icons": {"16": "img/icon16.png", "48": "img/icon48.png", "128": "img/icon128.png"}, @@ -25,11 +25,8 @@ "page": "bg/options.html" }, "permissions": [ - "webRequest", - "webRequestBlocking", "file://*/*", "http://127.0.0.1/*", - "https://ankiweb.net/*", "storage" ], "web_accessible_resources": [ |