Skip to content

Commit

Permalink
Added setting to turn the loading screen off
Browse files Browse the repository at this point in the history
  • Loading branch information
METROKOP228 committed Dec 31, 2024
1 parent 005e5ea commit 003d8f4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
10 changes: 7 additions & 3 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ select {
background-color: var(--bg-color);
border: 2px solid var(--alt-color);
color: var(--alt-color);
margin-left: 5px;
margin: 0 5px;
}
select:hover {
border: 2px solid var(--btn-hover-bg-color);
Expand Down Expand Up @@ -243,13 +243,13 @@ ul {
#cookie-banner #disagree-btn:hover {
background-color: #b70000;
}
#cookies-checkbox {
.settings-menu .settings-checkbox {
width: 35px;
height: 35px;
}

#loading-screen {
display: flex;
display: none;
flex-direction: column;
justify-content: center;
gap: 25px;
Expand Down Expand Up @@ -371,6 +371,10 @@ input[type="color"] {
display: none;
}

.link-text {
color: var(--link-color);
}




Expand Down
19 changes: 12 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,20 @@ <h3>Шаблони</h3>
<button class="pers-presets-button" onclick="presetChoice('#000033', '#0040ff', '#20367e', '#ffffff', '#00ffe1', '#ffffff'); setTheme('dracula');">Темний режим</button>
<button class="pers-presets-button" onclick="presetChoice('#000000', '#bababa', '#808080', '#bababa', '#737373', '#404040'); setTheme('dracula');">Темніший режим</button>
<h2>LocalStorage</h2>
Зберігати дані в localStorage?<br><input type="checkbox" id="cookies-checkbox">
Зберігати дані в localStorage?<br><input type="checkbox" class="settings-checkbox" id="cookies-checkbox">
<div id="local-storage-req">
<h2>Інше</h2>
Завантажувати версії Java
<select name="choice-load-java" id="choice-load-java">
<option value="all">Усі</option>
<option value="major">Мажорні</option>
</select>
<br><i><small>Вимагає перезавантаження сторінки</small></i>
Вантажити<select name="choice-load-java" id="choice-load-java">
<option value="all">усі</option>
<option value="major">мажорні</option>
<option value="last">лише останню</option>
</select>версію(ї) Java <span class="link-text">*</span>
<i><small>Пришвидшить завантаження сторінки</small></i>

<br><br>Показувати екран завантаження? <span class="link-text">*</span><br><input type="checkbox" class="settings-checkbox" id="loading-screen-checkbox" checked>


<p class="link-text">* — Вимагає перезавантаження сторінки</p>
</div>
</div>
<main class="content-container">
Expand Down
8 changes: 7 additions & 1 deletion js/arrays_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if (localStorage.getItem('cookieConsent') && localStorage.getItem('loadJava') ==
versJson = [ "1.21.4", "1.20.6", "1.19.4", "1.18.2", "1.17.1", "1.16.5", "1.15.2", "1.14.4", "1.13.2" ]

versLang = [ "1.12.2", "1.11.2" ]
} else if (localStorage.getItem('cookieConsent') && localStorage.getItem('loadJava') === "last") {
versJson = ["1.21.4"]
} else {
versJson =
[ "1.21.4", "1.21.3", "1.21.1", "1.21", "1.20.6", "1.20.5", "1.20.4", "1.20.3", "1.20.2", "1.20.1",
Expand All @@ -21,13 +23,15 @@ if (localStorage.getItem('cookieConsent') && localStorage.getItem('loadJava') ==

newestJeVer = versJson[0]


let screen = document.getElementById("loading-screen");
let bar = document.getElementById("progress-bar");

let totalTranslations = versJson.length + versLang.length;
let processedTranslations = 0;

function trackProgress() {
screen.style.display = "flex";
if (processedTranslations < totalTranslations) {
bar.value = processedTranslations;
bar.max = totalTranslations; // встановлюємо максимальне значення прогресбару
Expand Down Expand Up @@ -68,7 +72,9 @@ async function processVersions() {
}

// Викликаємо прогрес і обробку версій
trackProgress();
if (localStorage.getItem("loadingScreen") !== "false") {
trackProgress();
}
processVersions();

function syncJavaVers() {
Expand Down
9 changes: 9 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,9 @@ document.addEventListener('DOMContentLoaded', (event) => {
if (localStorage.getItem("loadJava")) {
document.getElementById("choice-load-java").value = localStorage.getItem("loadJava");
}
if (localStorage.getItem("loadingScreen")) {
document.getElementById("loading-screen-checkbox").checked = localStorage.getItem("loadingScreen") === "true";
}
} else {
document.getElementById('cookies-checkbox').checked = false;
}
Expand Down Expand Up @@ -1175,6 +1178,12 @@ document.getElementById("cookies-checkbox").addEventListener('change', function(
}
});

document.getElementById("loading-screen-checkbox").addEventListener('change', function() {
if (localStorage.getItem('cookieConsent')) {
localStorage.setItem('loadingScreen', this.checked);
}
});


// Подія для кнопки "Погоджуюсь"
document.getElementById('agree-btn').addEventListener('click', function() {
Expand Down

0 comments on commit 003d8f4

Please sign in to comment.