tahamajs/NS / slides /create_master_page.py
tahamajs's picture
download
raw
10.4 kB
import os
from bs4 import BeautifulSoup
def create_master_page():
base_dir = "/Users/tahamajs/Documents/uni/NS/slides"
with open(os.path.join(base_dir, "part1_ultimate.html"), "r", encoding="utf-8") as f:
part1_html = f.read()
with open(os.path.join(base_dir, "part2_ultimate.html"), "r", encoding="utf-8") as f:
part2_html = f.read()
with open(os.path.join(base_dir, "part3_ultimate.html"), "r", encoding="utf-8") as f:
part3_html = f.read()
with open(os.path.join(base_dir, "exam_ultimate.html"), "r", encoding="utf-8") as f:
exam_html = f.read()
master_html = f"""<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>سامانه جامع مرور صوتی و متنی امنیت شبکه‌های کامپیوتری</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;600;700;900&display=swap" rel="stylesheet">
<style>
:root {{
--bg-primary: #f8fafc;
--bg-secondary: #ffffff;
--bg-card: rgba(255, 255, 255, 0.9);
--border-color: rgba(0, 0, 0, 0.08);
--text-primary: #0f172a;
--text-secondary: #475569;
--accent-cyan: #0284c7;
--accent-blue: #2563eb;
--accent-gold: #d97706;
--accent-emerald: #059669;
--accent-purple: #7c3aed;
}}
* {{
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
}}
body {{
background: var(--bg-primary);
background-image:
radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
color: var(--text-primary);
min-height: 100vh;
padding: 2rem 1.5rem;
line-height: 1.8;
}}
.container {{
max-width: 1200px;
margin: 0 auto;
}}
header {{
text-align: center;
margin-bottom: 2.5rem;
padding: 2rem;
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 1.5rem;
backdrop-filter: blur(16px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}}
header h1 {{
font-size: 2.2rem;
font-weight: 900;
background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.8rem;
}}
header p {{
color: var(--text-secondary);
font-size: 1.1rem;
}}
/* Audio Player Bar */
.audio-hub {{
display: grid;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
gap: 1.2rem;
margin-bottom: 2.5rem;
}}
.audio-card {{
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 1.2rem;
padding: 1.2rem;
backdrop-filter: blur(12px);
transition: all 0.3s ease;
}}
.audio-card:hover {{
transform: translateY(-4px);
border-color: var(--accent-cyan);
box-shadow: 0 8px 24px rgba(6, 182, 212, 0.15);
}}
.audio-card h4 {{
font-size: 1.05rem;
margin-bottom: 0.8rem;
display: flex;
align-items: center;
gap: 0.5rem;
color: #0284c7;
}}
audio {{
width: 100%;
height: 38px;
border-radius: 8px;
}}
/* Tabs */
.tabs {{
display: flex;
gap: 0.8rem;
margin-bottom: 1.5rem;
overflow-x: auto;
padding-bottom: 0.5rem;
}}
.tab-btn {{
background: var(--bg-secondary);
color: var(--text-secondary);
border: 1px solid var(--border-color);
padding: 0.8rem 1.6rem;
border-radius: 1rem;
cursor: pointer;
font-weight: 700;
font-size: 1rem;
transition: all 0.25s ease;
white-space: nowrap;
}}
.tab-btn.active, .tab-btn:hover {{
background: linear-gradient(135deg, #0284c7, #2563eb);
color: #fff;
border-color: transparent;
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}}
/* Search Bar */
.search-box {{
margin-bottom: 2rem;
}}
.search-box input {{
width: 100%;
padding: 1rem 1.5rem;
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 1rem;
color: #0f172a;
font-size: 1rem;
outline: none;
backdrop-filter: blur(12px);
transition: border-color 0.2s;
}}
.search-box input:focus {{
border-color: var(--accent-cyan);
}}
/* Content Area */
.content-panel {{
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 1.5rem;
padding: 2.5rem;
backdrop-filter: blur(16px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}}
.tab-content {{
display: none;
}}
.tab-content.active {{
display: block;
animation: fadeIn 0.3s ease-in;
}}
@keyframes fadeIn {{
from {{ opacity: 0; transform: translateY(6px); }}
to {{ opacity: 1; transform: translateY(0); }}
}}
h2 {{
color: var(--accent-gold);
font-size: 1.5rem;
margin-bottom: 1.8rem;
padding-bottom: 0.6rem;
border-bottom: 2px solid rgba(245, 158, 11, 0.3);
}}
h3 {{
color: #0369a1;
font-size: 1.15rem;
margin-top: 2rem;
margin-bottom: 0.8rem;
background: rgba(3, 105, 161, 0.05);
padding: 0.8rem 1.2rem;
border-right: 4px solid #0369a1;
border-radius: 0.6rem;
}}
p {{
color: #334155;
font-size: 1.05rem;
margin-bottom: 1rem;
text-align: justify;
}}
strong {{
color: #b45309;
}}
code {{
background: rgba(0, 0, 0, 0.05);
color: #db2777;
padding: 0.2rem 0.5rem;
border-radius: 0.4rem;
font-size: 0.95rem;
font-family: monospace;
}}
</style>
</head>
<body>
<div class="container">
<header>
<h1>🔐 سامانه جامع یادگیری و مرور امنیت شبکه‌های کامپیوتری</h1>
<p>پوشش ۱۰۰ درصدی تمام ۲۳ سری اسلایدهای درسی دانشگاه + حل تشریحی نمونه سوالات پایان‌ترم با وویس و متن روان</p>
</header>
<div class="audio-hub">
<div class="audio-card">
<h4>🎧 بخش اول: مبانی رمزنگاری و هش</h4>
<audio controls src="audio/part_1.mp3"></audio>
</div>
<div class="audio-card">
<h4>🎧 بخش دوم: امنیت ایمیل، IPsec و وایرلس</h4>
<audio controls src="audio/part_2.mp3"></audio>
</div>
<div class="audio-card">
<h4>🎧 بخش سوم: فایروال، IDS، فارنزیک و حریم خصوصی</h4>
<audio controls src="audio/part_3.mp3"></audio>
</div>
<div class="audio-card">
<h4>🎧 بخش چهارم: حل تشریحی آزمون نهایی</h4>
<audio controls src="audio/final_exam.mp3"></audio>
</div>
</div>
<div class="tabs">
<button class="tab-btn active" onclick="showTab('part1')">بخش اول (رمزنگاری و هش)</button>
<button class="tab-btn" onclick="showTab('part2')">بخش دوم (ایمیل، IPsec، وایرلس)</button>
<button class="tab-btn" onclick="showTab('part3')">بخش سوم (فایروال، IDS، فارنزیک)</button>
<button class="tab-btn" onclick="showTab('exam')">حل تشریحی امتحان نهایی</button>
</div>
<div class="content-panel">
<div id="part1" class="tab-content active">
{part1_html}
</div>
<div id="part2" class="tab-content">
{part2_html}
</div>
<div id="part3" class="tab-content">
{part3_html}
</div>
<div id="exam" class="tab-content">
{exam_html}
</div>
</div>
</div>
<script>
function showTab(tabId) {{
document.querySelectorAll('.tab-content').forEach(el => el.classList.remove('active'));
document.querySelectorAll('.tab-btn').forEach(el => el.classList.remove('active'));
document.getElementById(tabId).classList.add('active');
event.target.classList.add('active');
}}
</script>
</body>
</html>"""
out_file = os.path.join(base_dir, "network_security_complete_mastery.html")
with open(out_file, "w", encoding="utf-8") as f:
f.write(master_html)
print(f"✨ Master page created at: {out_file}")
if __name__ == "__main__":
create_master_page()

Xet Storage Details

Size:
10.4 kB
·
Xet hash:
7fdb6f34ec16dcba271d729024c8cc43da38315f04b0cfdd8628186f0f868fb0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.