MediaWiki:Gadget-toc-progress.css: различия между версиями
Ланселот (обсуждение | вклад) Новая страница: «→Gadget: toc-progress: .gadget-toc { position: fixed; right: 16px; bottom: 24px; z-index: 1000; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #202122; } .gadget-toc__btn { position: relative; width: 56px; height: 56px; border-radius: 50%; border: none; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); cursor: pointer; display: grid; place-items: center; opacity: 0; pointer-events: none; tran...» |
Ланселот (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
/* Gadget: toc-progress */ | /* ============================================================ | ||
Gadget: toc-progress | |||
Плавающее оглавление с прогрессом чтения. | |||
Поддержка тёмной темы «АСТРЕЯ» (html.dm) + системной. | |||
============================================================ */ | |||
/* ---------- Светлая тема (по умолчанию) ---------- */ | |||
.gadget-toc { | .gadget-toc { | ||
--toc-bg: #fff; | |||
--toc-fg: #202122; | |||
--toc-muted: #72777d; | |||
--toc-border: #eee; | |||
--toc-hover: #f2f5fa; | |||
--toc-active-bg: #eaf3ff; | |||
--toc-active-border: #36c; | |||
--toc-accent: #36c; | |||
--toc-ring-bg: #e6e6e6; | |||
--toc-shadow: 0 2px 10px rgba(0, 0, 0, .18); | |||
--toc-shadow-panel: 0 6px 24px rgba(0, 0, 0, .2); | |||
--toc-shadow-drag: 0 6px 20px rgba(0, 0, 0, .28); | |||
position: fixed; | position: fixed; | ||
top: auto; | |||
left: auto; | |||
right: 16px; | right: 16px; | ||
bottom: 24px; | bottom: 24px; | ||
z-index: 1000; | z-index: 1000; | ||
font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; | font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; | ||
color: # | color: var(--toc-fg); | ||
} | |||
/* ---------- Тёмная тема «АСТРЕЯ» (html.dm) ---------- */ | |||
html.dm .gadget-toc { | |||
--toc-bg: #1f2329; | |||
--toc-fg: #d0d0d0; | |||
--toc-muted: #9aa0a6; | |||
--toc-border: #444; | |||
--toc-hover: #2a3038; | |||
--toc-active-bg: #1c3a5e; | |||
--toc-active-border: #8cc8ff; | |||
--toc-accent: #8cc8ff; | |||
--toc-ring-bg: #3a4048; | |||
--toc-shadow: 0 2px 10px rgba(0, 0, 0, .5); | |||
--toc-shadow-panel: 0 6px 24px rgba(0, 0, 0, .6); | |||
--toc-shadow-drag: 0 6px 20px rgba(0, 0, 0, .7); | |||
} | } | ||
/* ---------- Системная тёмная тема — fallback ---------- */ | |||
/* Срабатывает только если html.dm НЕ установлен. */ | |||
@media ( prefers-color-scheme: dark ) { | |||
html:not(.dm) .gadget-toc { | |||
--toc-bg: #1f2329; | |||
--toc-fg: #d0d0d0; | |||
--toc-muted: #9aa0a6; | |||
--toc-border: #444; | |||
--toc-hover: #2a3038; | |||
--toc-active-bg: #1c3a5e; | |||
--toc-active-border: #8cc8ff; | |||
--toc-accent: #8cc8ff; | |||
--toc-ring-bg: #3a4048; | |||
--toc-shadow: 0 2px 10px rgba(0, 0, 0, .5); | |||
--toc-shadow-panel: 0 6px 24px rgba(0, 0, 0, .6); | |||
--toc-shadow-drag: 0 6px 20px rgba(0, 0, 0, .7); | |||
} | |||
} | |||
/* ============================================================ | |||
Кнопка | |||
============================================================ */ | |||
.gadget-toc__btn { | .gadget-toc__btn { | ||
position: relative; | position: relative; | ||
| Строка 14: | Строка 74: | ||
border-radius: 50%; | border-radius: 50%; | ||
border: none; | border: none; | ||
background: | background: var(--toc-bg); | ||
box-shadow: | box-shadow: var(--toc-shadow); | ||
cursor: | cursor: grab; | ||
display: grid; | display: grid; | ||
place-items: center; | place-items: center; | ||
| Строка 22: | Строка 82: | ||
pointer-events: none; | pointer-events: none; | ||
transition: opacity .2s ease, transform .2s ease; | transition: opacity .2s ease, transform .2s ease; | ||
touch-action: none; | |||
user-select: none; | |||
} | } | ||
.gadget-toc.is-visible .gadget-toc__btn { | .gadget-toc.is-visible .gadget-toc__btn { | ||
| Строка 30: | Строка 92: | ||
transform: scale(1.05); | transform: scale(1.05); | ||
} | } | ||
.gadget-toc__btn.is-dragging { | |||
cursor: grabbing; | |||
transform: scale(1.1); | |||
transition: none; | |||
box-shadow: var(--toc-shadow-drag); | |||
} | |||
/* ============================================================ | |||
Кольцо прогресса | |||
============================================================ */ | |||
.gadget-toc__ring { | .gadget-toc__ring { | ||
position: absolute; | position: absolute; | ||
| Строка 37: | Строка 109: | ||
.gadget-toc__ring-bg { | .gadget-toc__ring-bg { | ||
fill: none; | fill: none; | ||
stroke: | stroke: var(--toc-ring-bg); | ||
stroke-width: 3; | stroke-width: 3; | ||
} | } | ||
.gadget-toc__ring-fg { | .gadget-toc__ring-fg { | ||
fill: none; | fill: none; | ||
stroke: | stroke: var(--toc-accent); | ||
stroke-width: 3; | stroke-width: 3; | ||
stroke-linecap: round; | stroke-linecap: round; | ||
| Строка 50: | Строка 122: | ||
font-size: 11px; | font-size: 11px; | ||
font-weight: 600; | font-weight: 600; | ||
color: | color: var(--toc-accent); | ||
} | } | ||
/* ============================================================ | |||
Панель | |||
============================================================ */ | |||
.gadget-toc__panel { | .gadget-toc__panel { | ||
position: absolute; | position: absolute; | ||
| Строка 60: | Строка 135: | ||
max-height: 60vh; | max-height: 60vh; | ||
overflow: auto; | overflow: auto; | ||
background: | background: var(--toc-bg); | ||
color: var(--toc-fg); | |||
border-radius: 10px; | border-radius: 10px; | ||
box-shadow: | box-shadow: var(--toc-shadow-panel); | ||
padding: 8px; | padding: 8px; | ||
} | } | ||
| Строка 71: | Строка 147: | ||
font-weight: 600; | font-weight: 600; | ||
padding: 4px 8px 8px; | padding: 4px 8px 8px; | ||
border-bottom: 1px solid | border-bottom: 1px solid var(--toc-border); | ||
} | } | ||
.gadget-toc__close { | .gadget-toc__close { | ||
border: none; | border: none; | ||
background: none; | background: none; | ||
color: var(--toc-fg); | |||
font-size: 20px; | font-size: 20px; | ||
cursor: pointer; | cursor: pointer; | ||
| Строка 89: | Строка 166: | ||
padding: 6px 10px; | padding: 6px 10px; | ||
border-radius: 6px; | border-radius: 6px; | ||
color: | color: var(--toc-fg); | ||
text-decoration: none; | text-decoration: none; | ||
border-left: 3px solid transparent; | border-left: 3px solid transparent; | ||
| Строка 98: | Строка 175: | ||
} | } | ||
.gadget-toc__item a:hover { | .gadget-toc__item a:hover { | ||
background: | background: var(--toc-hover); | ||
} | } | ||
.gadget-toc__item a.is-active { | .gadget-toc__item a.is-active { | ||
background: | background: var(--toc-active-bg); | ||
border-left-color: | border-left-color: var(--toc-active-border); | ||
font-weight: 600; | font-weight: 600; | ||
} | } | ||
.gadget-toc__item a.is-done { | .gadget-toc__item a.is-done { | ||
color: | color: var(--toc-muted); | ||
} | } | ||
/* Отступ под фиксированную шапку */ | /* ============================================================ | ||
Отступ под фиксированную шапку | |||
============================================================ */ | |||
#mw-content-text h2, | #mw-content-text h2, | ||
#mw-content-text h3 { | #mw-content-text h3 { | ||
| Строка 115: | Строка 194: | ||
} | } | ||
/* ============================================================ | |||
Мобильный bottom-sheet | |||
============================================================ */ | |||
@media ( max-width: 719px ) { | @media ( max-width: 719px ) { | ||
.gadget-toc__panel { | .gadget-toc__panel { | ||
| Строка 127: | Строка 209: | ||
} | } | ||
/* ============================================================ | |||
Reduced motion | |||
============================================================ */ | |||
@media ( prefers-reduced-motion: reduce ) { | @media ( prefers-reduced-motion: reduce ) { | ||
.gadget-toc__btn, | .gadget-toc__btn, | ||
| Строка 135: | Строка 220: | ||
} | } | ||
/* ============================================================ | |||
Печать | |||
============================================================ */ | |||
@media print { | @media print { | ||
.gadget-toc { | .gadget-toc { | ||