Compare commits

...

3 Commits

Author SHA1 Message Date
ostertun
d38de287dd Merge branch 'hotfix/ios_problems' 2020-10-21 16:27:02 +02:00
ostertun
da2beac8d3 hotfix 2020-10-21 16:26:40 +02:00
ostertun
92a11bcfa5 gitflow-hotfix-stash: ios_problems 2020-10-21 16:26:02 +02:00
5 changed files with 25 additions and 15 deletions

View File

@@ -38,6 +38,16 @@ function parseDate(string) {
return date; return date;
} }
function parseDbTimestamp(string) {
var year = string.substr(0, 4);
var month = string.substr(5, 2);
var day = string.substr(8, 2);
var hour = string.substr(11, 2);
var minute = string.substr(14, 2);
var second = string.substr(17, 2);
return new Date(year, month - 1, day, hour, minute, second);
}
function getToday() { function getToday() {
var date = new Date(); var date = new Date();
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));

View File

@@ -95,19 +95,19 @@ $(document).ready(function(){
log('[pwa] iOS Detected'); log('[pwa] iOS Detected');
if($('#menu-install-pwa-ios, .add-to-home').length){ if($('#menu-install-pwa-ios, .add-to-home').length){
if (!readCookie('Sticky_pwa_rejected_install')) { if (!readCookie('Sticky_pwa_rejected_install')) {
function triggerPwaInstallIos() { setTimeout(function(){
log('[pwa] Triggering PWA / Add to Home Screen Menu for iOS'); function triggerPwaInstallIos() {
setTimeout(function(){ log('[pwa] Triggering PWA / Add to Home Screen Menu for iOS');
$('.add-to-home').addClass('add-to-home-visible add-to-home-ios'); $('.add-to-home').addClass('add-to-home-visible add-to-home-ios');
$('#menu-install-pwa-ios, .menu-hider').addClass('menu-active'); $('#menu-install-pwa-ios, .menu-hider').addClass('menu-active');
},3000); }
} var welcomActive = $('#menu-welcome').hasClass('menu-active');
var welcomActive = $('#menu-welcome').hasClass('menu-active'); if (welcomActive) {
if (welcomActive) { $('#menu-welcome-a-okay').click(triggerPwaInstallIos);
$('#menu-welcome-a-okay').click(triggerPwaInstallIos); } else {
} else { triggerPwaInstallIos();
triggerPwaInstallIos(); }
} },3000);
}; };
} }
} }

View File

@@ -471,7 +471,7 @@ async function updateNewsBadge() {
var sum = 0; var sum = 0;
for (var n in news) { for (var n in news) {
var newsEntry = news[n]; var newsEntry = news[n];
newsEntry.date = new Date(Date.parse(newsEntry.date)); newsEntry.date = parseDbTimestamp(newsEntry.date);
if (newsEntry.date > now) continue; if (newsEntry.date > now) continue;
if (newsEntry.date < newsRead) continue; if (newsEntry.date < newsRead) continue;
sum ++; sum ++;
@@ -508,7 +508,7 @@ var initRegatten = function() {
var onServiceWorkerLoaded = function() { var onServiceWorkerLoaded = function() {
log('[app] sW loaded'); log('[app] sW loaded');
if ((swRegistration !== null) && canUseLocalDB) { if ((swRegistration !== null) && (swRegistration.pushManager) && canUseLocalDB) {
pushesPossible = true; pushesPossible = true;
updatePushBadge(); updatePushBadge();
} else { } else {

View File

@@ -66,7 +66,7 @@ var siteScript = async function() {
lastYear.setFullYear(lastYear.getFullYear() - 1); lastYear.setFullYear(lastYear.getFullYear() - 1);
for (var n in news) { for (var n in news) {
var newsEntry = news[n]; var newsEntry = news[n];
newsEntry.date = new Date(Date.parse(newsEntry.date)); newsEntry.date = parseDbTimestamp(newsEntry.date);
if (newsEntry.date > now) continue; if (newsEntry.date > now) continue;
if (newsEntry.date < lastYear) break; if (newsEntry.date < lastYear) break;
newsEntry.unread = (newsEntry.date > newsRead); newsEntry.unread = (newsEntry.date > newsRead);

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PWA_VERSION', '1.11h2'); define('PWA_VERSION', '1.11h3');
?> ?>