File size: 2,290 Bytes
c986e1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
let selectedVersion = '';


function toggleOptions() {
    document.querySelector('.custom-options').classList.toggle('open');
    document.querySelector('.custom-select').classList.toggle('open');
}

function selectVersion(version) {
    selectedVersion = version;
    document.querySelector('.custom-select').textContent = `Selected: ${version}`;
    toggleOptions();
}

function playGame() {
    if (!selectedVersion) {
        alert('Please select a version to play.');
        return;
    }
    window.location.href = selectedVersion + '/index.html';
}


function redirectToNews() {
    window.location.href = 'news.html';
}

function redirectToSettings() {
    window.location.href = 'settings.html';
}
function redirectToList() {
    window.location.href = 'serverlist.html';
}
function redirectToMain() {
    window.location.href = 'index.html';
}
document.addEventListener("DOMContentLoaded", function() {
            // Function to get a cookie value by name
            function getCookie(name) {
               let cookieArr = document.cookie.split(";");
               for(let i = 0; i < cookieArr.length; i++) {
                  let cookiePair = cookieArr[i].split("=");
                  if(name === cookiePair[0].trim()) {
                     return decodeURIComponent(cookiePair[1]);
                  }
               }
               return null;
            }

            // Set the username placeholder from the cookie
            let username = getCookie("username");
            if (username != null) {
            
               document.getElementById("profile-name").textContent = username;
            }

             let modMakerKitEnabled = getCookie("modMakerKitEnabled");
            if (modMakerKitEnabled === "true") {
               document.getElementById("modMakerCheckbox").checked = true;
               document.getElementById("modMakerItem").style.display = "flex";
               document.getElementById("apiItem").style.display = "flex";
            } else {
               document.getElementById("modMakerItem").style.display = "none";
               document.getElementById("apiItem").style.display = "none";
            }
         });
function openBlankPage(link) {
          // Open a new blank window or tab
        window.open(link);

}