need to make sure that get loop runs only once; closes #20
This commit is contained in:
23
ChangeLog
23
ChangeLog
@@ -1,3 +1,26 @@
|
|||||||
|
2015-08-26 22:43 marc
|
||||||
|
|
||||||
|
* ax_init_standard_project.m4, bootstrap.sh, configure.ac,
|
||||||
|
html/index.html.in, html/safechat.css, html/safechat.js: profile
|
||||||
|
download implemented; closes #16
|
||||||
|
|
||||||
|
2015-08-26 21:30 marc
|
||||||
|
|
||||||
|
* html/chat.html, html/index.html.in, html/safechat.js: profile
|
||||||
|
download implemented; closes #15
|
||||||
|
|
||||||
|
2015-08-26 21:13 marc
|
||||||
|
|
||||||
|
* html/index.html.in, html/menu.svg, html/safechat.css,
|
||||||
|
html/safechat.js: profile download implemented; closes #15
|
||||||
|
|
||||||
|
2015-08-16 15:07 marc
|
||||||
|
|
||||||
|
* ChangeLog, ax_check_qt.m4, ax_init_standard_project.m4,
|
||||||
|
bootstrap.sh, configure.ac, html/index.html, html/index.html.in,
|
||||||
|
html/safechat.js, mac-create-app-bundle.sh: Fixes #13 by
|
||||||
|
introducing vibration where available
|
||||||
|
|
||||||
2015-07-16 10:54 marc
|
2015-07-16 10:54 marc
|
||||||
|
|
||||||
* ChangeLog, doc/doxyfile.in: try without searchbox
|
* ChangeLog, doc/doxyfile.in: try without searchbox
|
||||||
|
@@ -121,8 +121,10 @@ td:last-child {
|
|||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
#menu li, #menu li * {
|
#menu li {
|
||||||
padding: 0 1em 0 1em;
|
padding: 0 1em 0 1em;
|
||||||
|
}
|
||||||
|
#menu li, #menu li * {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
@@ -119,6 +119,20 @@ function status(text, msg) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var getLoopTimeout = null; ///< store get timeout to make sure only one is running
|
||||||
|
/// Set timeout for next get request
|
||||||
|
/** @param time timeout time in ms, defaults to 10000 */
|
||||||
|
function getLoop(time) {
|
||||||
|
if (!time) time = 10000;
|
||||||
|
getLoopStop();
|
||||||
|
getLoopTimeout = setTimeout(get, time);
|
||||||
|
}
|
||||||
|
/// Stop get loop if it is running
|
||||||
|
function getLoopStop() {
|
||||||
|
if (getLoopTimeout) clearTimeout(getLoopTimeout);
|
||||||
|
getLoopTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Alert user
|
/// Alert user
|
||||||
/** Alert user, e.g. that a new message has arrived.
|
/** Alert user, e.g. that a new message has arrived.
|
||||||
@param */
|
@param */
|
||||||
@@ -139,6 +153,7 @@ function togglemenu() {
|
|||||||
|
|
||||||
/// Download Profile Backup
|
/// Download Profile Backup
|
||||||
function backup() {
|
function backup() {
|
||||||
|
getLoopStop();
|
||||||
status("<p>Starting backup download ...</p>");
|
status("<p>Starting backup download ...</p>");
|
||||||
var download = document.createElement('a');
|
var download = document.createElement('a');
|
||||||
download.href = 'data:attachment/text,'+encodeURI(JSON.stringify(localStorage));
|
download.href = 'data:attachment/text,'+encodeURI(JSON.stringify(localStorage));
|
||||||
@@ -160,6 +175,7 @@ function backup() {
|
|||||||
|
|
||||||
/// Upload Profile Backup
|
/// Upload Profile Backup
|
||||||
function restore(evt) {
|
function restore(evt) {
|
||||||
|
getLoopStop();
|
||||||
status("<p>Starting backup restore ...</p>");
|
status("<p>Starting backup restore ...</p>");
|
||||||
if (!window.FileReader)
|
if (!window.FileReader)
|
||||||
return error("your browser dows not support file upload", true);
|
return error("your browser dows not support file upload", true);
|
||||||
@@ -404,7 +420,7 @@ function get() {
|
|||||||
var res=JSON.parse(pk);
|
var res=JSON.parse(pk);
|
||||||
var key=openpgp.key.readArmored(res);
|
var key=openpgp.key.readArmored(res);
|
||||||
if (!res||key.err) {
|
if (!res||key.err) {
|
||||||
setTimeout(get, 10000);
|
getLoop();
|
||||||
return error("key of receiver not found", true);
|
return error("key of receiver not found", true);
|
||||||
}
|
}
|
||||||
var message = openpgp.message.readArmored(e.msg);
|
var message = openpgp.message.readArmored(e.msg);
|
||||||
@@ -449,7 +465,7 @@ function get() {
|
|||||||
}).fail(function(e) {
|
}).fail(function(e) {
|
||||||
error("offline", true)
|
error("offline", true)
|
||||||
});
|
});
|
||||||
setTimeout(get, 10000); // repeat every 10 seconds
|
getLoop(); // repeat every 10 seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send Message To Server
|
/// Send Message To Server
|
||||||
@@ -535,7 +551,7 @@ function chat() {
|
|||||||
$("#username").html(userid()+"@safechat.ch");
|
$("#username").html(userid()+"@safechat.ch");
|
||||||
$.ajax({url: "chat.html", success: function(res) {
|
$.ajax({url: "chat.html", success: function(res) {
|
||||||
status(res);
|
status(res);
|
||||||
setTimeout(get, 2000);
|
getLoop(2000);
|
||||||
}}).fail(function() {
|
}}).fail(function() {
|
||||||
error("offline")
|
error("offline")
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user