import os import re def port_html(): source_path = r"C:\Users\naman\OneDrive\Desktop\pragativeer-v2\pragativeer-celebration_1.html" dest_path = r"C:\Users\naman\OneDrive\Desktop\pragativeer-v2\public\streak-animation.html" with open(source_path, 'r', encoding='utf-8') as f: html = f.read() # 1. Inject CSS to make background transparent and hide stage layout hide_css = """ body { background: transparent !important; } body.sad { background: transparent !important; } body::after { display: none !important; } #stage, .hint { display: none !important; } """ # Insert hide_css inside " html = html.replace(style_tag, hide_css + "\n", 1) # 2. Replace parseTarget to read from URL search params parse_target_replacement = """ const parseTarget=()=>{ const params = new URLSearchParams(window.location.search); const s = params.get('streak'); const v=parseFloat(s); return isFinite(v)?v:0; }; """ html = re.sub(r"const parseTarget=\(\)=>\{.*?\};", parse_target_replacement, html, flags=re.DOTALL) with open(dest_path, 'w', encoding='utf-8') as f: f.write(html) print("Ported successfully to public/streak-animation.html") if __name__ == "__main__": port_html()