Merge pull request #466 from toasted-nutbread/wanakana-global
Use wanakana object directly
This commit is contained in:
commit
61d2185aee
@ -22,6 +22,7 @@
|
|||||||
* apiClipboardGet
|
* apiClipboardGet
|
||||||
* apiOptionsSet
|
* apiOptionsSet
|
||||||
* apiTermsFind
|
* apiTermsFind
|
||||||
|
* wanakana
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DisplaySearch extends Display {
|
class DisplaySearch extends Display {
|
||||||
@ -89,7 +90,7 @@ class DisplaySearch extends Display {
|
|||||||
|
|
||||||
if (this.options.general.enableWanakana === true) {
|
if (this.options.general.enableWanakana === true) {
|
||||||
this.wanakanaEnable.checked = true;
|
this.wanakanaEnable.checked = true;
|
||||||
window.wanakana.bind(this.query);
|
wanakana.bind(this.query);
|
||||||
} else {
|
} else {
|
||||||
this.wanakanaEnable.checked = false;
|
this.wanakanaEnable.checked = false;
|
||||||
}
|
}
|
||||||
@ -256,9 +257,9 @@ class DisplaySearch extends Display {
|
|||||||
onWanakanaEnableChange(e) {
|
onWanakanaEnableChange(e) {
|
||||||
const enableWanakana = e.target.checked;
|
const enableWanakana = e.target.checked;
|
||||||
if (enableWanakana) {
|
if (enableWanakana) {
|
||||||
window.wanakana.bind(this.query);
|
wanakana.bind(this.query);
|
||||||
} else {
|
} else {
|
||||||
window.wanakana.unbind(this.query);
|
wanakana.unbind(this.query);
|
||||||
}
|
}
|
||||||
apiOptionsSet({general: {enableWanakana}}, this.getOptionsContext());
|
apiOptionsSet({general: {enableWanakana}}, this.getOptionsContext());
|
||||||
}
|
}
|
||||||
@ -298,7 +299,7 @@ class DisplaySearch extends Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setQuery(query) {
|
setQuery(query) {
|
||||||
const interpretedQuery = this.isWanakanaEnabled() ? window.wanakana.toKana(query) : query;
|
const interpretedQuery = this.isWanakanaEnabled() ? wanakana.toKana(query) : query;
|
||||||
this.query.value = interpretedQuery;
|
this.query.value = interpretedQuery;
|
||||||
this.queryParser.setText(interpretedQuery);
|
this.queryParser.setText(interpretedQuery);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* global
|
||||||
|
* wanakana
|
||||||
|
*/
|
||||||
|
|
||||||
function appearanceInitialize() {
|
function appearanceInitialize() {
|
||||||
let previewVisible = false;
|
let previewVisible = false;
|
||||||
@ -37,7 +40,7 @@ function showAppearancePreview() {
|
|||||||
frame.src = '/bg/settings-popup-preview.html';
|
frame.src = '/bg/settings-popup-preview.html';
|
||||||
frame.id = 'settings-popup-preview-frame';
|
frame.id = 'settings-popup-preview-frame';
|
||||||
|
|
||||||
window.wanakana.bind(text[0]);
|
wanakana.bind(text[0]);
|
||||||
|
|
||||||
const targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');
|
const targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user