/* * Copyright (C) 2014 * This file is part of WvS VPlan. * * WvS VPlan is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ // Login-Popup beim Start $(document).bind('pageinit', function(){ setTimeout(function(){ fillform(); load(); }, 1000); setTimeout(function(){ trylogin(); }, 2000); }); /* der Loader wird nur angezeigt, wenn das Popup zu ist */ $('#loginpopup').on('popupafteropen', function(){ $.mobile.loading('hide'); }); /* füllt die Loginform mit gespeicherten Werten */ function fillform(){ var username = window.localStorage.getItem('username'); if(username !== 'undefined' && username != null && username != ''){ $('#username').val(username); } var password = window.localStorage.getItem('password'); if(password !== 'undefined' && password != null && password != ''){ $('#password').val(password); } } /* benachrichtigt den Benutzer an vdate mit msg */ var notifications = 0; function addNotification(vdate, msg){ var today = new Date(); vdate.setDate(vdate.getDate() - 1); // Ein Tag vorher, 18 Uhr benachrichtigen var secondsUntilDate = (vdate.getTime() - today.getTime()) / 1000; if(secondsUntilDate > 0){ localNotification.add(++notifications, { seconds: secondsUntilDate, message: msg, badge: 0}); console.log('Benachrichtigung hinzugefügt: ' + vdate.toString() + '; ' + msg); } } /* zeigt einen Button an, mit dem die Vertretung geteilt werden kann */ function addSocialButton(vdate, msg, $div){ var today = new Date(); if(vdate >= today){ var datestr = vdate.getDate() + "." + vdate.getMonth() + "."; var btn = $('