summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/index.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/js/index.js b/js/index.js
index 3e9e1b5..a22e96b 100644
--- a/js/index.js
+++ b/js/index.js
@@ -103,6 +103,7 @@ $('#settingspanel').change(function(){
localStorage.setItem('dntrack', $('#dntflip').val());
localStorage.setItem('classes', $('#addclass').val().toUpperCase());
localStorage.setItem('notifyday', $('#notifydayflip').val());
+ localStorage.setItem('notifynull', $('#notifynullflip').val());
localStorage.setItem('notifydate', $('#notifydate').val());
localStorage.setItem('apptheme', $('#themeselect').val());
});
@@ -139,6 +140,7 @@ $('#mainpage').on('pagebeforeshow', function(){
var dntrack = localStorage.getItem('dntrack');
var additionalClasses = localStorage.getItem('classes');
var notifyDay = localStorage.getItem('notifyday');
+ var notifyNull = localStorage.getItem('notifynull');
var notifyDate = localStorage.getItem('notifydate');
var premium = localStorage.getItem('premium');
var easteregg = localStorage.getItem('easteregg');
@@ -159,6 +161,11 @@ $('#mainpage').on('pagebeforeshow', function(){
}
$('#notifydayflip').val(notifyDay).slider('refresh');
+ if(notifyNull === null || notifyNull.length === 0){
+ notifyNull = 0;
+ }
+ $('#notifynullflip').val(notifyNull).slider('refresh');
+
if(notifyDate === null || notifyDate.length === 0){
notifyDate = '18:00';
}
@@ -234,7 +241,7 @@ function fillForm(){
/* benachrichtigt den Benutzer an vdate mit msg */
function addNotification(vdate, msg, $div){
- var title = 'Vertretung für ' + vdate.format('dddd');
+ var title = 'Vertretungen für ' + vdate.format('dddd');
var ndate = vdate.subtract('days', 1).add('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher
if(moment().isBefore(ndate)){
@@ -547,15 +554,19 @@ function benutzeVertretungen(pageText, $div){
var username = userdata[0];
var vertretungen = parseVertretungen(pageText, username);
- if(vertretungen.length > 0){
- var vdate = moment($div.data('date'), 'YYYY-MM-DD').startOf('second');
- var time = $('#notifydate').val().split(':');
+ var vdate = moment($div.data('date'), 'YYYY-MM-DD').startOf('second');
+ var time = $('#notifydate').val().split(':');
- vdate.set('hour', time[0]);
- vdate.set('minute', time[1]);
+ vdate.set('hour', time[0]);
+ vdate.set('minute', time[1]);
+ if(vertretungen.length > 0){
addSocialButton(vdate, vertretungen.join(', '), $div);
addNotification(vdate, vertretungen.join('\n'), $div);
+ }else{
+ if($('#notifynullflip').val() == 'true'){
+ addNotification(vdate, 'Keine weiteren Vertretungen', $div); // TODO FIXME Problem bei mehreren Seiten!
+ }
}
}