summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-11-20 21:11:45 +0300
committerAndrew Dolgov <[email protected]>2020-11-20 21:11:45 +0300
commit8104cc10e74bcf92c0cce9e736ab7755ec8c7998 (patch)
treec8a3a29bcdc681aeca66aae237bdf13c7f8b6a49 /js
parent2fe839fb75aef28df18ebb31a032604351880949 (diff)
App.onLine() is not a property
Diffstat (limited to 'js')
-rw-r--r--js/reader.js18
-rw-r--r--js/reader_iframe.js2
2 files changed, 10 insertions, 10 deletions
diff --git a/js/reader.js b/js/reader.js
index c8ea093..774b388 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -88,7 +88,7 @@ const Reader = {
console.log("loading from network");
- if (App.onLine) {
+ if (App.onLine()) {
const book_url = "backend.php?op=download&id=" + $.urlParam("id");
$(".loading_message").html("Downloading...");
@@ -277,7 +277,7 @@ const Reader = {
else
msg += "Unknown";
- msg += " (" + (App.onLine ? "Online" : "Offline") + ")";
+ msg += " (" + (App.onLine() ? "Online" : "Offline") + ")";
$(".last-mod-timestamp").text(msg)
});
@@ -529,7 +529,7 @@ const Reader = {
console.log("locations ready, stored=", Reader.Page._pagination_stored);
if (locations) {
- if (App.onLine && !Reader.Page._pagination_stored) {
+ if (App.onLine() && !Reader.Page._pagination_stored) {
$.post("backend.php", { op: "storepagination", id: $.urlParam("id"),
payload: JSON.stringify(locations), total: 100});
}
@@ -642,7 +642,7 @@ const Reader = {
if (Reader.Page._store_position && new Date().getTime()/1000 - Reader.Page._last_position_sync > 15) {
console.log("storing lastread", currentPct, currentCfi);
- if (App.onLine) {
+ if (App.onLine()) {
$.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPct,
cfi: currentCfi }, function(data) {
@@ -871,7 +871,7 @@ const Reader = {
const total = 100;
const lastCfi = window.book.locations.cfiFromPercentage(1);
- if (App.onLine) {
+ if (App.onLine()) {
$.post("backend.php", { op: "storelastread", page: total, cfi: lastCfi, id: $.urlParam("id") }, function(data) {
$(".lastread_input").val(data.page + '%');
});
@@ -892,7 +892,7 @@ const Reader = {
localforage.setItem(Reader.cacheId("lastread"),
{cfi: currentCfi, page: currentPage, total: totalPages});
- if (App.onLine) {
+ if (App.onLine()) {
$.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPage,
cfi: currentCfi }, function() {
window.location = $.urlParam("rt") ? "index.php?mode=" + $.urlParam("rt") : "index.php";
@@ -1067,7 +1067,7 @@ const Reader = {
if (confirm("Clear stored last read location?")) {
const total = window.book.locations.length();
- if (App.onLine) {
+ if (App.onLine()) {
$.post("backend.php", { op: "storelastread", page: -1, cfi: "", id: $.urlParam("id") }, function(data) {
$(".lastread_input").val(data.page + '%');
});
@@ -1101,11 +1101,11 @@ const Reader = {
console.warn(e);
}
- if (App.onLine && !local_only) {
+ if (App.onLine() && !local_only) {
$.post("backend.php", { op: "getlastread", id: $.urlParam("id") }, function(data) {
console.log('lr remote', data);
- if (App.onLine && data) {
+ if (App.onLine() && data) {
try {
if (item.cfi != data.cfi && (!item.page || data.page >= item.page))
console.log('using remote lastread...');
diff --git a/js/reader_iframe.js b/js/reader_iframe.js
index c58061e..7999da0 100644
--- a/js/reader_iframe.js
+++ b/js/reader_iframe.js
@@ -61,7 +61,7 @@ $(document).ready(function() {
let selectionChangeTimeout = null;
$(document).on("selectionchange", function() {
- if (!App.onLine) return;
+ if (!App.onLine()) return;
window.clearTimeout(selectionChangeTimeout);