Commit e7163194 authored by Thierry BUGEAT's avatar Thierry BUGEAT

Keep sync button disabled

parent edc167d8
......@@ -134,6 +134,7 @@
// User is reading a news.
},
"sync": { // Store informations about last synchro
"inProgress": false,
"nbFeedsLoaded": 0, // Used during synchro
"nbFeedsToLoad": 0, // Used during synchro
"nbDaysAgo": -1,
......@@ -1335,6 +1336,7 @@
}
function loadFeeds() {
liveValues.sync.inProgress = true;
liveValues.sync.timestamps.lastUpdate = Math.round(Date.now()/1000);
ui._onclick(sync, 'disable');
......
......@@ -62,6 +62,7 @@ var MyListeners_SimplePie = function() {
}
if (liveValues.sync.nbFeedsLoaded >= liveValues.sync.nbFeedsToLoad) {
liveValues.sync.inProgress = false;
liveValues.sync.nbFeedsToLoad = 0;
liveValues.sync.nbFeedsLoaded = 0;
ui._loading(100); ui.echo("loading", "", "");
......@@ -99,6 +100,7 @@ var MyListeners_SimplePie = function() {
}
if (liveValues.sync.nbFeedsLoaded >= liveValues.sync.nbFeedsToLoad) {
liveValues.sync.inProgress = false;
liveValues.sync.nbFeedsToLoad = 0;
liveValues.sync.nbFeedsLoaded = 0;
ui._loading(100); ui.echo("loading", "", "");
......
......@@ -245,6 +245,7 @@ MyUi.prototype._disable = function() {
/**
* Change opacity of UI elements when network connection change.
* Specific case for "sync" button: If synchro is in progress, "sync" button must remain disabled.
* @param {string} _status "enable", "disable"
*/
MyUi.prototype.toggle = function(_status) {
......@@ -255,7 +256,11 @@ MyUi.prototype.toggle = function(_status) {
var _items = document.querySelectorAll("._online_");
for (var i = 0; i < _items.length; i++) {
_MyUi._onclick(_items[i], _status);
if ((_items[i].id == 'sync') && liveValues.sync.inProgress) {
// Do nothing. Button "sync" must remain disabled.
} else {
_MyUi._onclick(_items[i], _status);
}
}
// Small entries :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment