Skip to content

Commit

Permalink
[webUI] Made clicking the title go back to main page
Browse files Browse the repository at this point in the history
  • Loading branch information
NSPC911 committed Jun 7, 2024
1 parent f3b1099 commit 2371968
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pys/pre_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
html_end = f'\n <div class="download-container">\n <div class="file-download">\n <input type="text" id="fileNameInput" placeholder="Enter Pack name">\n </div>\n <button class="download-selected-button" onclick="downloadSelectedTweaks()">Download Selected Tweaks</button>\n </div>\n </div>\n <script src="resource-pack-page.js"></script>\n </body>\n <footer style="auto" class="footer-container">\n <div class="credits-footer">\n {indented}\n <p><a href="https://github.com/BedrockTweaks/Bedrock-Tweaks-Base">GitHub</a></p>\n </div>\n </footer>\n</html>'

def pre_commit():
html = '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Bedrock Tweaks/resource-packs</title>\n <link rel="stylesheet" href="resource-pack-page.css">\n </head>\n <body>\n <br>\n <div class="image-container">\n <img id="title" alt="Resource Packs" src="images/title.png">\n </div>\n <div id="background-container"></div>\n <script>\n // Array of textures with their corresponding probabilities\n const textures = [\n { src: "images/blocks/stone.png", probability: 0.618 },\n { src: "images/blocks/copper_ore.png", probability: 0.128 },\n { src: "images/blocks/coal_ore.png", probability: 0.128 },\n { src: "images/blocks/iron_ore.png", probability: 0.064 },\n { src: "images/blocks/lapis_ore.png", probability: 0.032 },\n { src: "images/blocks/redstone_ore.png", probability: 0.016 },\n { src: "images/blocks/gold_ore.png", probability: 0.008 },\n { src: "images/blocks/emerald_ore.png", probability: 0.004 },\n { src: "images/blocks/diamond_ore.png", probability: 0.002 }\n ];\n \n // Function to select a texture based on the defined probabilities\n function selectTexture() {\n const rand = Math.random();\n let cumulativeProbability = 0;\n \n for (const texture of textures) {\n cumulativeProbability += texture.probability;\n if (rand < cumulativeProbability) {\n return texture.src;\n }\n }\n }\n \n // Function to create tiles with random background images\n function createTiles() {\n const container = document.getElementById("background-container");\n const numColumns = Math.ceil(window.innerWidth / 100) + 2;\n const numRows = Math.ceil(window.innerHeight / 100) + 2;\n \n container.innerHTML = "";\n \n for (let i = 0; i < numColumns; i++) {\n const rowDiv = document.createElement("div");\n rowDiv.className = "row"; // Add a class for styling purposes if needed\n \n for (let j = 0; j < numRows; j++) {\n const tile = document.createElement("div");\n tile.className = "tile";\n tile.style.backgroundImage = `url("${selectTexture()}")`;\n rowDiv.appendChild(tile);\n }\n \n container.appendChild(rowDiv);\n }\n }\n // Call the function to create tiles\n createTiles();\n \n // Redraw tiles on window resize to maintain the grid\n window.addEventListener("resize", () => {\n document.getElementById("background-container").innerHTML = "";\n createTiles();\n });\n </script>\n <div class="container">\n <!-- Categories -->\n <div class="category">'
html = '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Bedrock Tweaks/resource-packs</title>\n <link rel="stylesheet" href="resource-pack-page.css">\n </head>\n <body>\n <br>\n <div class="image-container">\n <a href="https://bedrocktweaks.github.io"><img id="title" alt="Resource Packs" src="images/title.png"></a>\n </div>\n <div id="background-container"></div>\n <script>\n // Array of textures with their corresponding probabilities\n const textures = [\n { src: "images/blocks/stone.png", probability: 0.618 },\n { src: "images/blocks/copper_ore.png", probability: 0.128 },\n { src: "images/blocks/coal_ore.png", probability: 0.128 },\n { src: "images/blocks/iron_ore.png", probability: 0.064 },\n { src: "images/blocks/lapis_ore.png", probability: 0.032 },\n { src: "images/blocks/redstone_ore.png", probability: 0.016 },\n { src: "images/blocks/gold_ore.png", probability: 0.008 },\n { src: "images/blocks/emerald_ore.png", probability: 0.004 },\n { src: "images/blocks/diamond_ore.png", probability: 0.002 }\n ];\n \n // Function to select a texture based on the defined probabilities\n function selectTexture() {\n const rand = Math.random();\n let cumulativeProbability = 0;\n \n for (const texture of textures) {\n cumulativeProbability += texture.probability;\n if (rand < cumulativeProbability) {\n return texture.src;\n }\n }\n }\n \n // Function to create tiles with random background images\n function createTiles() {\n const container = document.getElementById("background-container");\n const numColumns = Math.ceil(window.innerWidth / 100) + 2;\n const numRows = Math.ceil(window.innerHeight / 100) + 2;\n \n container.innerHTML = "";\n \n for (let i = 0; i < numColumns; i++) {\n const rowDiv = document.createElement("div");\n rowDiv.className = "row"; // Add a class for styling purposes if needed\n \n for (let j = 0; j < numRows; j++) {\n const tile = document.createElement("div");\n tile.className = "tile";\n tile.style.backgroundImage = `url("${selectTexture()}")`;\n rowDiv.appendChild(tile);\n }\n \n container.appendChild(rowDiv);\n }\n }\n // Call the function to create tiles\n createTiles();\n \n // Redraw tiles on window resize to maintain the grid\n window.addEventListener("resize", () => {\n document.getElementById("background-container").innerHTML = "";\n createTiles();\n });\n </script>\n <div class="container">\n <!-- Categories -->\n <div class="category">'
stats = [0, 0]
incomplete_packs = {"Aesthetic": [], "Colorful Slime": [], "Fixes and Consistency": [], "Fun": [],
"HUD and GUI": [], "Lower and Sides": [], "Menu Panoramas": [], "More Zombies": [],
Expand Down
3 changes: 2 additions & 1 deletion webUI/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<br>
<div class="image-container">
<img id="title" alt="Resource Packs" src="images/title.png">
<a href="https://bedrocktweaks.github.io"><img id="title" alt="Resource Packs" src="images/title.png"></a>
</div>
<div id="background-container"></div>
<script>
Expand Down Expand Up @@ -72,6 +72,7 @@
</script>
<div class="container">
<!-- Categories -->
<div class="category">
<div class="category">
<div class="category-label" onclick="toggleCategory(this)">Aesthetic</div>
<div class="tweaks">
Expand Down

0 comments on commit 2371968

Please sign in to comment.