diff options
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/background.html | 2 | ||||
-rw-r--r-- | ext/bg/context.html | 2 | ||||
-rw-r--r-- | ext/bg/js/backend.js | 7 | ||||
-rw-r--r-- | ext/bg/js/options.js | 7 | ||||
-rw-r--r-- | ext/bg/js/search.js | 2 | ||||
-rw-r--r-- | ext/bg/js/settings.js | 59 | ||||
-rw-r--r-- | ext/bg/js/util.js | 16 | ||||
-rw-r--r-- | ext/bg/lang/deinflect.json | 818 | ||||
-rw-r--r-- | ext/bg/search.html | 2 | ||||
-rw-r--r-- | ext/bg/settings.html | 36 |
10 files changed, 916 insertions, 35 deletions
diff --git a/ext/bg/background.html b/ext/bg/background.html index 3262f2a1..5978f10f 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -10,6 +10,8 @@ <script src="/mixed/lib/jszip.min.js"></script> <script src="/mixed/lib/wanakana.min.js"></script> + <script src="/mixed/js/extension.js"></script> + <script src="/bg/js/anki.js"></script> <script src="/bg/js/api.js"></script> <script src="/bg/js/audio.js"></script> diff --git a/ext/bg/context.html b/ext/bg/context.html index 01b4fb30..198ccd42 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -32,6 +32,8 @@ <script src="/mixed/lib/jquery.min.js"></script> <script src="/mixed/lib/bootstrap-toggle/bootstrap-toggle.min.js"></script> + <script src="/mixed/js/extension.js"></script> + <script src="/bg/js/api.js"></script> <script src="/bg/js/options.js"></script> <script src="/bg/js/util.js"></script> diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index d49286d0..d95cb82d 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -57,9 +57,10 @@ class Backend { this.anki = new AnkiNull(); } + const callback = () => this.checkLastError(chrome.runtime.lastError); chrome.tabs.query({}, tabs => { for (const tab of tabs) { - chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: options}, () => null); + chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: options}, callback); } }); } @@ -147,6 +148,10 @@ class Backend { chrome.browserAction.setBadgeText({text}); } } + + checkLastError(e) { + // NOP + } } window.yomichan_backend = new Backend(); diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 29d8a215..7d993987 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -199,6 +199,10 @@ function optionsSetDefaults(options) { popupHeight: 250, popupHorizontalOffset: 0, popupVerticalOffset: 10, + popupHorizontalOffset2: 10, + popupVerticalOffset2: 0, + popupHorizontalTextPosition: 'below', + popupVerticalTextPosition: 'before', showGuide: true, compactTags: false, compactGlossaries: false, @@ -214,7 +218,8 @@ function optionsSetDefaults(options) { autoHideResults: false, delay: 20, length: 10, - modifier: 'shift' + modifier: 'shift', + deepDomScan: false }, dictionaries: {}, diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index f08f22da..a3382398 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -25,7 +25,7 @@ class DisplaySearch extends Display { this.query = $('#query').on('input', this.onSearchInput.bind(this)); this.intro = $('#intro'); - this.dependencies = {...this.dependencies, ...{docRangeFromPoint, docSentenceExtract}}; + this.dependencies = Object.assign({}, this.dependencies, {docRangeFromPoint, docSentenceExtract}); window.wanakana.bind(this.query.get(0)); } diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 75082f3e..f5d669b2 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -32,10 +32,14 @@ async function formRead() { optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked'); optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10); optionsNew.general.popupDisplayMode = $('#popup-display-mode').val(); + optionsNew.general.popupHorizontalTextPosition = $('#popup-horizontal-text-position').val(); + optionsNew.general.popupVerticalTextPosition = $('#popup-vertical-text-position').val(); optionsNew.general.popupWidth = parseInt($('#popup-width').val(), 10); optionsNew.general.popupHeight = parseInt($('#popup-height').val(), 10); optionsNew.general.popupHorizontalOffset = parseInt($('#popup-horizontal-offset').val(), 0); optionsNew.general.popupVerticalOffset = parseInt($('#popup-vertical-offset').val(), 10); + optionsNew.general.popupHorizontalOffset2 = parseInt($('#popup-horizontal-offset2').val(), 0); + optionsNew.general.popupVerticalOffset2 = parseInt($('#popup-vertical-offset2').val(), 10); optionsNew.general.customPopupCss = $('#custom-popup-css').val(); optionsNew.scanning.middleMouse = $('#middle-mouse-button-scan').prop('checked'); @@ -43,6 +47,7 @@ async function formRead() { optionsNew.scanning.selectText = $('#select-matched-text').prop('checked'); optionsNew.scanning.alphanumeric = $('#search-alphanumeric').prop('checked'); optionsNew.scanning.autoHideResults = $('#auto-hide-results').prop('checked'); + optionsNew.scanning.deepDomScan = $('#deep-dom-scan').prop('checked'); optionsNew.scanning.delay = parseInt($('#scan-delay').val(), 10); optionsNew.scanning.length = parseInt($('#scan-length').val(), 10); optionsNew.scanning.modifier = $('#scan-modifier-key').val(); @@ -116,7 +121,7 @@ async function formMainDictionaryOptionsPopulate(options) { select.append($('<option class="text-muted" value="">Not selected</option>')); let mainDictionary = ''; - for (const dictRow of await utilDatabaseSummarize()) { + for (const dictRow of toIterable(await utilDatabaseSummarize())) { if (dictRow.sequenced) { select.append($(`<option value="${dictRow.title}">${dictRow.title}</option>`)); if (dictRow.title === options.general.mainDictionary) { @@ -168,10 +173,14 @@ async function onReady() { $('#show-advanced-options').prop('checked', options.general.showAdvanced); $('#max-displayed-results').val(options.general.maxResults); $('#popup-display-mode').val(options.general.popupDisplayMode); + $('#popup-horizontal-text-position').val(options.general.popupHorizontalTextPosition); + $('#popup-vertical-text-position').val(options.general.popupVerticalTextPosition); $('#popup-width').val(options.general.popupWidth); $('#popup-height').val(options.general.popupHeight); $('#popup-horizontal-offset').val(options.general.popupHorizontalOffset); $('#popup-vertical-offset').val(options.general.popupVerticalOffset); + $('#popup-horizontal-offset2').val(options.general.popupHorizontalOffset2); + $('#popup-vertical-offset2').val(options.general.popupVerticalOffset2); $('#custom-popup-css').val(options.general.customPopupCss); $('#middle-mouse-button-scan').prop('checked', options.scanning.middleMouse); @@ -179,6 +188,7 @@ async function onReady() { $('#select-matched-text').prop('checked', options.scanning.selectText); $('#search-alphanumeric').prop('checked', options.scanning.alphanumeric); $('#auto-hide-results').prop('checked', options.scanning.autoHideResults); + $('#deep-dom-scan').prop('checked', options.scanning.deepDomScan); $('#scan-delay').val(options.scanning.delay); $('#scan-length').val(options.scanning.length); $('#scan-modifier-key').val(options.scanning.modifier); @@ -314,12 +324,12 @@ async function dictionaryGroupsPopulate(options) { const dictGroups = $('#dict-groups').empty(); const dictWarning = $('#dict-warning').hide(); - const dictRows = await utilDatabaseSummarize(); + const dictRows = toIterable(await utilDatabaseSummarize()); if (dictRows.length === 0) { dictWarning.show(); } - for (const dictRow of dictRowsSort(dictRows, options)) { + for (const dictRow of toIterable(dictRowsSort(dictRows, options))) { const dictOptions = options.dictionaries[dictRow.title] || { enabled: false, priority: 0, @@ -581,26 +591,25 @@ async function onAnkiFieldTemplatesReset(e) { */ async function getBrowser() { - if (typeof chrome !== "undefined") { - if (typeof browser !== "undefined") { - try { - const info = await browser.runtime.getBrowserInfo(); - if (info.name === "Fennec") { - return "firefox-mobile"; - } - } catch (e) { } - return "firefox"; - } else { - return "chrome"; - } + if (EXTENSION_IS_BROWSER_EDGE) { + return 'edge'; + } + if (typeof browser !== 'undefined') { + try { + const info = await browser.runtime.getBrowserInfo(); + if (info.name === 'Fennec') { + return 'firefox-mobile'; + } + } catch (e) { } + return 'firefox'; } else { - return "edge"; + return 'chrome'; } } function storageBytesToLabeledString(size) { const base = 1000; - const labels = ["bytes", "KB", "MB", "GB"]; + const labels = ['bytes', 'KB', 'MB', 'GB']; let labelIndex = 0; while (size >= base) { size /= base; @@ -620,14 +629,14 @@ storageEstimate.mostRecent = null; async function storageInfoInitialize() { const browser = await getBrowser(); - const container = document.querySelector("#storage-info"); - container.setAttribute("data-browser", browser); + const container = document.querySelector('#storage-info'); + container.setAttribute('data-browser', browser); await storageShowInfo(); - container.classList.remove("storage-hidden"); + container.classList.remove('storage-hidden'); - document.querySelector("#storage-refresh").addEventListener('click', () => storageShowInfo(), false); + document.querySelector('#storage-refresh').addEventListener('click', () => storageShowInfo(), false); } async function storageUpdateStats() { @@ -637,8 +646,8 @@ async function storageUpdateStats() { const valid = (estimate !== null); if (valid) { - document.querySelector("#storage-usage").textContent = storageBytesToLabeledString(estimate.usage); - document.querySelector("#storage-quota").textContent = storageBytesToLabeledString(estimate.quota); + document.querySelector('#storage-usage').textContent = storageBytesToLabeledString(estimate.usage); + document.querySelector('#storage-quota').textContent = storageBytesToLabeledString(estimate.quota); } storageUpdateStats.isUpdating = false; @@ -650,8 +659,8 @@ async function storageShowInfo() { storageSpinnerShow(true); const valid = await storageUpdateStats(); - document.querySelector("#storage-use").classList.toggle("storage-hidden", !valid); - document.querySelector("#storage-error").classList.toggle("storage-hidden", valid); + document.querySelector('#storage-use').classList.toggle('storage-hidden', !valid); + document.querySelector('#storage-error').classList.toggle('storage-hidden', valid); storageSpinnerShow(false); } diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 34b06ddb..3dc7c900 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -87,6 +87,20 @@ function utilDatabasePurge() { return utilBackend().translator.database.purge(); } -function utilDatabaseImport(data, progress, exceptions) { +async function utilDatabaseImport(data, progress, exceptions) { + // Edge cannot read data on the background page due to the File object + // being created from a different window. Read on the same page instead. + if (EXTENSION_IS_BROWSER_EDGE) { + data = await utilReadFile(data); + } return utilBackend().translator.database.importDictionary(data, progress, exceptions); } + +function utilReadFile(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = () => reject(reader.error); + reader.readAsBinaryString(file); + }); +} diff --git a/ext/bg/lang/deinflect.json b/ext/bg/lang/deinflect.json index 7ee00b2f..7a68ea71 100644 --- a/ext/bg/lang/deinflect.json +++ b/ext/bg/lang/deinflect.json @@ -784,6 +784,150 @@ "rulesOut": [ "adj-i" ] + }, + { + "kanaIn": "のたもうたら", + "kanaOut": "のたまう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "いったら", + "kanaOut": "いく", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "おうたら", + "kanaOut": "おう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "こうたら", + "kanaOut": "こう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "そうたら", + "kanaOut": "そう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "とうたら", + "kanaOut": "とう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "行ったら", + "kanaOut": "行く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "逝ったら", + "kanaOut": "逝く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "往ったら", + "kanaOut": "往く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "請うたら", + "kanaOut": "請う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "乞うたら", + "kanaOut": "乞う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "恋うたら", + "kanaOut": "恋う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "問うたら", + "kanaOut": "問う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "負うたら", + "kanaOut": "負う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "沿うたら", + "kanaOut": "沿う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "添うたら", + "kanaOut": "添う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "副うたら", + "kanaOut": "副う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "厭うたら", + "kanaOut": "厭う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] } ], "-tari": [ @@ -891,6 +1035,150 @@ "rulesOut": [ "adj-i" ] + }, + { + "kanaIn": "のたもうたり", + "kanaOut": "のたまう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "いったり", + "kanaOut": "いく", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "おうたり", + "kanaOut": "おう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "こうたり", + "kanaOut": "こう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "そうたり", + "kanaOut": "そう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "とうたり", + "kanaOut": "とう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "行ったり", + "kanaOut": "行く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "逝ったり", + "kanaOut": "逝く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "往ったり", + "kanaOut": "往く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "請うたり", + "kanaOut": "請う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "乞うたり", + "kanaOut": "乞う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "恋うたり", + "kanaOut": "恋う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "問うたり", + "kanaOut": "問う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "負うたり", + "kanaOut": "負う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "沿うたり", + "kanaOut": "沿う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "添うたり", + "kanaOut": "添う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "副うたり", + "kanaOut": "副う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "厭うたり", + "kanaOut": "厭う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] } ], "-te": [ @@ -998,6 +1286,150 @@ "rulesOut": [ "v5" ] + }, + { + "kanaIn": "のたもうて", + "kanaOut": "のたまう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "いって", + "kanaOut": "いく", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "おうて", + "kanaOut": "おう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "こうて", + "kanaOut": "こう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "そうて", + "kanaOut": "そう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "とうて", + "kanaOut": "とう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "行って", + "kanaOut": "行く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "逝って", + "kanaOut": "逝く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "往って", + "kanaOut": "往く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "請うて", + "kanaOut": "請う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "乞うて", + "kanaOut": "乞う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "恋うて", + "kanaOut": "恋う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "問うて", + "kanaOut": "問う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "負うて", + "kanaOut": "負う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "沿うて", + "kanaOut": "沿う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "添うて", + "kanaOut": "添う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "副うて", + "kanaOut": "副う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "厭うて", + "kanaOut": "厭う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] } ], "-zu": [ @@ -1251,6 +1683,16 @@ ] }, { + "kanaIn": "させる", + "kanaOut": "す", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { "kanaIn": "たせる", "kanaOut": "つ", "rulesIn": [ @@ -1498,6 +1940,14 @@ ] }, { + "kanaIn": "き", + "kanaOut": "くる", + "rulesIn": [], + "rulesOut": [ + "vk" + ] + }, + { "kanaIn": "ぎ", "kanaOut": "ぎる", "rulesIn": [], @@ -1881,6 +2331,16 @@ ] }, { + "kanaIn": "される", + "kanaOut": "す", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { "kanaIn": "たれる", "kanaOut": "つ", "rulesIn": [ @@ -1929,12 +2389,10 @@ "rulesOut": [ "v5" ] - } - ], - "passive or causative": [ + }, { - "kanaIn": "される", - "kanaOut": "す", + "kanaIn": "られる", + "kanaOut": "る", "rulesIn": [ "v1" ], @@ -2048,6 +2506,150 @@ "rulesOut": [ "adj-i" ] + }, + { + "kanaIn": "のたもうた", + "kanaOut": "のたまう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "いった", + "kanaOut": "いく", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "おうた", + "kanaOut": "おう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "こうた", + "kanaOut": "こう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "そうた", + "kanaOut": "そう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "とうた", + "kanaOut": "とう", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "行った", + "kanaOut": "行く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "逝った", + "kanaOut": "逝く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "往った", + "kanaOut": "往く", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "請うた", + "kanaOut": "請う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "乞うた", + "kanaOut": "乞う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "恋うた", + "kanaOut": "恋う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "問うた", + "kanaOut": "問う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "負うた", + "kanaOut": "負う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "沿うた", + "kanaOut": "沿う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "添うた", + "kanaOut": "添う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "副うた", + "kanaOut": "副う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "厭うた", + "kanaOut": "厭う", + "rulesIn": [], + "rulesOut": [ + "v5" + ] } ], "polite": [ @@ -2674,7 +3276,6 @@ ], "rulesOut": [ "v1", - "v5", "vk" ] }, @@ -2787,5 +3388,210 @@ "vs" ] } + ], + "causative passive": [ + { + "kanaIn": "かされる", + "kanaOut": "く", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "がされる", + "kanaOut": "ぐ", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "たされる", + "kanaOut": "つ", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "なされる", + "kanaOut": "ぬ", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "ばされる", + "kanaOut": "ぶ", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "まされる", + "kanaOut": "む", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "らされる", + "kanaOut": "る", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "わされる", + "kanaOut": "う", + "rulesIn": [ + "v1" + ], + "rulesOut": [ + "v5" + ] + } + ], + "-toku": [ + { + "kanaIn": "いとく", + "kanaOut": "く", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "いどく", + "kanaOut": "ぐ", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "きとく", + "kanaOut": "くる", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "vk" + ] + }, + { + "kanaIn": "しとく", + "kanaOut": "す", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "しとく", + "kanaOut": "する", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "vs" + ] + }, + { + "kanaIn": "っとく", + "kanaOut": "う", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "っとく", + "kanaOut": "つ", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "っとく", + "kanaOut": "る", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "んどく", + "kanaOut": "ぬ", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "んどく", + "kanaOut": "ぶ", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "んどく", + "kanaOut": "む", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v5" + ] + }, + { + "kanaIn": "とく", + "kanaOut": "る", + "rulesIn": [ + "v5" + ], + "rulesOut": [ + "v1", + "vk" + ] + } ] } diff --git a/ext/bg/search.html b/ext/bg/search.html index ce156578..05c0daab 100644 --- a/ext/bg/search.html +++ b/ext/bg/search.html @@ -37,6 +37,8 @@ <script src="/mixed/lib/jquery.min.js"></script> <script src="/mixed/lib/wanakana.min.js"></script> + <script src="/mixed/js/extension.js"></script> + <script src="/bg/js/api.js"></script> <script src="/bg/js/audio.js"></script> <script src="/bg/js/dictionary.js"></script> diff --git a/ext/bg/settings.html b/ext/bg/settings.html index c6677018..cc140023 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -107,6 +107,28 @@ </select> </div> + <div class="form-group"> + <div class="row"> + <div class="col-xs-6"> + <label for="popup-display-mode">Popup position for horizontal text</label> + <select class="form-control" id="popup-horizontal-text-position"> + <option value="below">Below text</option> + <option value="above">Above text</option> + </select> + </div> + <div class="col-xs-6"> + <label for="popup-display-mode">Popup position for vertical text</label> + <select class="form-control" id="popup-vertical-text-position"> + <option value="default">Same as for horizontal text</option> + <option value="before">Before text reading direction</option> + <option value="after">After text reading direction</option> + <option value="left">Left of text</option> + <option value="right">Right of text</option> + </select> + </div> + </div> + </div> + <div class="form-group options-advanced"> <label for="audio-playback-volume">Audio playback volume (percent)</label> <input type="number" min="0" max="100" id="audio-playback-volume" class="form-control"> @@ -134,6 +156,14 @@ </div> <div class="form-group options-advanced"> + <label>Popup offset for vertical text (horizontal, vertical; in pixels)</label> + <div class="row"> + <div class="col-xs-6"><input type="number" min="0" id="popup-horizontal-offset2" class="form-control"></div> + <div class="col-xs-6"><input type="number" min="0" id="popup-vertical-offset2" class="form-control"></div> + </div> + </div> + + <div class="form-group options-advanced"> <label for="custom-popup-css">Custom popup CSS</label> <div><textarea autocomplete="off" spellcheck="false" wrap="soft" id="custom-popup-css" class="form-control"></textarea></div> </div> @@ -162,6 +192,10 @@ <label><input type="checkbox" id="auto-hide-results"> Automatically hide results</label> </div> + <div class="checkbox options-advanced"> + <label><input type="checkbox" id="deep-dom-scan"> Deep DOM scan</label> + </div> + <div class="form-group options-advanced"> <label for="scan-delay">Scan delay (in milliseconds)</label> <input type="number" min="1" id="scan-delay" class="form-control"> @@ -399,6 +433,8 @@ <script src="/mixed/lib/bootstrap/js/bootstrap.min.js"></script> <script src="/mixed/lib/handlebars.min.js"></script> + <script src="/mixed/js/extension.js"></script> + <script src="/bg/js/anki.js"></script> <script src="/bg/js/api.js"></script> <script src="/bg/js/dictionary.js"></script> |