Added function to read description and made some style changes.

This commit is contained in:
The Wobbler 2024-10-26 13:41:17 +02:00
parent ef55ce684e
commit 9881a1dba1
4 changed files with 44 additions and 8 deletions

View file

@ -18,10 +18,13 @@
function generateCSSCode($directory) {
foreach ($directory as $path => $filename) {
if (is_array($filename)) { // $filename is either a filename or an array of filenames, if so, it represents a directory
$randomColor = "rgba(" . rand(0, 255) . ", " . rand(0, 255) . ", " . rand(0, 255);
$useableName = str_replace("/", "_", $path);
echo "#input_$useableName:checked + .submenu_$useableName,
.submenu_$useableName:hover {
display: block;
background-color: $randomColor, 0.1);
}\n";
generateCSSCode($filename);
@ -35,14 +38,30 @@
if (is_array($filename)) {
$folderName = end(explode("/", $path));
echo " $indentation<label for='input_$useableName' class='inset hcb-label label_$useableName'>$folderName</label>
echo " $indentation<label for='input_$useableName' class='inout hcb-label label_$useableName'>$folderName</label>
$indentation<input type='checkbox' id='input_$useableName' class='hacked-checkbox'>
$indentation<div class='glass inset submenu submenu_$useableName'>\n";
if (file_exists("$path/README.txt")) { // show description text if there is a README.txt
echo " $indentation<p class='tiny-text'>Beschreibung:</p>\n";
$readmeFile = fopen("$path/README.txt", "r");
$readmeContent = fread($readmeFile, filesize("$path/README.txt"));
echo " $indentation<pre class='heading-text fat-text'>
$readmeContent
$indentation</pre>
$indentation<hr>\n";
fclose($readmeFile);
}
generateSubmenusHTML($filename, "$indentation ");
echo " $indentation</div>
$indentation<br>\n";
} else {
echo " $indentation<a href='$path' class='file-link'>$filename</a>\n";
if ($filename !== "README.txt") {
echo " $indentation<a href='$path' class='file-link'>$filename</a>\n";
}
}
echo " $indentation<br>\n";
}

View file

@ -2,6 +2,8 @@
display: none;
margin: 8px 0px 0px;
padding: 16px 0px 0px 16px;
border: 2px solid rgba(255, 255, 255, 0.3);
background-color: rgba(46, 46, 46, 0.5)
}
.file-link {

View file

@ -123,16 +123,19 @@ echo " </style>";
<br>
</div>
<div class="glass inset">
<p>
Hab hier nen kleinen Datenschrottplatz an Mist,
<p>
Hab hier nen kleinen Datenschrottplatz an Mist,
<br>
den ich mal mit irgendwem teilen musste und ich deshalb hier auf den Server geladen hab.
<br>
Evtl. könnt ihr hier etwas brauchbares finden.
</p>
<div class="glass inset">
<br>
den ich mal mit irgendwem teilen musste und ich deshalb hier auf den Server geladen hab.
<br>
Evtl. könnt ihr hier etwas brauchbares finden.
</p>
<?= generateSubmenusHTML(completeScanDir("files"), " ") ?>
</div>
</div>
</div>

View file

@ -40,6 +40,11 @@ label {
text-shadow: 4px 4px 8px rgb(0, 0, 0), -4px 4px 8px rgb(0, 0, 0), -4px -4px 8px rgb(0, 0, 0), 4px -4px 8px rgb(0, 0, 0);
}
hr {
margin: 0px 16px 0px 0px;
border: 1px solid rgba(255, 255, 255, 0.5);
}
.background {
background-image: url('<?= $chosen_background ?>');
background-repeat: no-repeat;
@ -111,6 +116,13 @@ label {
font-size: 26px;
}
.heading-text {
font-family: ubuntu, arial;
color: white;
font-size: 20px;
padding-left: 20px;
}
.medium-text {
font-family: ubuntu, arial;
}