diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6311779 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +web-ext-artifacts/ diff --git a/README.md b/README.md index 211d1a1..328865b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,25 @@ # nekotsume IME | ネコツメIME -Efficient Japanese IME for (almost) any website in your web browser! +_nekotsume IME_ is an efficient and privacy-friendly Japanese IME for (almost) any website in your web browser. It works fully locally: what you type is never sent on the Internet and stays private. With this, it's also pretty fast, and the suggestions dictionary should be decent. - +![](screenshot.png) + + + +## Usage + +General: + +* You can toggle the IME to ON [あ] to enable conversion of for all standard text input fields (`` and ` + + + diff --git a/ime.js b/ime.js index fc0bb50..f2cf9ba 100644 --- a/ime.js +++ b/ime.js @@ -177,7 +177,7 @@ function AjaxIME(doc) { ImeDocument_.ImeRequestCallback = ImeRequestCallback; ImeDocument_.ImeChangeMode = ImeChangeMode; - addEvent(ImeDocument_, 'keydown', ImeDocumentKeyDown); + //addEvent(ImeDocument_, 'keydown', ImeDocumentKeyDown); addEvent(ImePreEdit_, 'keydown', ImePreEditKeyDown); addEvent(ImePreEdit_, 'keyup', ImePreEditKeyUp); @@ -682,15 +682,17 @@ function ImeRequestCallback(result, source) { ImeCurrentDocument_.ImeRequestCallback(result, source); } -browser.runtime.onMessage.addListener(function(data){ - if (data.browserAction) { - ImeInit(); - if (!ImeEnabled_ || data.browserAction === 'ImeChangeMode') { - ImeChangeMode(); - } - return; - } - ImeRequestCallback(data.result, data.source); -}); - addEvent(window, 'load', ImeInit); + +if (typeof browser !== 'undefined' && typeof browser.runtime !== 'undefined' && typeof browser.runtime.onMessage !== 'undefined') { + browser.runtime.onMessage.addListener(function(data){ + if (data.browserAction) { + ImeInit(); + if (!ImeEnabled_ || data.browserAction === 'ImeChangeMode') { + ImeChangeMode(); + } + return; + } + ImeRequestCallback(data.result, data.source); + }); +} diff --git a/loader.js b/loader.js index a634170..97deb59 100644 --- a/loader.js +++ b/loader.js @@ -30,7 +30,7 @@ function initRuntime () { } var worker = new Worker('worker.js'); - igo.getServerFileToArrayBufffer("skkdic.zip", function(buffer){ + igo.getServerFileToArrayBufffer('skkdic.bin', function(buffer){ event({event: 'downloaded'}); var blob = new Blob([new Uint8Array(buffer)]); worker.postMessage({method: 'setdic', dic: blob}); @@ -46,7 +46,9 @@ function initRuntime () { postToWorker = function(data) { worker.postMessage(data); } - browser.runtime.onMessage.addListener(postToWorker); + if (typeof browser !== 'undefined' && typeof browser.runtime !== 'undefined' && typeof browser.runtime.onMessage !== 'undefined') { + browser.runtime.onMessage.addListener(postToWorker); + } } if (document.readyState === 'loading') { @@ -55,4 +57,4 @@ if (document.readyState === 'loading') { initRuntime(); } -})(); \ No newline at end of file +})(); diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..b93c65f Binary files /dev/null and b/screenshot.png differ diff --git a/skkdic.zip b/skkdic.bin similarity index 100% rename from skkdic.zip rename to skkdic.bin