diff options
author | Andrew Dolgov <[email protected]> | 2019-03-14 06:58:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-03-14 06:58:54 +0300 |
commit | d451c7575dc6534e3c0d2eee12ff6efe97b21901 (patch) | |
tree | 8daaec8a00df323b535af47de088465df097b327 | |
parent | 5bce92e454ff870e96b5f6d82db5e93da7418e6c (diff) |
add mru list skeleton, add minor hack to keep two columns at 50% width
-rwxr-xr-x | app.js | 2 | ||||
-rwxr-xr-x | reader.css | 4 | ||||
-rwxr-xr-x | reader.js | 29 |
3 files changed, 34 insertions, 1 deletions
@@ -16,7 +16,7 @@ function openFileDialog() { ], }); - if (result[0]) { + if (result && result[0]) { app.addRecentDocument(result[0]); mainWindow.webContents.send("open-file", result[0]); } @@ -109,6 +109,10 @@ margin: auto; } +#reader.fit-size img.limit-width { + max-width : 50%; +} + #reader.fit-size img { max-width : 100%; max-height : 100%; @@ -91,6 +91,19 @@ function Model() { }); localforage.setItem('LAST-OPENED-FILE', file).then(() => { + + localforage.getItem("MRU-LIST").then((mru) => { + if (!mru) mru = []; + + mru.splice(5); + + if (mru.length == 0 || mru[mru.length-1] != file) + mru.push(file); + + localforage.setItem("MRU-LIST", mru); + + }); + self.fileName(file.split(/[\\/]/).pop()); localforage.getItem(model.cacheKey("SINGLE-COLUMN")).then((single) => { @@ -333,6 +346,14 @@ $(document).ready(function () { }); }); + function fixColumnWidths() { + if ($(".right-page").is(":visible")) { + $("#reader img").addClass("limit-width"); + } else { + $("#reader img").removeClass("limit-width"); + } + } + $("#reader img").on("load", function(e) { const img = $(this); const is_right = img.hasClass('right-page'); @@ -345,6 +366,10 @@ $(document).ready(function () { } } + window.setTimeout(() => { + fixColumnWidths(); + }, 10); + }); $(".location").click(function() { @@ -419,6 +444,10 @@ $(document).ready(function () { } }); + $(window).on("resize", () => { + fixColumnWidths(); + }); + $(document).on("keydown", (e) => { if ($(".modal").is(":visible")) return; |