Initial commit - QBPOS Help
This commit is contained in:
39
scripts/add_mobile_nav_html.sh
Normal file
39
scripts/add_mobile_nav_html.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Add mobile navigation HTML to all body tags
|
||||
|
||||
HELP_DIR="/home/pts/Documents/QBPOS_Help_Web/QB_Help_Web/POS_Help"
|
||||
|
||||
echo "Adding mobile navigation HTML to body tags..."
|
||||
|
||||
# Find all .htm and .html files
|
||||
find "$HELP_DIR" -type f \( -name "*.htm" -o -name "*.html" \) | while read -r file; do
|
||||
# Skip if already has mobile-nav div
|
||||
if grep -q '<div class="mobile-nav">' "$file"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Calculate relative path to home based on file location
|
||||
rel_path=$(realpath --relative-to="$(dirname "$file")" "$HELP_DIR")
|
||||
if [ "$rel_path" = "." ]; then
|
||||
home_link="___left.htm"
|
||||
else
|
||||
home_link="${rel_path}/___left.htm"
|
||||
fi
|
||||
|
||||
# Add mobile navigation after <body> or <body ...> tag
|
||||
sed -i "/<body[^>]*>/I {
|
||||
a\\
|
||||
<div class=\"mobile-nav\">\\
|
||||
<div class=\"mobile-nav-content\">\\
|
||||
<a href=\"${home_link}\" class=\"home-btn\">🏠 Home</a>\\
|
||||
<span class=\"site-title\">QB POS Help</span>\\
|
||||
<a href=\"javascript:history.back()\" class=\"back-btn\">← Back</a>\\
|
||||
</div>\\
|
||||
</div>
|
||||
}" "$file"
|
||||
|
||||
echo "Updated: $(basename $file)"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✅ Mobile navigation added!"
|
||||
Reference in New Issue
Block a user