Browse Source

fix safari countdown

master
Carmine De Rosa 7 years ago
parent
commit
eae416b5e2
  1. 17
      device/script.js

17
device/script.js

@ -14,9 +14,18 @@ $(document).ready(()=>{
if(session.enabled){
$.each(session.messages, (index,item)=>{
if(item.timer != session.start){
const now = Date.now() / 1000;
const timer = Date.parse(item.timer) / 1000;
const start = Date.parse(session.start) / 1000;
const now = new Date().getTime();
const timerValue = item.timer.split(' ');
const timerDate = timerValue[0].split('-');
const timerHours = timerValue[1].split(':');
const timer = new Date(timerDate[0], timerDate[1] - 1, timerDate[2], timerHours[0], timerHours[1], timerHours[2]).getTime();
const startValue = session.start.split(' ');
const startDate = startValue[0].split('-');
const startHours = startValue[1].split(':');
const start = new Date(startDate[0], startDate[1] - 1, startDate[2], startHours[0], startHours[1], startHours[2]).getTime();
if(now > timer){
showCloud(item.title, [item.short_text, item.long_text], item.image, item.actions, session.messages);
@ -26,7 +35,7 @@ $(document).ready(()=>{
setTimeout( ()=>{
showCloud(item.title, [item.short_text, item.long_text], item.image, item.actions, session.messages);
notify(true);
},1000*delay);
},delay);
}
}
});

Loading…
Cancel
Save