Compare commits
5 Commits
remote_log
...
error_repo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0298cefc8b | ||
|
|
15d7060354 | ||
|
|
d38de287dd | ||
|
|
da2beac8d3 | ||
|
|
92a11bcfa5 |
@@ -9,10 +9,16 @@
|
|||||||
log('[tpl] Script "custom.js" loaded');
|
log('[tpl] Script "custom.js" loaded');
|
||||||
|
|
||||||
var loaderCount = 2;
|
var loaderCount = 2;
|
||||||
|
var showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
var showLoader = function() {
|
var showLoader = function() {
|
||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').removeClass('preloader-hide');
|
$('#preloader').removeClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
log('[tpl] Loader shown');
|
log('[tpl] Loader shown');
|
||||||
}
|
}
|
||||||
loaderCount ++;
|
loaderCount ++;
|
||||||
@@ -22,6 +28,8 @@ var hideLoader = function() {
|
|||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').addClass('preloader-hide');
|
$('#preloader').addClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
clearTimeout(showConsoleButtonTimeout);
|
||||||
|
$('#button-show-console').hide();
|
||||||
log('[tpl] Loader hidden');
|
log('[tpl] Loader hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,7 +378,7 @@ eraseCookie('sticky_dark_mode');
|
|||||||
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
log('[tpl] init a2h');
|
log('[tpl] init a2h');
|
||||||
|
|
||||||
//Adding added-to-homescreen class to be targeted when used as PWA.
|
//Adding added-to-homescreen class to be targeted when used as PWA.
|
||||||
|
|||||||
@@ -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()));
|
||||||
|
|||||||
@@ -1155,6 +1155,8 @@ var mobileConsole = (function () {
|
|||||||
if (!msgContainer.innerHTML) { return; }
|
if (!msgContainer.innerHTML) { return; }
|
||||||
leftContainer.appendChild(msgContainer);
|
leftContainer.appendChild(msgContainer);
|
||||||
|
|
||||||
|
var errorReportEntry = { message: arguments[1].newMessage };
|
||||||
|
|
||||||
if (detailTable || stackTable) {
|
if (detailTable || stackTable) {
|
||||||
setCSS(msgContainer, {cursor : 'pointer'});
|
setCSS(msgContainer, {cursor : 'pointer'});
|
||||||
leftContainer.appendChild(detailTable || stackTable);
|
leftContainer.appendChild(detailTable || stackTable);
|
||||||
@@ -1164,8 +1166,18 @@ var mobileConsole = (function () {
|
|||||||
//populate right side
|
//populate right side
|
||||||
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
||||||
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
||||||
|
errorReportEntry.stack = { caller: stackTrace[0].caller, file: stackTrace[0].url, line: stackTrace[0].line, col: stackTrace[0].col };
|
||||||
|
if ((typeof LINK_PRE !== 'undefined') && (errorReportEntry.stack.file.startsWith(LINK_PRE))) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = errorReportEntry.stack.file.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(0, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof onConsoleOutput === 'function') onConsoleOutput(errorReportEntry);
|
||||||
|
|
||||||
//add to line
|
//add to line
|
||||||
lineContainer.appendChild(leftContainer);
|
lineContainer.appendChild(leftContainer);
|
||||||
lineContainer.appendChild(rightContainer);
|
lineContainer.appendChild(rightContainer);
|
||||||
|
|||||||
@@ -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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -13,6 +14,31 @@ const YOUTH_AGE = '<?php echo $_CLASS['youth-age']; ?>';
|
|||||||
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
||||||
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
||||||
|
|
||||||
|
var consoleOutput = [];
|
||||||
|
|
||||||
|
function onConsoleOutput(entry) {
|
||||||
|
consoleOutput.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(message, source, lineno, colno, errorError) {
|
||||||
|
if (source.startsWith(LINK_PRE)) {
|
||||||
|
source = source.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = source.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
source = source.substr(0, pos);
|
||||||
|
}
|
||||||
|
consoleOutput.push({
|
||||||
|
message: message,
|
||||||
|
stack: {
|
||||||
|
caller: '',
|
||||||
|
file: source,
|
||||||
|
line: lineno,
|
||||||
|
col: colno
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var hour = now.getHours().toString();
|
var hour = now.getHours().toString();
|
||||||
@@ -471,7 +497,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 +534,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 {
|
||||||
@@ -547,19 +573,39 @@ var addConsoleOpenerToPreloader = function() {
|
|||||||
addConsoleOpenerToPreloader = function(){};
|
addConsoleOpenerToPreloader = function(){};
|
||||||
var preloader = document.getElementById('preloader');
|
var preloader = document.getElementById('preloader');
|
||||||
var button = document.createElement('a');
|
var button = document.createElement('a');
|
||||||
|
button.id = 'button-show-console';
|
||||||
button.href = '#';
|
button.href = '#';
|
||||||
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3';
|
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3 bg-red2-dark bg-white';
|
||||||
button.style.position = 'fixed';
|
button.style.position = 'fixed';
|
||||||
button.style.bottom = 0;
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
button.style.right = 0;
|
button.style.right = 0;
|
||||||
button.innerHTML = '</>';
|
button.innerHTML = 'Fehlerbericht senden';
|
||||||
button.onclick = function(){
|
button.onclick = function(){
|
||||||
alert('CONSOLE OPENED\nDir werden jetzt einige Entwickler-Informationen angezeigt. Du kannst die Console über das X oben rechts wieder schließen.');
|
alert('FEHLERBERICHT\nEs wird jetzt ein Fehlerbericht an die Entwickler geschickt.\nBitte stelle sicher, dass Du mit dem Internet verbunden bist und drücke dann auf OK.');
|
||||||
mobileConsole.displayConsole();
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'error_report',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
errors: consoleOutput,
|
||||||
|
device: navigator.userAgent,
|
||||||
|
version: '<?php echo PWA_VERSION; ?>'
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
alert('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Fehlerbericht zu senden');
|
||||||
|
} else {
|
||||||
|
alert('Beim Senden ist ein unbekannter Fehler aufgetreten. Bitte versuche es noch einmal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
alert('Wir leiten Dich jetzt zum erstellten Fehlerbericht um, sodass Du ggf. weitere Informationen ergänzen kannst.');
|
||||||
|
location.href = 'https://github.com/ostertun/RegattenApp/issues/' + data.issueNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setTimeout(function(){
|
preloader.appendChild(button);
|
||||||
preloader.appendChild(button);
|
$(button).hide();
|
||||||
}, 5000);
|
|
||||||
}
|
}
|
||||||
addConsoleOpenerToPreloader();
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.11h2');
|
define('PWA_VERSION', '1.11h4');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user