Template:Theme-HJ: Difference between revisions
From HUIJIA FUN
PlurimodSU (talk | contribs) Color scheme debug |
PlurimodSU (talk | contribs) Design System and Theme updated to V5.0 |
||
| Line 3: | Line 3: | ||
<style> | <style> | ||
/** | /** | ||
* HUIJIA FUN - TIMELESS | * HUIJIA FUN - TIMELESS THEME - HJ V5.0 | ||
* | * VGR Design System: Archive Zone / site-wide default theme | ||
* | * Changes: uses VGR tokens; body text in Zhuque Fangsong; square corners, no shadows; keeps the dot pattern and graded heading rules; | ||
* scroll fade-ins removed; overrides the pink of Timeless and Tabber | |||
*/ | */ | ||
/* | /* === 0. Fonts === | ||
@import url('https://fonts.googleapis.com/css2?family= | Source Sans 3 / Source Serif 4 are the Latin halves of the same families as Noto Sans SC / Noto Serif SC (Source Han Sans / Serif). | ||
Latin first, Chinese second: English italics come from the Latin font, while Chinese stays upright. */ | |||
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Noto+Serif+SC:wght@400;600&family=Source+Sans+3:ital,wght@0,400;0,500;0,700;1,400&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=JetBrains+Mono:wght@400;700&display=swap'); | |||
@import url('https://cdn.jsdelivr.net/npm/[email protected]/style.css'); | |||
/* Zhuque Fangsong: body font. Loaded in character slices, so only the glyphs a page uses are downloaded. SIL OFL 1.1 */ | |||
@import url('https://cdn.jsdelivr.net/npm/@chinese-fonts/[email protected]/dist/ZhuqueFangsong-Regular/result.css'); | |||
/* === 1. Tokens (light) === */ | |||
:root { | :root { | ||
-- | /* Source colors */ | ||
-- | --src-huijia-green: #025F32; | ||
-- | --src-dragon-green: #3B7E3D; | ||
-- | --src-gate-grey: #969682; | ||
-- | --src-plurimod-light: #C1E1A6; | ||
-- | --src-huashao-blue: #002F9C; | ||
-- | |||
-- | /* Semantic colors */ | ||
--font- | --paper: #F3F5F1; | ||
--font-body: | --paper-raised: #FFFFFF; | ||
--font- | --paper-sunk: #E7ECE5; | ||
-- | --ink: #16211B; | ||
--ink-muted: #4C5A51; | |||
--rule: #C9D3CA; | |||
--rule-strong: #7E8B81; | |||
--accent: #025F32; | |||
--accent-fill: #025F32; | |||
--on-accent: #FFFFFF; | |||
--accent-tint: #DCEBD9; | |||
--link: #0B6B3A; | |||
--link-new: #A8432F; | |||
--focus: #002F9C; | |||
--heading-bar: #C8D8C8; /* graded rules under headings */ | |||
--dot: #A3B1A8; /* dot pattern on the content card */ | |||
/* Type */ | |||
--font-display: Huiwen, "Source Serif 4", "Noto Serif SC", "Source Han Serif SC", serif; | |||
--font-serif: "Source Serif 4", "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif; | |||
--font-sans: "Source Sans 3", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; | |||
/* Body: Fangsong, the tone of archives and official documents. Falls back to Noto Serif SC if it fails to load */ | |||
--font-body: "Source Serif 4", "Zhuque Fangsong (technical preview)", "Noto Serif SC", "Source Han Serif SC", "FangSong", "STFangsong", serif; | |||
--font-latin: "Cormorant Garamond", "EB Garamond", Georgia, serif; | |||
--font-scripture: "LXGW WenKai Screen", "Kaiti SC", STKaiti, KaiTi, serif; | |||
--font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace; | |||
/* Spacing and radius */ | |||
--space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; | |||
--space-6: 24px; --space-8: 32px; --space-12: 48px; | |||
--radius-none: 0; --radius-xs: 2px; --radius-sm: 4px; --radius-pill: 999px; | |||
/* Point the Timeless / Codex / FlowThread primary-color variables at Huijia Green, replacing the skin's pink */ | |||
--color-primary: var(--accent); | |||
--color-progressive: var(--accent); | |||
--color-progressive--hover: var(--src-dragon-green); | |||
--background-color-progressive: var(--accent-fill); | |||
--border-color-progressive: var(--accent); | |||
--color-link: var(--link); | |||
--color-link--visited: var(--link); | |||
--color-link-red: var(--link-new); | |||
/* Legacy variable names, kept for other templates */ | |||
--mw-primary: var(--accent); | |||
--mw-accent: var(--src-dragon-green); | |||
--mw-link: var(--link); | |||
--mw-border: var(--rule); | |||
--font-heading: var(--font-serif); | |||
--font-code: var(--font-mono); | |||
} | |||
/* === 1b. Tokens (dark) | |||
Applies only under MediaWiki's night-mode class and does not follow the system setting: | |||
Common.css and other templates are not dark-ready yet, so following the system would leave some elements dark-on-dark. */ | |||
html.skin-theme-clientpref-night { | |||
--paper: #111613; | |||
--paper-raised: #18201B; | |||
--paper-sunk: #0C100E; | |||
--ink: #E4EBE5; | |||
--ink-muted: #A2B0A6; | |||
--rule: #2A352E; | |||
--rule-strong: #667A6C; | |||
--accent: #C1E1A6; | |||
--accent-fill: #3B7E3D; | |||
--accent-tint: #1C2B21; | |||
--link: #8FD3A8; | |||
--link-new: #F0907E; | |||
--focus: #8FB0FF; | |||
--heading-bar: #2F4033; | |||
--dot: #2A352E; | |||
color-scheme: dark; | |||
} | } | ||
/* | /* === 2. Page and body text === */ | ||
body { | body { | ||
background-color: var(-- | background-color: var(--paper); | ||
color: | color: var(--ink); | ||
font-family: var(--font-sans); | |||
font-size: 16px; | |||
line-height: 1.8; | |||
accent-color: var(--accent); | |||
-webkit-font-smoothing: antialiased; | |||
} | |||
/* Body text uses Fangsong; UI elements such as navigation, tables and buttons stay in sans (set in their own sections) */ | |||
.mw-parser-output { | |||
font-family: var(--font-body); | font-family: var(--font-body); | ||
line-height: 1. | font-size: 16px; | ||
- | line-height: 1.9; | ||
letter-spacing: 0.02em; | |||
} | } | ||
.mw-parser-output b, | |||
.mw-parser-output strong { font-family: var(--font-serif); font-weight: 600; letter-spacing: 0; } | |||
/* Chinese has no true italic: stop the browser from faking slanted Chinese; Latin italics work as usual */ | |||
i, em, cite, .mw-parser-output i { font-synthesis: none; } | |||
} | |||
::selection { background: var(--accent-fill); color: var(--on-accent); } | |||
} | |||
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } | |||
} | |||
# | /* === 3. Header === */ | ||
#mw-header-container { | |||
background: var(--paper-raised); | |||
border-bottom: 1px solid var(--rule); | |||
box-shadow: none; | |||
} | } | ||
#p-banner, #p-banner a, .mw-wiki-title { | |||
#p- | font-family: var(--font-sans); | ||
font-weight: 500; | |||
letter-spacing: 0.04em; | |||
color: var(--ink) !important; | |||
} | } | ||
/* | /* === 4. Search box (the only pill shape) === */ | ||
#p-search { | #p-search { | ||
margin: 0 20px !important; | margin: 0 20px !important; | ||
| Line 76: | Line 147: | ||
align-items: center; | align-items: center; | ||
} | } | ||
#searchform { | #searchform { | ||
background: | background: var(--paper-raised) !important; | ||
border: 1px solid var(-- | border: 1px solid var(--rule-strong) !important; | ||
border-radius: | border-radius: var(--radius-pill) !important; | ||
display: flex !important; | display: flex !important; | ||
flex-direction: row !important; | flex-direction: row !important; | ||
align-items: center !important; | align-items: center !important; | ||
padding: 2px 4px 2px | padding: 2px 4px 2px 16px !important; | ||
max-width: 350px; | |||
overflow: hidden; | overflow: hidden; | ||
box-shadow: none !important; | |||
transition: border-color 0.2s ease; | |||
} | } | ||
#searchform:focus-within { | #searchform:focus-within { | ||
border-color: var(-- | border-color: var(--accent) !important; | ||
outline: 2px solid var(--focus); | |||
outline-offset: 2px; | |||
} | } | ||
#simpleSearch { | #simpleSearch { | ||
background: transparent !important; | background: transparent !important; | ||
| Line 102: | Line 172: | ||
align-items: center !important; | align-items: center !important; | ||
} | } | ||
#searchInput { | #searchInput { | ||
background: transparent !important; | background: transparent !important; | ||
border: none !important; | border: none !important; | ||
box-shadow: none !important; | box-shadow: none !important; | ||
font-family: var(--font- | font-family: var(--font-sans); | ||
font-size: | font-size: 14px !important; | ||
padding: 8px 0 !important; | padding: 8px 0 !important; | ||
color: | color: var(--ink) !important; | ||
width: 100% !important; | width: 100% !important; | ||
outline: none; | |||
} | |||
#searchInput::placeholder { color: var(--ink-muted); } | |||
/* === 5. Logo === */ | |||
#p-logo, .mw-portlet-logo { | |||
display: flex !important; | |||
justify-content: center; | |||
align-items: center; | |||
padding: 20px 0 !important; | |||
margin-bottom: 10px; | |||
} | |||
#p-logo img { | |||
border-radius: var(--radius-none); | |||
box-shadow: none; | |||
} | } | ||
/* --- | /* === 6. Left and right sidebars === */ | ||
.sidebar-chunk { | |||
font-family: var(--font- | background-color: var(--paper-raised); | ||
font- | border: 1px solid var(--rule); | ||
letter-spacing: | border-radius: var(--radius-none); | ||
box-shadow: none; | |||
margin-bottom: var(--space-4); | |||
padding: var(--space-4); | |||
} | |||
.sidebar-chunk h2, | |||
.sidebar-chunk h3, | |||
.mw-portlet h3 { | |||
/* Group names (Navigation / Hubs / Setting Zone / Page tools…): Source Serif / Noto Serif SC */ | |||
font-family: var(--font-serif) !important; | |||
font-size: 15px !important; | |||
font-weight: 600 !important; | |||
letter-spacing: 0.1em; | |||
text-transform: none; | |||
color: var(--ink) !important; | |||
border: none !important; | |||
border-bottom: 2px solid var(--heading-bar) !important; | |||
padding-bottom: 6px; | |||
margin-bottom: var(--space-3); | |||
} | |||
.sidebar-chunk li a, | |||
.sidebar-chunk li a span, | |||
.mw-portlet-body li a, | |||
.mw-portlet-body li a span { | |||
/* Nav links: Zhuque Fangsong, matching the body text */ | |||
color: var(--ink) !important; | |||
font-family: var(--font-body) !important; | |||
font-size: 15.5px; | |||
letter-spacing: 0.04em; | |||
} | |||
.sidebar-chunk li a:hover, | |||
.mw-portlet-body li a:hover { | |||
color: var(--accent) !important; | |||
text-decoration: none; | |||
} | |||
/* === 7. Content card === */ | |||
#mw-content-wrapper { | |||
background: transparent; | |||
padding-top: 0; | |||
box-shadow: none; | |||
} | |||
#mw-content { | |||
background-color: var(--paper-raised); | |||
/* dot pattern: 1px dots on a 20px grid */ | |||
background-image: radial-gradient(var(--dot) 0px, transparent 1px); | |||
background-size: 20px 20px; | |||
border: 1px solid var(--rule); | |||
border-radius: var(--radius-none); | |||
box-shadow: none; | |||
padding: var(--space-6) var(--space-8); | |||
} | |||
/* Page tabs (Read / Edit / History / Discussion): the selected tab uses Huijia Green instead of pink */ | |||
#mw-content-block .mw-portlet li a, | |||
#mw-content-block .mw-portlet li a .mw-ui-icon::before { | |||
color: var(--ink-muted) !important; | |||
} | |||
/* Page tab labels (Template / Discussion / Read / Edit / History): Zhuque Fangsong */ | |||
#mw-content-block .mw-portlet li a, | |||
#mw-content-block .mw-portlet li a span { | |||
font-family: var(--font-body) !important; | |||
font-size: 15.5px; | |||
letter-spacing: 0.06em; | |||
} | |||
#mw-content-block .mw-portlet li.selected a, | |||
#mw-content-block .mw-portlet li.selected a .mw-ui-icon::before { | |||
color: var(--accent) !important; | |||
} | |||
#mw-content-block .mw-portlet li.selected a { | |||
border-bottom: 2px solid var(--accent) !important; | |||
box-shadow: none !important; | |||
} | |||
#mw-content-block .mw-portlet li a:hover { color: var(--ink) !important; } | |||
/* Tabber (e.g. the Main Page "Site info / Create a page" tabs) */ | |||
.tabber__tab { color: var(--ink-muted) !important; font-family: var(--font-body) !important; font-size: 15.5px; letter-spacing: 0.06em; } | |||
.tabber__tab[aria-selected="true"] { color: var(--accent) !important; } | |||
.tabber__indicator { background: var(--accent) !important; } | |||
.tabber .tabbernav li a { color: var(--ink-muted) !important; font-family: var(--font-body) !important; letter-spacing: 0.06em; } | |||
.tabber .tabbernav li.tabberactive a { | |||
color: var(--accent) !important; | |||
border-bottom-color: var(--accent) !important; | |||
} | } | ||
. | /* === 8. Headings === */ | ||
h1.firstHeading { | |||
font-family: var(--font-serif); | |||
font-size: 30px; | |||
font-weight: 600; | |||
line-height: 1.3; | |||
color: var(--ink) !important; | |||
letter-spacing: 0; | |||
border-bottom: 4px solid var(--heading-bar); | |||
padding-bottom: var(--space-2); | |||
margin-bottom: var(--space-6); | |||
text-wrap: balance; | |||
} | } | ||
.mw-parser-output h1, | |||
.mw-parser-output | .mw-parser-output h2, | ||
.mw-parser-output | .mw-parser-output h3, | ||
.mw-parser-output h4, | |||
.mw-parser-output h5, | |||
.mw-parser-output h6 { | |||
font-family: var(--font-serif) !important; | |||
font-weight: 600; | |||
color: var(--ink) !important; | |||
letter-spacing: 0; | |||
text-wrap: balance; | |||
padding-bottom: var(--space-2); | |||
overflow: hidden; | |||
} | |||
.mw-parser-output h3, .mw-parser-output h4, .mw-parser-output h5, .mw-parser-output h6 { | /* Graded rules: full width under h1 and h2; from h3 down, shorter and fainter at each level */ | ||
border | .mw-parser-output h1 { | ||
font-size: 26px; | |||
line-height: 1.3; | |||
border-bottom: 4px solid var(--heading-bar) !important; | |||
margin: var(--space-8) 0 var(--space-3); | |||
} | |||
.mw-parser-output h2 { | |||
font-size: 23px; | |||
line-height: 1.35; | |||
border: none !important; | |||
border-bottom: 4px solid var(--heading-bar) !important; | |||
margin: var(--space-8) 0 var(--space-3); | |||
} | |||
.mw-parser-output h3 { | |||
font-size: 19px; | |||
line-height: 1.45; | |||
margin: var(--space-6) 0 var(--space-2); | |||
} | |||
.mw-parser-output h4 { | |||
font-size: 17px; | |||
line-height: 1.5; | |||
margin: var(--space-4) 0 var(--space-2); | |||
} | |||
.mw-parser-output h5 { | |||
font-size: 15px; | |||
line-height: 1.5; | |||
margin: var(--space-4) 0 var(--space-1); | |||
} | |||
.mw-parser-output h6 { | |||
font-family: var(--font-sans) !important; | |||
font-size: 13px; | |||
font-weight: 500; | |||
letter-spacing: 0.08em; | |||
color: var(--ink-muted) !important; | |||
margin: var(--space-4) 0 var(--space-1); | |||
} | |||
.mw-parser-output h3, | |||
.mw-parser-output h4, | |||
.mw-parser-output h5, | |||
.mw-parser-output h6 { | |||
border: none !important; | |||
position: relative; | position: relative; | ||
} | } | ||
.mw-parser-output h3::after, | |||
.mw-parser-output h3::after, .mw-parser-output h4::after, .mw-parser-output h5::after, .mw-parser-output h6::after { | .mw-parser-output h4::after, | ||
.mw-parser-output h5::after, | |||
.mw-parser-output h6::after { | |||
content: ""; | content: ""; | ||
display: block; | display: block; | ||
position: absolute; | position: absolute; | ||
left: 0; | |||
bottom: 0; | bottom: 0; | ||
height: 4px; | height: 4px; | ||
background-color: | background-color: var(--heading-bar); | ||
border-radius: 2px; | border-radius: 2px; | ||
} | } | ||
.mw-parser-output h3::after { width: 80%; opacity: 1; } | .mw-parser-output h3::after { width: 80%; opacity: 1; } | ||
.mw-parser-output h4::after { width: 60%; opacity: 0.8; } | .mw-parser-output h4::after { width: 60%; opacity: 0.8; } | ||
| Line 154: | Line 378: | ||
.mw-parser-output h6::after { width: 20%; opacity: 0.4; } | .mw-parser-output h6::after { width: 20%; opacity: 0.4; } | ||
#personal h2, | |||
#personal .header-avatar { overflow: visible; } | |||
} | |||
/* === 9. Links === */ | |||
.mw-parser-output a, | |||
#catlinks a { color: var(--link); text-decoration: none; } | |||
.mw-parser-output a:visited { color: var(--link); } | |||
.mw-parser-output a:hover { text-decoration: underline; text-underline-offset: 3px; } | |||
.mw-parser-output a.new, | |||
} | .mw-parser-output a.new:visited { color: var(--link-new); } | ||
/* === 10. Code === */ | |||
/* | |||
code { | code { | ||
background-color: | background-color: var(--paper-sunk); | ||
color: | color: var(--ink); | ||
padding: | padding: 2px 6px; | ||
border-radius: | border-radius: var(--radius-xs); | ||
font-family: var(--font- | font-family: var(--font-mono); | ||
font-size: | font-size: 13px; | ||
} | } | ||
pre { | pre { | ||
background-color: | position: relative; | ||
border: 1px solid var(-- | background-color: var(--paper-sunk) !important; | ||
border- | color: var(--ink); | ||
padding | border: 1px solid var(--rule) !important; | ||
border-radius: var(--radius-none); | |||
font-family: var(--font- | padding: var(--space-4) !important; | ||
font-family: var(--font-mono) !important; | |||
font-size: 13px; | |||
line-height: 1.6; | line-height: 1.6; | ||
overflow-x: auto; | overflow-x: auto; | ||
} | } | ||
/* | /* === 11. Tables (override Common.css's solid deep-green header row and zebra striping) === */ | ||
. | .mw-parser-output table.wikitable { | ||
background-color: var(-- | width: auto; | ||
border- | background: var(--paper-raised); | ||
border: | color: var(--ink); | ||
border: none; | |||
border-top: 2px solid var(--accent); | |||
border-bottom: 1px solid var(--rule-strong); | |||
border-collapse: collapse; | |||
border-radius: var(--radius-none); | |||
box-shadow: none; | |||
overflow: visible; | |||
font-family: var(--font-sans); | |||
font-size: 14px; | |||
} | } | ||
.mw-parser-output table.wikitable > * > tr > th, | |||
. | .mw-parser-output table.wikitable > tr > th { | ||
font-size: | background: transparent; | ||
color: var(--accent); | |||
letter-spacing: | font-family: var(--font-sans); | ||
font-size: 12px; | |||
font-weight: 700; | |||
letter-spacing: 0.08em; | |||
text-align: left; | |||
padding: 10px 12px; | |||
border: none; | border: none; | ||
border-bottom: 1px solid var(--rule-strong); | |||
} | } | ||
.mw-parser-output table.wikitable > * > tr > td, | |||
.mw-parser-output table.wikitable > tr > td { | |||
table.wikitable | color: var(--ink); | ||
padding: 9px 12px; | |||
border: none; | |||
border-bottom: 1px solid var(--rule); | |||
vertical-align: top; | |||
table.wikitable | |||
padding: 12px; | |||
border- | |||
} | } | ||
.mw-parser-output table.wikitable > tbody > tr:nth-of-type(even) { background: transparent; } | |||
.mw-parser-output table.wikitable > tbody > tr:last-of-type > td { border-bottom: none; } | |||
.mw-parser-output table.wikitable > tbody > tr:hover td { background: var(--accent-tint); color: var(--ink); } | |||
/* === 12. Category bar and footer === */ | |||
/* | |||
#catlinks { | #catlinks { | ||
background-color: | background-color: var(--paper-sunk); | ||
border: 1px solid var(-- | border: 1px solid var(--rule); | ||
border-radius: var(-- | border-radius: var(--radius-none); | ||
padding: | padding: var(--space-3) var(--space-4); | ||
font-size: 13px; | |||
color: var(--ink-muted); | |||
} | } | ||
.mw-footer { | .mw-footer { | ||
background-color: var(-- | background-color: var(--paper-sunk); | ||
color: var(--ink-muted); | |||
border- | border-top: 1px solid var(--rule); | ||
margin-top: | border-radius: var(--radius-none); | ||
margin-top: var(--space-12); | |||
padding: var(--space-6) var(--space-8); | |||
font-size: 13px; | |||
} | } | ||
.mw-footer a { color: var(--ink-muted); } | |||
.mw-footer-container { background: transparent; } | |||
. | /* === 13. Pink from Common.css (temporary override; better to fix Common.css itself later) === */ | ||
textarea:hover, | |||
textarea:focus-visible { border-color: var(--accent) !important; box-shadow: none !important; } | |||
.navbox th, .navbox-title { background: var(--accent-tint) !important; color: var(--ink); } | |||
.navbox-abovebelow, th.navbox-group, .navbox-subgroup .navbox-title { background: var(--paper-sunk) !important; } | |||
.navbox-subgroup .navbox-group, .navbox-subgroup .navbox-abovebelow { background: var(--paper) !important; } | |||
.navbox-even { background: var(--paper) !important; } | |||
.repost-circle, .repost-circle a.external { color: var(--accent) !important; border-color: var(--accent) !important; } | |||
/* | /* === 14. Mobile (≤850px) === */ | ||
@media screen and (max-width: 850px) { | @media screen and (max-width: 850px) { | ||
#mw-content { padding: var(--space-4); } | |||
/* Restore Timeless mobile nav (in case global rules interfere) */ | /* Restore Timeless mobile nav (in case global rules interfere) */ | ||
#mw-mf-page-left, .dropdown, .dropdown-active, | #mw-mf-page-left, .dropdown, .dropdown-active, | ||
#mw-related-navigation, | |||
#site-tools, #personal { | #site-tools, #personal { | ||
height: auto !important; | height: auto !important; | ||
max-height: none !important; | max-height: none !important; | ||
overflow: visible !important; | overflow: visible !important; | ||
} | |||
/* Cap the logo size so it can't blow up when the sidebar renders incorrectly */ | |||
#p-logo img { | |||
max-width: 180px !important; | |||
width: auto !important; | |||
height: auto !important; | |||
} | } | ||
| Line 289: | Line 507: | ||
max-height: 70vh !important; | max-height: 70vh !important; | ||
overflow-y: auto !important; | overflow-y: auto !important; | ||
background-color: var(-- | background-color: var(--paper-raised) !important; | ||
border: 1px solid var(-- | border: 1px solid var(--rule) !important; | ||
border-radius: var(-- | border-radius: var(--radius-none) !important; | ||
box-shadow: | box-shadow: none !important; | ||
z-index: 9999 !important; | z-index: 9999 !important; | ||
position: relative !important; | position: relative !important; | ||
| Line 302: | Line 520: | ||
} | } | ||
/* Hide the empty | /* Hide the empty sidebar/portlet shells */ | ||
.sidebar-chunk:empty, | .sidebar-chunk:empty, | ||
.mw-portlet:empty, | .mw-portlet:empty, | ||
| Line 320: | Line 538: | ||
} | } | ||
#mw-content-block { | #mw-content-block { background: transparent !important; } | ||
.mw-parser-output table.wikitable { | |||
display: block; | |||
overflow-x: auto; | |||
white-space: normal; | |||
} | } | ||
} | } | ||
/* === 15. Reading progress bar and copy button === */ | |||
#reading-progress-container { | |||
position: fixed; | |||
left: 0; | |||
bottom: 0; | |||
width: 100%; | |||
height: 3px; | |||
background: var(--rule); | |||
z-index: 9999; | |||
pointer-events: none; | |||
} | |||
#reading-progress-bar { | |||
height: 100%; | |||
width: 0; | |||
background: var(--accent-fill); | |||
} | |||
.code-copy-btn { | |||
position: absolute; | |||
top: 8px; | |||
right: 8px; | |||
font-family: var(--font-sans); | |||
font-size: 12px; | |||
font-weight: 500; | |||
letter-spacing: 0.04em; | |||
padding: 4px 10px; | |||
color: var(--on-accent); | |||
background: var(--accent-fill); | |||
border: none; | |||
border-radius: var(--radius-sm); | |||
cursor: pointer; | |||
opacity: 0; | |||
transition: opacity 0.2s ease; | |||
} | |||
pre:hover .code-copy-btn, | |||
.code-copy-btn:focus-visible { opacity: 1; } | |||
@media (prefers-reduced-motion: reduce) { | |||
* { transition: none !important; animation: none !important; } | |||
} | |||
</style> | </style> | ||
<script> | <script> | ||
/** | /** | ||
* HUIJIA FUN - UI ENHANCEMENTS ( | * HUIJIA FUN - UI ENHANCEMENTS (v5.0) | ||
* | * Kept: bottom reading progress bar, code copy button | ||
* | * Removed: scroll fade-ins (headings started transparent and vanished if the script failed) | ||
*/ | */ | ||
(function () { | |||
(function() { | |||
"use strict"; | "use strict"; | ||
if (window.__hjThemeLoaded) return; /* don't run twice when a page includes the template twice */ | |||
window.__hjThemeLoaded = true; | |||
var isZh = (document.documentElement.lang || "").toLowerCase().indexOf("zh") === 0; | |||
var LABEL = isZh ? { copy: "复制", done: "已复制", fail: "请手动复制" } | |||
: { copy: "Copy", done: "Copied", fail: "Copy failed" }; | |||
function initProgressBar() { | |||
if (document.getElementById("reading-progress-container")) return; | |||
container.id = | var container = document.createElement("div"); | ||
container.id = "reading-progress-container"; | |||
bar.id = | var bar = document.createElement("div"); | ||
bar.id = "reading-progress-bar"; | |||
container.appendChild(bar); | container.appendChild(bar); | ||
document.body.appendChild(container); | document.body.appendChild(container); | ||
var ticking = false; | |||
function update() { | |||
var top = window.pageYOffset || document.documentElement.scrollTop; | |||
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; | |||
bar.style.width = (height > 0 ? (top / height) * 100 : 0) + "%"; | |||
}); | ticking = false; | ||
} | } | ||
window.addEventListener("scroll", function () { | |||
if (!ticking) { ticking = true; window.requestAnimationFrame(update); } | |||
}, { passive: true }); | |||
update(); | |||
} | |||
function initCopyButtons() { | |||
document.querySelectorAll("#mw-content pre").forEach(function (block) { | |||
if (block.querySelector(".code-copy-btn")) return; | |||
if (block.querySelector( | var btn = document.createElement("button"); | ||
btn.type = "button"; | |||
btn.className = | btn.className = "code-copy-btn"; | ||
btn. | btn.textContent = LABEL.copy; | ||
btn.addEventListener("click", function () { | |||
btn.addEventListener( | var clone = block.cloneNode(true); | ||
var own = clone.querySelector(".code-copy-btn"); | |||
if (own) own.remove(); | |||
btn. | var text = clone.textContent.trim(); | ||
setTimeout(() | var done = function (label) { | ||
}); | btn.textContent = label; | ||
setTimeout(function () { btn.textContent = LABEL.copy; }, 2000); | |||
}; | |||
if (navigator.clipboard && navigator.clipboard.writeText) { | |||
navigator.clipboard.writeText(text).then( | |||
function () { done(LABEL.done); }, | |||
function () { done(LABEL.fail); } | |||
); | |||
} else { | |||
done(LABEL.fail); | |||
} | |||
}); | }); | ||
block.appendChild(btn); | block.appendChild(btn); | ||
}); | }); | ||
} | } | ||
function init() { | |||
initProgressBar(); | initProgressBar(); | ||
initCopyButtons(); | initCopyButtons(); | ||
} | |||
}); | |||
if (document.readyState === "loading") { | |||
document.addEventListener("DOMContentLoaded", init); | |||
} else { | |||
init(); | |||
} | |||
})(); | })(); | ||
</script> | </script> | ||
| Line 463: | Line 668: | ||
</includeonly><noinclude>{{Theme-HJ}} | </includeonly><noinclude>{{Theme-HJ}} | ||
==Description== | ==Description== | ||
'''Theme-HJ''' is the theme for HUIJIA FUN's Archive Zone and the site-wide default pages, built strictly on the VGR Design System. Its features: a cool, green-tinted grey paper ground, a "Huijia Green" accent, square corners and no shadows; the content card carries a dot pattern, and headings sit on rules that get shorter and fainter at each level. | |||
Author: [[User:PlurimodSU| | |||
==Origin== | |||
Author: [[User:PlurimodSU|Marina Malinti]] | |||
===Note=== | ===Note=== | ||
To use this theme on a page, simply add the following code directly to the page's source code: | To use this theme on a page, simply add the following code directly to the page's source code: | ||
<pre>{{Theme-HJ}}</pre> | <pre>{{Theme-HJ}}</pre> | ||
==Test== | |||
A body paragraph with an [[Main Page|internal link]], a [[Nonexistent Page|red link]] and some <code>inline code</code>. ''English italic stays italic; 中文不会被压斜。'' | |||
===Subheading 3=== | |||
====Subheading 4==== | |||
=====Subheading 5===== | |||
======Subheading 6====== | |||
{| class="wikitable" | |||
! Event !! S.C. !! O. | |||
|- | |||
| Sample event A || 1999 || 0 | |||
|- | |||
| Sample event B || 2021 || 22 | |||
|} | |||
<pre>{{Theme-HJ}}</pre> | |||
==Test 2== | |||
===Subheading 3=== | |||
====Subheading 4==== | |||
=====Subheading 5===== | |||
======Subheading 6====== | |||
[[Category:Template-Theme]] | [[Category:Template-Theme]] | ||
</noinclude> | </noinclude> | ||
Revision as of 03:09, 3 October 2026
Description
Theme-HJ is the theme for HUIJIA FUN's Archive Zone and the site-wide default pages, built strictly on the VGR Design System. Its features: a cool, green-tinted grey paper ground, a "Huijia Green" accent, square corners and no shadows; the content card carries a dot pattern, and headings sit on rules that get shorter and fainter at each level.
Origin
Author: Marina Malinti
Note
To use this theme on a page, simply add the following code directly to the page's source code:
{{Theme-HJ}}
Test
A body paragraph with an internal link, a red link and some inline code. English italic stays italic; 中文不会被压斜。
Subheading 3
Subheading 4
Subheading 5
Subheading 6
| Event | S.C. | O. |
|---|---|---|
| Sample event A | 1999 | 0 |
| Sample event B | 2021 | 22 |
{{Theme-HJ}}
