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>
<script type="text/javascript">
getStringOfPageContent("../backgrounds", function(pageContent) {
let backgrounds = getFilesInFolder(pageContent);
randomBackground(backgrounds)
});
setBackground("../");
</script>
<div class="topnav-companion"></div>

View file

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

View file

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

View file

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

View file

@ -2,7 +2,11 @@ function randomBackground(backgrounds) {
let background = selectRandom(backgrounds);
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 half_div_height = (0 - div_height) / 2;
// document.getElementById("background").style.backgroundPosition = "0% " + half_div_height.toString() + "px";
@ -51,5 +55,36 @@ function getFilesInFolder(pageContent) { // Needs auto file indexing
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)

View file

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