-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.py
More file actions
84 lines (66 loc) · 2.66 KB
/
demo.py
File metadata and controls
84 lines (66 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"""
Final demonstration of the Space Jam 1996 landing page recreation.
Opens the page in a visible browser window.
"""
import http.server
import socketserver
import threading
import os
import time
from pathlib import Path
from playwright.sync_api import sync_playwright
PORT = 8766 # Different port for demo
class ReuseAddrTCPServer(socketserver.TCPServer):
allow_reuse_address = True
def start_server():
"""Start a simple HTTP server to serve the static files."""
os.chdir(Path(__file__).parent)
handler = http.server.SimpleHTTPRequestHandler
httpd = ReuseAddrTCPServer(("", PORT), handler)
thread = threading.Thread(target=httpd.serve_forever, daemon=True)
thread.start()
return httpd
def run_demo():
"""Run the demonstration in a visible browser."""
print("Starting Space Jam 1996 landing page demonstration...")
server = start_server()
print(f"Server running at http://localhost:{PORT}")
try:
with sync_playwright() as p:
# Launch browser in visible (non-headless) mode
browser = p.chromium.launch(headless=False)
page = browser.new_page()
# Set viewport to exact screenshot dimensions
page.set_viewport_size({"width": 1791, "height": 1000})
# Navigate to page
print("Opening Space Jam landing page...")
page.goto(f"http://localhost:{PORT}/index.html")
page.wait_for_load_state("networkidle")
print("\n" + "="*60)
print("SPACE JAM 1996 LANDING PAGE RECREATION")
print("="*60)
print("\nThe page is now displayed in the browser window.")
print("All navigation elements link to https://tilework.tech")
print("\nClickable areas:")
print(" - Space Jam logo (center)")
print(" - Press Box Shuttle")
print(" - Jam Central (Earth)")
print(" - Planet B-Ball (basketball)")
print(" - Lunar Tunes (blue planet)")
print(" - The Lineup (pink planet)")
print(" - Junior Jam (green striped)")
print(" - Stellar Souvenirs (cyan ball)")
print(" - Site Map (swirl)")
print(" - Behind the Jam (blue striped)")
print(" - Jump Station (green ball)")
print(" - Warner Studio Store (orange)")
print(" - Footer links (Privacy, Terms, Accessibility, AdChoices)")
print("\n" + "="*60)
print("Press Enter to close the demo...")
input()
browser.close()
print("Demo closed.")
finally:
server.shutdown()
if __name__ == "__main__":
run_demo()