Adding stub for usage guide
This commit is contained in:
parent
8f8d8d3f51
commit
d0654e2cf6
21
ext/bg/guide.html
Normal file
21
ext/bg/guide.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Using Yomichan</title>
|
||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Using Yomichan</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -54,6 +54,7 @@ function formToOptions(section, callback) {
|
||||
optsNew.activateOnStartup = $('#activate-on-startup').prop('checked');
|
||||
optsNew.loadEnamDict = $('#load-enamdict').prop('checked');
|
||||
optsNew.selectMatchedText = $('#select-matched-text').prop('checked');
|
||||
optsNew.showAdvancedOptions = $('#show-advanced-options').prop('checked');
|
||||
optsNew.enableAudioPlayback = $('#enable-audio-playback').prop('checked');
|
||||
optsNew.enableAnkiConnect = $('#enable-anki-connect').prop('checked');
|
||||
break;
|
||||
@ -174,9 +175,15 @@ function onOptionsGeneralChanged(e) {
|
||||
if (!optsOld.enableAnkiConnect && optsNew.enableAnkiConnect) {
|
||||
updateAnkiStatus();
|
||||
populateAnkiDeckAndModel(optsNew);
|
||||
$('.options-anki').fadeIn();
|
||||
$('.options-anki').show();
|
||||
} else if (optsOld.enableAnkiConnect && !optsNew.enableAnkiConnect) {
|
||||
$('.options-anki').fadeOut();
|
||||
$('.options-anki').hide();
|
||||
}
|
||||
|
||||
if (optsNew.showAdvancedOptions) {
|
||||
$('.options-advanced').show();
|
||||
} else {
|
||||
$('.options-advanced').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -208,6 +215,7 @@ $(document).ready(() => {
|
||||
$('#activate-on-startup').prop('checked', opts.activateOnStartup);
|
||||
$('#load-enamdict').prop('checked', opts.loadEnamDict);
|
||||
$('#select-matched-text').prop('checked', opts.selectMatchedText);
|
||||
$('#show-advanced-options').prop('checked', opts.showAdvancedOptions);
|
||||
$('#enable-audio-playback').prop('checked', opts.enableAudioPlayback);
|
||||
$('#enable-anki-connect').prop('checked', opts.enableAnkiConnect);
|
||||
|
||||
@ -219,6 +227,10 @@ $(document).ready(() => {
|
||||
$('.anki-deck').change(onOptionsAnkiChanged);
|
||||
$('.anki-model').change(onAnkiModelChanged);
|
||||
|
||||
if (opts.showAdvancedOptions) {
|
||||
$('.options-advanced').show();
|
||||
}
|
||||
|
||||
if (opts.enableAnkiConnect) {
|
||||
updateAnkiStatus();
|
||||
populateAnkiDeckAndModel(opts);
|
||||
|
@ -22,6 +22,7 @@ function sanitizeOptions(options) {
|
||||
scanLength: 20,
|
||||
activateOnStartup: false,
|
||||
selectMatchedText: true,
|
||||
showAdvancedOptions: false,
|
||||
loadEnamDict: false,
|
||||
enableAudioPlayback: true,
|
||||
enableAnkiConnect: false,
|
||||
|
@ -22,7 +22,7 @@ class Yomichan {
|
||||
Handlebars.partials = Handlebars.templates;
|
||||
Handlebars.registerHelper('kanjiLinks', function(options) {
|
||||
let result = '';
|
||||
for (let c of options.fn(this)) {
|
||||
for (const c of options.fn(this)) {
|
||||
if (Translator.isKanji(c)) {
|
||||
result += Handlebars.templates['kanji-link.html']({kanji: c}).trim();
|
||||
} else {
|
||||
@ -53,7 +53,7 @@ class Yomichan {
|
||||
|
||||
onInstalled(details) {
|
||||
if (details.reason === 'install') {
|
||||
chrome.runtime.openOptionsPage();
|
||||
chrome.tabs.create({url: chrome.extension.getURL('bg/guide.html')});
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ class Yomichan {
|
||||
|
||||
tabInvokeAll(action, params) {
|
||||
chrome.tabs.query({}, (tabs) => {
|
||||
for (let tab of tabs) {
|
||||
for (const tab of tabs) {
|
||||
this.tabInvoke(tab.id, action, params);
|
||||
}
|
||||
});
|
||||
@ -176,7 +176,7 @@ class Yomichan {
|
||||
'url',
|
||||
];
|
||||
|
||||
for (let tag of tags) {
|
||||
for (const tag of tags) {
|
||||
let value = definition[tag] || null;
|
||||
switch (tag) {
|
||||
case 'audio':
|
||||
@ -195,7 +195,7 @@ class Yomichan {
|
||||
case 'glossary-list':
|
||||
if (definition.glossary) {
|
||||
value = '<ol>';
|
||||
for (let gloss of definition.glossary) {
|
||||
for (const gloss of definition.glossary) {
|
||||
value += `<li>${gloss}</li>`;
|
||||
}
|
||||
value += '</ol>';
|
||||
@ -223,12 +223,12 @@ class Yomichan {
|
||||
|
||||
let fields = [];
|
||||
if (mode === 'kanji') {
|
||||
fields = this.options.ankiKanjiFields;
|
||||
note.deckName = this.options.ankiKanjiDeck;
|
||||
fields = this.options.ankiKanjiFields;
|
||||
note.deckName = this.options.ankiKanjiDeck;
|
||||
note.modelName = this.options.ankiKanjiModel;
|
||||
} else {
|
||||
fields = this.options.ankiTermFields;
|
||||
note.deckName = this.options.ankiTermDeck;
|
||||
fields = this.options.ankiTermFields;
|
||||
note.deckName = this.options.ankiTermDeck;
|
||||
note.modelName = this.options.ankiTermModel;
|
||||
|
||||
const audio = {
|
||||
@ -237,7 +237,7 @@ class Yomichan {
|
||||
fields: []
|
||||
};
|
||||
|
||||
for (let name in fields) {
|
||||
for (const name in fields) {
|
||||
if (fields[name].indexOf('{audio}') !== -1) {
|
||||
audio.fields.push(name);
|
||||
}
|
||||
@ -261,9 +261,9 @@ class Yomichan {
|
||||
}
|
||||
|
||||
api_canAddDefinitions({definitions, modes, callback}) {
|
||||
let notes = [];
|
||||
for (let definition of definitions) {
|
||||
for (let mode of modes) {
|
||||
const notes = [];
|
||||
for (const definition of definitions) {
|
||||
for (const mode of modes) {
|
||||
notes.push(this.formatNote(definition, mode));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
||||
<style>
|
||||
.options-anki {
|
||||
.options-anki, .options-advanced {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<h3>General Options</h3>
|
||||
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="form-group options-advanced">
|
||||
<label for="scan-length" class="control-label col-sm-2">Scan length</label>
|
||||
<div class="col-sm-10"><input type="number" min="1" id="scan-length" class="form-control"></div>
|
||||
</div>
|
||||
@ -72,6 +72,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label class="control-label"><input type="checkbox" id="show-advanced-options"> Show advanced options</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@ -92,7 +101,7 @@
|
||||
<div class="col-sm-10"><input type="text" id="anki-card-tags" class="form-control"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group options-advanced">
|
||||
<label for="sentence-extent" class="control-label col-sm-2">Sentence extent</label>
|
||||
<div class="col-sm-10"><input type="number" min="1" id="sentence-extent" class="form-control"></div>
|
||||
</div>
|
||||
@ -162,7 +171,7 @@
|
||||
</div>
|
||||
|
||||
<div style="text-align: right;">
|
||||
<small><a href="https://foosoft.net/projects/yomichan-chrome">Homepage</a> • <a href="legal.html">Legal</a></small>
|
||||
<small><a href="https://foosoft.net/projects/yomichan-chrome">Homepage</a> • <a href="guide.html">Guide</a> • <a href="legal.html">Legal</a></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user