diff options
author | Andrew Dolgov <[email protected]> | 2017-02-27 09:40:08 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-02-27 09:40:08 +0300 |
commit | 17f826cd1d1fdaa7212a568c371273f702f77b7c (patch) | |
tree | 8f624c67d529b289abf16badedb348d263e84f3c /read.html | |
parent | bc720234f59d39119c9486ff88f248bacd3140c3 (diff) |
store basic settings in indexed db
Diffstat (limited to 'read.html')
-rw-r--r-- | read.html | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -278,14 +278,21 @@ restore: false, }); - var settings = { - fontSize: localStorage['epube:fontSize'] ? localStorage['epube:fontSize'] : '16px', - fontFamily: localStorage['epube:fontFamily'] ? localStorage['epube:fontFamily'] : 'Georgia', - lineHeight: localStorage['epube:lineHeight'] ? localStorage['epube:lineHeight'] : '140%' }; - - book.setStyle("fontSize", settings.fontSize + "px"); - book.setStyle("fontFamily", settings.fontFamily); - book.setStyle("lineHeight", settings.lineHeight + "%"); + Promise.all([ + localforage.getItem("epube.fontSize"), + localforage.getItem("epube.fontFamily"), + localforage.getItem("epube.lineHeight") + ]).then(function(res) { + var fontSize = res[0] ? res[0] + "px" : "16px"; + var fontFamily = res[1] ? res[1] : "Georgia"; + var lineHeight = res[2] ? res[2] + "%" : "140%"; + + book.setStyle("fontSize", fontSize); + book.setStyle("fontFamily", fontFamily); + book.setStyle("lineHeight", lineHeight); + + }); + //styles: { fontSize: '24px', lineHeight: '130%', fontFamily: 'Georgia' } |