...
  View open merge request
Commits (32)
......@@ -274,18 +274,21 @@
</div></div>
</div>
</div>
<!-- </div> -->
<div id="menu_right_part">
<div id="fps" style="display: none"> </div>
<div id="header_messages" class="message_container header"></div>
<div id='live-ajax'>
<div class="active-container">
<img src="images/ajax-loader.gif" />
<div id='live-ajax' style="display: flex; align-items: center">
<div id='live-ajax-msg'>
</div>
<div id='live-ajax-icon'>
</div>
</div>
<div id="upload_summary" class="menu" onmouseover="showSelector('upload_summary_selector');" onmouseout="hideSelector();">
<span id="upload_summary_label">upload</span>
......@@ -301,6 +304,8 @@
<a id="palette_dark" class="buttonSelector" onclick="changeStyle('solarizeD')">dark</a>
</div></div>
</div>
<div id="help_menu" class="menu" onmouseover="showSelector('helpSelector');"> help
<div id="helpSelector" class="selector"><div>
<a id="help_support" class="buttonSelector getHelp" onclick="report.sendMail()">get support</a>
......@@ -310,7 +315,7 @@
+Need to be registered or create a specific account.">bugtracker</a>
<a class="buttonSelector devel-mode" onclick="my_tips.reset()">reset tips of the day</a>
</div></div>
</div>
</div>
<div class="menu" id="alert"></div>
......
......@@ -220,7 +220,7 @@ Database.prototype = {
setTimeout(function(){ self.waitProcess(processId, interval, callback); }, interval);
}
},
},
error: function (request, status, error) {
self.connected = false;
if (status === "timeout") {
......@@ -1102,18 +1102,42 @@ Database.prototype = {
return args
},
/**
* Show ajax wait with indicator
*/
ajax_indicator_start: function() {
if (!(this.uploader.is_uploading())) {
var tgt = $('#live-ajax');
tgt.empty();
$('<img/>', {src: 'images/ajax-loader.gif'}).appendTo($('<div/>', {class: 'active-container'}).appendTo(tgt));
$('#live-ajax-icon').empty();
$('#live-ajax-msg').empty();
$('body').css('cursor', 'wait');
}
},
/**
* Show ajax wait with spinner
*/
ajax_indicator_long: function() {
if (!(this.uploader.is_uploading())) {
var live_icon = document.getElementById("live-ajax-icon")
$('<img/>', {src: 'images/ajax-loader.gif'}).appendTo(live_icon)
}
},
/**
* Print a message for the user to tell him to wait a little more
* @param {String} message the message to said to wait to the user; optionnal
*/
ajax_indicator_msg: function(message) {
if (!(this.uploader.is_uploading())) {
if (message == undefined) { message = "Waiting the answer of the server"}
var div_msg = document.getElementById("live-ajax-msg")
div_msg.innerHTML = message
}
},
ajax_indicator_stop: function() {
var tgt = $('#live-ajax');
tgt.empty();
$('#live-ajax-icon').empty();
$('#live-ajax-msg').empty();
$('body').css('cursor', 'default');
},
......
......@@ -22,8 +22,11 @@
NOTIFICATION_PERIOD = 300000 // Time interval to check for notifications periodically (ms)
AJAX_TIMEOUT_START = 200
AJAX_TIMEOUT_LONG = 600
AJAX_TIMEOUT_MSG = 8000
var timeout;
var ajaxOn = false;
/* Console (optional)
* Setting here a console replaces the default javascript console with a custom one.
......@@ -152,17 +155,43 @@ if (typeof config !== 'undefined' && typeof config.alert !== 'undefined') {
console.log("=== main.js finished ===");
var timeout;
$(document).ajaxStart(function () {
//show ajax indicator
ajaxOn = true;
// Start process without print, only cursor change
timeout = setTimeout(function(){
db.ajax_indicator_start()
}, 600);
}).ajaxStop(function () {
if (ajaxOn){
db.ajax_indicator_start()
//show ajax indicator (wheel)
setTimeout(function(){
if (ajaxOn){
db.ajax_indicator_long()
setTimeout(function(){
if (ajaxOn) {
//show ajax indicator message
db.ajax_indicator_msg("Still computing content...")
}
}, AJAX_TIMEOUT_MSG);
}
}, AJAX_TIMEOUT_LONG);
}
}, AJAX_TIMEOUT_START);
})
$(document).ajaxStop(function () {
//hide ajax indicator
ajaxOn = false;
db.ajax_indicator_stop();
clearTimeout(timeout);
});
db.ajax_indicator_stop();
// Load regularly notifications
......