#!/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 '
' "$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 or tag
sed -i "/]*>/I {
a\\
}" "$file"
echo "Updated: $(basename $file)"
done
echo ""
echo "✅ Mobile navigation added!"