Custom log function => log current time
This commit is contained in:
@@ -733,7 +733,7 @@ $(document).ready(function(){
|
|||||||
//Age Verification
|
//Age Verification
|
||||||
var checkAge = $('.check-age');
|
var checkAge = $('.check-age');
|
||||||
function activate_age_checker(){
|
function activate_age_checker(){
|
||||||
console.log('active');
|
log('active');
|
||||||
$(".check-age").on('click',function(){
|
$(".check-age").on('click',function(){
|
||||||
var dateBirghtDay = $("#date-birth-day").val();
|
var dateBirghtDay = $("#date-birth-day").val();
|
||||||
var dateBirthMonth = $("#date-birth-month").val();
|
var dateBirthMonth = $("#date-birth-month").val();
|
||||||
@@ -747,7 +747,7 @@ $(document).ready(function(){
|
|||||||
setDate.setFullYear(mydate.getFullYear() + age, dateBirthMonth-1, dateBirghtDay);
|
setDate.setFullYear(mydate.getFullYear() + age, dateBirthMonth-1, dateBirghtDay);
|
||||||
|
|
||||||
if ((currdate - setDate) > 0){
|
if ((currdate - setDate) > 0){
|
||||||
console.log("above 18");
|
log("above 18");
|
||||||
$('#menu-age').removeClass('menu-active')
|
$('#menu-age').removeClass('menu-active')
|
||||||
$('#menu-age-okay').addClass('menu-active');
|
$('#menu-age-okay').addClass('menu-active');
|
||||||
}else{
|
}else{
|
||||||
@@ -889,11 +889,11 @@ $(document).ready(function(){
|
|||||||
function updateOnlineStatus(event) {
|
function updateOnlineStatus(event) {
|
||||||
var condition = navigator.onLine ? "online" : "offline";
|
var condition = navigator.onLine ? "online" : "offline";
|
||||||
isOnline();
|
isOnline();
|
||||||
console.log( 'Connection: Online');
|
log( 'Connection: Online');
|
||||||
}
|
}
|
||||||
function updateOfflineStatus(event) {
|
function updateOfflineStatus(event) {
|
||||||
isOffline();
|
isOffline();
|
||||||
console.log( 'Connection: Offline');
|
log( 'Connection: Offline');
|
||||||
}
|
}
|
||||||
window.addEventListener('online', updateOnlineStatus);
|
window.addEventListener('online', updateOnlineStatus);
|
||||||
window.addEventListener('offline', updateOfflineStatus);
|
window.addEventListener('offline', updateOfflineStatus);
|
||||||
@@ -908,7 +908,7 @@ $(document).ready(function(){
|
|||||||
$('.generate-qr-auto').attr('src', qr_api_address+qr_auto_link)
|
$('.generate-qr-auto').attr('src', qr_api_address+qr_auto_link)
|
||||||
$('.generate-qr-button').on('click',function(){
|
$('.generate-qr-button').on('click',function(){
|
||||||
if($(this).parent().find('.fa').hasClass('fa-exclamation-triangle')){
|
if($(this).parent().find('.fa').hasClass('fa-exclamation-triangle')){
|
||||||
console.log('Invalid URL');
|
log('Invalid URL');
|
||||||
} else {
|
} else {
|
||||||
var get_qr_url = $('.generate-qr-input').val();
|
var get_qr_url = $('.generate-qr-input').val();
|
||||||
if(!get_qr_url == ''){
|
if(!get_qr_url == ''){
|
||||||
@@ -1238,7 +1238,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
|
|
||||||
//Local Error Message
|
//Local Error Message
|
||||||
if (window.location.protocol === "file:"){$('a').on('mouseover',function(){console.log("You are seeing these errors because your file is on your local computer. For real life simulations please use a Live Server or a Local Server such as AMPPS or WAMPP or simulate a Live Preview using a Code Editor like http://brackets.io (it's 100% free) - PWA functions and AJAX Page Transitions will only work in these scenarios.");});}
|
if (window.location.protocol === "file:"){$('a').on('mouseover',function(){log("You are seeing these errors because your file is on your local computer. For real life simulations please use a Live Server or a Local Server such as AMPPS or WAMPP or simulate a Live Preview using a Code Editor like http://brackets.io (it's 100% free) - PWA functions and AJAX Page Transitions will only work in these scenarios.");});}
|
||||||
|
|
||||||
|
|
||||||
//Style Generator
|
//Style Generator
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ var getJSON = function(url, callback) {
|
|||||||
callback(xhr.status, xhr.response);
|
callback(xhr.status, xhr.response);
|
||||||
};
|
};
|
||||||
xhr.ontimeout = function () {
|
xhr.ontimeout = function () {
|
||||||
console.log("getJSON: timeout");
|
log("getJSON: timeout");
|
||||||
callback(0, null);
|
callback(0, null);
|
||||||
}
|
}
|
||||||
xhr.onerror = function () {
|
xhr.onerror = function () {
|
||||||
console.log("getJSON: error");
|
log("getJSON: error");
|
||||||
callback(0, null);
|
callback(0, null);
|
||||||
}
|
}
|
||||||
if (USER_ID != null) {
|
if (USER_ID != null) {
|
||||||
@@ -76,7 +76,7 @@ function dbGetData(table, id = null) {
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
resolve(data.data);
|
resolve(data.data);
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
fail(strings.error_network, 5000);
|
fail(strings.error_network, 5000);
|
||||||
resolve([]);
|
resolve([]);
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ function dbGetData(table, id = null) {
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
resolve(data.data);
|
resolve(data.data);
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
fail(strings.error_network, 5000);
|
fail(strings.error_network, 5000);
|
||||||
resolve(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ function dbGetDataIndex(table, indexName, value) {
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
resolve(data.data);
|
resolve(data.data);
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
fail(strings.error_network, 5000);
|
fail(strings.error_network, 5000);
|
||||||
resolve([]);
|
resolve([]);
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ function sync() {
|
|||||||
|
|
||||||
syncInProgress = 11;
|
syncInProgress = 11;
|
||||||
var syncOkay = true;
|
var syncOkay = true;
|
||||||
console.log("Sync Start");
|
log("Sync Start");
|
||||||
$('#i-sync').addClass('fa-spin');
|
$('#i-sync').addClass('fa-spin');
|
||||||
|
|
||||||
var interval = window.setInterval(function () {
|
var interval = window.setInterval(function () {
|
||||||
@@ -503,7 +503,7 @@ function sync() {
|
|||||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
osUpdateTimes.put({ table: 'last_sync', time: now });
|
osUpdateTimes.put({ table: 'last_sync', time: now });
|
||||||
}
|
}
|
||||||
console.log("Sync Stop");
|
log("Sync Stop");
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('#i-sync').removeClass('fa-spin');
|
$('#i-sync').removeClass('fa-spin');
|
||||||
}, 500);
|
}, 500);
|
||||||
@@ -523,7 +523,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_clubs?changed-after=' + localTimes['clubs'], function (code, data) {
|
getJSON(QUERY_URL + 'get_clubs?changed-after=' + localTimes['clubs'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('clubs', 'readwrite').objectStore('clubs');
|
var os = db.transaction('clubs', 'readwrite').objectStore('clubs');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -541,7 +541,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_boats?changed-after=' + localTimes['boats'], function (code, data) {
|
getJSON(QUERY_URL + 'get_boats?changed-after=' + localTimes['boats'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('boats', 'readwrite').objectStore('boats');
|
var os = db.transaction('boats', 'readwrite').objectStore('boats');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -573,7 +573,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -587,7 +587,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_sailors?changed-after=' + localTimes['sailors'], function (code, data) {
|
getJSON(QUERY_URL + 'get_sailors?changed-after=' + localTimes['sailors'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('sailors', 'readwrite').objectStore('sailors');
|
var os = db.transaction('sailors', 'readwrite').objectStore('sailors');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -605,7 +605,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -619,7 +619,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_regattas?changed-after=' + localTimes['regattas'], function (code, data) {
|
getJSON(QUERY_URL + 'get_regattas?changed-after=' + localTimes['regattas'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('regattas', 'readwrite').objectStore('regattas');
|
var os = db.transaction('regattas', 'readwrite').objectStore('regattas');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -653,7 +653,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_results?changed-after=' + localTimes['results'], function (code, data) {
|
getJSON(QUERY_URL + 'get_results?changed-after=' + localTimes['results'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('results', 'readwrite').objectStore('results');
|
var os = db.transaction('results', 'readwrite').objectStore('results');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -685,7 +685,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -699,7 +699,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_plannings?changed-after=' + localTimes['plannings'], function (code, data) {
|
getJSON(QUERY_URL + 'get_plannings?changed-after=' + localTimes['plannings'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('plannings', 'readwrite').objectStore('plannings');
|
var os = db.transaction('plannings', 'readwrite').objectStore('plannings');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -717,7 +717,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -732,7 +732,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_trim_boats?changed-after=' + localTimes['trim_boats'], function (code, data) {
|
getJSON(QUERY_URL + 'get_trim_boats?changed-after=' + localTimes['trim_boats'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('trim_boats', 'readwrite').objectStore('trim_boats');
|
var os = db.transaction('trim_boats', 'readwrite').objectStore('trim_boats');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -750,7 +750,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -764,7 +764,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_trim_users?changed-after=' + localTimes['trim_users'], function (code, data) {
|
getJSON(QUERY_URL + 'get_trim_users?changed-after=' + localTimes['trim_users'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('trim_users', 'readwrite').objectStore('trim_users');
|
var os = db.transaction('trim_users', 'readwrite').objectStore('trim_users');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -782,7 +782,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -796,7 +796,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_trim_trims?changed-after=' + localTimes['trim_trims'], function (code, data) {
|
getJSON(QUERY_URL + 'get_trim_trims?changed-after=' + localTimes['trim_trims'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('trim_trims', 'readwrite').objectStore('trim_trims');
|
var os = db.transaction('trim_trims', 'readwrite').objectStore('trim_trims');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -814,7 +814,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_news?changed-after=' + localTimes['news'], function (code, data) {
|
getJSON(QUERY_URL + 'get_news?changed-after=' + localTimes['news'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('news', 'readwrite').objectStore('news');
|
var os = db.transaction('news', 'readwrite').objectStore('news');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -850,7 +850,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -864,7 +864,7 @@ function sync() {
|
|||||||
getJSON(QUERY_URL + 'get_users?changed-after=' + localTimes['users'], function (code, data) {
|
getJSON(QUERY_URL + 'get_users?changed-after=' + localTimes['users'], function (code, data) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
var os = db.transaction('users', 'readwrite').objectStore('users');
|
var os = db.transaction('users', 'readwrite').objectStore('users');
|
||||||
console.log(data);
|
log(data);
|
||||||
data.data.forEach(function (entry) {
|
data.data.forEach(function (entry) {
|
||||||
os.put(entry);
|
os.put(entry);
|
||||||
});
|
});
|
||||||
@@ -882,7 +882,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress --;
|
syncInProgress --;
|
||||||
}
|
}
|
||||||
@@ -892,7 +892,7 @@ function sync() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Something went wrong (HTTP " + code + ")");
|
log("Something went wrong (HTTP " + code + ")");
|
||||||
syncOkay = false;
|
syncOkay = false;
|
||||||
syncInProgress = 0;
|
syncInProgress = 0;
|
||||||
}
|
}
|
||||||
@@ -916,12 +916,12 @@ function initDatabase() {
|
|||||||
if (window.indexedDB) {
|
if (window.indexedDB) {
|
||||||
var request = window.indexedDB.open('regatten_app_db_' + BOATCLASS, DB_VERSION);
|
var request = window.indexedDB.open('regatten_app_db_' + BOATCLASS, DB_VERSION);
|
||||||
request.onerror = function (event) {
|
request.onerror = function (event) {
|
||||||
console.log("Cannot open DB: " + event.target.errorCode);
|
log("Cannot open DB: " + event.target.errorCode);
|
||||||
|
|
||||||
runPageScript();
|
runPageScript();
|
||||||
};
|
};
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
console.log("Database loaded");
|
log("Database loaded");
|
||||||
db = event.target.result;
|
db = event.target.result;
|
||||||
|
|
||||||
db.onversionchange = function (event) {
|
db.onversionchange = function (event) {
|
||||||
@@ -934,7 +934,7 @@ function initDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
db.onerror = function (event) {
|
db.onerror = function (event) {
|
||||||
console.log("DB Error: " + event.target.errorCode);
|
log("DB Error: " + event.target.errorCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
canUseLocalDB = true;
|
canUseLocalDB = true;
|
||||||
@@ -964,10 +964,10 @@ function initDatabase() {
|
|||||||
var oldVersion = event.oldVersion;
|
var oldVersion = event.oldVersion;
|
||||||
var newVersion = event.newVersion;
|
var newVersion = event.newVersion;
|
||||||
|
|
||||||
console.log("Datenbank Version Upgrade von " + oldVersion + " auf " + newVersion);
|
log("Datenbank Version Upgrade von " + oldVersion + " auf " + newVersion);
|
||||||
|
|
||||||
if ((oldVersion < 1) && (newVersion >= 1)) {
|
if ((oldVersion < 1) && (newVersion >= 1)) {
|
||||||
console.log('to version 1');
|
log('to version 1');
|
||||||
var osClubs = db.createObjectStore('clubs', { keyPath: 'id' });
|
var osClubs = db.createObjectStore('clubs', { keyPath: 'id' });
|
||||||
var osBoats = db.createObjectStore('boats', { keyPath: 'id' });
|
var osBoats = db.createObjectStore('boats', { keyPath: 'id' });
|
||||||
var osSailors = db.createObjectStore('sailors', { keyPath: 'id' });
|
var osSailors = db.createObjectStore('sailors', { keyPath: 'id' });
|
||||||
@@ -996,7 +996,7 @@ function initDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((oldVersion < 2) && (newVersion >= 2)) {
|
if ((oldVersion < 2) && (newVersion >= 2)) {
|
||||||
console.log('to version 2');
|
log('to version 2');
|
||||||
var osUsers = db.createObjectStore('users', { keyPath: 'id' });
|
var osUsers = db.createObjectStore('users', { keyPath: 'id' });
|
||||||
osUsers.createIndex('username', 'username', { unique: true });
|
osUsers.createIndex('username', 'username', { unique: true });
|
||||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||||
@@ -1004,25 +1004,25 @@ function initDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((oldVersion < 3) && (newVersion >= 3)) {
|
if ((oldVersion < 3) && (newVersion >= 3)) {
|
||||||
console.log('to version 3');
|
log('to version 3');
|
||||||
var osYears = db.createObjectStore('years', { keyPath: 'year' });
|
var osYears = db.createObjectStore('years', { keyPath: 'year' });
|
||||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||||
osUpdateTimes.put({ table: 'regattas', time: 0 });
|
osUpdateTimes.put({ table: 'regattas', time: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((oldVersion < 4) && (newVersion >= 4)) {
|
if ((oldVersion < 4) && (newVersion >= 4)) {
|
||||||
console.log('to version 4');
|
log('to version 4');
|
||||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||||
osUpdateTimes.add({ table: 'loggedin', status: isLoggedIn() });
|
osUpdateTimes.add({ table: 'loggedin', status: isLoggedIn() });
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((oldVersion < 5) && (newVersion >= 5)) {
|
if ((oldVersion < 5) && (newVersion >= 5)) {
|
||||||
console.log('to version 5');
|
log('to version 5');
|
||||||
var osPushes = db.createObjectStore('settings', { keyPath: 'key' });
|
var osPushes = db.createObjectStore('settings', { keyPath: 'key' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((oldVersion < 6) && (newVersion >= 6)) {
|
if ((oldVersion < 6) && (newVersion >= 6)) {
|
||||||
console.log('to version 6');
|
log('to version 6');
|
||||||
var osNews = db.createObjectStore('news', { keyPath: 'id' });
|
var osNews = db.createObjectStore('news', { keyPath: 'id' });
|
||||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||||
osUpdateTimes.add({ table: 'news', time: 0 });
|
osUpdateTimes.add({ table: 'news', time: 0 });
|
||||||
@@ -1052,7 +1052,7 @@ function resetDb() {
|
|||||||
osUpdateTimes.put({ table: 'trim_trims', time: 0 });
|
osUpdateTimes.put({ table: 'trim_trims', time: 0 });
|
||||||
osUpdateTimes.put({ table: 'news', time: 0 });
|
osUpdateTimes.put({ table: 'news', time: 0 });
|
||||||
osUpdateTimes.put({ table: 'users', time: 0 });
|
osUpdateTimes.put({ table: 'users', time: 0 });
|
||||||
console.log('DB update times reset');
|
log('DB update times reset');
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ var mobileConsole = (function () {
|
|||||||
function isRepeat(message, method) {
|
function isRepeat(message, method) {
|
||||||
return (history.output.prevMsg === message && history.output.prevMethod === method) && (typeof message !== 'object') && (method !== 'trace') && (method !== 'group') && (method !== 'groupCollapsed') && (method !== 'groupEnd');
|
return (history.output.prevMsg === message && history.output.prevMethod === method) && (typeof message !== 'object') && (method !== 'trace') && (method !== 'group') && (method !== 'groupCollapsed') && (method !== 'groupEnd');
|
||||||
}
|
}
|
||||||
function newConsole() {
|
function newConsole2() {
|
||||||
try {
|
try {
|
||||||
//get arguments, set vars
|
//get arguments, set vars
|
||||||
var method = arguments[0], className, isHTMLElement,
|
var method = arguments[0], className, isHTMLElement,
|
||||||
@@ -1195,11 +1195,7 @@ var mobileConsole = (function () {
|
|||||||
}
|
}
|
||||||
//scroll
|
//scroll
|
||||||
consoleElement.toggleScroll();
|
consoleElement.toggleScroll();
|
||||||
//==========================================================
|
|
||||||
//make sure we still call the original method, if applicable (not window.onerror)
|
|
||||||
if (typeof arguments[1].original === 'function') {
|
|
||||||
arguments[1].original.apply(console, arguments[1].originalArguments);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//not logging. why? throw error
|
//not logging. why? throw error
|
||||||
if (options.browserinfo.isMobile) { alert(e); }
|
if (options.browserinfo.isMobile) { alert(e); }
|
||||||
@@ -1211,6 +1207,37 @@ var mobileConsole = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function newConsole() {
|
||||||
|
if (typeof arguments[1].newMessage === 'object') {
|
||||||
|
var args = arguments[1].newMessage.slice();
|
||||||
|
var argString = [];
|
||||||
|
for (var i in args) {
|
||||||
|
if (typeof args[i] === 'object') {
|
||||||
|
if (argString.length > 0) {
|
||||||
|
arguments[1].newMessage = argString.join(' ');
|
||||||
|
newConsole2(...arguments);
|
||||||
|
argString = [];
|
||||||
|
}
|
||||||
|
arguments[1].newMessage = args[i];
|
||||||
|
newConsole2(...arguments);
|
||||||
|
} else {
|
||||||
|
argString.push(args[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (argString.length > 0) {
|
||||||
|
arguments[1].newMessage = argString.join(' ');
|
||||||
|
newConsole2(...arguments);
|
||||||
|
argString = [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newConsole2(...arguments);
|
||||||
|
}
|
||||||
|
//==========================================================
|
||||||
|
//make sure we still call the original method, if applicable (not window.onerror)
|
||||||
|
if (typeof arguments[1].original === 'function') {
|
||||||
|
arguments[1].original.apply(console, arguments[1].originalArguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
function interceptConsole(method) {
|
function interceptConsole(method) {
|
||||||
var original = console ? console[method] : missingMethod(), i, stackTraceOrig;
|
var original = console ? console[method] : missingMethod(), i, stackTraceOrig;
|
||||||
if (!console) { console = {}; } //create empty console if we have no console (IE?)
|
if (!console) { console = {}; } //create empty console if we have no console (IE?)
|
||||||
@@ -1218,7 +1245,7 @@ var mobileConsole = (function () {
|
|||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
args.original = original;
|
args.original = original;
|
||||||
args.originalArguments = arguments;
|
args.originalArguments = arguments;
|
||||||
args.newMessage = (method === 'assert') ? [args[0], args[1]] : args[0];
|
//args.newMessage = (method === 'assert') ? [args[0], args[1]] : args[0];
|
||||||
//create an Error and get its stack trace and format it
|
//create an Error and get its stack trace and format it
|
||||||
try { throw new Error(); } catch (e) { stackTraceOrig = e.stack; }
|
try { throw new Error(); } catch (e) { stackTraceOrig = e.stack; }
|
||||||
args.newStackTrace = formatStackTrace(args.newStackTrace, stackTraceOrig);
|
args.newStackTrace = formatStackTrace(args.newStackTrace, stackTraceOrig);
|
||||||
@@ -1241,6 +1268,12 @@ var mobileConsole = (function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Handle the new console logging
|
//Handle the new console logging
|
||||||
|
args.newMessage = [];
|
||||||
|
var i = 0;
|
||||||
|
while (typeof args[i] !== 'undefined') {
|
||||||
|
args.newMessage.push(args[i]);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
newConsole(method, args);
|
newConsole(method, args);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ $(document).ready(function(){
|
|||||||
//Enabling dismiss button
|
//Enabling dismiss button
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.pwa-dismiss').on('click',function(){
|
$('.pwa-dismiss').on('click',function(){
|
||||||
console.log('User Closed Add to Home / PWA Prompt')
|
log('User Closed Add to Home / PWA Prompt')
|
||||||
createCookie('Sticky_pwa_rejected_install', true, 1);
|
createCookie('Sticky_pwa_rejected_install', true, 1);
|
||||||
$('body').find('#menu-install-pwa-android, #menu-install-pwa-ios, .menu-hider').removeClass('menu-active');
|
$('body').find('#menu-install-pwa-android, #menu-install-pwa-ios, .menu-hider').removeClass('menu-active');
|
||||||
});
|
});
|
||||||
@@ -52,18 +52,16 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
//Firing PWA prompts for specific versions and when not on home screen.
|
//Firing PWA prompts for specific versions and when not on home screen.
|
||||||
if (isMobile.Android()) {
|
if (isMobile.Android()) {
|
||||||
console.log('Android Detected');
|
log('Android Detected');
|
||||||
function showInstallPromotion(){
|
function showInstallPromotion(){
|
||||||
if($('#menu-install-pwa-android, .add-to-home').length){
|
if($('#menu-install-pwa-android, .add-to-home').length){
|
||||||
console.log('Triggering PWA Menu for Android');
|
log('Triggering PWA Menu for Android');
|
||||||
if (!readCookie('Sticky_pwa_rejected_install')) {
|
if (!readCookie('Sticky_pwa_rejected_install')) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.add-to-home').addClass('add-to-home-visible add-to-home-android');
|
$('.add-to-home').addClass('add-to-home-visible add-to-home-android');
|
||||||
$('#menu-install-pwa-android, .menu-hider').addClass('menu-active')
|
$('#menu-install-pwa-android, .menu-hider').addClass('menu-active')
|
||||||
},3000);
|
},3000);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log('The div #menu-install-pwa-android was not found. Please add this div to show the install window')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let deferredPrompt;
|
let deferredPrompt;
|
||||||
@@ -82,9 +80,9 @@ $(document).ready(function(){
|
|||||||
deferredPrompt.userChoice
|
deferredPrompt.userChoice
|
||||||
.then((choiceResult) => {
|
.then((choiceResult) => {
|
||||||
if (choiceResult.outcome === 'accepted') {
|
if (choiceResult.outcome === 'accepted') {
|
||||||
console.log('User accepted the A2HS prompt');
|
log('User accepted the A2HS prompt');
|
||||||
} else {
|
} else {
|
||||||
console.log('User dismissed the A2HS prompt');
|
log('User dismissed the A2HS prompt');
|
||||||
}
|
}
|
||||||
deferredPrompt = null;
|
deferredPrompt = null;
|
||||||
});
|
});
|
||||||
@@ -96,11 +94,11 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
if (isMobile.iOS()) {
|
if (isMobile.iOS()) {
|
||||||
if(!isInWebAppiOS){
|
if(!isInWebAppiOS){
|
||||||
console.log('iOS Detected');
|
log('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() {
|
function triggerPwaInstallIos() {
|
||||||
console.log('Triggering PWA / Add to Home Screen Menu for iOS');
|
log('Triggering PWA / Add to Home Screen Menu for iOS');
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.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');
|
||||||
@@ -113,8 +111,6 @@ $(document).ready(function(){
|
|||||||
triggerPwaInstallIos();
|
triggerPwaInstallIos();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
console.log('The div #menu-install-pwa-ios was not found. Please add this div to show the install window')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +134,7 @@ $(document).ready(function(){
|
|||||||
var counter = 3;
|
var counter = 3;
|
||||||
var interval = setInterval(function() {
|
var interval = setInterval(function() {
|
||||||
counter--;
|
counter--;
|
||||||
console.log(counter);
|
log(counter);
|
||||||
$('.page-update').html('Aktuallisierung in ... '+ counter + ' Sekunden');
|
$('.page-update').html('Aktuallisierung in ... '+ counter + ' Sekunden');
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
@@ -146,7 +142,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
caches.delete('workbox-runtime').then(function() {
|
caches.delete('workbox-runtime').then(function() {
|
||||||
console.log('Content Updated - Cache Removed!');
|
log('Content Updated - Cache Removed!');
|
||||||
});
|
});
|
||||||
//localStorage.clear();
|
//localStorage.clear();
|
||||||
sessionStorage.clear()
|
sessionStorage.clear()
|
||||||
@@ -171,7 +167,7 @@ $(document).ready(function(){
|
|||||||
//console.log(' Checking PWA Content for updates...\n PWA Server Version: ' + onlineVersionNumber + '\n' + ' PWA Cached Version: ' + localVersionNumber);
|
//console.log(' Checking PWA Content for updates...\n PWA Server Version: ' + onlineVersionNumber + '\n' + ' PWA Cached Version: ' + localVersionNumber);
|
||||||
if(onlineVersionNumber != localVersionNumber && onlineVersionNumber != "Connection Offline. Waiting to Reconect"){
|
if(onlineVersionNumber != localVersionNumber && onlineVersionNumber != "Connection Offline. Waiting to Reconect"){
|
||||||
updateModal();
|
updateModal();
|
||||||
console.log('New Version of Content Available. Refreshing. On Desktop Browsers a manual refresh maybe required.')
|
log('New Version of Content Available. Refreshing. On Desktop Browsers a manual refresh maybe required.')
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('body').find('#menu-update').addClass('menu-active');
|
$('body').find('#menu-update').addClass('menu-active');
|
||||||
$('.menu-hider').addClass('menu-active-no-click');
|
$('.menu-hider').addClass('menu-active-no-click');
|
||||||
@@ -246,13 +242,13 @@ $(document).ready(function(){
|
|||||||
function updateOnlineStatus(event) {
|
function updateOnlineStatus(event) {
|
||||||
var condition = navigator.onLine ? "online" : "offline";
|
var condition = navigator.onLine ? "online" : "offline";
|
||||||
isOnline();
|
isOnline();
|
||||||
console.log( 'Connection: Online');
|
log( 'Connection: Online');
|
||||||
$("a").off( "click", returnFalse );
|
$("a").off( "click", returnFalse );
|
||||||
}
|
}
|
||||||
function updateOfflineStatus(event) {
|
function updateOfflineStatus(event) {
|
||||||
isOffline();
|
isOffline();
|
||||||
$("a").on( "click", returnFalse );
|
$("a").on( "click", returnFalse );
|
||||||
console.log( 'Connection: Offline');
|
log( 'Connection: Offline');
|
||||||
}
|
}
|
||||||
window.addEventListener('online', updateOnlineStatus);
|
window.addEventListener('online', updateOnlineStatus);
|
||||||
window.addEventListener('offline', updateOfflineStatus);
|
window.addEventListener('offline', updateOfflineStatus);
|
||||||
|
|||||||
@@ -13,6 +13,19 @@ 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; ?>';
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
var now = new Date();
|
||||||
|
var hour = now.getHours().toString();
|
||||||
|
var min = now.getMinutes().toString();
|
||||||
|
var sec = now.getSeconds().toString();
|
||||||
|
var millis = now.getMilliseconds().toString();
|
||||||
|
hour = (hour.length < 2 ? '0' + hour : hour);
|
||||||
|
min = (min.length < 2 ? '0' + min : min);
|
||||||
|
sec = (sec.length < 2 ? '0' + sec : sec);
|
||||||
|
while (millis.length < 3) millis = '0' + millis;
|
||||||
|
console.log('[' + hour + ':' + min + ':' + sec + '.' + millis + ']', ...arguments);
|
||||||
|
}
|
||||||
|
|
||||||
var randomId = function() { return '_' + Math.random().toString(36).substr(2, 9); }
|
var randomId = function() { return '_' + Math.random().toString(36).substr(2, 9); }
|
||||||
|
|
||||||
var badges = {
|
var badges = {
|
||||||
@@ -140,8 +153,8 @@ var login = function() {
|
|||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||||
$('#menu-login').hideMenu();
|
$('#menu-login').hideMenu();
|
||||||
} else {
|
} else {
|
||||||
console.log('Login: unbekannter Fehler', status, error);
|
log('Login: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
@@ -173,7 +186,7 @@ var logout = function() {
|
|||||||
hash: localStorage.getItem('auth_hash')
|
hash: localStorage.getItem('auth_hash')
|
||||||
}
|
}
|
||||||
if ((auth.id === null) || (auth.hash === null)) {
|
if ((auth.id === null) || (auth.hash === null)) {
|
||||||
console.log('Not logged in');
|
log('Not logged in');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -185,14 +198,14 @@ var logout = function() {
|
|||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
if (xhr.status == 401) {
|
if (xhr.status == 401) {
|
||||||
console.log('Not logged in');
|
log('Not logged in');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
} else if (xhr.status == 0) {
|
} else if (xhr.status == 0) {
|
||||||
console.log('Could not delete auth from server');
|
log('Could not delete auth from server');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
} else {
|
} else {
|
||||||
console.log('Logout: unbekannter Fehler', status, error);
|
log('Logout: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -209,12 +222,12 @@ function deleteDb() {
|
|||||||
showLoader();
|
showLoader();
|
||||||
var request = window.indexedDB.deleteDatabase('regatten_app_db_' + BOATCLASS);
|
var request = window.indexedDB.deleteDatabase('regatten_app_db_' + BOATCLASS);
|
||||||
request.onerror = function (event) {
|
request.onerror = function (event) {
|
||||||
console.log('Cannot delete DB: ', event.target.errorCode);
|
log('Cannot delete DB: ', event.target.errorCode);
|
||||||
toastError('Beim Löschen der Datenbank ist ein Fehler aufgetreten.<br>Bitte melde diesen Fehler. (Dev-Menu => Problem melden)', 5000);
|
toastError('Beim Löschen der Datenbank ist ein Fehler aufgetreten.<br>Bitte melde diesen Fehler. (Dev-Menu => Problem melden)', 5000);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
console.log('DB deleted');
|
log('DB deleted');
|
||||||
toastInfo('Die Datenbank wurde gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit eine neue Datenbank.', 10000);
|
toastInfo('Die Datenbank wurde gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit eine neue Datenbank.', 10000);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
setTimeout(function(){ location.reload(); }, 3000);
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
@@ -228,13 +241,13 @@ function deleteCache() {
|
|||||||
$('#menu-developer').hideMenu();
|
$('#menu-developer').hideMenu();
|
||||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
console.log('Unregister sW:', registration);
|
log('Unregister sW:', registration);
|
||||||
registration.unregister();
|
registration.unregister();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
caches.keys().then((keyList) => {
|
caches.keys().then((keyList) => {
|
||||||
return Promise.all(keyList.map((key) => {
|
return Promise.all(keyList.map((key) => {
|
||||||
console.log('Cache deleted:', key);
|
log('Cache deleted:', key);
|
||||||
return caches.delete(key);
|
return caches.delete(key);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -260,7 +273,7 @@ function urlB64ToUint8Array(base64String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushesSubscribe() {
|
function pushesSubscribe() {
|
||||||
console.log('Subscribing');
|
log('Subscribing');
|
||||||
const applicationServerKey = urlB64ToUint8Array(PUSH_SERVER_KEY);
|
const applicationServerKey = urlB64ToUint8Array(PUSH_SERVER_KEY);
|
||||||
swRegistration.pushManager.subscribe({
|
swRegistration.pushManager.subscribe({
|
||||||
userVisibleOnly: true,
|
userVisibleOnly: true,
|
||||||
@@ -272,14 +285,14 @@ function pushesSubscribe() {
|
|||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
console.log('Failed to subscribe the user: ', err);
|
log('Failed to subscribe the user: ', err);
|
||||||
toastError('Da ist leider etwas schief gelaufen. Bitte stelle sicher, dass Du mit dem Internet verbunden bist und versuche es erneut.', 5000);
|
toastError('Da ist leider etwas schief gelaufen. Bitte stelle sicher, dass Du mit dem Internet verbunden bist und versuche es erneut.', 5000);
|
||||||
pushesUnSubscribe(true);
|
pushesUnSubscribe(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushesUnSubscribe(silent = false) {
|
function pushesUnSubscribe(silent = false) {
|
||||||
console.log('Unsubscribing');
|
log('Unsubscribing');
|
||||||
swRegistration.pushManager.getSubscription()
|
swRegistration.pushManager.getSubscription()
|
||||||
.then(function(subscription) {
|
.then(function(subscription) {
|
||||||
if (subscription) {
|
if (subscription) {
|
||||||
@@ -291,7 +304,7 @@ function pushesUnSubscribe(silent = false) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
console.log('Error unsubscribing', error);
|
log('Error unsubscribing', error);
|
||||||
$('#menu-pushes').hideMenu();
|
$('#menu-pushes').hideMenu();
|
||||||
if (!silent) toastError('Da ist leider etwas schief gelaufen. Bitte versuche es erneut oder wende Dich an unseren Support.', 5000);
|
if (!silent) toastError('Da ist leider etwas schief gelaufen. Bitte versuche es erneut oder wende Dich an unseren Support.', 5000);
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
@@ -300,7 +313,7 @@ function pushesUnSubscribe(silent = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushesUpdateServerSubscription(subscription, enabled) {
|
function pushesUpdateServerSubscription(subscription, enabled) {
|
||||||
console.log('updateServer', enabled, subscription);
|
log('updateServer', enabled, subscription);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
|
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ async function onEditBoatnameClick() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Bootsnamen zu bearbeiten');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Bootsnamen zu bearbeiten');
|
||||||
} else {
|
} else {
|
||||||
console.log('EditBoatname: unbekannter Fehler', status, error);
|
log('EditBoatname: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ function sendMessage() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um eine Nachricht zu versenden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um eine Nachricht zu versenden');
|
||||||
} else {
|
} else {
|
||||||
console.log('Contact: unbekannter Fehler', status, error);
|
log('Contact: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ async function onEditYearClick() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Jahrgang zu bearbeiten');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Jahrgang zu bearbeiten');
|
||||||
} else {
|
} else {
|
||||||
console.log('EditYear: unbekannter Fehler', status, error);
|
log('EditYear: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|||||||
Reference in New Issue
Block a user