Skip to content

Commit

Permalink
Added English names for various events and activities in the schedule…
Browse files Browse the repository at this point in the history
…; refactored countdown.js to improve readability and maintainability; updated style.css with additional responsive design improvements for different screen sizes
  • Loading branch information
JagGillarVatten committed Aug 29, 2024
1 parent 8663bac commit 999c2bc
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 168 deletions.
26 changes: 26 additions & 0 deletions scheman/MP2.json
Original file line number Diff line number Diff line change
@@ -1,181 +1,207 @@
[
{
"name": "Mentorsgrupp",
"englishName": "Mentor Group",
"startDay": 1,
"startTime": "11:00",
"endTime": "12:00",
"location": "705"
},
{
"name": "Svenska",
"englishName": "Swedish",
"startDay": 1,
"startTime": "12:50",
"endTime": "14:05",
"location": "705"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 1,
"startTime": "14:20",
"endTime": "15:35",
"location": "320"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 1,
"startTime": "14:20",
"endTime": "15:35",
"location": "316"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 1,
"startTime": "14:20",
"endTime": "15:35",
"location": "319"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 1,
"startTime": "14:20",
"endTime": "15:35",
"location": "315"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 1,
"startTime": "14:20",
"endTime": "15:35",
"location": "313"
},
{
"name": "Naturkunskap",
"englishName": "Natural Science",
"startDay": 1,
"startTime": "15:45",
"endTime": "17:00",
"location": "705"
},
{
"name": "Musikproduktion",
"englishName": "Music Production",
"startDay": 2,
"startTime": "08:20",
"endTime": "09:20",
"location": "306"
},
{
"name": "Gehörs- och musiklära",
"englishName": "Ear Training and Music Theory",
"startDay": 2,
"startTime": "11:00",
"endTime": "12:15",
"location": "415"
},
{
"name": "Animation",
"englishName": "Animation",
"startDay": 2,
"startTime": "13:00",
"endTime": "15:30",
"location": "705"
},
{
"name": "Idrott & Hälsa",
"englishName": "Physical Education & Health",
"startDay": 2,
"startTime": "14:30",
"endTime": "16:30",
"location": "Sjöstadshallen"
},
{
"name": "Naturkunskap",
"englishName": "Natural Science",
"startDay": 3,
"startTime": "09:35",
"endTime": "10:45",
"location": "705"
},
{
"name": "Medieproduktion",
"englishName": "Media Production",
"startDay": 3,
"startTime": "10:55",
"endTime": "12:10",
"location": "323"
},
{
"name": "Svenska",
"englishName": "Swedish",
"startDay": 3,
"startTime": "12:55",
"endTime": "14:10",
"location": "705"
},
{
"name": "Historia",
"englishName": "History",
"startDay": 3,
"startTime": "14:20",
"endTime": "15:35",
"location": "705"
},
{
"name": "Musikproduktion",
"englishName": "Music Production",
"startDay": 3,
"startTime": "15:45",
"endTime": "17:00",
"location": "306"
},
{
"name": "Engelska",
"englishName": "English",
"startDay": 4,
"startTime": "09:25",
"endTime": "10:40",
"location": "705"
},
{
"name": "Historia",
"englishName": "History",
"startDay": 4,
"startTime": "13:00",
"endTime": "14:15",
"location": "705"
},
{
"name": "Estetisk kommunikation",
"englishName": "Aesthetic Communication",
"startDay": 4,
"startTime": "14:25",
"endTime": "15:40",
"location": "308"
},
{
"name": "Stuga",
"englishName": "Study Hall",
"startDay": 4,
"startTime": "15:50",
"endTime": "17:00",
"location": " "
},
{
"name": "Engelska",
"englishName": "English",
"startDay": 5,
"startTime": "09:00",
"endTime": "10:15",
"location": "705"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 5,
"startTime": "10:40",
"endTime": "11:55",
"location": "320"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 5,
"startTime": "10:40",
"endTime": "11:55",
"location": "319"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 5,
"startTime": "10:40",
"endTime": "11:55",
"location": "315"
},
{
"name": "Ensemble med körsång",
"englishName": "Ensemble with Choir Singing",
"startDay": 5,
"startTime": "10:40",
"endTime": "11:55",
Expand Down
2 changes: 1 addition & 1 deletion scripts/countdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function displayEvent(name, englishName, location, start, end, currentDate, isUp
const countdownText = document.getElementById("countdown-text");
countdownText.textContent = isUpcoming
? `${isSwedish ? name : englishName} ${isSwedish ? "börjar om" : "starts in"}:`
: `${isSwedish ? "Tid kvar för" : "Time left for"} ${isSwedish ? name : englishName}:`;
: `${isSwedish ? "Tid kvar för" : "Time left for"} ${isSwedish ? name : englishName}:`

const locationElement = document.getElementById("location");
locationElement.textContent = `${isSwedish ? "Plats" : "Location"}: ${currentEventLocation}`;
Expand Down
42 changes: 19 additions & 23 deletions scripts/gfx.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Toggle dropdown
function toggleDropdown() {
const dropdownContent = document.querySelector(".dropdown-content");
const animationDuration = 0.5;

dropdownContent.classList.toggle("show");
dropdownContent.style.animation = dropdownContent.classList.contains("show") ? "fadeIn 0.5s" : "fadeOut 0.5s";
document.body.style.filter = dropdownContent.classList.contains("show") ? "blur(5px)" : "none";
const dropdownButton = document.querySelector(".dropdown-button");
dropdownButton.style.animation = dropdownContent.classList.contains("show") ? "pulse 0.5s" : "";
dropdownContent.style.animation = dropdownContent.classList.contains("show") ? `fadeIn ${animationDuration}s` : `fadeOut ${animationDuration}s`;
}

// Adjust timezone
function adjustTimezone(date) {
return new Date(date.getTime() + (userTimeZoneOffset + ukTimeZoneOffset + hourOffset) * 60 * 60 * 1000);
return new Date(date.getTime() + (userTimeZoneOffset + ukTimeZoneOffset + (hourOffset || 0)) * 60 * 60 * 1000);
}

// Check if special date
Expand All @@ -25,8 +24,9 @@ return specialDates.find(entry => entry.date === date.toISOString().split("T")[0

// Check if snowfall period
function isSnowfallPeriod() {
const currentDate = new Date();
return currentDate >= new Date(currentDate.getFullYear(), 10, 23) && currentDate <= new Date(currentDate.getFullYear(), 11, 31);
const startDate = new Date(new Date().getFullYear(), 10, 23);
const endDate = new Date(new Date().getFullYear(), 11, 31);
return new Date() >= startDate && new Date() <= endDate;
}

// Create snowflake
Expand All @@ -43,37 +43,33 @@ document.body.removeChild(snowflake);

// Function to update the background color every second
function updateBackground() {
const body = document.body;
const currentHour = new Date().getHours();

body.classList.remove("morning", "afternoon", "evening", "night");

document.body.className = "";
if (currentHour >= 6 && currentHour < 12) {
body.classList.add("morning");
document.body.classList.add("morning");
} else if (currentHour >= 12 && currentHour < 18) {
body.classList.add("afternoon");
document.body.classList.add("afternoon");
} else if (currentHour >= 18 && currentHour < 22) {
body.classList.add("evening");
document.body.classList.add("evening");
} else {
body.classList.add("night");
document.body.classList.add("night");
}
}

// Function to update the background color every second
// Set interval for updating background
setInterval(updateBackground, 1000);

// Function to create snowflakes every 50 milliseconds
// Set interval for creating snowflakes
setInterval(createSnowflake, 50);

// Function to update the countdown every 50 milliseconds
// Set interval for updating countdown
setInterval(updateCountdown, 50);

// Parallax scrolling
window.addEventListener("scroll", () => {
const scrollPosition = window.scrollY;
document.body.style.backgroundPosition = `center ${scrollPosition * 0.3}px`;
document.querySelector(".name").style.transform = `translateY(${scrollPosition * 0.2}px)`;
document.querySelector("#countdown").style.transform = `translateY(${scrollPosition * 0.2}px)`;
document.querySelector(".progress-bar").style.transform = `translateY(${scrollPosition * 0.2}px)`;
document.body.style.backgroundPosition = `center ${window.scrollY * 0.3}px`;
document.querySelector(".name").style.transform = `translateY(${window.scrollY * 0.2}px)`;
document.querySelector("#countdown").style.transform = `translateY(${window.scrollY * 0.2}px)`;
document.querySelector(".progress-bar").style.transform = `translateY(${window.scrollY * 0.2}px)`;
});

Loading

0 comments on commit 999c2bc

Please sign in to comment.