summaryrefslogtreecommitdiff
path: root/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/index.js')
-rw-r--r--js/index.js51
1 files changed, 48 insertions, 3 deletions
diff --git a/js/index.js b/js/index.js
index 62820a8..9cfaa40 100644
--- a/js/index.js
+++ b/js/index.js
@@ -16,6 +16,47 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+version = '0.9_beta';
+
+function updateCheck(){
+ var request = $.ajax({
+ url: 'http://klimaag.***REMOVED***/app/www/knockout.html'
+ });
+
+ request.done(function(resultHtml){
+ var appStatus = $('li[id="' + version + '"]', resultHtml).text().trim();
+ var loginOk = true;
+
+ console.log('Appstatus: ' + appStatus);
+
+ switch(appStatus){
+ case 'ok':
+ break;
+ case 'info':
+ $('#versioninfo').text('Ein Update ist verfügbar.').show();
+ break;
+ case 'warn':
+ $('#versioninfo').text('Ein wichtiges Update ist verfügbar.').show();
+ break;
+ case 'force':
+ $('#versioninfo').text('Ein wichtiges Update ist verfügbar. Du musst es installieren, um dich weiterhin einloggen zu können.').show();
+ $('#loginsubmit').prop('disabled', true);
+ loginOk = false;
+ break;
+ default:
+ $('#versioninfo').text('Diese Appversion wird nicht mehr unterstützt, bitte aktualisiere auf die neueste Version.').show();
+ $('#loginsubmit').prop('disabled', true);
+ loginOk = false;
+ }
+
+ if(loginOk == true){
+ tryLogin(); // nur wenn alles in Ordnung ist, einloggen lassen
+ }
+ });
+
+ request.fail(fail);
+}
+
function setDNT(dntrack){
dntrack = dntrack.toString();
@@ -62,6 +103,9 @@ document.addEventListener('online', function online(){
var _paq = _paq || [];
$('#mainpage').on('pagebeforeshow', function(){
+ /* Versionsnummer zeigen */
+ $('.version').text(version);
+
/* Sprache setzen */
moment.lang('de');
@@ -106,6 +150,7 @@ document.addEventListener('deviceready', function(){
/* los geht's */
_paq.push(['setCustomVariable', 1, 'Modell', device.model, 'visit']);
_paq.push(['setCustomVariable', 2, 'Version', device.version, 'visit']);
+ _paq.push(['setCustomVariable', 3, 'Appversion', version, 'visit']);
track('event/load');
var dntrack = localStorage.getItem('dntrack');
@@ -116,9 +161,9 @@ document.addEventListener('deviceready', function(){
}, 2000);
}else{
fillForm();
+ updateCheck();
window.plugin.notification.local.cancelAll(); // alle Benachrichtigungen canceln, werden während des Renderings neu gesetzt
load();
- tryLogin();
}
}, false);
@@ -129,9 +174,9 @@ $('#loginpopup').on('popupafteropen', function(){
$('#disclaimerpopup').on('popupafterclose', function(){
fillForm();
+ updateCheck();
window.plugin.notification.local.cancelAll();
load();
- tryLogin();
});
/* füllt die Loginform mit gespeicherten Werten */
@@ -187,7 +232,7 @@ function addSocialButton(vdate, msg, $div){
track('event/share');
})
- .addClass('ui-btn ui-corner-all ui-btn-inline');
+ .addClass('ui-btn ui-corner-all ui-btn-inline ui-btn-icon-left ui-icon-share-square-o');
$div.prepend(btn);