-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_external_js.py
More file actions
31 lines (24 loc) · 893 Bytes
/
check_external_js.py
File metadata and controls
31 lines (24 loc) · 893 Bytes
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
# Validating if Swiper is initialized in external JS.
# Also checking server.py.
import os
import re
files_to_check = ['animations.js', 'script.js', 'main.js', 'app.js', 'server.py']
for fname in files_to_check:
if os.path.exists(fname):
with open(fname, 'r', encoding='utf-8') as f:
content = f.read()
print(f"--- {fname} found ---")
# Check for Swiper
if 'new Swiper' in content:
print(f"!!! Swiper init found in {fname} !!!")
# Print context
matches = re.findall(r'new Swiper\([^)]*\)', content)
for m in matches:
print(m)
# Check for server logic
if fname == 'server.py':
print("Server content snippet:")
print(content[:500]) # First 500 chars
else:
# print(f"{fname} not found.")
pass