summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-11-21 19:03:23 +0300
committerAndrew Dolgov <[email protected]>2020-11-21 19:03:23 +0300
commit2d22ff140adad2d6aabf7d7e0f9242fbddf6c672 (patch)
treefb5898473f40707a5630776837429997cc6df44f /js
parent8193d20d390c1fc4038ce586fc27ad52b3b8b9d0 (diff)
App.onLine -> App.isOnline
Diffstat (limited to 'js')
-rw-r--r--js/app.js4
-rw-r--r--js/reader.js18
-rw-r--r--js/reader_iframe.js2
3 files changed, 12 insertions, 12 deletions
diff --git a/js/app.js b/js/app.js
index 6a7146e..04fd5f1 100644
--- a/js/app.js
+++ b/js/app.js
@@ -198,14 +198,14 @@ const App = {
.html("Could not communicate with service worker. Try reloading the page.");
}
},
- onLine: function() {
+ isOnline: function() {
if (typeof EpubeApp != "undefined" && typeof EpubeApp.isOnline != "undefined")
return EpubeApp.isOnline();
else
return navigator.onLine;
},
appCheckOffline: function() {
- EpubeApp.setOffline(!App.onLine);
+ EpubeApp.setOffline(!App.isOnline);
},
initNightMode: function() {
if (typeof EpubeApp != "undefined") {
diff --git a/js/reader.js b/js/reader.js
index 774b388..5538f99 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.isOnline()) {
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.isOnline() ? "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.isOnline() && !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.isOnline()) {
$.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.isOnline()) {
$.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.isOnline()) {
$.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.isOnline()) {
$.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.isOnline() && !local_only) {
$.post("backend.php", { op: "getlastread", id: $.urlParam("id") }, function(data) {
console.log('lr remote', data);
- if (App.onLine() && data) {
+ if (App.isOnline() && 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 7999da0..6baf788 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.isOnline()) return;
window.clearTimeout(selectionChangeTimeout);