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.activateOnStartup = $('#activate-on-startup').prop('checked');
|
||||||
optsNew.loadEnamDict = $('#load-enamdict').prop('checked');
|
optsNew.loadEnamDict = $('#load-enamdict').prop('checked');
|
||||||
optsNew.selectMatchedText = $('#select-matched-text').prop('checked');
|
optsNew.selectMatchedText = $('#select-matched-text').prop('checked');
|
||||||
|
optsNew.showAdvancedOptions = $('#show-advanced-options').prop('checked');
|
||||||
optsNew.enableAudioPlayback = $('#enable-audio-playback').prop('checked');
|
optsNew.enableAudioPlayback = $('#enable-audio-playback').prop('checked');
|
||||||
optsNew.enableAnkiConnect = $('#enable-anki-connect').prop('checked');
|
optsNew.enableAnkiConnect = $('#enable-anki-connect').prop('checked');
|
||||||
break;
|
break;
|
||||||
@ -174,9 +175,15 @@ function onOptionsGeneralChanged(e) {
|
|||||||
if (!optsOld.enableAnkiConnect && optsNew.enableAnkiConnect) {
|
if (!optsOld.enableAnkiConnect && optsNew.enableAnkiConnect) {
|
||||||
updateAnkiStatus();
|
updateAnkiStatus();
|
||||||
populateAnkiDeckAndModel(optsNew);
|
populateAnkiDeckAndModel(optsNew);
|
||||||
$('.options-anki').fadeIn();
|
$('.options-anki').show();
|
||||||
} else if (optsOld.enableAnkiConnect && !optsNew.enableAnkiConnect) {
|
} 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);
|
$('#activate-on-startup').prop('checked', opts.activateOnStartup);
|
||||||
$('#load-enamdict').prop('checked', opts.loadEnamDict);
|
$('#load-enamdict').prop('checked', opts.loadEnamDict);
|
||||||
$('#select-matched-text').prop('checked', opts.selectMatchedText);
|
$('#select-matched-text').prop('checked', opts.selectMatchedText);
|
||||||
|
$('#show-advanced-options').prop('checked', opts.showAdvancedOptions);
|
||||||
$('#enable-audio-playback').prop('checked', opts.enableAudioPlayback);
|
$('#enable-audio-playback').prop('checked', opts.enableAudioPlayback);
|
||||||
$('#enable-anki-connect').prop('checked', opts.enableAnkiConnect);
|
$('#enable-anki-connect').prop('checked', opts.enableAnkiConnect);
|
||||||
|
|
||||||
@ -219,6 +227,10 @@ $(document).ready(() => {
|
|||||||
$('.anki-deck').change(onOptionsAnkiChanged);
|
$('.anki-deck').change(onOptionsAnkiChanged);
|
||||||
$('.anki-model').change(onAnkiModelChanged);
|
$('.anki-model').change(onAnkiModelChanged);
|
||||||
|
|
||||||
|
if (opts.showAdvancedOptions) {
|
||||||
|
$('.options-advanced').show();
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.enableAnkiConnect) {
|
if (opts.enableAnkiConnect) {
|
||||||
updateAnkiStatus();
|
updateAnkiStatus();
|
||||||
populateAnkiDeckAndModel(opts);
|
populateAnkiDeckAndModel(opts);
|
||||||
|
@ -22,6 +22,7 @@ function sanitizeOptions(options) {
|
|||||||
scanLength: 20,
|
scanLength: 20,
|
||||||
activateOnStartup: false,
|
activateOnStartup: false,
|
||||||
selectMatchedText: true,
|
selectMatchedText: true,
|
||||||
|
showAdvancedOptions: false,
|
||||||
loadEnamDict: false,
|
loadEnamDict: false,
|
||||||
enableAudioPlayback: true,
|
enableAudioPlayback: true,
|
||||||
enableAnkiConnect: false,
|
enableAnkiConnect: false,
|
||||||
|
@ -22,7 +22,7 @@ class Yomichan {
|
|||||||
Handlebars.partials = Handlebars.templates;
|
Handlebars.partials = Handlebars.templates;
|
||||||
Handlebars.registerHelper('kanjiLinks', function(options) {
|
Handlebars.registerHelper('kanjiLinks', function(options) {
|
||||||
let result = '';
|
let result = '';
|
||||||
for (let c of options.fn(this)) {
|
for (const c of options.fn(this)) {
|
||||||
if (Translator.isKanji(c)) {
|
if (Translator.isKanji(c)) {
|
||||||
result += Handlebars.templates['kanji-link.html']({kanji: c}).trim();
|
result += Handlebars.templates['kanji-link.html']({kanji: c}).trim();
|
||||||
} else {
|
} else {
|
||||||
@ -53,7 +53,7 @@ class Yomichan {
|
|||||||
|
|
||||||
onInstalled(details) {
|
onInstalled(details) {
|
||||||
if (details.reason === 'install') {
|
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) {
|
tabInvokeAll(action, params) {
|
||||||
chrome.tabs.query({}, (tabs) => {
|
chrome.tabs.query({}, (tabs) => {
|
||||||
for (let tab of tabs) {
|
for (const tab of tabs) {
|
||||||
this.tabInvoke(tab.id, action, params);
|
this.tabInvoke(tab.id, action, params);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -176,7 +176,7 @@ class Yomichan {
|
|||||||
'url',
|
'url',
|
||||||
];
|
];
|
||||||
|
|
||||||
for (let tag of tags) {
|
for (const tag of tags) {
|
||||||
let value = definition[tag] || null;
|
let value = definition[tag] || null;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 'audio':
|
case 'audio':
|
||||||
@ -195,7 +195,7 @@ class Yomichan {
|
|||||||
case 'glossary-list':
|
case 'glossary-list':
|
||||||
if (definition.glossary) {
|
if (definition.glossary) {
|
||||||
value = '<ol>';
|
value = '<ol>';
|
||||||
for (let gloss of definition.glossary) {
|
for (const gloss of definition.glossary) {
|
||||||
value += `<li>${gloss}</li>`;
|
value += `<li>${gloss}</li>`;
|
||||||
}
|
}
|
||||||
value += '</ol>';
|
value += '</ol>';
|
||||||
@ -237,7 +237,7 @@ class Yomichan {
|
|||||||
fields: []
|
fields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let name in fields) {
|
for (const name in fields) {
|
||||||
if (fields[name].indexOf('{audio}') !== -1) {
|
if (fields[name].indexOf('{audio}') !== -1) {
|
||||||
audio.fields.push(name);
|
audio.fields.push(name);
|
||||||
}
|
}
|
||||||
@ -261,9 +261,9 @@ class Yomichan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
api_canAddDefinitions({definitions, modes, callback}) {
|
api_canAddDefinitions({definitions, modes, callback}) {
|
||||||
let notes = [];
|
const notes = [];
|
||||||
for (let definition of definitions) {
|
for (const definition of definitions) {
|
||||||
for (let mode of modes) {
|
for (const mode of modes) {
|
||||||
notes.push(this.formatNote(definition, mode));
|
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.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
||||||
<style>
|
<style>
|
||||||
.options-anki {
|
.options-anki, .options-advanced {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<h3>General Options</h3>
|
<h3>General Options</h3>
|
||||||
|
|
||||||
<form class="form-horizontal">
|
<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>
|
<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 class="col-sm-10"><input type="number" min="1" id="scan-length" class="form-control"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -72,6 +72,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -92,7 +101,7 @@
|
|||||||
<div class="col-sm-10"><input type="text" id="anki-card-tags" class="form-control"></div>
|
<div class="col-sm-10"><input type="text" id="anki-card-tags" class="form-control"></div>
|
||||||
</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>
|
<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 class="col-sm-10"><input type="number" min="1" id="sentence-extent" class="form-control"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -162,7 +171,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="text-align: right;">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user