first commit
@@ -0,0 +1,621 @@
|
||||
/* /srv/http/eos-modern/public/assets/css/style.css */
|
||||
:root {
|
||||
--bg-body: #f8f9fa;
|
||||
--bg-card: #ffffff;
|
||||
--text-main: #2d3436;
|
||||
--text-muted: #636e72;
|
||||
--primary: #734f96;
|
||||
--primary-hover: #5a3d75;
|
||||
--accent: #c5a3e8;
|
||||
--border: #e9ecef;
|
||||
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
--radius: 12px;
|
||||
--font-main: "Inter", sans-serif;
|
||||
--font-mono: "Fira Code", monospace;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--bg-body: #121212;
|
||||
--bg-card: #1e1e1e;
|
||||
--text-main: #e0e0e0;
|
||||
--text-muted: #a0a0a0;
|
||||
--primary: #9f7aea;
|
||||
--primary-hover: #805ad5;
|
||||
--border: #333333;
|
||||
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-main);
|
||||
background-color: var(--bg-body);
|
||||
color: var(--text-main);
|
||||
line-height: 1.7;
|
||||
transition:
|
||||
background-color 0.3s ease,
|
||||
color 0.3s ease;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.site-header {
|
||||
background-color: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
padding: 1rem 0;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
color: var(--text-main);
|
||||
font-weight: 700;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
font-size: 0.8rem;
|
||||
padding: 2px 8px;
|
||||
border-radius: 20px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.main-nav ul {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.main-nav a {
|
||||
text-decoration: none;
|
||||
color: var(--text-main);
|
||||
font-weight: 500;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.main-nav a:hover {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
/* Search */
|
||||
.search-box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#searchInput {
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--bg-body);
|
||||
color: var(--text-main);
|
||||
width: 200px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
#searchInput:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px rgba(115, 79, 150, 0.2);
|
||||
}
|
||||
|
||||
.search-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
margin-top: 5px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
display: none;
|
||||
box-shadow: var(--shadow);
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
.search-item {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
color: var(--text-main);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.search-item:hover {
|
||||
background: var(--bg-body);
|
||||
}
|
||||
.search-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Theme Toggle */
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-main);
|
||||
font-size: 1.2rem;
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: 50%;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.icon-btn:hover {
|
||||
background: var(--bg-body);
|
||||
}
|
||||
|
||||
/* Content */
|
||||
.main-content {
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.article-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 30px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.article-card {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 25px;
|
||||
transition:
|
||||
transform 0.2s,
|
||||
box-shadow 0.2s;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.article-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: var(--shadow);
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
.article-card h3 {
|
||||
color: var(--primary);
|
||||
margin-bottom: 10px;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.article-card p {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
margin-top: 15px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Article Page Styles */
|
||||
.article-title {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.article-date {
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 2rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.content-body {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.content-body h2,
|
||||
.content-body h3 {
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.content-body p {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.content-body ul,
|
||||
.content-body ol {
|
||||
margin-bottom: 1.5rem;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.content-body li {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* Code Blocks */
|
||||
pre[class*="language-"] {
|
||||
border-radius: var(--radius);
|
||||
margin: 1.5rem 0;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.site-footer {
|
||||
background: var(--bg-card);
|
||||
border-top: 1px solid var(--border);
|
||||
padding: 40px 0;
|
||||
margin-top: 60px;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.header-content {
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
}
|
||||
.main-nav ul {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.article-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.search-dropdown {
|
||||
width: 100%;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Styly pro tabulky (OPRAVENÉ PRO VIDITELNOST RÁMEČKŮ) --- */
|
||||
.table-wrapper {
|
||||
overflow-x: auto;
|
||||
margin: 1.5rem 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.markdown-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 1rem;
|
||||
background-color: var(--bg-card);
|
||||
box-shadow: var(--shadow);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
/* Přidáme jemný okraj kolem celé tabulky */
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.markdown-table th,
|
||||
.markdown-table td {
|
||||
padding: 12px 15px;
|
||||
/* ZDE JE KLÍČOVÁ ZMĚNA: Použijeme explicitní barvu nebo silnější kontrast */
|
||||
border: 1px solid #555555; /* Tmavě šedá, viditelná i na světlém i tmavém pozadí */
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Pro tmavý režim můžeme použít ještě světlejší barvu pro lepší kontrast */
|
||||
[data-theme="dark"] .markdown-table th,
|
||||
[data-theme="dark"] .markdown-table td {
|
||||
border: 1px solid #666666; /* Světlejší šedá pro tmavé pozadí */
|
||||
}
|
||||
|
||||
.markdown-table th {
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.85rem;
|
||||
letter-spacing: 0.05em;
|
||||
border-bottom: 2px solid rgba(255, 255, 255, 0.5); /* Silnější čára pod hlavičkou */
|
||||
}
|
||||
|
||||
.markdown-table tr:nth-child(even) {
|
||||
background-color: rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .markdown-table tr:nth-child(even) {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.markdown-table tr:hover {
|
||||
background-color: rgba(115, 79, 150, 0.1);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.markdown-table th,
|
||||
.markdown-table td {
|
||||
padding: 8px 10px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Vylepšené styly pro odkazy --- */
|
||||
|
||||
a {
|
||||
color: var(--primary); /* Použijeme primární barvu (fialová) */
|
||||
text-decoration: none; /* Odstraníme výchozí podtržení */
|
||||
font-weight: 500; /* Trochu tučnější text */
|
||||
transition: all 0.2s ease; /* Plynulý přechod efektů */
|
||||
border-bottom: 2px solid transparent; /* Rezervujeme místo pro podtržení */
|
||||
padding-bottom: 2px; /* Aby podtržení nebylo příliš blízko textu */
|
||||
}
|
||||
|
||||
/* Efekt při najetí myší (Hover) */
|
||||
a:hover {
|
||||
color: var(--primary-hover); /* Změna barvy na tmavší odstín */
|
||||
border-bottom-color: var(--primary); /* Zobrazí se podtržení */
|
||||
background-color: rgba(115, 79, 150, 0.1); /* Jemný podklad při najetí */
|
||||
border-radius: 4px; /* Zaoblení podkladu */
|
||||
padding-left: 4px; /* Jemný posun doprava pro dynamiku */
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
/* Styly pro odkazy v textu článku (content-body) */
|
||||
.content-body a {
|
||||
color: var(--primary);
|
||||
text-decoration: underline; /* V textu článku můžeš chtít podtržení vidět hned */
|
||||
text-decoration-thickness: 1px;
|
||||
text-underline-offset: 3px; /* Posun podtržení od textu */
|
||||
}
|
||||
|
||||
.content-body a:hover {
|
||||
color: var(--primary-hover);
|
||||
text-decoration-thickness: 2px;
|
||||
text-decoration-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
/* Styly pro odkazy v navigaci (hlavička) */
|
||||
.main-nav a {
|
||||
color: var(--text-main); /* V menu zůstane barva textu */
|
||||
border-bottom: none; /* V menu žádné podtržení */
|
||||
padding: 8px 12px;
|
||||
border-radius: 6px;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
.main-nav a:hover {
|
||||
color: var(--primary);
|
||||
background-color: rgba(115, 79, 150, 0.1);
|
||||
}
|
||||
|
||||
/* Styly pro odkazy v patičce a meta datech */
|
||||
.article-meta a,
|
||||
.site-footer a {
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.article-meta a:hover,
|
||||
.site-footer a:hover {
|
||||
color: var(--primary);
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* --- Vylepšení pro tlačítko Sdílet --- */
|
||||
#shareButton {
|
||||
position: relative;
|
||||
z-index: 102; /* Nad search dropdown */
|
||||
}
|
||||
|
||||
#shareButton:hover {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
transform: scale(1.1);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
/* Tooltip pro sdílení */
|
||||
#shareButton::after {
|
||||
content: 'Sdílet';
|
||||
position: absolute;
|
||||
bottom: -30px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--text-main);
|
||||
color: var(--bg-card);
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.75rem;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#shareButton:hover::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* --- Zlepšení viditelnosti tlačítek --- */
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: 1px solid var(--border); /* Přidáme jemný okraj pro viditelnost */
|
||||
color: var(--text-main);
|
||||
font-size: 1.1rem;
|
||||
cursor: pointer;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
/* Tlačítko Sdílet - zvýraznění */
|
||||
#shareButton {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#shareButton:hover {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border-color: var(--primary);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* Tlačítko Téma */
|
||||
#themeToggle:hover {
|
||||
background: var(--bg-body);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
/* Ujistě se, že ikony jsou vidět */
|
||||
.icon-btn i {
|
||||
font-size: 1rem;
|
||||
}
|
||||
/* --- Vylepšení pro světlý režim (Light Mode) --- */
|
||||
[data-theme="light"] .icon-btn {
|
||||
border: 1px solid #d1d5db; /* Jemný šedý okraj pro viditelnost */
|
||||
background: transparent; /* Průhledné pozadí */
|
||||
}
|
||||
|
||||
[data-theme="light"] .icon-btn:hover {
|
||||
background: #f3f4f6; /* Jemně šedé pozadí při najetí (ne bílé) */
|
||||
border-color: var(--primary); /* Okraj se změní na fialovou */
|
||||
color: var(--primary); /* Ikona se změní na fialovou */
|
||||
}
|
||||
|
||||
/* Pro tmavý režim necháme původní chování */
|
||||
[data-theme="dark"] .icon-btn {
|
||||
border: 1px solid #333333;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .icon-btn:hover {
|
||||
background: #2d2d2d; /* Tmavě šedé pozadí */
|
||||
border-color: var(--primary);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
/* --- Styly pro Cheatsheets (Krátké návody) --- */
|
||||
.cheatsheet-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 40px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.cheatsheet-section {
|
||||
background: var(--bg-card);
|
||||
padding: 25px;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--border);
|
||||
box-shadow: var(--shadow);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.cheatsheet-section:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 12px -1px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.cheatsheet-section h2 {
|
||||
color: var(--primary);
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 2px solid var(--accent);
|
||||
padding-bottom: 10px;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.cheatsheet-section table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.cheatsheet-section th,
|
||||
.cheatsheet-section td {
|
||||
padding: 12px 15px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.cheatsheet-section th {
|
||||
background-color: rgba(115, 79, 150, 0.05);
|
||||
color: var(--text-main);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.cheatsheet-section tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.cheatsheet-section tr:hover {
|
||||
background-color: rgba(115, 79, 150, 0.05);
|
||||
}
|
||||
|
||||
.cheatsheet-section code {
|
||||
background-color: rgba(115, 79, 150, 0.1);
|
||||
color: var(--primary);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.9em;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Responsivita pro Cheatsheets */
|
||||
@media (max-width: 768px) {
|
||||
.cheatsheet-section {
|
||||
padding: 15px;
|
||||
}
|
||||
.cheatsheet-section table {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.cheatsheet-section th,
|
||||
.cheatsheet-section td {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 249 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 359 KiB |
|
After Width: | Height: | Size: 367 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 197 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,156 @@
|
||||
// /srv/http/eos-modern/public/assets/js/main.js
|
||||
|
||||
// 1. Globální funkce pro Toast notifikaci
|
||||
function showToast(message, isError = false) {
|
||||
const existingToasts = document.querySelectorAll('.custom-toast');
|
||||
existingToasts.forEach(t => t.remove());
|
||||
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'custom-toast';
|
||||
toast.textContent = message;
|
||||
|
||||
const bgColor = isError ? '#e74c3c' : 'var(--primary)';
|
||||
|
||||
Object.assign(toast.style, {
|
||||
position: 'fixed',
|
||||
bottom: '20px',
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
backgroundColor: bgColor,
|
||||
color: '#fff',
|
||||
padding: '12px 24px',
|
||||
borderRadius: '8px',
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
||||
zIndex: '9999',
|
||||
transition: 'opacity 0.3s ease, transform 0.3s ease',
|
||||
fontFamily: 'var(--font-main)',
|
||||
fontSize: '0.95rem',
|
||||
opacity: '0',
|
||||
pointerEvents: 'none'
|
||||
});
|
||||
|
||||
document.body.appendChild(toast);
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
toast.style.opacity = '1';
|
||||
toast.style.transform = 'translateX(-50%) translateY(0)';
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0';
|
||||
toast.style.transform = 'translateX(-50%) translateY(10px)';
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// 2. Tmavý režim
|
||||
const themeToggle = document.getElementById('themeToggle');
|
||||
const html = document.documentElement;
|
||||
|
||||
if (themeToggle) {
|
||||
const icon = themeToggle.querySelector('i');
|
||||
if (icon) {
|
||||
const savedTheme = localStorage.getItem('theme') || 'dark';
|
||||
html.setAttribute('data-theme', savedTheme);
|
||||
updateIcon(savedTheme);
|
||||
|
||||
themeToggle.addEventListener('click', () => {
|
||||
const currentTheme = html.getAttribute('data-theme');
|
||||
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
||||
html.setAttribute('data-theme', newTheme);
|
||||
localStorage.setItem('theme', newTheme);
|
||||
updateIcon(newTheme);
|
||||
});
|
||||
|
||||
function updateIcon(theme) {
|
||||
icon.className = theme === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Vyhledávání (Fuse.js) -
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
const searchResults = document.getElementById('searchResults');
|
||||
let fuse = null;
|
||||
|
||||
if (searchInput && searchResults) {
|
||||
const jsonUrl = '/eos-modern/public/data/articlesSearch.json';
|
||||
fetch(jsonUrl)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
fuse = new Fuse(data, {
|
||||
keys: ['title', 'excerpt', 'slug'],
|
||||
threshold: 0.3,
|
||||
ignoreLocation: true
|
||||
});
|
||||
})
|
||||
.catch(err => console.error('Chyba JSON:', err));
|
||||
|
||||
searchInput.addEventListener('input', (e) => {
|
||||
const query = e.target.value.trim();
|
||||
if (query.length < 2) {
|
||||
searchResults.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
if (!fuse) return;
|
||||
const results = fuse.search(query);
|
||||
searchResults.innerHTML = '';
|
||||
if (results.length > 0) {
|
||||
searchResults.style.display = 'block';
|
||||
results.forEach(result => {
|
||||
const item = result.item;
|
||||
const link = document.createElement('a');
|
||||
link.href = `/eos-modern/public/article.php?slug=${item.slug}`;
|
||||
link.className = 'search-item';
|
||||
link.innerHTML = `<strong>${item.title}</strong><br><small>${item.excerpt}</small>`;
|
||||
searchResults.appendChild(link);
|
||||
});
|
||||
} else {
|
||||
searchResults.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!searchInput.contains(e.target) && !searchResults.contains(e.target)) {
|
||||
searchResults.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 4. Tlačítko Sdílet - ZLEPŠENÁ VERZE
|
||||
const shareButton = document.getElementById('shareButton');
|
||||
if (shareButton) {
|
||||
shareButton.addEventListener('click', async () => {
|
||||
const currentUrl = window.location.href;
|
||||
const title = document.title;
|
||||
|
||||
// Zkusíme nejprve nativní sdílení (mobil)
|
||||
if (navigator.share) {
|
||||
try {
|
||||
await navigator.share({
|
||||
title: title,
|
||||
text: 'Podívej se na tento článek na EndeavourOS CZ!',
|
||||
url: currentUrl
|
||||
});
|
||||
console.log('Sdílení úspěšné (mobile).');
|
||||
return; // Ukončíme, pokud se podařilo
|
||||
} catch (err) {
|
||||
console.warn('Sdílení zrušeno nebo selhalo:', err);
|
||||
// Pokud selže, přejdeme na fallback
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback pro Desktop: Zkusíme zkopírovat do schránky
|
||||
try {
|
||||
await navigator.clipboard.writeText(currentUrl);
|
||||
showToast('Odkaz zkopírován do schránky! 📋');
|
||||
console.log('Odkaz zkopírován (desktop).');
|
||||
} catch (err) {
|
||||
console.error('Chyba kopírování:', err);
|
||||
// Pokud selže i clipboard (často na HTTP), ukážeme chybu
|
||||
showToast('Nelze zkopírovat. Zkuste to ručně (URL v adresním řádku).', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||