Initial commit - QBPOS Help
This commit is contained in:
43
python/fix_navbar.py
Normal file
43
python/fix_navbar.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import re
|
||||
import glob
|
||||
|
||||
# The correct navbar HTML to insert
|
||||
navbar_html = '''<div class="mobile-nav">
|
||||
<div class="mobile-nav-content">
|
||||
<a href="../___left.htm" class="home-btn">🏠 Home</a>
|
||||
<div class="site-title">QuickBooks Point of Sale Help</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offline-notice">Note: All Online Services are disabled and won't work. This is Completely Offline and No subscription needed</div>'''
|
||||
|
||||
os.chdir('/home/pts/Documents/QBPOS_Help_Web/QB_Help_Web/POS_Help')
|
||||
|
||||
# Process all htm files except special ones
|
||||
files = []
|
||||
for pattern in ['*/*.htm', '*/*/*.htm']:
|
||||
files.extend(glob.glob(pattern))
|
||||
|
||||
files = [f for f in files if not f.startswith('___')]
|
||||
|
||||
print(f"Processing {len(files)} files...")
|
||||
|
||||
for filepath in files:
|
||||
try:
|
||||
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
||||
content = f.read()
|
||||
|
||||
# Remove all mobile-nav and offline-notice divs
|
||||
content = re.sub(r'<div class="mobile-nav">.*?</div>\s*</div>', '', content, flags=re.DOTALL)
|
||||
content = re.sub(r'<div class="offline-notice">.*?</div>', '', content, flags=re.DOTALL)
|
||||
|
||||
# Insert navbar after <body> tag
|
||||
content = re.sub(r'(<body[^>]*>)', r'\1\n' + navbar_html, content, count=1)
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
except Exception as e:
|
||||
print(f"Error processing {filepath}: {e}")
|
||||
|
||||
print("Done!")
|
||||
Reference in New Issue
Block a user