Individualisations

This commit is contained in:
Timon Ostertun
2020-09-21 21:06:16 +02:00
parent 7e8d863e26
commit 62cb4408cf
21 changed files with 1810 additions and 1632 deletions

File diff suppressed because it is too large Load Diff

1397
client/scripts/custom.js.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,14 @@
<?php
header('Content-Type: text/javascript');
require_once(__DIR__ . '/../../server/config.php');
?>
//Loading the Service Worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('_service-worker.js', {scope: ''});
// TODO navigator.serviceWorker.register('_service-worker.js', {scope: ''});
});
}
@@ -9,7 +16,7 @@ if ('serviceWorker' in navigator) {
$(document).ready(function(){
'use strict'
var pwaVersion = '3.0'; //must be identical to _manifest.json version. If not it will create update window loop
var pwaVersion = '<?php echo PWA_VERSION; ?>'; //must be identical to _manifest.json version. If not it will create update window loop
var pwaCookie = true; // if set to false, the PWA prompt will appear even if the user selects "maybe later"
var pwaNoCache = true; // always keep the cache clear to serve the freshest possible content
@@ -116,7 +123,7 @@ $(document).ready(function(){
var interval = setInterval(function() {
counter--;
console.log(counter);
$('.page-update').html('Updating in ... '+ counter + ' seconds');
$('.page-update').html('Aktuallisierung in ... '+ counter + ' Sekunden');
if (counter == 0) {
clearInterval(interval);
window.location.reload(true)
@@ -141,7 +148,7 @@ $(document).ready(function(){
var dt = new Date();
var maniTimeVersion = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
var localVersionNumber = $('link[rel="manifest"]').data('pwa-version');
var onlineVersionJSON = "_manifest.json?ver=" + maniTimeVersion;
var onlineVersionJSON = "<?php echo SERVER_ADDR; ?>/manifest.json.php?ver=" + maniTimeVersion;
var onlineVersionNumber = "Connection Offline. Waiting to Reconect";
$.getJSON(onlineVersionJSON, function(onlineData) {onlineVersionNumber = onlineData.version;});
setTimeout(function(){
@@ -187,8 +194,8 @@ $(document).ready(function(){
var offlineAlerts = $('.offline-message');
if(!offlineAlerts.length){
$('body').append('<p class="offline-message bg-red2-dark color-white center-text uppercase ultrabold">No internet connection detected</p> ');
$('body').append('<p class="online-message bg-green1-dark color-white center-text uppercase ultrabold">You are back online</p>');
$('body').append('<p class="offline-message bg-red2-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOffline'] + '</p>');
$('body').append('<p class="online-message bg-green1-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOnline'] + '</p>');
}
//Offline Function Show

View File

@@ -0,0 +1,101 @@
<?php
header('Content-Type: text/javascript');
require_once(__DIR__ . '/../../server/config.php');
?>
var randomId = function() { return '_' + Math.random().toString(36).substr(2, 9); }
var badges = {
more: {
id: 'badge-footer-more',
cnt: 0,
childs: {
news: {
id: 'badge-more-news',
cnt: 0
}
}
}
};
/**
* updateBadge - updates the count in pre-defined badges
* name - name of the badge (e.g. 'more/news'), must exist and must not have childs
* val - new value for badge ('+2' or '-4' for increase/decrease current value)
* returns true, if badge was updated, false on error
*/
var updateBadge = function (name, val) {
const names = name.split('/');
if (!(names[0] in badges)) return false;
var badge = [badges[names[0]]];
var cnt = names.length;
for (i = 1; i < cnt; i ++) {
if (!('childs' in badge[i-1]) || !(names[i] in badge[i-1].childs)) return false;
badge[i] = badge[i-1].childs[names[i]];
}
if ('childs' in badge[cnt-1]) return false;
if (String(val).substr(0, 1) == '+') val = parseInt(badge[cnt-1].cnt) + parseInt(String(val).substr(1));
else if (String(val).substr(0, 1) == '-') val = parseInt(badge[cnt-1].cnt) - parseInt(String(val).substr(1));
badge[cnt-1].cnt = parseInt(val);
$('#' + badge[cnt-1].id).text(val == 0 ? '' : val);
for (i = cnt - 2; i >= 0; i --) {
var sum = 0;
for (b in badge[i].childs) {
sum += badge[i].childs[b].cnt;
}
badge[i].cnt = sum
$('#' + badge[i].id).text(sum == 0 ? '' : sum);
}
return true;
}
/**
* makeToast - creates a snackbar toast
* color - css class as bg-color / font-color (e.g. 'bg-highlight color-white')
* icon - font awesome icon
* text - text to be displayed
* time - time after which toast is hidden (ms), 0 to disable auto-hide
* returns id of created toast (needed for manual hide)
*/
var makeToast = function (color, icon, text, time) {
var id = 'snackbar' + randomId();
var delay = (time > 0 ? 'data-delay="' + time + '" data-autohide="true"' : 'data-autohide="false"');
var div = '<div id="' + id + '" class="snackbar-toast ' + color + '" ' + delay + '>';
div += '<i class="fa ' + icon + ' mr-3"></i>' + text + '</div>';
$('#page').append(div);
$('#' + id).toast('show');
if (time > 0) {
setTimeout(function(){
$('#' + id).remove();
}, parseInt(time) + 1000);
}
return id;
}
/**
* closeToast - hides a toast
* id - id of toast to be hidden
*/
var closeToast = function (id) {
$('#' + id).toast('hide');
setTimeout(function(){
$('#' + id).remove();
}, 1000);
}
/**
* toastType - creates a pre-defined toast (Load, Ok, Warn, Info, Error)
* text - text to be displayed
* time (optional) - time after which toast is hidden(ms), 0 to disable auto-hide
* returns id of created toast (needed for manual hide)
*/
var toastLoad = function (text, time = 3000) { return makeToast('bg-highlight color-white', 'fa-sync fa-spin', text, time); }
var toastOk = function (text, time = 3000) { return makeToast('bg-green1-dark', 'fa-check', text, time); }
var toastWarn = function (text, time = 3000) { return makeToast('bg-yellow1-dark', 'fa-info', text, time); }
var toastInfo = function (text, time = 3000) { return makeToast('bg-blue2-dark', 'fa-info', text, time); }
var toastError = function (text, time = 3000) { return makeToast('bg-red2-dark', 'fa-times', text, time); }
var initRegatten = function() {
$('#table-favorites').find('tbody').html('<tr><td>Finn Soetebier</td><td>noch nicht verf&uuml;gbar</td></tr>');
}

View File

@@ -0,0 +1,11 @@
<?php
header('Content-Type: text/javascript');
require_once(__DIR__ . '/../../server/config.php');
?>
const strings = {
inetMsgOffline: "Keine Internet-Verbindung erkannt",
inetMsgOnline: "Du bist wieder online",
}

View File

@@ -1,17 +0,0 @@
BEGIN:VCARD
N:Black;Karla;;Mrs;
ADR;INTL;PARCEL;WORK:;;UltraMobile Street;Planet Earth;Milky Way;2134;
ADR;DOM;PARCEL;HOME:;;Enabled Avenue;Planet Erath;Milky Way;1234;
EMAIL;home:home@domain.com
EMAIL;office:office@domain.com
EMAIL;personal:personal@domain.com
ORG:Enabled
TEL;mobile:+1 234 567 890
TEL;office:+1 234 567 890
TEL;personal:+1 234 567 890
TITLE:Photographer
URL;WORK:www.domain.com
URL;facebook:www.facebook.com
URL;twitter:www.twitter.com
URL;google plus:www.googleplus.com
END:VCARD

View File

@@ -4866,13 +4866,38 @@ code {
.theme-dark .loader-main,
.theme-dark .instant-article,
.theme-dark .divider-icon i,
.theme-dark .table tr.even td,
.theme-dark .timeline-body,
.theme-dark table,
.theme-dark td {
.theme-dark .timeline-body {
background-color: #1b1d21 !important;
}
/* auto table-dark by theme */
.theme-dark .table th,
.theme-dark .table td,
.theme-dark .table thead th,
.theme-dark .table tbody + tbody {
border-color: #95999c;
}
.theme-dark .table {
color: #fff;
background-color: #343a40;
}
.theme-dark .table th,
.theme-dark .table td,
.theme-dark .table thead th {
border-color: #454d55;
}
.theme-dark .table-bordered {
border: 0;
}
.theme-dark .table-striped tbody tr:nth-of-type(odd) {
background-color: rgba(255, 255, 255, 0.05);
}
/* END OF table-dark */
.theme-dark .ios-switch label::before,
.theme-dark .android-switch label::before {
background-color: #1b1d21;