Files
QBPOS-Help/scripts/add_nav_final.sh

47 lines
1.3 KiB
Bash
Raw Normal View History

2026-01-27 18:07:54 -06:00
#!/bin/bash
# Add mobile navigation HTML to all HTML files
HELP_DIR="/home/pts/Documents/QBPOS_Help_Web/QB_Help_Web/POS_Help"
count=0
echo "Adding mobile navigation to all HTML files..."
echo ""
# 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
if grep -q '<div class="mobile-nav">' "$file"; then
continue
fi
# Calculate relative path for home link
dir=$(dirname "$file")
rel_path=$(realpath --relative-to="$dir" "$HELP_DIR")
if [ "$rel_path" = "." ]; then
home_link="___left.htm"
else
home_link="${rel_path}/___left.htm"
fi
# Add navigation after <body> tag (exact match)
sed -i "/<body>/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"
((count++))
done
echo ""
echo "✅ Mobile navigation added to $count files!"
echo ""
echo "Navigation features:"
echo " 🏠 Home button - Returns to main navigation page"
echo " ← Back button - Goes to previous page"
echo " 📱 Only visible on mobile and tablet devices"