summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-03-14 06:58:54 +0300
committerAndrew Dolgov <[email protected]>2019-03-14 06:58:54 +0300
commitd451c7575dc6534e3c0d2eee12ff6efe97b21901 (patch)
tree8daaec8a00df323b535af47de088465df097b327
parent5bce92e454ff870e96b5f6d82db5e93da7418e6c (diff)
add mru list skeleton, add minor hack to keep two columns at 50% width
-rwxr-xr-xapp.js2
-rwxr-xr-xreader.css4
-rwxr-xr-xreader.js29
3 files changed, 34 insertions, 1 deletions
diff --git a/app.js b/app.js
index f3a0239..e6fbf3b 100755
--- a/app.js
+++ b/app.js
@@ -16,7 +16,7 @@ function openFileDialog() {
],
});
- if (result[0]) {
+ if (result && result[0]) {
app.addRecentDocument(result[0]);
mainWindow.webContents.send("open-file", result[0]);
}
diff --git a/reader.css b/reader.css
index e2412a3..2ec4294 100755
--- a/reader.css
+++ b/reader.css
@@ -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%;
diff --git a/reader.js b/reader.js
index b99e3fd..ba79fcc 100755
--- a/reader.js
+++ b/reader.js
@@ -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;