summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-04-08 18:04:37 -0700
committerAlex Yatskov <alex@foosoft.net>2017-04-08 18:04:37 -0700
commit1b49f91a9b252447ab791ccef7b26a0b8b6062dd (patch)
tree1cee3846da13d317be015a6ec4c244864e8b9247 /ext/bg/js
parentbea50cca462be631dadbd2f5bde1bc0a12ad17bf (diff)
parentd263a93d446096abfc33e47f591dbb71eb7fe928 (diff)
Merge branch 'master' into firefox-amo
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options.js5
-rw-r--r--ext/bg/js/util.js6
-rw-r--r--ext/bg/js/yomichan.js10
3 files changed, 9 insertions, 12 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index ad8d83d8..49544840 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -25,6 +25,7 @@ function formRead() {
return optionsLoad().then(optionsOld => {
const optionsNew = $.extend(true, {}, optionsOld);
+ optionsNew.general.showGuide = $('#show-usage-guide').prop('checked');
optionsNew.general.audioSource = $('#audio-playback-source').val();
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
@@ -111,6 +112,7 @@ $(document).ready(() => {
handlebarsRegister();
optionsLoad().then(options => {
+ $('#show-usage-guide').prop('checked', options.general.showGuide);
$('#audio-playback-source').val(options.general.audioSource);
$('#audio-playback-volume').val(options.general.audioVolume);
$('#group-terms-results').prop('checked', options.general.groupResults);
@@ -368,9 +370,6 @@ function ankiFieldsPopulate(element, options) {
],
'kanji': [
'character',
- 'cloze-body',
- 'cloze-prefix',
- 'cloze-suffix',
'dictionary',
'glossary',
'kunyomi',
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 05c7ff27..64143ffe 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -89,7 +89,8 @@ function optionsSetDefaults(options) {
showAdvanced: false,
popupWidth: 400,
popupHeight: 250,
- popupOffset: 10
+ popupOffset: 10,
+ showGuide: true
},
scanning: {
@@ -144,6 +145,9 @@ function optionsVersion(options) {
} else {
options.general.audioSource = 'disabled';
}
+ },
+ () => {
+ options.general.showGuide = false;
}
];
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index feb74b6e..51e05c80 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -28,8 +28,8 @@ window.yomichan = new class {
this.translator.prepare().then(optionsLoad).then(this.optionsSet.bind(this)).then(() => {
chrome.commands.onCommand.addListener(this.onCommand.bind(this));
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
- if (chrome.runtime.onInstalled) {
- chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
+ if (this.options.general.showGuide) {
+ chrome.tabs.create({url: chrome.extension.getURL('/bg/guide.html')});
}
});
}
@@ -157,12 +157,6 @@ window.yomichan = new class {
return Promise.resolve(handlebarsRender(template, data));
}
- onInstalled(details) {
- if (details.reason === 'install') {
- chrome.tabs.create({url: chrome.extension.getURL('/bg/guide.html')});
- }
- }
-
onCommand(command) {
const handlers = {
search: () => {