diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-12 14:38:26 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-12 14:38:31 +0000 |
commit | d19497f5ff6150c3512b9103f418dc9965431a20 (patch) | |
tree | ad99616b5bbb963246a04cae830baf4e5c67bc0a /web | |
parent | e2dc6536689b43f807302748aa6d65122a1e26f7 (diff) |
Remove offline banner when no longer necessary.
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/offline.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/web/cobrands/fixmystreet/offline.js b/web/cobrands/fixmystreet/offline.js index 177e54e4d..c98d76210 100644 --- a/web/cobrands/fixmystreet/offline.js +++ b/web/cobrands/fixmystreet/offline.js @@ -15,6 +15,10 @@ fixmystreet.offlineBanner = (function() { return 'You are offline \u2013 <span>' + formText() + '</span> saved.'; } + function remove() { + $('.top_banner--offline').slideUp(); + } + return { make: function(offline) { var num = fixmystreet.offlineData.getForms().length; @@ -75,6 +79,10 @@ fixmystreet.offlineBanner = (function() { update: function() { $('.top_banner--offline').slideDown(); $('#offline_forms span').text(formText()); + var num = fixmystreet.offlineData.getForms().length; + if (num === 0) { + window.setTimeout(remove, 3000); + } }, startProgress: function(l) { $('.top_banner--offline').slideDown(); @@ -85,6 +93,7 @@ fixmystreet.offlineBanner = (function() { cachedSoFar += 1; if (cachedSoFar === toCache) { $('#offline_saving').text('Reports saved offline.'); + window.setTimeout(remove, 3000); } else { $('#offline_saving span').text(cachedSoFar); } |