From 288c0558e4c54734639846faa3c933c1fa501004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:06:32 +0100 Subject: [PATCH 1/8] Update style.css --- style.css | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/style.css b/style.css index 0911292..5c87a31 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,13 @@ body { - background-color: gainsboro; + background-attachment: fixed; + background-position: center; + background-size: cover; font-family: Arial, sans-serif; display: flex; + margin: 0px; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif; justify-content: center; align-items: center; min-height: 100vh; @@ -13,11 +19,10 @@ body { width: 80%; height: 80%; padding: 40px; - background-color: #f0f0f0; + background-color: #f0f0f0e7; border-radius: 20px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); /* transform: scale(0.95); */ - transition: transform 0.3s ease; display: flex; } @@ -95,7 +100,7 @@ body { } .project p { - color: #812020; + color: #070202; } .project a { @@ -368,3 +373,43 @@ img { padding-left: 5%; min-width: 45%; } + +.project-card { + background-color: #f8f8f8; + padding: 20px; + margin-bottom: 20px; + border-radius: 10px; + box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; +} + +.project-card:hover { + transform: scale(1.1); + transition: 0.4s; + box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.2); +} + +.project-card h2 { + margin-top: 0; + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); + transition: text-shadow 0.3s ease; +} + +.project-card:hover h2 { + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); +} + +.project-card p { + color: #070202; +} + +.project-card a { + display: inline-block; + padding: 8px 12px; + background-color: #fff; + color: #333; + border-radius: 5px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; + text-decoration: none; +} From eed206a9848baa1458779425c818f295ae4cedc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:06:42 +0100 Subject: [PATCH 2/8] Update project.html --- project.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/project.html b/project.html index b6bf6b6..7e1ed92 100644 --- a/project.html +++ b/project.html @@ -45,5 +45,24 @@

+ + From 22ab211c9a521f5fbcdeb345827c622f5fda822a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:06:54 +0100 Subject: [PATCH 3/8] Update index.js --- js/index.js | 434 ++++++++++++++++++++++++++-------------------------- 1 file changed, 218 insertions(+), 216 deletions(-) diff --git a/js/index.js b/js/index.js index d15e89c..47c2ab9 100644 --- a/js/index.js +++ b/js/index.js @@ -1,162 +1,205 @@ - // Default username -let username = "schBenedikt"; -const home = document.getElementById("home"); -home.href = `https://www.github.com/${username}`; - - -// Function to get the GitHub user data via API -async function getGitHubUser(username) { - const response = await fetch(`https://api.github.com/users/${username}`); - const data = await response.json(); - return data; -} - -// Function to get the GitHub project data via API -async function getGitHubProjects(username) { - const response = await fetch(`https://api.github.com/users/${username}/repos`); - const data = await response.json(); - return data.slice(0, 15); -} - -// Function to create the project cards based on the project data -function createProjectCards(projects) { - const projectsContainer = document.querySelector(".projects"); - projectsContainer.innerHTML = ""; // Clear existing project cards - - const maxProjectsToShow = 5; // Maximum number of projects to show initially - const showAllButton = document.createElement("button"); - showAllButton.textContent = "Show All Projects"; - showAllButton.onclick = () => { - showAllButton.style.display = "none"; // Hide the button after clicking - projects.forEach((project, index) => { - if (index >= maxProjectsToShow) { - const projectCard = createProjectCard(project); - projectsContainer.appendChild(projectCard); - } - }); - const collapseButton = document.createElement("button"); - collapseButton.textContent = "Collapse"; - collapseButton.onclick = () => { - projectsContainer.innerHTML = ""; // Clear project cards - for (let i = 0; i < Math.min(projects.length, maxProjectsToShow); i++) { - const projectCard = createProjectCard(projects[i]); - projectsContainer.appendChild(projectCard); - } - projectsContainer.appendChild(showAllButton); // Show the "Show All Projects" button - }; - projectsContainer.appendChild(collapseButton); // Show the "Collapse" button - }; + // Default username + let username = "schBenedikt"; + const home = document.getElementById("home"); + home.href = `https://www.github.com/${username}`; - for (let i = 0; i < Math.min(projects.length, maxProjectsToShow); i++) { - const project = projects[i]; - const projectCard = createProjectCard(project); - projectsContainer.appendChild(projectCard); + + // Function to get the GitHub user data via API + async function getGitHubUser(username) { + const response = await fetch(`https://api.github.com/users/${username}`); + const data = await response.json(); + return data; } - if (projects.length > maxProjectsToShow) { - projectsContainer.appendChild(showAllButton); + // Function to get the GitHub project data via API + async function getGitHubProjects(username) { + const response = await fetch(`https://api.github.com/users/${username}/repos`); + const data = await response.json(); + return data.slice(0, 15); } -} - -function createProjectCard(project) { - const projectCard = document.createElement("div"); - projectCard.classList.add("project"); - projectCard.onclick = () => openOverlay(project); - - const title = document.createElement("h2"); - title.textContent = project.name; - - const description = document.createElement("p"); - description.textContent = project.description; - - const viewLink = document.createElement("a"); - viewLink.href = project.html_url; - viewLink.textContent = "View Project"; - viewLink.target = "_blank"; // Open link in a new tab - - projectCard.appendChild(title); - projectCard.appendChild(description); - projectCard.appendChild(viewLink); - - return projectCard; -} - -// Function to get the contents of a project's README.md file -async function getReadmeContent(username, repoName) { - const response = await fetch(`https://api.github.com/repos/${username}/${repoName}/readme`); - const data = await response.json(); - - if (data.download_url) { - const readmeResponse = await fetch(data.download_url); - const readmeContent = await readmeResponse.text(); - return readmeContent; - } else { - return "No README.md file found."; + + // Function to create the project cards based on the project data + function createProjectCards(projects) { + const projectsContainer = document.querySelector(".projects"); + projectsContainer.innerHTML = ""; // Clear existing project cards + + const maxProjectsToShow = 5; // Maximum number of projects to show initially + const showAllButton = document.createElement("button"); + showAllButton.textContent = "Show All Projects"; + showAllButton.onclick = () => { + showAllButton.style.display = "none"; // Hide the button after clicking + projects.forEach((project, index) => { + if (index >= maxProjectsToShow) { + const projectCard = createProjectCard(project); + projectsContainer.appendChild(projectCard); + } + }); + const collapseButton = document.createElement("button"); + collapseButton.textContent = "Collapse"; + collapseButton.onclick = () => { + projectsContainer.innerHTML = ""; // Clear project cards + for (let i = 0; i < Math.min(projects.length, maxProjectsToShow); i++) { + const projectCard = createProjectCard(projects[i]); + projectsContainer.appendChild(projectCard); + } + projectsContainer.appendChild(showAllButton); // Show the "Show All Projects" button + }; + projectsContainer.appendChild(collapseButton); // Show the "Collapse" button + }; + + for (let i = 0; i < Math.min(projects.length, maxProjectsToShow); i++) { + const project = projects[i]; + const projectCard = createProjectCard(project); + projectsContainer.appendChild(projectCard); + } + + if (projects.length > maxProjectsToShow) { + projectsContainer.appendChild(showAllButton); + } } -} -async function getRepositoryDetails(username, projectName) { - try { - const response = await fetch(`https://api.github.com/repos/${username}/${projectName}`); - const data = await response.json(); - data.username = username; // Füge den Username zum Datenobjekt hinzu - return data; - } catch (error) { - console.error("Error fetching repository details:", error); - return null; + function createProjectCard(project) { + const projectCard = document.createElement("div"); + projectCard.classList.add("project-card"); // Updated class name + projectCard.onclick = () => openOverlay(project); + + const title = document.createElement("h2"); + title.textContent = project.name; + + const description = document.createElement("p"); + description.textContent = project.description; + + const viewLink = document.createElement("a"); + viewLink.href = project.html_url; + viewLink.textContent = "View Project"; + viewLink.target = "_blank"; // Open link in a new tab + + projectCard.appendChild(title); + projectCard.appendChild(description); + projectCard.appendChild(viewLink); + + return projectCard; } -} -async function openOverlay(project) { - const overlay = document.getElementById("overlay"); - const overlayReadme = document.getElementById("overlay-readme"); + // Function to get the contents of a project's README.md file + async function getReadmeContent(username, repoName) { + const response = await fetch(`https://api.github.com/repos/${username}/${repoName}/readme`); + const data = await response.json(); - if (project === 'about') { - const aboutDescription = document.getElementById("about-description"); - overlayReadme.innerHTML = aboutDescription.innerHTML; - } else { + if (data.download_url) { + const readmeResponse = await fetch(data.download_url); + const readmeContent = await readmeResponse.text(); + return readmeContent; + } else { + return "No README.md file found."; + } + } + async function getRepositoryDetails(username, projectName) { try { - // Get README.md content - const readmeContent = await getReadmeContent(username, project.name); + const response = await fetch(`https://api.github.com/repos/${username}/${projectName}`); + const data = await response.json(); + data.username = username; // Füge den Username zum Datenobjekt hinzu + return data; + } catch (error) { + console.error("Error fetching repository details:", error); + return null; + } + } - // Get repository details (including the number of stars, forks, watchers, and contributors) - const repositoryDetails = await getRepositoryDetails(username, project.name); + async function openOverlay(project) { + const overlay = document.getElementById("overlay"); + const overlayReadme = document.getElementById("overlay-readme"); - // Get the topics for the project - const topicsResponse = await fetch(`https://api.github.com/repos/${username}/${project.name}/topics`, { - headers: { - Accept: "application/vnd.github.mercy-preview+json" // Include the 'topics' preview header - } - }); - const topicsData = await topicsResponse.json(); - const topics = topicsData.names.join(", "); + if (project === 'about') { + const aboutDescription = document.getElementById("about-description"); + overlayReadme.innerHTML = aboutDescription.innerHTML; + } else { - // Open the new page with README content, number of stars, forks, watchers, topics, and project description - window.open(`project.html?username=${encodeURIComponent(username)}&project=${encodeURIComponent(project.name)}&content=${encodeURIComponent(readmeContent)}&stars=${encodeURIComponent(repositoryDetails.stargazers_count)}&forks=${encodeURIComponent(repositoryDetails.forks_count)}&watchers=${encodeURIComponent(repositoryDetails.watchers_count)}&topics=${encodeURIComponent(topics)}&description=${encodeURIComponent(project.description)}`, '_blank'); - } catch (error) { - console.error("Error getting README.md content, repository details, or topics:", error); - return; + try { + // Get README.md content + const readmeContent = await getReadmeContent(username, project.name); + + // Get repository details (including the number of stars, forks, watchers, and contributors) + const repositoryDetails = await getRepositoryDetails(username, project.name); + + // Get the topics for the project + const topicsResponse = await fetch(`https://api.github.com/repos/${username}/${project.name}/topics`, { + headers: { + Accept: "application/vnd.github.mercy-preview+json" // Include the 'topics' preview header + } + }); + const topicsData = await topicsResponse.json(); + const topics = topicsData.names.join(", "); + + // Open the new page with README content, number of stars, forks, watchers, topics, and project description + window.open(`project.html?username=${encodeURIComponent(username)}&project=${encodeURIComponent(project.name)}&content=${encodeURIComponent(readmeContent)}&stars=${encodeURIComponent(repositoryDetails.stargazers_count)}&forks=${encodeURIComponent(repositoryDetails.forks_count)}&watchers=${encodeURIComponent(repositoryDetails.watchers_count)}&topics=${encodeURIComponent(topics)}&description=${encodeURIComponent(project.description)}`, '_blank'); + } catch (error) { + console.error("Error getting README.md content, repository details, or topics:", error); + return; + } } + + overlay.classList.add("inactive"); } - overlay.classList.add("inactive"); -} - -// Function to update the username and reload data -function updateUsername() { - const usernameInput = document.getElementById("username-input"); - const newUsername = usernameInput.value.trim(); - home.href = `https://www.github.com/${newUsername}`; - if (newUsername === "") { - alert("Please enter a valid username."); - return; + // Function to update the username and reload data + function updateUsername() { + const usernameInput = document.getElementById("username-input"); + const newUsername = usernameInput.value.trim(); + home.href = `https://www.github.com/${newUsername}`; + if (newUsername === "") { + alert("Please enter a valid username."); + return; + } + + username = newUsername; + usernameInput.value = ""; // Clear the input field + + // Reload data + Promise.all([ + getGitHubUser(username), + getGitHubProjects(username), + getReadmeContent(username, username) + ]) + .then(([user, projects, aboutContent]) => { + createProjectCards(projects); + const aboutDescription = document.getElementById("about-description"); + const converter = new showdown.Converter(); + const htmlContent = converter.makeHtml(aboutContent); + aboutDescription.innerHTML = htmlContent; + + // Update the user profile picture + const profileImg = document.getElementById("profile-picture"); + profileImg.src = user.avatar_url; + profileImg.alt = `${username}'s Profile Picture`; + }) + .catch((error) => { + console.error("Error updating username:", error); + }); } - username = newUsername; - usernameInput.value = ""; // Clear the input field + // Get the projects container + const projectsContainer = document.querySelector(".projects"); + + // Filter the projects based on the search input + function filterProjects() { + const searchInput = document.getElementById("search-input").value.toLowerCase(); + const projectCards = projectsContainer.getElementsByClassName("project-card"); // Updated class name + + for (const projectCard of projectCards) { + const title = projectCard.querySelector("h2").textContent.toLowerCase(); + const description = projectCard.querySelector("p").textContent.toLowerCase(); + + if (title.includes(searchInput) || description.includes(searchInput)) { + projectCard.style.display = "block"; + } else { + projectCard.style.display = "none"; + } + } + } - // Reload data + // Load initial data Promise.all([ getGitHubUser(username), getGitHubProjects(username), @@ -169,89 +212,48 @@ function updateUsername() { const htmlContent = converter.makeHtml(aboutContent); aboutDescription.innerHTML = htmlContent; - // Update the user profile picture + // Set the user profile picture const profileImg = document.getElementById("profile-picture"); profileImg.src = user.avatar_url; profileImg.alt = `${username}'s Profile Picture`; }) .catch((error) => { - console.error("Error updating username:", error); - }); -} - -// Get the projects container -const projectsContainer = document.querySelector(".projects"); - -// Filter the projects based on the search input -function filterProjects() { - const searchInput = document.getElementById("search-input").value.toLowerCase(); - const projectCards = projectsContainer.getElementsByClassName("project"); - - for (const projectCard of projectCards) { - const title = projectCard.querySelector("h2").textContent.toLowerCase(); - const description = projectCard.querySelector("p").textContent.toLowerCase(); - - if (title.includes(searchInput) || description.includes(searchInput)) { - projectCard.style.display = "block"; - } else { - projectCard.style.display = "none"; - } - } -} - -// Load initial data -Promise.all([ - getGitHubUser(username), - getGitHubProjects(username), - getReadmeContent(username, username) -]) - .then(([user, projects, aboutContent]) => { - createProjectCards(projects); - const aboutDescription = document.getElementById("about-description"); - const converter = new showdown.Converter(); - const htmlContent = converter.makeHtml(aboutContent); - aboutDescription.innerHTML = htmlContent; - - // Set the user profile picture - const profileImg = document.getElementById("profile-picture"); - profileImg.src = user.avatar_url; - profileImg.alt = `${username}'s Profile Picture`; - }) - .catch((error) => { - console.error("Error loading initial data:", error); - }); - - // Function to handle keydown event on the username input field - function handleKeyDown(event) { - if (event.key === "Enter") { - updateUsername(); + console.error("Error loading initial data:", error); + }); + + // Function to handle keydown event on the username input field + function handleKeyDown(event) { + if (event.key === "Enter") { + updateUsername(); + } } - } -$(document).ready(function(){ - var retryCount = 0; - var maxRetries = 3; - - function fetchData() { - $.ajax({ - url: "https://api.github.com/", - type: "GET", - success: function(){ - $(".container").addClass("success"); - $("#github-api-status").html("🟢 GitHub API is working"); - }, - error: function(){ - if (retryCount < maxRetries) { - retryCount++; - $("#github-api-status").html("🔵 Connection error. Retrying... (" + retryCount + "/" + maxRetries + ")"); - setTimeout(fetchData, 3000); // Retry after 3 seconds - } else { - $(".container").addClass("error"); - $("#github-api-status").html("🔴 GitHub API is not available.

Please wait some minutes."); + $(document).ready(function(){ + var retryCount = 0; + var maxRetries = 3; + + function fetchData() { + $.ajax({ + url: "https://api.github.com/", + type: "GET", + success: function(){ + $(".container").addClass("success"); + $("#github-api-status").html("🟢 GitHub API is working"); + }, + error: function(){ + if (retryCount < maxRetries) { + retryCount++; + $("#github-api-status").html("🔵 Connection error. Retrying... (" + retryCount + "/" + maxRetries + ")"); + setTimeout(fetchData, 3000); // Retry after 3 seconds + } else { + $(".container").addClass("error"); + $("#github-api-status").html("🔴 GitHub API is not available.

Please wait some minutes."); + } } - } - }); - } + }); + } + + fetchData(); - fetchData(); -}); + + }); From 8a3bc8108248d9a677ed51f46b546dcedd8f93bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:07:05 +0100 Subject: [PATCH 4/8] Update settings.js --- js/settings.js | 102 +++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/js/settings.js b/js/settings.js index 4a90fb3..ec4caac 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,54 +1,48 @@ - - function saveBackgroundColor(color) { - document.cookie = `background_color=${encodeURIComponent(color)}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; - } - - function getBackgroundColor() { - const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)background_color\s*=\s*([^;]*).*$)|^.*$/, "$1"); - return decodeURIComponent(cookieValue) || "#ededed"; - } - - function applyBackgroundColor() { - const body = document.body; - const backgroundColor = getBackgroundColor(); - body.style.backgroundColor = backgroundColor; - } - - function saveButtonColor(color) { - document.cookie = `button_color=${encodeURIComponent(color)}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; - } - - function getButtonColor() { - const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)button_color\s*=\s*([^;]*).*$)|^.*$/, "$1"); - return decodeURIComponent(cookieValue) || "#fff"; - } - - function applyButtonColor() { - const buttons = document.querySelectorAll(".button"); - const buttonColor = getButtonColor(); - buttons.forEach(button => { - button.style.backgroundColor = buttonColor; - button.style.color = "#333"; - }); - } - - function saveProjectColor(color) { - document.cookie = `project_color=${encodeURIComponent(color)}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; - } - - function getProjectColor() { - const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)project_color\s*=\s*([^;]*).*$)|^.*$/, "$1"); - return decodeURIComponent(cookieValue) || "#f8f8f8"; - } - - function applyProjectColor() { - const projects = document.querySelectorAll(".project"); - const projectColor = getProjectColor(); - projects.forEach(project => { - project.style.backgroundColor = projectColor; - }); - } - - applyBackgroundColor(); - applyButtonColor(); - applyProjectColor(); +function saveBackgroundColor(color) { + document.cookie = `background_color=${encodeURIComponent(color)}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; +} + +function getBackgroundColor() { + const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)background_color\s*=\s*([^;]*).*$)|^.*$/, "$1"); + return decodeURIComponent(cookieValue) || "#ededed"; +} + +function applyBackgroundColor() { + const body = document.body; + const backgroundColor = getBackgroundColor(); + body.style.backgroundColor = backgroundColor; +} + +function toggleUnsplash(checked) { + document.cookie = `unsplash_enabled=${checked}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; +} + +function isUnsplashEnabled() { + const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)unsplash_enabled\s*=\s*([^;]*).*$)|^.*$/, "$1"); + return cookieValue === "true"; +} + +function applyUnsplash() { + const unsplashCheckbox = document.getElementById("unsplash"); + unsplashCheckbox.checked = isUnsplashEnabled(); +} + +function toggleStyle(checked) { + document.cookie = `style_enabled=${checked}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; +} + +function isStyleEnabled() { + const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)style_enabled\s*=\s*([^;]*).*$)|^.*$/, "$1"); + return cookieValue === "true"; +} + +function applyStyle() { + const styleCheckbox = document.getElementById("style"); + styleCheckbox.checked = isStyleEnabled(); + +} + +applyBackgroundColor(); +applyUnsplash(); +applyStyle(); +applyGlassStyle(); From 07023827d5a884ec8bf4c111ae365ae8bb2ea535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:07:13 +0100 Subject: [PATCH 5/8] Update index.html --- index.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/index.html b/index.html index 4a00831..b4ae38a 100644 --- a/index.html +++ b/index.html @@ -50,6 +50,7 @@

About Me

onkeydown="handleKeyDown(event)" /> + Choose Background Color: value="#ededed" onchange="saveBackgroundColor(this.value); applyBackgroundColor()" /> -
-

Choose Button Color:

- -
-

Choose Project Color:

+

+ +

Choose Style:

+ +

+ +

Enable Unsplash:

@@ -100,5 +98,36 @@

Choose Project Color:

+ From 4032c58095c3531673d78b112c77fa923493b533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Sch=C3=A4chner?= Date: Mon, 12 Feb 2024 21:08:20 +0100 Subject: [PATCH 7/8] Update settings.html --- settings.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/settings.html b/settings.html index e99b251..0f900ee 100644 --- a/settings.html +++ b/settings.html @@ -78,13 +78,6 @@

Choose Background Color:

/>

-

Choose Style:

- -

Enable Unsplash:

Date: Mon, 12 Feb 2024 21:08:37 +0100 Subject: [PATCH 8/8] Update settings.js --- js/settings.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/js/settings.js b/js/settings.js index ec4caac..e83e0e6 100644 --- a/js/settings.js +++ b/js/settings.js @@ -27,21 +27,6 @@ function applyUnsplash() { unsplashCheckbox.checked = isUnsplashEnabled(); } -function toggleStyle(checked) { - document.cookie = `style_enabled=${checked}; expires=Fri, 31 Dec 9999 23:59:59 GMT;`; -} - -function isStyleEnabled() { - const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)style_enabled\s*=\s*([^;]*).*$)|^.*$/, "$1"); - return cookieValue === "true"; -} - -function applyStyle() { - const styleCheckbox = document.getElementById("style"); - styleCheckbox.checked = isStyleEnabled(); - -} - applyBackgroundColor(); applyUnsplash(); applyStyle();