mirror of
https://github.com/AngelJumbo/gruvbox-wallpapers.git
synced 2026-10-08 23:29:22 +00:00
Fix some issues, fix JS, fix meta tag
This commit is contained in:
@@ -21,3 +21,17 @@ function loadPage(section, page) {
|
|||||||
document.getElementById(section).getElementsByTagName("button")[page - 1].classList.add("sel-btn");
|
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";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ write_header(){
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset=\"utf-8\">
|
<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\">
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
|
||||||
<title>Gruvbox wallpapers</title>
|
<title>Gruvbox wallpapers</title>
|
||||||
<script src='app.js' defer></script>
|
<script src='app.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -37,7 +37,7 @@ write_header(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
write_section_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 "$2" | tr a-z A-Z >> $3
|
||||||
echo "</h2>" >> $3
|
echo "</h2>" >> $3
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ do
|
|||||||
subhtml="${section}_page${page}.html"
|
subhtml="${section}_page${page}.html"
|
||||||
touch ./$subhtml
|
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
|
echo "<div class=\"pager\">" >> ./index.html
|
||||||
countImgs=$(find "$subdir" -type f | wc -l)
|
countImgs=$(find "$subdir" -type f | wc -l)
|
||||||
@@ -84,8 +84,8 @@ do
|
|||||||
echo "<button class=\"clickable\" onclick=\"loadPage('$section', $i)\">$i</button>" >> ./index.html
|
echo "<button class=\"clickable\" onclick=\"loadPage('$section', $i)\">$i</button>" >> ./index.html
|
||||||
done
|
done
|
||||||
echo "</div>" >> ./index.html
|
echo "</div>" >> ./index.html
|
||||||
echo "<div id=\"$section-content\">" >> ./index.html
|
echo "<div id=\"$section-content\">" >> ./index.html
|
||||||
echo "<div id=\"c\">" >> ./$subhtml
|
echo "<div class='c'>" >> ./$subhtml
|
||||||
for wallpaper in ${subdir}/*
|
for wallpaper in ${subdir}/*
|
||||||
do
|
do
|
||||||
if [ "$img_count" -ge $maxPerPage ]; then
|
if [ "$img_count" -ge $maxPerPage ]; then
|
||||||
@@ -96,7 +96,7 @@ do
|
|||||||
touch ./$subhtml
|
touch ./$subhtml
|
||||||
|
|
||||||
|
|
||||||
echo "<div id=\"c\">" >> ./$subhtml
|
echo "<div class='c'>" >> ./$subhtml
|
||||||
img_count=0
|
img_count=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -117,26 +117,16 @@ done
|
|||||||
|
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload = () => {" >> ./index.html
|
window.onload = () => {" >> ./index.html
|
||||||
|
echo "console.log('fuck');" >> ./index.html
|
||||||
|
echo "hideAll();" >> ./index.html
|
||||||
for section in "${sections[@]}"; do
|
for section in "${sections[@]}"; do
|
||||||
echo " loadPage('$section', 1);
|
echo " loadPage('$section', 1);" >> ./index.html
|
||||||
document.getElementById('$section').style.display = \"none\";
|
|
||||||
" >> ./index.html
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
document.getElementById(\"${sections[0]}\").style.display = \"block\";
|
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
|
</script>" >> ./index.html
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ h2 {
|
|||||||
background-color: #689d6a;
|
background-color: #689d6a;
|
||||||
}
|
}
|
||||||
|
|
||||||
#c {
|
.c {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
background-color: var(--bg-color-3);
|
background-color: var(--bg-color-3);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -120,3 +120,7 @@ img:hover {
|
|||||||
.clickable {
|
.clickable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user