From e2640c66be32f191eaa70845afc283c1ad3f4e72 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 17 May 2021 11:37:36 +0300 Subject: use both hyphenation dictionaries if enabled --- js/reader.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'js') 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())); }); } }); -- cgit v1.2.3