fix(frontend): align top navigation with reference theme
This commit is contained in:
1 parent
1c501ff713
commit
9b27508a5b
12 files changed
+234
-607
No files matched your search
+32
-122
@@ -2708,122 +2708,43 @@ main.container,
|
||||
/**
|
||||
* Header account popover.
|
||||
*
|
||||
* The shared legacy navigation styles provide the popover shell, and every
|
||||
* account row (avatar, VIP bar, check-in, wallet tiles, stats badges) renders
|
||||
* through the reference legacy classes. This module only owns the navigation
|
||||
* shell anchoring plus the account action-row geometry.
|
||||
* The shared navigation rules own the layout. Restore the reference typography
|
||||
* and action controls where the public reset differs from Bootstrap 3.
|
||||
*/
|
||||
|
||||
/* The reference keeps the right cluster as three floated .navbar-form groups.
|
||||
* Bootstrap's base .navbar-form rule carries margin-top: 8px and the >=768px
|
||||
* override only zeroes the horizontal margins, so every right-cluster group
|
||||
* starts 8px below the top of .navbar-collapse. The 50px menu row and the logo
|
||||
* put the navbar midline at 25px, so a 34px cross-size lands a group's midline
|
||||
* at 8 + 17 = 25px. The publish/VIP chips already reach that line through their
|
||||
* own 0.4em margin stacked on the group's 8px; the account row reaches it from
|
||||
* its 34px icon tiles, and the theme group needs the same cross-size because
|
||||
* its 29px toggle is otherwise 2.5px high. Nothing here may restate a 50px
|
||||
* min-height: it would double-count the 8px and push that group's content 8px
|
||||
* below the line while inflating the navbar from 50px to 58px. */
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li > .sub-menu {
|
||||
top: calc(100% + 5px);
|
||||
right: 0;
|
||||
left: auto;
|
||||
z-index: 1002;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon,
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
padding: 0 !important;
|
||||
overflow: visible !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon .icon {
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-avatar .avatar {
|
||||
display: block;
|
||||
width: 29px;
|
||||
height: 29px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* The account-row chips, the theme and the language toggles all want the 29px
|
||||
* midline circle. The popover's quick-login buttons are .toggle-radius too and
|
||||
* also live inside .navbar-form, but they must keep the .social_loginbar
|
||||
* geometry from main.css: in a flex container flex-basis outranks width, so
|
||||
* without this exemption the buttons collapse to 29px and lose the 5px side
|
||||
* margins that space them apart. */
|
||||
.navbar-top .navbar-form .toggle-radius:not(.social-login-item):not(.xh-social-item) {
|
||||
flex: 0 0 29px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Match the account row's 34px cross-size so the 29px toggle shares the 25px
|
||||
* midline instead of sitting 2.5px above it. */
|
||||
.navbar-top .navbar-form.flex.ac {
|
||||
min-height: 34px;
|
||||
}
|
||||
|
||||
.navbar-top .navbar-form .aksrt-navbar-language {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* The reference keeps the publish/VIP hover wrapper a plain inline-block, so the
|
||||
* absolutely positioned .sub-vip-card takes its normal-flow static position.
|
||||
* The shared action cluster otherwise forces inline-flex on every child, which
|
||||
* would move that static position to the flex container's cross-start. */
|
||||
.navbar-top .navbar-but > .hover-show {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Keep the drop-down search panel above a fixed header (z-index: 999). */
|
||||
.header,
|
||||
.mobile-header,
|
||||
.navbar-search {
|
||||
z-index: 1001;
|
||||
opacity: 0;
|
||||
transform: translate3d(0, -24px, 0);
|
||||
transition: transform .24s ease, opacity .18s ease, visibility 0s linear .24s;
|
||||
will-change: transform, opacity;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
-webkit-font-smoothing: auto;
|
||||
-moz-osx-font-smoothing: auto;
|
||||
text-rendering: auto;
|
||||
}
|
||||
|
||||
.navbar-search.show {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0);
|
||||
transition-delay: 0s;
|
||||
/* Keep the logo inline so the centered mobile brand can use text-align. */
|
||||
.navbar-logo > img {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Reference .btn geometry without the public .btn skin. The 14px SVG keeps
|
||||
* main.css's 1em size and -0.15em baseline; list-inline owns the item spacing. */
|
||||
.navbar-top .aksrt-nav-icon {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
touch-action: manipulation;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.navbar-search .line-form-input:focus,
|
||||
@@ -2832,17 +2753,6 @@ main.container,
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.navbar-search .search-close-box {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
max-width: 660px;
|
||||
margin: 16px auto 0;
|
||||
}
|
||||
|
||||
.navbar-search .search-close-box > .but {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.aksrt-header-userbox {
|
||||
color: var(--color-ink-2);
|
||||
line-height: 1.42857143;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
:root{--color-primary: #f04494;--color-primary-hover: #e0307e;--color-primary-active: #c9206d;--color-primary-soft: rgba(240, 68, 148, .1);--color-primary-softer: rgba(240, 68, 148, .05);--color-on-primary: #FFFFFF;--color-ink: #333333;--color-ink-2: #4e5358;--color-ink-3: #777777;--color-ink-4: #999999;--surface-page: #f5f6f7;--surface-1: #FFFFFF;--surface-2: #eeeeee;--surface-3: #e9ecef;--surface-4: #f8f8f8;--color-line: rgba(50, 50, 50, .06);--color-line-soft: rgba(0, 0, 0, .03);--color-line-stronger: rgba(50, 50, 50, .12);--color-success: #10B981;--color-warning: #F59E0B;--color-error: #EF4444;--color-info: #3B82F6;--color-accent: #18a058;--color-accent-soft: rgba(24, 160, 88, .12);--color-accent-shadow: rgba(24, 160, 88, .28);--font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;--text-xs: .75rem;--text-sm: .875rem;--text-base: .875rem;--text-md: 1.125rem;--text-lg: 1.25rem;--text-xl: 1.5rem;--text-2xl: 1.875rem;--text-3xl: 2.25rem;--text-4xl: 3rem;--text-5xl: 3.75rem;--leading-tight: 1.2;--leading-snug: 1.4;--leading-normal: 1.6;--leading-relaxed: 1.6;--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 16px;--space-5: 20px;--space-6: 24px;--space-7: 32px;--space-8: 40px;--space-9: 48px;--space-10: 64px;--space-11: 80px;--space-12: 96px;--radius-xs: 3px;--radius-sm: 4px;--radius: 8px;--radius-lg: 8px;--radius-xl: 12px;--radius-2xl: 16px;--radius-pill: 100px;--radius-avatar: 50%;--shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);--shadow-sm: 0 0 10px rgba(116, 116, 116, .08);--shadow: 0 0 10px rgba(116, 116, 116, .12);--shadow-lg: 0 12px 32px rgba(18, 18, 18, .1);--shadow-drawer: 0 18px 60px rgba(0, 0, 0, .2);--nav-height: 60px;--container: 1200px;--container-wide: 1440px;--container-read: 760px;--container-page: 880px;--sidebar-width: 311px;--content-gap: 24px;--section-gap: 24px;--sidebar-bp: 992px;--ease: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-spring: cubic-bezier(.34, 1.56, .64, 1);--dur-fast: .15s;--dur: .25s;--dur-slow: .4s;--focus-ring: 0 0 2px 3px rgba(253, 83, 161, .4);--z-dropdown: 100;--z-sticky: 200;--z-fixed: 300;--z-overlay: 400;--z-modal: 500;--z-popover: 600;--z-toast: 700;--z-tooltip: 800;--radius-btn: 4px;--btn-sm-h: 28px;--btn-md-h: 34px;--btn-lg-h: 44px;--card-padding: 15px;--card-padding-sm: 10px;--card-gap: 16px;--card-gap-lg: 20px;--color-primary-light: var(--color-primary-soft);--color-surface: var(--surface-1);--color-line-strong: var(--color-line);--color-bg-hover: var(--surface-2);--color-border-light: var(--color-line-soft);--color-fill: var(--surface-2);--color-warning-bg: #fffbe6;--color-warning-text: #ad6800;--text-secondary: var(--color-ink-3);--text-tertiary: var(--color-ink-4);--surface-active: var(--surface-2);--surface-card: var(--surface-1);--surface-hover: var(--surface-2);--surface-secondary: var(--surface-2);--radius-code: var(--radius);--radius-full: 100px;--shadow-xl: 0 0 10px rgba(116, 116, 116, .12);--space-16: 64px;--z-floating: 900;--transition-fast: .15s ease;--transition-base: .25s ease;--header-bg: var(--blur-bg);--header-color: var(--color-ink-2);--footer-bg: var(--surface-1);--footer-color: var(--color-ink-4);--blur-bg: rgba(255, 255, 255, .8);--float-btn-bg: rgba(200, 200, 200, .4);--font-heading: var(--font-ui);--radius-card: var(--radius);--radius-md: var(--radius);--color-primary-50: var(--color-primary-soft);--color-primary-dark: var(--color-primary-active);--shadow-md: var(--shadow);--mini-radius: calc(var(--radius) / 1.4);--aksrt-avatar-size-xs: 24px;--aksrt-avatar-size-sm: 32px;--aksrt-avatar-size: 40px;--aksrt-avatar-size-lg: 56px;--aksrt-avatar-size-xl: 80px;--aksrt-card-thumb-scale: 56.25%;--aksrt-rose: #f43f5e;--aksrt-rose-soft: rgba(244, 63, 94, .12);--aksrt-blue: #3b82f6;--aksrt-blue-soft: rgba(59, 130, 246, .12);--aksrt-green: #10b981;--aksrt-green-soft: rgba(16, 185, 129, .12);--aksrt-orange: #f97316;--aksrt-orange-soft:rgba(249, 115, 22, .12);--aksrt-purple: #8b5cf6;--aksrt-purple-soft:rgba(139, 92, 246, .12);--aksrt-cyan: #06b6d4;--aksrt-cyan-soft: rgba(6, 182, 212, .12);--aksrt-yellow: #eab308;--aksrt-yellow-soft:rgba(234, 179, 8, .12);--aksrt-red: #ef4444;--aksrt-red-soft: rgba(239, 68, 68, .12);--aksrt-teal: #14b8a6;--aksrt-teal-soft: rgba(20, 184, 166, .12);--aksrt-indigo: #6366f1;--aksrt-indigo-soft:rgba(99, 102, 241, .12);--aksrt-pink: #ec4899;--aksrt-pink-soft: rgba(236, 72, 153, .12);--aksrt-vip-gold-1: #f6d365;--aksrt-vip-gold-2: #fda085;--aksrt-grad-sunset-1: #f093fb;--aksrt-grad-sunset-2: #f5576c;--aksrt-graLine truncated
|
||||
:root{--color-primary: #f04494;--color-primary-hover: #e0307e;--color-primary-active: #c9206d;--color-primary-soft: rgba(240, 68, 148, .1);--color-primary-softer: rgba(240, 68, 148, .05);--color-on-primary: #FFFFFF;--color-ink: #333333;--color-ink-2: #4e5358;--color-ink-3: #777777;--color-ink-4: #999999;--surface-page: #f5f6f7;--surface-1: #FFFFFF;--surface-2: #eeeeee;--surface-3: #e9ecef;--surface-4: #f8f8f8;--color-line: rgba(50, 50, 50, .06);--color-line-soft: rgba(0, 0, 0, .03);--color-line-stronger: rgba(50, 50, 50, .12);--color-success: #10B981;--color-warning: #F59E0B;--color-error: #EF4444;--color-info: #3B82F6;--color-accent: #18a058;--color-accent-soft: rgba(24, 160, 88, .12);--color-accent-shadow: rgba(24, 160, 88, .28);--font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;--text-xs: .75rem;--text-sm: .875rem;--text-base: .875rem;--text-md: 1.125rem;--text-lg: 1.25rem;--text-xl: 1.5rem;--text-2xl: 1.875rem;--text-3xl: 2.25rem;--text-4xl: 3rem;--text-5xl: 3.75rem;--leading-tight: 1.2;--leading-snug: 1.4;--leading-normal: 1.6;--leading-relaxed: 1.6;--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 16px;--space-5: 20px;--space-6: 24px;--space-7: 32px;--space-8: 40px;--space-9: 48px;--space-10: 64px;--space-11: 80px;--space-12: 96px;--radius-xs: 3px;--radius-sm: 4px;--radius: 8px;--radius-lg: 8px;--radius-xl: 12px;--radius-2xl: 16px;--radius-pill: 100px;--radius-avatar: 50%;--shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);--shadow-sm: 0 0 10px rgba(116, 116, 116, .08);--shadow: 0 0 10px rgba(116, 116, 116, .12);--shadow-lg: 0 12px 32px rgba(18, 18, 18, .1);--shadow-drawer: 0 18px 60px rgba(0, 0, 0, .2);--nav-height: 60px;--container: 1200px;--container-wide: 1440px;--container-read: 760px;--container-page: 880px;--sidebar-width: 311px;--content-gap: 24px;--section-gap: 24px;--sidebar-bp: 992px;--ease: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-spring: cubic-bezier(.34, 1.56, .64, 1);--dur-fast: .15s;--dur: .25s;--dur-slow: .4s;--focus-ring: 0 0 2px 3px rgba(253, 83, 161, .4);--z-dropdown: 100;--z-sticky: 200;--z-fixed: 300;--z-overlay: 400;--z-modal: 500;--z-popover: 600;--z-toast: 700;--z-tooltip: 800;--radius-btn: 4px;--btn-sm-h: 28px;--btn-md-h: 34px;--btn-lg-h: 44px;--card-padding: 15px;--card-padding-sm: 10px;--card-gap: 16px;--card-gap-lg: 20px;--color-primary-light: var(--color-primary-soft);--color-surface: var(--surface-1);--color-line-strong: var(--color-line);--color-bg-hover: var(--surface-2);--color-border-light: var(--color-line-soft);--color-fill: var(--surface-2);--color-warning-bg: #fffbe6;--color-warning-text: #ad6800;--text-secondary: var(--color-ink-3);--text-tertiary: var(--color-ink-4);--surface-active: var(--surface-2);--surface-card: var(--surface-1);--surface-hover: var(--surface-2);--surface-secondary: var(--surface-2);--radius-code: var(--radius);--radius-full: 100px;--shadow-xl: 0 0 10px rgba(116, 116, 116, .12);--space-16: 64px;--z-floating: 900;--transition-fast: .15s ease;--transition-base: .25s ease;--header-bg: var(--blur-bg);--header-color: var(--color-ink-2);--footer-bg: var(--surface-1);--footer-color: var(--color-ink-4);--blur-bg: rgba(255, 255, 255, .8);--float-btn-bg: rgba(200, 200, 200, .4);--font-heading: var(--font-ui);--radius-card: var(--radius);--radius-md: var(--radius);--color-primary-50: var(--color-primary-soft);--color-primary-dark: var(--color-primary-active);--shadow-md: var(--shadow);--mini-radius: calc(var(--radius) / 1.4);--aksrt-avatar-size-xs: 24px;--aksrt-avatar-size-sm: 32px;--aksrt-avatar-size: 40px;--aksrt-avatar-size-lg: 56px;--aksrt-avatar-size-xl: 80px;--aksrt-card-thumb-scale: 56.25%;--aksrt-rose: #f43f5e;--aksrt-rose-soft: rgba(244, 63, 94, .12);--aksrt-blue: #3b82f6;--aksrt-blue-soft: rgba(59, 130, 246, .12);--aksrt-green: #10b981;--aksrt-green-soft: rgba(16, 185, 129, .12);--aksrt-orange: #f97316;--aksrt-orange-soft:rgba(249, 115, 22, .12);--aksrt-purple: #8b5cf6;--aksrt-purple-soft:rgba(139, 92, 246, .12);--aksrt-cyan: #06b6d4;--aksrt-cyan-soft: rgba(6, 182, 212, .12);--aksrt-yellow: #eab308;--aksrt-yellow-soft:rgba(234, 179, 8, .12);--aksrt-red: #ef4444;--aksrt-red-soft: rgba(239, 68, 68, .12);--aksrt-teal: #14b8a6;--aksrt-teal-soft: rgba(20, 184, 166, .12);--aksrt-indigo: #6366f1;--aksrt-indigo-soft:rgba(99, 102, 241, .12);--aksrt-pink: #ec4899;--aksrt-pink-soft: rgba(236, 72, 153, .12);--aksrt-vip-gold-1: #f6d365;--aksrt-vip-gold-2: #fda085;--aksrt-grad-sunset-1: #f093fb;--aksrt-grad-sunset-2: #f5576c;--aksrt-graLine truncated
|
||||
@@ -1,122 +1,43 @@
|
||||
/**
|
||||
* Header account popover.
|
||||
*
|
||||
* The shared legacy navigation styles provide the popover shell, and every
|
||||
* account row (avatar, VIP bar, check-in, wallet tiles, stats badges) renders
|
||||
* through the reference legacy classes. This module only owns the navigation
|
||||
* shell anchoring plus the account action-row geometry.
|
||||
* The shared navigation rules own the layout. Restore the reference typography
|
||||
* and action controls where the public reset differs from Bootstrap 3.
|
||||
*/
|
||||
|
||||
/* The reference keeps the right cluster as three floated .navbar-form groups.
|
||||
* Bootstrap's base .navbar-form rule carries margin-top: 8px and the >=768px
|
||||
* override only zeroes the horizontal margins, so every right-cluster group
|
||||
* starts 8px below the top of .navbar-collapse. The 50px menu row and the logo
|
||||
* put the navbar midline at 25px, so a 34px cross-size lands a group's midline
|
||||
* at 8 + 17 = 25px. The publish/VIP chips already reach that line through their
|
||||
* own 0.4em margin stacked on the group's 8px; the account row reaches it from
|
||||
* its 34px icon tiles, and the theme group needs the same cross-size because
|
||||
* its 29px toggle is otherwise 2.5px high. Nothing here may restate a 50px
|
||||
* min-height: it would double-count the 8px and push that group's content 8px
|
||||
* below the line while inflating the navbar from 50px to 58px. */
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li > .sub-menu {
|
||||
top: calc(100% + 5px);
|
||||
right: 0;
|
||||
left: auto;
|
||||
z-index: 1002;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon,
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
padding: 0 !important;
|
||||
overflow: visible !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon .icon {
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-avatar .avatar {
|
||||
display: block;
|
||||
width: 29px;
|
||||
height: 29px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* The account-row chips, the theme and the language toggles all want the 29px
|
||||
* midline circle. The popover's quick-login buttons are .toggle-radius too and
|
||||
* also live inside .navbar-form, but they must keep the .social_loginbar
|
||||
* geometry from main.css: in a flex container flex-basis outranks width, so
|
||||
* without this exemption the buttons collapse to 29px and lose the 5px side
|
||||
* margins that space them apart. */
|
||||
.navbar-top .navbar-form .toggle-radius:not(.social-login-item):not(.xh-social-item) {
|
||||
flex: 0 0 29px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Match the account row's 34px cross-size so the 29px toggle shares the 25px
|
||||
* midline instead of sitting 2.5px above it. */
|
||||
.navbar-top .navbar-form.flex.ac {
|
||||
min-height: 34px;
|
||||
}
|
||||
|
||||
.navbar-top .navbar-form .aksrt-navbar-language {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* The reference keeps the publish/VIP hover wrapper a plain inline-block, so the
|
||||
* absolutely positioned .sub-vip-card takes its normal-flow static position.
|
||||
* The shared action cluster otherwise forces inline-flex on every child, which
|
||||
* would move that static position to the flex container's cross-start. */
|
||||
.navbar-top .navbar-but > .hover-show {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Keep the drop-down search panel above a fixed header (z-index: 999). */
|
||||
.header,
|
||||
.mobile-header,
|
||||
.navbar-search {
|
||||
z-index: 1001;
|
||||
opacity: 0;
|
||||
transform: translate3d(0, -24px, 0);
|
||||
transition: transform .24s ease, opacity .18s ease, visibility 0s linear .24s;
|
||||
will-change: transform, opacity;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
-webkit-font-smoothing: auto;
|
||||
-moz-osx-font-smoothing: auto;
|
||||
text-rendering: auto;
|
||||
}
|
||||
|
||||
.navbar-search.show {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0);
|
||||
transition-delay: 0s;
|
||||
/* Keep the logo inline so the centered mobile brand can use text-align. */
|
||||
.navbar-logo > img {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Reference .btn geometry without the public .btn skin. The 14px SVG keeps
|
||||
* main.css's 1em size and -0.15em baseline; list-inline owns the item spacing. */
|
||||
.navbar-top .aksrt-nav-icon {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
touch-action: manipulation;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.navbar-search .line-form-input:focus,
|
||||
@@ -125,17 +46,6 @@
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.navbar-search .search-close-box {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
max-width: 660px;
|
||||
margin: 16px auto 0;
|
||||
}
|
||||
|
||||
.navbar-search .search-close-box > .but {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.aksrt-header-userbox {
|
||||
color: var(--color-ink-2);
|
||||
line-height: 1.42857143;
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
/**
|
||||
* AKSRT Menu Decorations
|
||||
*
|
||||
* 菜单图标、徽章、多列下拉、图文卡片子菜单样式。
|
||||
* 所有选择器均带 aksrt- 或 .site-nav 命名空间。
|
||||
*/
|
||||
|
||||
/* ========== 菜单图标 ========== */
|
||||
.nav-desktop .menu-item > a .menu-icon,
|
||||
.nav-desktop .menu-item > a > i:first-child {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-right: 6px;
|
||||
font-size: 14px;
|
||||
opacity: 0.75;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.nav-desktop .menu-item:hover > a .menu-icon,
|
||||
.nav-desktop .menu-item:hover > a > i:first-child {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* ========== 菜单徽章 ========== */
|
||||
.nav-desktop .menu-item > a .menu-badge,
|
||||
.nav-desktop .menu-item > a .aksrt-menu-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 6px;
|
||||
padding: 1px 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
letter-spacing: 0.02em;
|
||||
border-radius: 8px;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.aksrt-menu-badge--new {
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.aksrt-menu-badge--hot {
|
||||
background: #ff4d4f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.aksrt-menu-badge--info {
|
||||
background: var(--color-info, #1890ff);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.aksrt-menu-badge--success {
|
||||
background: var(--color-success, #52c41a);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.aksrt-menu-badge--warning {
|
||||
background: var(--color-warning, #faad14);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* ========== Hover 效果 ========== */
|
||||
/* 下划线效果 */
|
||||
.aksrt-menu-hover--underline .nav-desktop .menu-item > a {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.aksrt-menu-hover--underline .nav-desktop .menu-item > a::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background: var(--color-primary);
|
||||
border-radius: 1px;
|
||||
transform: translateX(-50%);
|
||||
transition: width 0.25s ease;
|
||||
}
|
||||
|
||||
.aksrt-menu-hover--underline .nav-desktop .menu-item:hover > a::after,
|
||||
.aksrt-menu-hover--underline .nav-desktop .menu-item.current-menu-item > a::after,
|
||||
.aksrt-menu-hover--underline .nav-desktop .menu-item.current_page_item > a::after {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
/* 背景色效果 */
|
||||
.aksrt-menu-hover--background .nav-desktop .menu-item > a {
|
||||
border-radius: 6px;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.aksrt-menu-hover--background .nav-desktop .menu-item:hover > a {
|
||||
background-color: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
}
|
||||
|
||||
/* 文字变色效果 */
|
||||
.aksrt-menu-hover--color .nav-desktop .menu-item > a {
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.aksrt-menu-hover--color .nav-desktop .menu-item:hover > a {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* ========== 多列 Mega 下拉 ========== */
|
||||
.nav-desktop .menu-item .aksrt-mega-submenu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
z-index: 999;
|
||||
min-width: var(--aksrt-mega-width, 480px);
|
||||
padding: 16px 20px;
|
||||
background: var(--surface-page, #fff);
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
|
||||
}
|
||||
|
||||
.nav-desktop .menu-item:hover .aksrt-mega-submenu {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__grid {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
|
||||
.aksrt-mega-submenu__grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
|
||||
.aksrt-mega-submenu__grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
|
||||
.aksrt-mega-submenu__grid--cols-5 { grid-template-columns: repeat(5, 1fr); }
|
||||
|
||||
.aksrt-mega-submenu__item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
color: var(--color-ink);
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__item:hover {
|
||||
background-color: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__item-icon {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
background: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
color: var(--color-primary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__item-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__item-title {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.aksrt-mega-submenu__item-desc {
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: var(--text-tertiary, #8a909c);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ========== 图文卡片子菜单 ========== */
|
||||
.nav-desktop .menu-item .aksrt-card-submenu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
background: var(--surface-page, #fff);
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
|
||||
}
|
||||
|
||||
.nav-desktop .menu-item:hover .aksrt-card-submenu {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: var(--aksrt-card-width, 160px);
|
||||
text-decoration: none;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__item:hover {
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__thumb {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 10;
|
||||
object-fit: cover;
|
||||
background: var(--color-fill, #f5f5f5);
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__body {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__title {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
color: var(--color-ink);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.aksrt-card-submenu__desc {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
color: var(--text-tertiary, #8a909c);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ========== 暗色模式适配 ========== */
|
||||
html.dark .aksrt-mega-submenu,
|
||||
body.dark-theme .aksrt-mega-submenu,
|
||||
html.dark .aksrt-card-submenu,
|
||||
body.dark-theme .aksrt-card-submenu {
|
||||
background: var(--surface-page);
|
||||
border-color: var(--color-line, #2d2d3f);
|
||||
}
|
||||
|
||||
html.dark .aksrt-mega-submenu__item-title,
|
||||
body.dark-theme .aksrt-mega-submenu__item-title,
|
||||
html.dark .aksrt-card-submenu__title,
|
||||
body.dark-theme .aksrt-card-submenu__title {
|
||||
color: var(--color-ink);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ if (!function_exists('aksrt_footer_navbar_search')) :
|
||||
echo '<div mini-touch="nav_search" touch-direction="top" class="main-search fixed-body main-bg box-body navbar-search nopw-sm">';
|
||||
echo '<div class="container">';
|
||||
echo $remote; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<div class="search-close-box"><button type="button" class="but cir" data-toggle-class data-target=".navbar-search" aria-label="'
|
||||
echo '<div class="mb20 search-close-box"><button type="button" class="but cir" data-toggle-class data-target=".navbar-search" aria-label="'
|
||||
. esc_attr__('关闭搜索', 'aksrt') . '"><svg class="ic-close" aria-hidden="true"><use xlink:href="#icon-close"></use></svg></button></div>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
@@ -63,9 +63,13 @@ if (!function_exists('aksrt_nav_mobile_content')) :
|
||||
if (in_array('m_menu', (array) ($ctx['theme_positions'] ?? []), true)) {
|
||||
$top_btns .= '<a href="javascript:;" class="toggle-theme toggle-radius" id="theme-toggle-mobile" title="'
|
||||
. esc_attr__('切换亮暗色', 'aksrt') . '">';
|
||||
$top_btns .= '<i class="fa fas fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '</a>';
|
||||
}
|
||||
if ('center' !== ($ctx['mobile_layout'] ?? 'center')) {
|
||||
$top_btns .= '<a href="javascript:;" class="toggle-radius main-search-btn" aria-label="'
|
||||
. esc_attr__('打开搜索', 'aksrt') . '"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a>';
|
||||
}
|
||||
if (function_exists('aksrt_get_translate_language_btn')) {
|
||||
$top_btns .= aksrt_get_translate_language_btn('pull-right');
|
||||
}
|
||||
|
||||
@@ -71,9 +71,11 @@ if (!function_exists('aksrt_navbar_header')) :
|
||||
$button = '<button type="button" data-toggle-class="mobile-navbar-show" data-target="body" class="navbar-toggle" aria-label="'
|
||||
. esc_attr__('打开菜单', 'aksrt') . '">';
|
||||
$button .= '<i class="em12 css-icon i-menu"><i></i></i></button>';
|
||||
$button .= '<a href="javascript:;" class="navbar-toggle main-search-btn" aria-label="'
|
||||
. esc_attr__('打开搜索', 'aksrt') . '">';
|
||||
$button .= '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a>';
|
||||
if ('center' === ($ctx['mobile_layout'] ?? 'center')) {
|
||||
$button .= '<a href="javascript:;" class="navbar-toggle main-search-btn" aria-label="'
|
||||
. esc_attr__('打开搜索', 'aksrt') . '">';
|
||||
$button .= '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a>';
|
||||
}
|
||||
|
||||
echo '<div class="navbar-header">';
|
||||
echo '<div class="navbar-brand">' . $logo . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
@@ -100,7 +102,7 @@ if (!function_exists('aksrt_get_menu_search')) :
|
||||
echo '<input type="text" class="form-control search-input focus-show" name="s" value="'
|
||||
. esc_attr(get_search_query()) . '" placeholder="' . esc_attr($placeholder) . '" autocomplete="off">';
|
||||
echo '<div class="abs-right muted-3-color"><button type="submit" class="null" aria-label="'
|
||||
. esc_attr__('搜索', 'aksrt') . '"><i class="fa fas fa-search" aria-hidden="true"></i></button></div>';
|
||||
. esc_attr__('搜索', 'aksrt') . '"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></button></div>';
|
||||
if (function_exists('aksrt_get_remote_box')) {
|
||||
echo aksrt_get_remote_box([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'class' => '',
|
||||
@@ -322,11 +324,11 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
if (in_array('pc_nav', (array) ($ctx['theme_positions'] ?? []), true)) {
|
||||
$utility_buttons .= '<a href="javascript:;" class="toggle-theme toggle-radius" id="theme-toggle-desktop" title="'
|
||||
. esc_attr__('切换亮暗色', 'aksrt') . '">';
|
||||
$utility_buttons .= '<i class="fa fas fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '</a>';
|
||||
}
|
||||
if (function_exists('aksrt_get_translate_language_btn')) {
|
||||
$utility_buttons .= aksrt_get_translate_language_btn('aksrt-navbar-language');
|
||||
$utility_buttons .= aksrt_get_translate_language_btn('ml10 pull-right');
|
||||
}
|
||||
|
||||
// Notifications, user and search.
|
||||
@@ -341,7 +343,7 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
if ($unread > 0) {
|
||||
$notification_but .= '<span class="aksrt-notification-badge">' . esc_html((string) min(99, $unread)) . '</span>';
|
||||
}
|
||||
$notification_but .= '</a></li>';
|
||||
$notification_but .= "</a></li>\n";
|
||||
}
|
||||
|
||||
$sign_but = '';
|
||||
@@ -349,7 +351,7 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
if ('2' === $layout) {
|
||||
if ($user_id > 0) {
|
||||
$avatar = aksrt_get_avatar_html($user_id, 36, ['class' => 'avatar']);
|
||||
$sign_but = '<li><a href="javascript:;" class="navbar-avatar aksrt-nav-avatar">' . $avatar . '</a><ul class="sub-menu">'
|
||||
$sign_but = '<li><a href="javascript:;" class="navbar-avatar">' . $avatar . '</a><ul class="sub-menu">'
|
||||
. $user_sub . '</ul></li>';
|
||||
} else {
|
||||
$sign_but = '<li><a href="javascript:;" class="signin-loader">' . esc_html__('登录', 'aksrt') . '</a></li>';
|
||||
@@ -360,7 +362,7 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
} else {
|
||||
$cls = 'aksrt-nav-icon' . ($user_id > 0 ? '' : ' signin-loader');
|
||||
$sign_but = '<li><a href="javascript:;" class="' . esc_attr($cls) . '">'
|
||||
. '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-user"></use></svg></a>'
|
||||
. '<svg class="icon" viewBox="50 0 924 924" aria-hidden="true"><use xlink:href="#icon-user"></use></svg></a>'
|
||||
. '<ul class="sub-menu">' . $user_sub . '</ul></li>';
|
||||
}
|
||||
|
||||
@@ -370,8 +372,9 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
. esc_attr__('打开搜索', 'aksrt') . '"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a></li>';
|
||||
}
|
||||
|
||||
$account = '<ul class="list-inline splitters relative aksrt-navbar-account'
|
||||
. ($user_id <= 0 && '2' === $layout ? ' navbar-text' : '') . '">'
|
||||
// Inline list items retain the reference whitespace between controls.
|
||||
$sign_but .= "\n";
|
||||
$account = '<ul class="list-inline splitters relative">'
|
||||
. $notification_but . $sign_but . $search_but . '</ul>';
|
||||
|
||||
// Reference cluster split: publish/VIP, theme + language, account row.
|
||||
@@ -387,10 +390,10 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
. $account . '</div>';
|
||||
|
||||
$fold = '<div class="navbar-form navbar-right hide show-nav-but" style="margin-right:-10px;">'
|
||||
. '<a data-toggle-class data-target=".nav.navbar-nav" href="javascript:;" class="aksrt-nav-icon" aria-label="'
|
||||
. '<a data-toggle-class data-target=".nav.navbar-nav" href="javascript:;" class="but" aria-label="'
|
||||
. esc_attr__('展开菜单', 'aksrt') . '"><svg class="icon" viewBox="0 0 1024 1024" aria-hidden="true"><use xlink:href="#icon-menu_2"></use></svg></a></div>';
|
||||
|
||||
$html = $fold . $button . $right_but;
|
||||
$html = $fold . ('3' === $layout ? $right_but . $button : $button . $right_but);
|
||||
|
||||
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
@@ -27,23 +27,6 @@ function aksrt_menu_pz(int $id, string $key = '', $default = '') {
|
||||
return $options[$id][$key] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoration for a menu item (meta only).
|
||||
*
|
||||
* @param WP_Post|object $menu_item Menu item.
|
||||
* @return array{icon:string,badge_text:string,badge_class:string,submenu_s:bool,submenu_type:string}
|
||||
*/
|
||||
function aksrt_get_menu_item_decoration($menu_item): array {
|
||||
$id = (int) ($menu_item->ID ?? 0);
|
||||
return [
|
||||
'icon' => (string) aksrt_menu_pz($id, 'icon', ''),
|
||||
'badge_text' => (string) aksrt_menu_pz($id, 'badge', ''),
|
||||
'badge_class' => (string) aksrt_menu_pz($id, 'badge_class', ''),
|
||||
'submenu_s' => !empty(aksrt_menu_pz($id, 'submenu_s', false)),
|
||||
'submenu_type' => sanitize_key((string) aksrt_menu_pz($id, 'submenu_type', '')),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $icon_class Icon-picker value (FA5 class, zibsvg- or customsvg-).
|
||||
* @param bool $enabled Global switch.
|
||||
|
||||
@@ -62,12 +62,6 @@ trait ScriptsPart1b {
|
||||
);
|
||||
};
|
||||
|
||||
// 顶部导航用户卡片(legacy header-userbox 模块样式)。
|
||||
// 仅登录用户渲染用户卡(aksrt-header-userbox.php 的渲染条件),访客页面不加载。
|
||||
if (is_user_logged_in()) {
|
||||
$enqueue_module('header-userbox');
|
||||
}
|
||||
|
||||
if (!is_user_logged_in() || (bool) get_query_var('aksrt_sign')) {
|
||||
$auth_css = get_template_directory() . '/assets/css/routes/sign.css';
|
||||
wp_enqueue_style(
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { spawnSync } = require('node:child_process');
|
||||
const test = require('node:test');
|
||||
|
||||
const root = path.resolve(__dirname, '..', '..');
|
||||
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
|
||||
|
||||
function renderHeaderParts() {
|
||||
const php = String.raw`
|
||||
define('ABSPATH', __DIR__ . '/');
|
||||
$GLOBALS['aksrt_test_user_id'] = 0;
|
||||
function esc_attr($value) { return htmlspecialchars((string) $value, ENT_QUOTES); }
|
||||
function esc_html($value) { return htmlspecialchars((string) $value, ENT_QUOTES); }
|
||||
function esc_attr__($value, $domain = null) { return esc_attr($value); }
|
||||
function esc_html__($value, $domain = null) { return esc_html($value); }
|
||||
function esc_url($value) { return $value; }
|
||||
function esc_url_raw($value) { return $value; }
|
||||
function home_url($path = '/') { return 'https://example.test' . $path; }
|
||||
function get_bloginfo($field = '') { return 'AKSRT'; }
|
||||
function get_current_user_id() { return (int) $GLOBALS['aksrt_test_user_id']; }
|
||||
function get_option($name, $default = false) { return $name === 'users_can_register'; }
|
||||
function aksrt_render_header_menu_buttons() { return '<a class="newadd-btns">发布</a>'; }
|
||||
function aksrt_get_translate_language_btn($class = '') { return '<a class="' . esc_attr($class) . '">语言</a>'; }
|
||||
function aksrt_header_user_box_html($ctx) { return '<div class="sub-user-box">账户</div>'; }
|
||||
function aksrt_get_avatar_html($userId, $size, $args = []) { return '<img class="avatar" width="' . (int) $size . '">'; }
|
||||
function has_nav_menu($location) { return false; }
|
||||
function is_super_admin() { return false; }
|
||||
function is_singular($type = '') { return false; }
|
||||
require __DIR__ . '/inc/helpers/header/aksrt-header-navbar.php';
|
||||
require __DIR__ . '/inc/helpers/header/aksrt-header-mobile.php';
|
||||
|
||||
$results = [];
|
||||
foreach (['1', '2', '3'] as $layout) {
|
||||
foreach ([0, 7] as $userId) {
|
||||
$GLOBALS['aksrt_test_user_id'] = $userId;
|
||||
$ctx = [
|
||||
'layout' => $layout,
|
||||
'user_id' => $userId,
|
||||
'theme_positions' => ['pc_nav', 'm_menu'],
|
||||
'message_icon_positions' => [],
|
||||
'messages_url' => '',
|
||||
'unread_count' => 0,
|
||||
'mobile_layout' => 'center',
|
||||
'brand_name' => 'AKSRT',
|
||||
'logo_html' => '',
|
||||
];
|
||||
ob_start(); aksrt_menu_button($ctx); $buttons = ob_get_clean();
|
||||
$results['desktop'][$layout][$userId] = $buttons;
|
||||
}
|
||||
}
|
||||
foreach (['center', 'left'] as $mobileLayout) {
|
||||
$ctx = [
|
||||
'mobile_layout' => $mobileLayout,
|
||||
'mobile_align' => 'left',
|
||||
'theme_positions' => [],
|
||||
'brand_name' => 'AKSRT',
|
||||
'logo_html' => '',
|
||||
'user_id' => 0,
|
||||
];
|
||||
ob_start(); aksrt_navbar_header($ctx); $results['mobile'][$mobileLayout]['header'] = ob_get_clean();
|
||||
ob_start(); aksrt_nav_mobile_content($ctx); $results['mobile'][$mobileLayout]['drawer'] = ob_get_clean();
|
||||
}
|
||||
echo json_encode($results, JSON_UNESCAPED_SLASHES);
|
||||
`;
|
||||
const result = spawnSync('php', ['-r', php], { cwd: root, encoding: 'utf8' });
|
||||
assert.equal(result.status, 0, result.stderr || result.stdout);
|
||||
return JSON.parse(result.stdout);
|
||||
}
|
||||
|
||||
test('rendered desktop layouts retain reference control order for guests and members', () => {
|
||||
const output = renderHeaderParts();
|
||||
for (const layout of ['1', '2', '3']) {
|
||||
for (const userId of ['0', '7']) {
|
||||
const html = output.desktop[layout][userId];
|
||||
assert.match(html, /class="but" aria-label=/, `layout ${layout} menu fold`);
|
||||
assert.match(html, /class="list-inline splitters relative"/, `layout ${layout} account list`);
|
||||
assert.doesNotMatch(html, /aksrt-navbar-account|aksrt-nav-avatar/);
|
||||
if (layout === '2' && userId === '0') assert.match(html, /class="signin-loader"/);
|
||||
else assert.match(html, /class="aksrt-nav-icon[^"]*"|class="navbar-avatar"/);
|
||||
const right = html.indexOf('list-inline splitters relative');
|
||||
const actions = html.indexOf('navbar-but');
|
||||
if (layout === '3' && actions !== -1) assert.ok(right < actions, 'layout 3 puts account group before actions');
|
||||
if (layout !== '3' && actions !== -1) assert.ok(actions < right, `layout ${layout} puts actions before account group`);
|
||||
}
|
||||
}
|
||||
assert.match(output.desktop['2']['0'], /signin-loader/);
|
||||
assert.match(output.desktop['2']['7'], /class="navbar-avatar"/);
|
||||
assert.match(output.desktop['1']['0'], /#icon-user/);
|
||||
assert.match(output.desktop['3']['7'], /#icon-user/);
|
||||
});
|
||||
|
||||
test('mobile search appears in the centered header or left drawer according to layout', () => {
|
||||
const output = renderHeaderParts();
|
||||
assert.match(output.mobile.center.header, /class="navbar-toggle main-search-btn"/);
|
||||
assert.doesNotMatch(output.mobile.center.drawer, /main-search-btn/);
|
||||
assert.doesNotMatch(output.mobile.left.header, /main-search-btn/);
|
||||
assert.match(output.mobile.left.drawer, /class="toggle-radius main-search-btn"/);
|
||||
});
|
||||
|
||||
test('header source restores the reference typography and Bootstrap control dimensions', () => {
|
||||
const css = read('assets/css/frontend/header-userbox.css');
|
||||
const mainCss = read('assets/css/main.css');
|
||||
assert.match(css, /\.header,\s*\.mobile-header,\s*\.navbar-search\s*\{[^}]*font-family:\s*"Helvetica Neue", Helvetica, Arial, sans-serif;[^}]*font-size:\s*14px;[^}]*font-weight:\s*400;[^}]*line-height:\s*1\.42857143;[^}]*-webkit-font-smoothing:\s*auto;[^}]*text-rendering:\s*auto;/s);
|
||||
assert.match(css, /\.navbar-top \.aksrt-nav-icon\s*\{[^}]*display:\s*inline-block;[^}]*padding:\s*6px 12px;[^}]*font-size:\s*14px;[^}]*line-height:\s*1\.42857143;[^}]*border:\s*1px solid transparent;[^}]*border-radius:\s*4px;/s);
|
||||
assert.match(mainCss, /\.navbar-avatar\s*\{[^}]*margin-top:\s*3px;[^}]*width:\s*29px;[^}]*height:\s*29px;/s);
|
||||
assert.doesNotMatch(css, /\.aksrt-navbar-account|\.aksrt-nav-avatar|\.navbar-form \.toggle-radius:not|navbar-form\.flex\.ac\s*\{[^}]*min-height|\.navbar-search(?:\.show)?\s*\{[^}]*transform:/s);
|
||||
});
|
||||
@@ -166,7 +166,8 @@ test('guest account member VIP and publish contracts share reference header DOM'
|
||||
assert.match(header, /nav_newposts/);
|
||||
assert.match(header, /navbar-form navbar-right navbar-but/);
|
||||
assert.match(header, /pay-vip/);
|
||||
assert.match(scripts, /\$enqueue_module\('header-userbox'\)/);
|
||||
assert.match(header, /fa far fa-toggle-theme/);
|
||||
assert.doesNotMatch(scripts, /\$enqueue_module\('header-userbox'\)/);
|
||||
assert.match(userboxCss, /\.header-user-href > a[\s\S]*?max-height: none/);
|
||||
assert.doesNotMatch(userboxCss, /user-dropdown|nav-user|html\.dark|theme-dark/);
|
||||
assert.doesNotMatch(userboxCss, /--(?:main|muted|key)-|@import/);
|
||||
@@ -180,21 +181,14 @@ test('guest account member VIP and publish contracts share reference header DOM'
|
||||
assert.match(userboxCss, /\.aksrt-header-userbox\s*>\s*\.mt6\.em09\s*>\s*\.but\.block\s*\{[^}]*display:\s*block;[^}]*box-sizing:\s*border-box;[^}]*width:\s*100%;/s);
|
||||
});
|
||||
|
||||
test('the top-nav midline chip rule leaves the popover social buttons alone', () => {
|
||||
test('the top navigation keeps the reference Bootstrap control geometry', () => {
|
||||
const userboxCss = read('assets/css/frontend/header-userbox.css');
|
||||
const publicCss = read('assets/css/build/public.css');
|
||||
|
||||
// The account-row chips, the theme toggle and the language toggle all want a
|
||||
// 29px midline circle. The popover's quick-login buttons are .toggle-radius
|
||||
// too and also live inside .navbar-form, but they must keep the
|
||||
// .social_loginbar geometry from main.css. flex-basis outranks width in a
|
||||
// flex container and the bare rule is (0,3,0) against (0,2,0), so an
|
||||
// unscoped selector collapses the buttons to 29px and zeroes their margins.
|
||||
assert.match(userboxCss, /\.navbar-top \.navbar-form \.toggle-radius:not\(\.social-login-item\):not\(\.xh-social-item\)\s*\{[^}]*flex:\s*0 0 29px;[^}]*margin:\s*0;/s);
|
||||
assert.doesNotMatch(userboxCss, /\.navbar-top \.navbar-form \.toggle-radius\s*\{/);
|
||||
// header-userbox.css is also folded into the public bundle, so the exemption
|
||||
// has to survive the build.
|
||||
assert.match(publicCss, /\.navbar-top \.navbar-form \.toggle-radius:not\(\.social-login-item\):not\(\.xh-social-item\)/);
|
||||
assert.match(userboxCss, /\.header,\s*\.mobile-header,\s*\.navbar-search\s*\{[^}]*font-family:\s*['"]Helvetica Neue['"],\s*Helvetica,\s*Arial,\s*sans-serif;[^}]*font-weight:\s*400;[^}]*line-height:\s*1\.42857143;/s);
|
||||
assert.match(userboxCss, /\.navbar-top \.aksrt-nav-icon\s*\{[^}]*display:\s*inline-block;[^}]*padding:\s*6px 12px;[^}]*font-size:\s*14px;[^}]*line-height:\s*1\.42857143;[^}]*border:\s*1px solid transparent;[^}]*border-radius:\s*4px;/s);
|
||||
assert.doesNotMatch(userboxCss, /\.aksrt-navbar-account|\.aksrt-nav-avatar|\.navbar-form \.toggle-radius:not|navbar-form\.flex\.ac\s*\{[^}]*min-height|\.aksrt-navbar-language\s*\{[^}]*margin:/);
|
||||
assert.doesNotMatch(publicCss, /\.navbar-top \.navbar-form \.toggle-radius:not\(\.social-login-item\)/);
|
||||
});
|
||||
|
||||
test('route and feature modules do not restyle the legacy top-nav chips', () => {
|
||||
@@ -278,14 +272,15 @@ test('the account popover rows match the reference user box structure', () => {
|
||||
|
||||
// Check-in entry is an anchor with the reference button classes.
|
||||
assert.match(header, /but block c-yellow/);
|
||||
assert.match(header, /but block c-yellow is-done/);
|
||||
assert.match(header, /aksrt_get_user_checkin_details_link\([\s\S]*?'but block c-yellow'/);
|
||||
assert.match(header, /checkin-details-link/);
|
||||
assert.match(buttonsCss, /\.but\.block\s*\{\s*display:\s*block;\s*\}/);
|
||||
assert.match(buttonsCss, /\.btn-block\s*\{\s*display:\s*block;\s*width:\s*100%;\s*\}/);
|
||||
// The reference selector is a descendant, so the VIP chip inside its hover-show
|
||||
// wrapper receives the same .but geometry (font-size, padding, margin) as the
|
||||
// publish chip instead of falling back to the bare .but defaults.
|
||||
// The hover wrapper uses the reference inline-block utility so the absolutely
|
||||
// positioned VIP card keeps its original static position.
|
||||
assert.match(read('inc/helpers/aksrt-header-menu-buttons.php'), /class="hover-show inline-block"/);
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-but \.but\s*\{[^}]*font-size:\s*0\.8em;[^}]*padding:\s*0\.3em 1em !important;[^}]*margin:\s*0\.4em;/s);
|
||||
assert.doesNotMatch(legacyMainCss, /\.navbar-top \.navbar-but > \.but\s*\{/);
|
||||
assert.doesNotMatch(read('assets/css/frontend/header-userbox.css'), /\.navbar-top \.navbar-but > \.hover-show/);
|
||||
assert.doesNotMatch(header, /but block c-yellow[^"']*btn-block/);
|
||||
assert.match(header, /<div class="mt6 em09" style="padding:2px;">' \. \$checkin \. '<\/div>/);
|
||||
assert.match(header, /data-signin-done-label[\s\S]{0,120}?今日已签到/);
|
||||
|
||||
@@ -169,7 +169,8 @@ test('header VIP hover cards match the legacy markup and style contract', () =>
|
||||
assert.match(legacyMainCss, /\.sub-vip-card \.vip-img\s*\{[^}]*display:\s*none;/s)
|
||||
// The hover wrapper must stay a plain block container so the legacy static
|
||||
// position of .sub-vip-card matches the reference theme.
|
||||
assert.match(headerCss, /\.navbar-top \.navbar-but > \.hover-show\s*\{[^}]*display:\s*inline-block;/s)
|
||||
assert.match(headerMenuButtons, /class="hover-show inline-block"/)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-top \.navbar-but > \.hover-show/)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-cta|\.navbar-vip-hover/)
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-right \.sub-menu\s*\{[^}]*right:\s*0;/s)
|
||||
})
|
||||
@@ -350,20 +351,19 @@ test('user profile and author widgets render the reference user-card contract',
|
||||
test('desktop header actions share one row without generic button masks', () => {
|
||||
assert.match(headerNavbar, /navbar-form navbar-right navbar-but/)
|
||||
assert.match(headerNavbar, /navbar-form navbar-right flex ac/)
|
||||
assert.match(headerNavbar, /\$fold \. \$button \. \$right_but/)
|
||||
assert.match(headerNavbar, /\$fold \. \('3' === \$layout \? \$right_but \. \$button : \$button \. \$right_but\)/)
|
||||
assert.match(headerNavbar, /class="aksrt-nav-icon nav-search-btn main-search-btn"/)
|
||||
assert.doesNotMatch(headerNavbar, /class="btn nav-search-btn main-search-btn"/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account\s*\{[^}]*display:\s*inline-flex;[^}]*align-items:\s*center;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-nav-icon,[\s\S]*?background:\s*transparent !important;/)
|
||||
// Bootstrap's base .navbar-form rule keeps margin-top: 8px at >=768px (the
|
||||
// override only zeroes the horizontal margins), so every right-cluster group
|
||||
// starts 8px below the top of .navbar-collapse. A 34px cross-size therefore
|
||||
// puts each group's midline on the navbar's 25px line, where the 50px menu row
|
||||
// and the logo already sit. A 50px min-height double-counts that 8px: the
|
||||
// group's content drops 8px below the line and the navbar grows from 50px to
|
||||
// 58px, which also breaks the body.nav-fixed offset.
|
||||
assert.doesNotMatch(headerCss, /\.navbar-top \.aksrt-navbar-account\s*\{[^}]*min-height/s)
|
||||
assert.match(headerCss, /\.navbar-top \.navbar-form\.flex\.ac\s*\{[^}]*min-height:\s*34px;/s)
|
||||
assert.match(headerNavbar, /<ul class="list-inline splitters relative">/)
|
||||
assert.doesNotMatch(headerNavbar, /aksrt-navbar-account|aksrt-nav-avatar/)
|
||||
assert.match(headerNavbar, /class="navbar-avatar"/)
|
||||
assert.match(legacyMainCss, /\.navbar-avatar\s*\{[^}]*margin-top:\s*3px;[^}]*width:\s*29px;[^}]*height:\s*29px;/s)
|
||||
assert.match(headerNavbar, /aksrt_get_translate_language_btn\('ml10 pull-right'\)/)
|
||||
assert.match(headerNavbar, /<a data-toggle-class data-target="\.nav\.navbar-nav" href="javascript:;" class="but"/)
|
||||
assert.match(headerNavbar, /<svg class="icon" viewBox="50 0 924 924"/)
|
||||
assert.match(headerNavbar, /<svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"/)
|
||||
assert.doesNotMatch(headerCss, /\.aksrt-navbar-account|\.aksrt-nav-avatar|navbar-form\.flex\.ac\s*\{[^}]*min-height/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-nav-icon\s*\{[^}]*display:\s*inline-block;[^}]*padding:\s*6px 12px;[^}]*font-size:\s*14px;[^}]*line-height:\s*1\.42857143;[^}]*border:\s*1px solid transparent;[^}]*border-radius:\s*4px;/s)
|
||||
// The publish and VIP chips ride the legacy .but geometry verbatim; nothing in
|
||||
// the header module may restate their padding, margin, radius or icon size.
|
||||
// Descendant, not child: the VIP chip lives inside the hover-show wrapper.
|
||||
@@ -371,15 +371,14 @@ test('desktop header actions share one row without generic button masks', () =>
|
||||
assert.doesNotMatch(headerCss, /\.navbar-cta|\.navbar-vip-hover/)
|
||||
// No merged flex container: the three groups keep their own .navbar-form
|
||||
// padding, which is what produces the reference inter-cluster spacing.
|
||||
assert.doesNotMatch(headerCss, /\.aksrt-navbar-actions/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account > li\s*\{[^}]*position:\s*relative;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account > li > \.sub-menu\s*\{[^}]*top:\s*calc\(100% \+ 5px\);[^}]*right:\s*0;/s)
|
||||
assert.doesNotMatch(headerCss, /\.aksrt-navbar-actions|\.aksrt-navbar-account|\.aksrt-nav-avatar/)
|
||||
})
|
||||
|
||||
test('mobile search stays inside the scroll-hiding top header', () => {
|
||||
test('mobile search follows the reference center and left header placements', () => {
|
||||
assert.match(headerNavbar, /class="navbar-toggle main-search-btn"/)
|
||||
assert.doesNotMatch(headerNavbar, /mobile_layout/)
|
||||
assert.doesNotMatch(headerMobile, /main-search-btn|\$m_layout|aksrt_navbar_header/)
|
||||
assert.match(headerNavbar, /mobile_layout/)
|
||||
assert.match(headerNavbar, /'center' === \(\$ctx\['mobile_layout'\] \?\? 'center'\)/)
|
||||
assert.match(headerMobile, /main-search-btn|toggle-radius/)
|
||||
assert.match(headerMobile, /aksrt_nav_mobile_content\(\$ctx\)/)
|
||||
assert.doesNotMatch(headerRender, /'fixed'\s*=>/)
|
||||
assert.doesNotMatch(legacyMainCss, /\.mobile-navbar \.navbar-(?:header|brand)/)
|
||||
@@ -394,14 +393,12 @@ test('mobile search stays inside the scroll-hiding top header', () => {
|
||||
assert.match(legacyMainCss, /\.scroll-down\.nav-fixed \.header\.scroll-down-hide\s*\{[^}]*transform:\s*translate3d\(0, -105%, 0\);/s)
|
||||
})
|
||||
|
||||
test('search dropdown clears the fixed header and closes from the panel lower-right', () => {
|
||||
assert.match(headerCss, /\.navbar-search\s*\{[^}]*z-index:\s*1001;[^}]*transform:\s*translate3d\(0, -24px, 0\);[^}]*transition:\s*transform \.24s ease, opacity \.18s ease, visibility 0s linear \.24s;/s)
|
||||
assert.match(headerCss, /\.navbar-search\.show\s*\{[^}]*opacity:\s*1;[^}]*transform:\s*translate3d\(0, 0, 0\);/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-search\s*\{[^}]*height:\s*100%/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-search > \.container\s*\{[^}]*overflow-y:\s*auto/s)
|
||||
test('search panel retains the reference main.css surface and close spacing', () => {
|
||||
assert.match(legacyMainCss, /\.navbar-search\s*\{[^}]*visibility:\s*hidden;[^}]*transform:\s*translateY\(-101%\);[^}]*padding:\s*10px 30px;[^}]*padding-top:\s*80px;[^}]*transition:\s*all 0\.5s;/s)
|
||||
assert.match(legacyMainCss, /\.navbar-search\.show\s*\{[^}]*visibility:\s*unset;[^}]*transform:\s*translateY\(0\);/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-search(?:\.show)?\s*\{[^}]*transform:/s)
|
||||
assert.match(headerCss, /\.navbar-search \.line-form-input:focus,[\s\S]*?\.navbar-search \.line-form-input:focus-visible\s*\{[^}]*outline:\s*0;[^}]*box-shadow:\s*none;/s)
|
||||
assert.match(headerCss, /\.navbar-search \.search-close-box\s*\{[^}]*display:\s*flex;[^}]*justify-content:\s*flex-end;[^}]*margin:\s*16px auto 0;/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-search \.search-close-box\s*\{[^}]*position:\s*fixed/s)
|
||||
assert.match(headerSearch, /class="mb20 search-close-box"/)
|
||||
assert.ok(headerSearch.indexOf('echo $remote') < headerSearch.indexOf('search-close-box'))
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user