infobar: show message every five days
Change-Id: Iedf6aff2f026f4530bfed06cd4bf5e7acae15a50 Signed-off-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
parent
1722c16322
commit
6ebd84831e
1 changed files with 15 additions and 1 deletions
|
@ -16,7 +16,19 @@ L.Map.Infobar = L.Handler.extend({
|
|||
|
||||
if (viewInfo && !this.enabled() && viewInfo.userextrainfo &&
|
||||
viewInfo.userextrainfo.is_admin) {
|
||||
this.enable();
|
||||
var laterDate = new Date();
|
||||
var currentDate = new Date();
|
||||
var timeValue = window.localStorage.getItem('InfoBarLaterDate');
|
||||
if (!timeValue || isNaN(timeValue)) {
|
||||
/* - 5 seconds */
|
||||
laterDate.setTime(currentDate.getTime() - 5000);
|
||||
} else {
|
||||
/* + 5 days (432,000,000 Milliseconds) */
|
||||
laterDate.setTime(timeValue + 432000000);
|
||||
}
|
||||
|
||||
if (currentDate > laterDate)
|
||||
this.enable();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -62,6 +74,8 @@ L.Map.Infobar = L.Handler.extend({
|
|||
var data = e.data;
|
||||
|
||||
if (data === 'updatecheck-show') {
|
||||
var currentDate = new Date();
|
||||
window.localStorage.setItem('InfoBarLaterDate', currentDate.getTime());
|
||||
this._iframeInfobar.show();
|
||||
} else if (data === 'updatecheck-close') {
|
||||
this._map.infobar.disable();
|
||||
|
|
Loading…
Reference in a new issue