#!/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 '
' "$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 tag (exact match)
sed -i "//a\\
" "$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"