Make bilingual version, organise pages

This commit is contained in:
Christoph Hagen
2022-03-26 22:27:23 +01:00
parent 0fbd1e59f5
commit dca9daf219
7 changed files with 87 additions and 88 deletions

View File

@ -1,3 +1,11 @@
[lang] {
display: none;
}
[lang=en] {
display: unset;
}
html {
font-family: -apple-system, BlinkMacSystemFont, "SF Hello", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
font-weight: 200;

View File

@ -1,5 +1,21 @@
var isPlaying = false;
var currentLang = 'de';
if (window.navigator.language != 'de') {
currentLang = 'en';
}
function localize() {
let lang = ':lang(' + currentLang + ')';
let show = '[lang]' + lang;
document.querySelectorAll(show).forEach(function (node) {
node.style.display = 'unset';
});
let hide = '[lang]:not(' + lang + ')';
document.querySelectorAll(hide).forEach(function (node) {
node.style.display = 'none';
});
}
function showRegisterForm() {
document.getElementById("text-container").style.top = '2%'
document.getElementById("register-button").style.opacity = 0
@ -7,6 +23,7 @@ function showRegisterForm() {
document.getElementById("name-form").style.display = 'inherit'
document.getElementById("add-calender-event").style.display = 'none'
document.getElementById("guest-name").focus()
document.getElementById("info-button").style.display = 'none';
if (!isPlaying) {
playPause();
}
@ -42,6 +59,7 @@ async function participate(isParticipating) {
let name = value.trim()
document.getElementById("participation-buttons").style.display = 'none'
document.getElementById("name-form").style.display = 'none'
document.getElementById("info-button").style.display = 'inherit'
console.log("Registering: " + name);
if (isParticipating) {
let registered = await performRequest(name, "register")
@ -84,6 +102,14 @@ async function performRequest(name, path) {
return false;
}
function downloadCalender() {
if (currentLang == 'de') {
download('/festival/event.ics')
} else {
download('/festival/event-en.ics')
}
}
function download(file) {
window.location = file
}