auto-sync: 2026-05-13 16:30:01
This commit is contained in:
29
tasks/enduro-trails/scripts/patch_popup_pos.py
Normal file
29
tasks/enduro-trails/scripts/patch_popup_pos.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import sys
|
||||
|
||||
path = "/home/slin/enduro-trails/prototype/static/app.js"
|
||||
with open(path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Replace the positioning logic
|
||||
old = """const rect = btn.getBoundingClientRect();
|
||||
popup.style.top = rect.top + 'px';
|
||||
popup.style.right = (window.innerWidth - rect.left + 8) + 'px';"""
|
||||
|
||||
new = """const rect = btn.getBoundingClientRect();
|
||||
popup.style.right = (window.innerWidth - rect.left + 8) + 'px';
|
||||
// Position: align bottom of popup with bottom of button, ensure fits in viewport
|
||||
const popupHeight = popup.offsetHeight;
|
||||
const desiredTop = rect.bottom - popupHeight;
|
||||
const minTop = 8;
|
||||
popup.style.top = Math.max(minTop, desiredTop) + 'px';"""
|
||||
|
||||
if old not in content:
|
||||
print("ERROR: old text not found")
|
||||
sys.exit(1)
|
||||
|
||||
content = content.replace(old, new)
|
||||
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print("OK - positioning fixed")
|
||||
Reference in New Issue
Block a user