Added halloween backgrounds.

This commit is contained in:
The Wobbler 2023-10-24 19:40:17 +02:00
parent 17bc1ea575
commit f0eaf6a1ea
9 changed files with 65 additions and 47 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

View file

@ -72,10 +72,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
getStringOfPageContent("../backgrounds", function(pageContent) { setBackground("../");
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
</script> </script>
<div class="topnav-companion"></div> <div class="topnav-companion"></div>

View file

@ -39,10 +39,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
getStringOfPageContent("backgrounds", function(pageContent) { setBackground();
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
</script> </script>
<div class="topnav-companion"></div> <div class="topnav-companion"></div>

View file

@ -34,10 +34,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
getStringOfPageContent("backgrounds", function(pageContent) { setBackground();
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
</script> </script>
<div class="topnav-companion"></div> <div class="topnav-companion"></div>

View file

@ -16,42 +16,37 @@
<body style="background-color: #2e2e2e;"> <body style="background-color: #2e2e2e;">
<div class="background"> <div class="background" id="background">
<div class="topnav-placeholder"></div> <div class="topnav-placeholder"></div>
<dl> <p>
<dt class="normal-list"> <a href="https://i21k.de/emil/files/python/PyBrow">* PyBrow</a>
<a href="https://i21k.de/emil/files/python/PyBrow" class="normal-link">* PyBrow</a> </p>
</dt> <p>
<dd class="normal-text">
- Ein Webbrowser mit Python programmiert. - Ein Webbrowser mit Python programmiert.
<br> <br>
Downloaded eine Version aber mit den Settings und Icon. Downloaded eine Version aber mit den Settings und Icon.
</dd> </p>
<dt class="normal-list"> <p>
<a href="https://i21k.de/emil/files/python/winke-winke.py" class="normal-link">* Python Animation Test</a> <a href="https://i21k.de/emil/files/python/winke-winke.py">* Python Animation Test</a>
</dt> </p>
<dd class="normal-text"> <p>
- Ein kleiner Test einer Terminalanimation. - Ein kleiner Test einer Terminalanimation.
</dd> </p>
<dt class="normal-list"> <p>
<a href="https://i21k.de/emil/files/python/ematrix/" class="normal-link">* EMatrix</a> <a href="https://i21k.de/emil/files/python/ematrix/">* EMatrix</a>
</dt> </p>
<dd class="normal-text"> <p>
- Eine kleine einfache Matrix. - Eine kleine einfache Matrix.
<br> <br>
Downloaded eine Version aber ab der 1.1 mit den Settings Downloaded eine Version aber ab der 1.1 mit den Settings
</dd> </p>
</dl>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
getStringOfPageContent("backgrounds", function(pageContent) { setBackground();
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
</script> </script>
<div class="topnav-companion"></div> <div class="topnav-companion"></div>

View file

@ -2,7 +2,11 @@ function randomBackground(backgrounds) {
let background = selectRandom(backgrounds); let background = selectRandom(backgrounds);
console.log("Choosen random background image:", background); console.log("Choosen random background image:", background);
document.getElementById("background").style.backgroundImage = "url(https://i21k.de/emil/backgrounds/" + background + ")"; if (!background.includes("backgrounds/")) {
background = "backgrounds/" + background
}
document.getElementById("background").style.backgroundImage = "url(" + background + ")";
// let div_height = document.getElementById("background").offsetHeight; // let div_height = document.getElementById("background").offsetHeight;
// let half_div_height = (0 - div_height) / 2; // let half_div_height = (0 - div_height) / 2;
// document.getElementById("background").style.backgroundPosition = "0% " + half_div_height.toString() + "px"; // document.getElementById("background").style.backgroundPosition = "0% " + half_div_height.toString() + "px";
@ -51,5 +55,36 @@ function getFilesInFolder(pageContent) { // Needs auto file indexing
return files; return files;
}; };
function setBackground(bla = "") {
let currentDate = new Date();
let currentMonth = currentDate.getMonth();
let currentDay = currentDate.getDay();
if (currentMonth == 9) {
if (currentDay > 0 && currentDay < 20) {
getStringOfPageContent(bla + "backgrounds/halloween", function(pageContent) {
let backgrounds = getFilesInFolder(pageContent);
let backgroundNumber = 0;
while (backgroundNumber < backgrounds.length) {
backgrounds[backgroundNumber] = bla + "backgrounds/halloween/" + backgrounds[backgroundNumber];
backgroundNumber++;
}
randomBackground(backgrounds);
});
}
} else {
getStringOfPageContent("backgrounds", function(pageContent) {
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds);
});
}
}
// getStringOfPageContent("backgrounds", getFilesInFolder) // getStringOfPageContent("backgrounds", getFilesInFolder)

View file

@ -100,10 +100,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
getStringOfPageContent("backgrounds", function(pageContent) { setBackground();
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
</script> </script>
<div class="topnav-companion"></div> <div class="topnav-companion"></div>