#!/bin/bash # Add mobile navigation bar to all HTML files HELP_DIR="/home/pts/Documents/QBPOS_Help_Web/QB_Help_Web/POS_Help" echo "Adding mobile navigation to HTML files..." # 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 "mobile-nav.css" "$file"; then continue fi # Add mobile-nav.css link after other CSS files if grep -q "qbpos.css" "$file" || grep -q "prompttech-header.css" "$file"; then # Calculate relative path for CSS rel_path=$(realpath --relative-to="$(dirname "$file")" "$HELP_DIR") if [ "$rel_path" = "." ]; then css_path="mobile-nav.css" else css_path="${rel_path}/mobile-nav.css" fi # Add after the last stylesheet sed -i "/qbpos\.css/a " "$file" fi # Add mobile navigation HTML after tag if ! grep -q "mobile-nav" "$file"; then # 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 sed -i "/]*>/I a\\
\\
\\ 🏠 Home\\ QB POS Help\\ ← Back\\
\\
" "$file" fi echo "Updated: $file" done echo "" echo "Mobile navigation added to all pages!" echo "" echo "Features:" echo " - Home button (returns to main page)" echo " - Back button (goes to previous page)" echo " - Only visible on mobile/tablet devices"