Skip to content

TagSpaces is an offline, open source, document manager with tagging support

offline check optimizations

uggrockd64b5f822335
diff --git a/data/index.html b/data/index.html
index 84036a35d..719445453 100644
--- a/data/index.html
+++ b/data/index.html
@@ -363,22 +363,19 @@
</div>
</div>
-<div class="modal fullScreenMobile" id="dialogLostConnection" tabindex="-1" role="dialog" aria-hidden="true">
+<div class="modal" id="dialogLostConnection" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<a type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></a>
<!--<h4 class="modal-title" id="myModalLabel2" data-i18n="ns.dialogs:lostConnectionTitle"></h4>-->
- <h4 class="modal-title" id="myModalLabel2">Lost Connection With TagSpaces</h4>
+ <h4 class="modal-title" id="myModalLabel2">Connection TagSpaces server lost</h4>
</div>
<div class="modal-body">
- <!--<iframe id="aboutIframe" sandbox="allow-same-origin allow-scripts" nwdisable style="width: 100%; height: 100%; min-height: 350px; border: 0;" src="about.html"></iframe>-->
- <img src="assets/icon.svg" style="float: left; margin-right: 10px; width: 100px; height: 100px">
- <p>Your computer or device lost its internet connection.</p>
+ <p>Your computer appears to be currently offline</p>
<!--<p data-i18n="ns.dialogs:lostConnectionMessage"></p>-->
</div>
<div class="modal-footer">
- <!--<button class="btn pull-left" id="aboutDialogBack" title="Go Back"><i class="fa fa-arrow-left fa-lg"></i></button>-->
<!--<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"><i class="fa fa-check fa-lg"></i></button>-->
</div>
</div>
diff --git a/data/web/web.api.js b/data/web/web.api.js
index dab329713..1de423cb1 100644
--- a/data/web/web.api.js
+++ b/data/web/web.api.js
@@ -19,10 +19,10 @@ define(function(require, exports, module) {
require("webdav");
require("offlinelib");
- // Offline mode
+ // Offline notification
Offline.options = {
- checkOnLoad: false,
- interceptRequests: true,
+ checkOnLoad: true,
+ //interceptRequests: true,
reconnect: {
initialDelay: 3
},
@@ -31,32 +31,22 @@ define(function(require, exports, module) {
checks: {xhr: {url: 'assets/icon16.png'}}
};
+ Offline.check();
+
function showLostConnectionDialog() {
$('#dialogLostConnection').modal({
backdrop: 'static',
show: true,
- open: function() {
- $('.modal-body');
- }
});
$('#dialogLostConnection').draggable({
handle: ".modal-header"
});
}
- Offline.on('up', function() {
- if (Offline.state === 'up') {
- $('#dialogLostConnection').modal('hide');
- Offline.check();
- }
- });
- Offline.on('down', function() {
- if (Offline.state === 'down') {
- Offline.check();
- showLostConnectionDialog();
- console.log("Server is down");
- }
+ Offline.on('confirmed-up', function() {
+ $('#dialogLostConnection').modal('hide');
});
+ Offline.on('confirmed-down', showLostConnectionDialog);
var davClient;
//exact copy of getAjax with timeout added