MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Freifunk Köln, Bonn und Umgebung
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
K (3rd week canceled due to Corona as well)
 
(24 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
DATE_CONFIG = [
const DATE_CONFIG = [
{
    {
week: 1, // 1st week
        week: 1, // 1st week
day: 4, // Thursday
        day: 4, // Thursday
text: 'in der <a rel="nofollow" class="external text" href="https://www.openstreetmap.org/way/123890490">Alten VHS, Wilhelmstraße 34</a>, <b>20:00</b> Uhr'
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
}, {
/* //Corona    }, {
week: 2, //2nd week
        week: 2, //2nd week
day: 4, // Thursday
        day: 4, // Thursday
text: 'im <a rel="nofollow" class="external text" href="https://koeln.ccc.de">C4</a> in Köln, <a rel="nofollow" class="external text" href="http://www.koeln.ccc.de/c4/faq/index.xml#anreise">Helios Str. 6a</a>, <b>20:00</b> Uhr'
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
}, {
    }, {
week: 3, // 3rd week
        week: 3, // 3rd week
day: 4, // Thursday
        day: 4, // Thursday
text: 'in der <a rel="nofollow" class="external text" href="https://www.openstreetmap.org/way/123890490">Alten VHS, Wilhelmstraße 34</a>, <b>20:00</b> Uhr'
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
}
*/ // Corona
    }
];
];


function upcomingDates(){
const upcomingDates = function(){
let ret = "";
    var ret = "";
let today = new Date();
    var today = new Date();
    for (var counter = 0;counter < 3; counter++){
        var text = null;
        while (!(text = getDateText(today))) { // Count
            today.setDate(today.getDate() + 1);
        }
        today.setDate(today.getDate() + 1);
        ret += text;
    }
    return ret;
};
const getDateText = function (d) {
    const dayOfMonth = d.getDate();
    const month = d.getMonth() +1;
    const year = d.getFullYear();


for (let counter = 0;counter < 3; counter++){
    for(var index = 0; index < DATE_CONFIG.length; index++){
let text = null;
        const conf = DATE_CONFIG[index];
while (!(text = getDateText(today, bonnText, koelnText))) { // Count
        if (d.getDay() == conf.day && dayOfMonth <= 7 * conf.week){
today.setDate(today.getDate() + 1);
            const dateStr = (dayOfMonth <= 9) ? "0" + dayOfMonth : "" + dayOfMonth;
}
            const monthStr = (month <= 9) ? "0" + month : "" + month;
today.setDate(today.getDate() + 1);
            return '<li>' + dateStr + '.' + monthStr + '.' + year + " " + conf.text + '</li>';
ret += text;
        }
}
    }
return ret;
    return null;
}
};
 
const div =  document.getElementById("termine");
function getDateText(d, bonnText, koelnText) {
if(div) {
const dayOfMonth = d.getDate();
    div.innerHTML = "<ul>" + upcomingDates() + "</ul>";
const month = d.getMonth() +1;
const year = d.getFullYear();
 
for(let index = 0; index < DATE_CONFIG.length; index++){
const conf = DATE_CONFIG[index];
if (d.getDay() == conf.day && dayOfMonth <= 7 * conf.week){
const dateStr = (dayOfMonth < 9) ? "0" + dayOfMonth : "" + dayOfMonth;
return '<li>' + dateStr + '.' + month + '.' + year + " " + conf.text + '</li>';
}
}
return null;
}
}

Aktuelle Version vom 15. April 2021, 20:02 Uhr

const DATE_CONFIG = [
    {
        week: 1, // 1st week
        day: 4, // Thursday
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
/* //Corona    }, {
        week: 2, //2nd week
        day: 4, // Thursday
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
    }, {
        week: 3, // 3rd week
        day: 4, // Thursday
        text: 'Videokonferenz unter <a rel="nofollow" class="external text" href="https://meet.kbu.freifunk.net/lounge">KBU Jitsi</a>, ab <b>20:00</b> Uhr'
*/ // Corona
    }
];

const upcomingDates = function(){
    var ret = "";
    var today = new Date();
    for (var counter = 0;counter < 3; counter++){
        var text = null;
        while (!(text = getDateText(today))) { // Count
            today.setDate(today.getDate() + 1);
        }
        today.setDate(today.getDate() + 1);
        ret += text;
    }
    return ret;
};
const getDateText = function (d) {
    const dayOfMonth = d.getDate();
    const month = d.getMonth() +1;
    const year = d.getFullYear();

    for(var index = 0; index < DATE_CONFIG.length; index++){
        const conf = DATE_CONFIG[index];
        if (d.getDay() == conf.day && dayOfMonth <= 7 * conf.week){
            const dateStr = (dayOfMonth <= 9) ? "0" + dayOfMonth : "" + dayOfMonth;
            const monthStr = (month <= 9) ? "0" + month : "" + month;
            return '<li>' + dateStr + '.' + monthStr + '.' + year + " " + conf.text + '</li>';
        }
    }
     return null;
};
const div =  document.getElementById("termine");
if(div) {
    div.innerHTML = "<ul>" + upcomingDates() + "</ul>";
}