Fix some issues, fix JS, fix meta tag

This commit is contained in:
Katy248
2024-06-01 12:50:16 +03:00
parent 6409642dc3
commit d0eee7a6a4
3 changed files with 31 additions and 23 deletions
+14
View File
@@ -21,3 +21,17 @@ function loadPage(section, page) {
document.getElementById(section).getElementsByTagName("button")[page - 1].classList.add("sel-btn");
});
}
function activeSection(section) {
hideAll();
const targetSection = document.getElementById(section);
targetSection.style.display = "block";
targetSection.focus();
}
function hideAll() {
document.querySelectorAll(".section").forEach((s) => {
s.style.display = "none";
});
}
+12 -22
View File
@@ -26,10 +26,10 @@ write_header(){
<head>
<meta charset=\"utf-8\">
<meta name='viewport' content='idth=device-width, initial-scale=1.0'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
<title>Gruvbox wallpapers</title>
<script src='app.js' defer></script>
<script src='app.js'></script>
</head>
<body>
@@ -37,7 +37,7 @@ write_header(){
}
write_section_header(){
echo "<h2 class=\"clickable\ s$1\" onclick=\"activeSection('$2')\" >" >> $3
echo "<h2 class=\"clickable s$1\" onclick=\"activeSection('$2')\" >" >> $3
echo "$2" | tr a-z A-Z >> $3
echo "</h2>" >> $3
}
@@ -75,7 +75,7 @@ do
subhtml="${section}_page${page}.html"
touch ./$subhtml
echo "<div id=\"$section\" style={display : \"none\"}>" >> ./index.html
echo "<div class='section' id=\"$section\">" >> ./index.html
echo "<div class=\"pager\">" >> ./index.html
countImgs=$(find "$subdir" -type f | wc -l)
@@ -84,8 +84,8 @@ do
echo "<button class=\"clickable\" onclick=\"loadPage('$section', $i)\">$i</button>" >> ./index.html
done
echo "</div>" >> ./index.html
echo "<div id=\"$section-content\">" >> ./index.html
echo "<div id=\"c\">" >> ./$subhtml
echo "<div id=\"$section-content\">" >> ./index.html
echo "<div class='c'>" >> ./$subhtml
for wallpaper in ${subdir}/*
do
if [ "$img_count" -ge $maxPerPage ]; then
@@ -96,7 +96,7 @@ do
touch ./$subhtml
echo "<div id=\"c\">" >> ./$subhtml
echo "<div class='c'>" >> ./$subhtml
img_count=0
fi
@@ -117,26 +117,16 @@ done
echo "<script>
window.onload = () => {" >> ./index.html
echo "console.log('fuck');" >> ./index.html
echo "hideAll();" >> ./index.html
for section in "${sections[@]}"; do
echo " loadPage('$section', 1);
document.getElementById('$section').style.display = \"none\";
" >> ./index.html
echo " loadPage('$section', 1);" >> ./index.html
done
echo "
document.getElementById(\"${sections[0]}\").style.display = \"block\";
echo "
activeSection(\"${sections[0]}\");
}
function activeSection(section){">> ./index.html
for section in "${sections[@]}"; do
echo "
document.getElementById('$section').style.display = \"none\";
" >> ./index.html
done
echo " document.getElementById(section).style.display = \"block\";
document.getElementById(section).focus();
}
</script>" >> ./index.html
+5 -1
View File
@@ -65,7 +65,7 @@ h2 {
background-color: #689d6a;
}
#c {
.c {
padding: 1em;
background-color: var(--bg-color-3);
text-align: center;
@@ -120,3 +120,7 @@ img:hover {
.clickable {
cursor: pointer;
}
.section {
display: none;
}