diff options
-rw-r--r-- | ext/bg/guide.html | 29 | ||||
-rw-r--r-- | ext/bg/import.html | 45 | ||||
-rw-r--r-- | ext/bg/js/deinflector.js | 4 | ||||
-rw-r--r-- | ext/bg/js/import.js | 10 | ||||
-rw-r--r-- | ext/bg/js/yomichan.js | 9 |
5 files changed, 53 insertions, 44 deletions
diff --git a/ext/bg/guide.html b/ext/bg/guide.html deleted file mode 100644 index a3fa8221..00000000 --- a/ext/bg/guide.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8"> - <title>Yomichan Guide</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>Yomichan Guide</h1> - </div> - - <p>This is a minimal guide to get you started with Yomichan. For complete documentation, visit the <a href="https://foosoft.net/projects/yomichan-chrome/">official homepage</a>.</p> - - <ol> - <li>Left-click on the <img src="../img/icon16.png" alt> icon to enable or disable Yomichan for the current browser instance.</li> - <li>Right-click on the <img src="../img/icon16.png" alt> icon and select <em>Options</em> to open the Yomichan options page.</li> - <li>Hold down <kbd>Shift</kbd> or the middle mouse button as you move your cursor over text to see definitions.</li> - <li>Resize the definition window by dragging the bottom-left corner inwards or outwards.</li> - <li>Click on Kanji in the definition window to view additional information about that character.</li> - </ol> - - <p>Enjoy!</p> - </div> - </body> -</html> diff --git a/ext/bg/import.html b/ext/bg/import.html index 85841eee..3dcdfdbd 100644 --- a/ext/bg/import.html +++ b/ext/bg/import.html @@ -5,18 +5,55 @@ <title>Yomichan Dictionary Import</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"> + <style> + div.alert { + display: none; + } + </style> </head> <body> <div class="container"> <div class="page-header"> - <h1>Yomichan Dictionary Import</h1> + <h1>Welcome to Yomichan!</h1> </div> - <p>Importing dictionary data, this can take a while...</p> + <p>Thank you for downloading this extension! I sincerely hope that it will assist you on your language learning journey.</p> - <div class="progress"> - <div class="progress-bar progress-bar-striped" style="width: 0%">0%</div> + <div> + <h2>Dictionary Import</h2> + + <p> + Before it can be used for the first time, Yomichan must import the Japanese dictionary data included with this extension. This process can take a + couple of minutes to finish so please be patient! Please do not completely exit out of your browser until this process completes. + </p> + + <div class="progress"> + <div class="progress-bar progress-bar-striped" style="width: 0%"></div> + </div> + + <div class="alert alert-success">Dictionary import complete!</div> </div> + + <div> + <h2>Quick Guide</h2> + + <p> + Please read the steps outlined below to get quickly get up and running with Yomichan. For complete documentation, + visit the <a href="https://foosoft.net/projects/yomichan-chrome/">official homepage</a>. + </p> + + <ol> + <li>Left-click on the <img src="../img/icon16.png" alt> icon to enable or disable Yomichan for the current browser instance.</li> + <li>Right-click on the <img src="../img/icon16.png" alt> icon and select <em>Options</em> to open the Yomichan options page.</li> + <li>Hold down <kbd>Shift</kbd> or the middle mouse button as you move your cursor over text to see definitions.</li> + <li>Resize the definitions window by dragging the bottom-left corner inwards or outwards.</li> + <li>Click on Kanji in the definition window to view additional information about that character.</li> + </ol> + </div> + + <br> + + <p>よろしくね!</p> </div> <script src="../lib/jquery-2.2.2.min.js"></script> diff --git a/ext/bg/js/deinflector.js b/ext/bg/js/deinflector.js index e5b1efe5..8b9f88e2 100644 --- a/ext/bg/js/deinflector.js +++ b/ext/bg/js/deinflector.js @@ -66,6 +66,10 @@ class Deinflection { } const term = this.term.slice(0, -variant.ki.length) + variant.ko; + if (term.length === 0) { + continue; + } + const child = new Deinflection(term, variant.to, rule); promises.push( child.deinflect(validator, rules).then(valid => { diff --git a/ext/bg/js/import.js b/ext/bg/js/import.js index ebc7c7be..0601cb9f 100644 --- a/ext/bg/js/import.js +++ b/ext/bg/js/import.js @@ -17,9 +17,13 @@ */ -function api_setProgress({state, progress}) { - const str = `${progress}%`; - $('.progress-bar').css('width', str).text(str); +function api_setProgress(progress) { + $('.progress-bar').css('width', `${progress}%`); + + if (progress === 100.0) { + $('.progress').hide(); + $('.alert').show(); + } } chrome.runtime.onMessage.addListener(({action, params}, sender, callback) => { diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index 24ddf92d..f1b3ffc4 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -28,7 +28,6 @@ class Yomichan { this.ankiConnectVer = 0; this.setState('disabled'); - chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this)); chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this)); chrome.tabs.onCreated.addListener(tab => this.onTabReady(tab.id)); @@ -42,19 +41,13 @@ class Yomichan { }); } - onInstalled(details) { - if (details.reason === 'install') { - chrome.tabs.create({url: chrome.extension.getURL('bg/guide.html')}); - } - } - onImport({state, progress}) { if (state === 'begin') { chrome.tabs.create({url: chrome.extension.getURL('bg/import.html')}, tab => this.importTabId = tab.id); } if (this.importTabId !== null) { - this.tabInvoke(this.importTabId, 'setProgress', {state, progress}); + this.tabInvoke(this.importTabId, 'setProgress', progress); } if (state === 'end') { |