summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-06-01 10:54:12 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2016-08-15 20:02:36 +0200
commitdafc010d9139836fcdb2592b557535e505366f4c (patch)
treee74c9bd2c63843d687dc1eda741b1569e51bdfe0
parentffc185a9a367a415ee9bba09e25cefdaebfdd1eb (diff)
downloadwvs-vplan-dafc010d9139836fcdb2592b557535e505366f4c.tar.gz
wvs-vplan-dafc010d9139836fcdb2592b557535e505366f4c.zip
diverse kleine Änderungen; ändere Loginbutton-Text nach Login
-rw-r--r--js/index.js36
1 files changed, 14 insertions, 22 deletions
diff --git a/js/index.js b/js/index.js
index 0a6969f..86f50c7 100644
--- a/js/index.js
+++ b/js/index.js
@@ -74,7 +74,7 @@ function updateCheck(){
loginOk = false;
break;
default:
- $('#versioninfo').text('Diese Appversion wird nicht mehr unterstützt, bitte aktualisiere auf die neueste Version.').show();
+ $('#versioninfo').text('Diese Appversion wird nicht mehr unterstützt, bitte aktualisiere auf die neueste Version aus dem Appstore.').show();
$('#loginsubmit').prop('disabled', true);
loginOk = false;
}
@@ -209,7 +209,7 @@ document.addEventListener('deviceready', function(){
fillForm();
if(navigator.connection.type !== Connection.NONE){ // falls Netz da ist
- updateCheck();
+ updateCheck(); // checkt ob aktuellste Version und loggt ein
}
window.plugin.notification.local.cancelAll(); // alle Benachrichtigungen canceln, werden während des Renderings neu gesetzt
@@ -247,16 +247,15 @@ function fillForm(){
/* benachrichtigt den Benutzer an vdate mit msg */
function addNotification(vdate, msg, $div){
var title = 'Vertretung für ' + vdate.format('dddd');
- vdate = vdate.subtract('days', 1).add('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher
+ var ndate = vdate.subtract('days', 1).add('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher
- if(moment().isBefore(vdate)){
+ if(moment().isBefore(ndate)){
window.plugin.notification.local.add({
- date: vdate.toDate(),
+ date: ndate.toDate(),
message: msg,
title: title,
autoCancel: true,
- json: JSON.stringify({id: $div.attr('id')}),
- //badge: 0 //TODO
+ json: JSON.stringify({id: $div.attr('id')})
});
window.plugin.notification.local.onclick = function(id, state, json){
@@ -264,7 +263,7 @@ function addNotification(vdate, msg, $div){
location.href = '#' + div; // TODO hoffentlich funktioniert das auch immer...
};
- console.log('Benachrichtigung hinzugefügt: ' + vdate.format('DD.MM. HH:mm') + '; ' + msg);
+ console.log('Benachrichtigung hinzugefügt: ' + ndate.format('DD.MM. HH:mm') + '; ' + msg);
}
}
@@ -291,10 +290,10 @@ function addSocialButton(vdate, msg, $div){
btnholder.append(btn);
$div.prepend(btnholder);
- console.log('Teilen-Button hinzugefügt: ' + datestr + msg);
+ console.log('Teilen-Button hinzugefügt: ' + datestr + ' ' + msg);
}else{
sharebtns.first().data('msg', sharebtns.first().data('msg') + ', ' + msg);
- console.log('Zum Teilen-Button hinzugefügt: ' + datestr + msg);
+ console.log('Zum Teilen-Button hinzugefügt: ' + datestr + ' ' + msg);
}
}
}
@@ -489,7 +488,7 @@ function renderPage($div, pdf, pageNumber, callback){
vdate.set('minute', time[1]);
addSocialButton(vdate, vertretungen.join(', '), $div);
- addNotification(vdate, vertretungen.join('\n'), $div); //FIXME addNotification ändert vdate
+ addNotification(vdate, vertretungen.join('\n'), $div);
}
});
@@ -519,7 +518,6 @@ function renderPdf(url, divstr){
function fail(text){
$('#lnklogin').click();
$('#error_general').show('fast');
- console.log('Fehler: ' + text.toString() + ' / ' + text.code);
}
function replaceUmlauts(umlautstr){
@@ -547,7 +545,7 @@ function addPlanAttr(fileEntry, wasdownloaded){
name = vdate.format('DD_MM_YYYY') + replaceUmlauts(results[2]);
if(!$(name).length){
- $('#vplannavbar').find('*').andSelf().each(function(){
+ $('#vplannavbar').find('*').andSelf().each(function(){ // Navbar neuzeichnen; hier hat jQuery Mobile eine Schwäche :(
$(this).removeClass(function(i, cn){
var matches = cn.match(/ui-[\w\-]+/g) || [];
return (matches.join(' '));
@@ -579,7 +577,6 @@ function addPlanAttr(fileEntry, wasdownloaded){
function downloadPdf(link){
var filename = link.substring(link.lastIndexOf("/") + 1);
- // FIXME Downloads beim ersten Start erst nach Schließen der App fertig
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function(fileSystem){
@@ -728,8 +725,6 @@ function getUserData(){
localStorage.setItem('password', password);
}
- console.log('Benutzerdaten geladen');
-
if(username !== null && username.length !== 0 && password !== null && password.length !== 0){
return [username, password];
}else{
@@ -739,16 +734,13 @@ function getUserData(){
/* loggt ein oder zeigt Loginform */
function login(){
- if(navigator.connection.type === Connection.NONE){
- return;
- }
-
- $.mobile.loading('show', {theme: 'a'});
+ $.mobile.loading('show');
userdata = getUserData();
if(userdata){
sendLogin(userdata[0], userdata[1]);
$('#loginpopup').popup('close');
+ $('#lnklogin').text('Aktualisieren');
return 1;
}else{
$('#lnklogin').click();
@@ -788,7 +780,7 @@ function getActual(entries){
/* lädt Vertretungspläne aus dem Speicher [1) SD-Karte oder 2) dem internen Speicher] */
function load(){
- $.mobile.loading('show', {theme: 'a'});
+ $.mobile.loading('show');
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function(fileSystem){