diff options
author | Andrew Dolgov <[email protected]> | 2021-05-17 11:37:36 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-05-17 11:37:36 +0300 |
commit | e2640c66be32f191eaa70845afc283c1ad3f4e72 (patch) | |
tree | 1cdb40d567dee7f989d99010a23254ac64ea8598 /js/reader.js | |
parent | e7917856c97b253abf32c2d5c3f19951f7fff4a5 (diff) |
use both hyphenation dictionaries if enabled
Diffstat (limited to 'js/reader.js')
-rw-r--r-- | js/reader.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/js/reader.js b/js/reader.js index fd3df1e..b6834ae 100644 --- a/js/reader.js +++ b/js/reader.js @@ -13,6 +13,7 @@ const Reader = { csrf_token: "", last_stored_cfi: "", prevent_lastread_update: false, + hyphenate: {}, init: function() { this.csrf_token = Cookie.get('epube_csrf_token'); @@ -227,8 +228,9 @@ const Reader = { localforage.getItem("epube.enable-hyphens").then(function(enable_hyphens) { if (enable_hyphens) { - /* global hyphenationPatternsEnUs, createHyphenator */ - Reader.hyphenateHTML = createHyphenator(hyphenationPatternsEnUs, { html: true }); + /* global hyphenationPatternsEnUs, hyphenationPatternsRu, createHyphenator */ + Reader.hyphenate.en = createHyphenator(hyphenationPatternsEnUs, { html: true }); + Reader.hyphenate.ru = createHyphenator(hyphenationPatternsRu, { html: true }); } Reader.applyStyles(true); @@ -565,11 +567,12 @@ const Reader = { .css("background", "") .css("background-color", ""); - if (typeof Reader.hyphenateHTML != "undefined") { - $(doc).find('p').each((i,p) => { + if (typeof Reader.hyphenate.en != "undefined") { + $(doc).find('p, div').each((i,p) => { p = $(p); - p.html(Reader.hyphenateHTML(p.html())); + p.html(Reader.hyphenate.en(p.html())); + p.html(Reader.hyphenate.ru(p.html())); }); } }); |