fix(nav): restore reference theme toggle geometry and single binding
The top-bar theme switch was bound twice — core/theme.js attached a click handler to #theme-toggle-desktop while runtime/main.js delegated click on .toggle-theme, and both ship in main.min.js, so one press toggled twice and the button looked dead. Also realign the control with the reference: - Drop the far modifier from fa-toggle-theme so the sun/moon glyphs resolve against the Solid face at the reference weight instead of Regular. - Restore .toggle-radius .fa/.icon to the reference form (left/right 0 + auto margin only). The extra position/top/transform/size/flex block and the > i selector were overriding the shared abs-* centering rule. - Replace the per-ID bindings with one delegated listener so the floating rail, which carries no id, keeps working. - Remove dead theme.js queries for selectors no markup or stylesheet ships (#theme-toggle, #dropdown-theme-toggle, .theme-icon-moon/.theme-icon-sun, [data-action='toggle-theme'], .is-dark). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e30de6562c
commit
030baa511e
9 files changed
+19
-139
No files matched your search
@@ -1053,21 +1053,10 @@ strong, b {
|
||||
}
|
||||
/* legacy groups these with abs-* : absolute + vertical center; then pin left/right 0 */
|
||||
.toggle-radius .fa,
|
||||
.toggle-radius .icon,
|
||||
.toggle-radius > i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
.toggle-radius .icon {
|
||||
right: 0 !important;
|
||||
left: 0 !important;
|
||||
margin: auto;
|
||||
transform: translateY(-50%);
|
||||
line-height: 1;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* solid color modifiers — set --this-bg; default --this-color white */
|
||||
|
||||
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);--jio-avatar-size-xs: 24px;--jio-avatar-size-sm: 32px;--jio-avatar-size: 40px;--jio-avatar-size-lg: 56px;--jio-avatar-size-xl: 80px;--jio-card-thumb-scale: 56.25%;--jio-rose: #f43f5e;--jio-rose-soft: rgba(244, 63, 94, .12);--jio-blue: #3b82f6;--jio-blue-soft: rgba(59, 130, 246, .12);--jio-green: #10b981;--jio-green-soft: rgba(16, 185, 129, .12);--jio-orange: #f97316;--jio-orange-soft:rgba(249, 115, 22, .12);--jio-purple: #8b5cf6;--jio-purple-soft:rgba(139, 92, 246, .12);--jio-cyan: #06b6d4;--jio-cyan-soft: rgba(6, 182, 212, .12);--jio-yellow: #eab308;--jio-yellow-soft:rgba(234, 179, 8, .12);--jio-red: #ef4444;--jio-red-soft: rgba(239, 68, 68, .12);--jio-teal: #14b8a6;--jio-teal-soft: rgba(20, 184, 166, .12);--jio-indigo: #6366f1;--jio-indigo-soft:rgba(99, 102, 241, .12);--jio-pink: #ec4899;--jio-pink-soft: rgba(236, 72, 153, .12);--jio-vip-gold-1: #f6d365;--jio-vip-gold-2: #fda085;--jio-grad-sunset-1: #f093fb;--jio-grad-sunset-2: #f5576c;--jio-grad-ocean-1: #4facfe;--jio-grad-ocean-2: #00f2fe;--jio-grad-forest-1Line 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);--jio-avatar-size-xs: 24px;--jio-avatar-size-sm: 32px;--jio-avatar-size: 40px;--jio-avatar-size-lg: 56px;--jio-avatar-size-xl: 80px;--jio-card-thumb-scale: 56.25%;--jio-rose: #f43f5e;--jio-rose-soft: rgba(244, 63, 94, .12);--jio-blue: #3b82f6;--jio-blue-soft: rgba(59, 130, 246, .12);--jio-green: #10b981;--jio-green-soft: rgba(16, 185, 129, .12);--jio-orange: #f97316;--jio-orange-soft:rgba(249, 115, 22, .12);--jio-purple: #8b5cf6;--jio-purple-soft:rgba(139, 92, 246, .12);--jio-cyan: #06b6d4;--jio-cyan-soft: rgba(6, 182, 212, .12);--jio-yellow: #eab308;--jio-yellow-soft:rgba(234, 179, 8, .12);--jio-red: #ef4444;--jio-red-soft: rgba(239, 68, 68, .12);--jio-teal: #14b8a6;--jio-teal-soft: rgba(20, 184, 166, .12);--jio-indigo: #6366f1;--jio-indigo-soft:rgba(99, 102, 241, .12);--jio-pink: #ec4899;--jio-pink-soft: rgba(236, 72, 153, .12);--jio-vip-gold-1: #f6d365;--jio-vip-gold-2: #fda085;--jio-grad-sunset-1: #f093fb;--jio-grad-sunset-2: #f5576c;--jio-grad-ocean-1: #4facfe;--jio-grad-ocean-2: #00f2fe;--jio-grad-forest-1Line truncated
|
||||
@@ -274,21 +274,10 @@
|
||||
}
|
||||
/* legacy groups these with abs-* : absolute + vertical center; then pin left/right 0 */
|
||||
.toggle-radius .fa,
|
||||
.toggle-radius .icon,
|
||||
.toggle-radius > i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
.toggle-radius .icon {
|
||||
right: 0 !important;
|
||||
left: 0 !important;
|
||||
margin: auto;
|
||||
transform: translateY(-50%);
|
||||
line-height: 1;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* solid color modifiers — set --this-bg; default --this-color white */
|
||||
|
||||
+12
-31
@@ -157,25 +157,11 @@
|
||||
syncThemeImages(isDark);
|
||||
syncCodeHighlightTheme(isDark);
|
||||
dispatchThemeChange(isDark);
|
||||
// Icon visibility is CSS-driven via html.dark / body.theme-dark.
|
||||
// Only sync a11y state here — do not set inline display (fights !important CSS).
|
||||
document.querySelectorAll("#theme-toggle, #theme-toggle-desktop, #theme-toggle-mobile, #dropdown-theme-toggle, .toggle-theme, [data-action='toggle-theme']").forEach(function (btn) {
|
||||
if (!btn) return;
|
||||
// Glyph visibility (sun / moon slide) is CSS-driven off .toggle-theme's
|
||||
// ::before / ::after and the .dark-theme body class — no JS here.
|
||||
document.querySelectorAll(".toggle-theme").forEach(function (btn) {
|
||||
btn.setAttribute("aria-pressed", isDark ? "true" : "false");
|
||||
btn.classList.toggle("is-dark", isDark);
|
||||
var moon = btn.querySelector(".theme-icon-moon");
|
||||
var sun = btn.querySelector(".theme-icon-sun");
|
||||
if (moon) {
|
||||
moon.removeAttribute("style");
|
||||
moon.setAttribute("aria-hidden", isDark ? "true" : "false");
|
||||
}
|
||||
if (sun) {
|
||||
sun.removeAttribute("style");
|
||||
sun.setAttribute("aria-hidden", isDark ? "false" : "true");
|
||||
}
|
||||
});
|
||||
var ddBtn = document.getElementById("dropdown-theme-toggle");
|
||||
if (ddBtn) ddBtn.setAttribute("aria-pressed", isDark ? "true" : "false");
|
||||
}
|
||||
|
||||
var themeInitialized = false;
|
||||
@@ -243,20 +229,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function bindToggle(id) {
|
||||
var el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
el.addEventListener("click", function (event) {
|
||||
var next = document.body.classList.contains("theme-dark") ? "light" : "dark";
|
||||
setStoredTheme(next);
|
||||
runThemeTransition(next, event);
|
||||
});
|
||||
}
|
||||
|
||||
bindToggle("theme-toggle");
|
||||
bindToggle("theme-toggle-desktop");
|
||||
bindToggle("dropdown-theme-toggle");
|
||||
bindToggle("theme-toggle-mobile");
|
||||
// Delegated so every current and future .toggle-theme anchor works — the
|
||||
// header, the mobile drawer and the floating rail all share one binding.
|
||||
document.addEventListener("click", function (event) {
|
||||
var btn = event.target && event.target.closest ? event.target.closest(".toggle-theme") : null;
|
||||
if (!btn) return;
|
||||
var next = document.body.classList.contains("theme-dark") ? "light" : "dark";
|
||||
setStoredTheme(next);
|
||||
runThemeTransition(next, event);
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
|
||||
@@ -2766,85 +2766,6 @@ jQuery.fn.autoAffix = function (top, bottom) {
|
||||
return _this;
|
||||
};
|
||||
|
||||
// 切换主题
|
||||
_win.bd.on('click', '.toggle-theme', function (event) {
|
||||
var isDark = jQuery('body').hasClass('dark-theme');
|
||||
|
||||
// 检查浏览器是否支持 View Transition API
|
||||
if (!document.startViewTransition) {
|
||||
// 不支持则直接切换主题,不添加动画
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
const transition = document.startViewTransition(() => {
|
||||
toggle();
|
||||
});
|
||||
|
||||
const { clientX, clientY } = event;
|
||||
const endRadius = Math.hypot(Math.max(clientX, innerWidth - clientX), Math.max(clientY, innerHeight - clientY));
|
||||
const clipPath = [`circle(0px at ${clientX}px ${clientY}px)`, `circle(${endRadius}px at ${clientX}px ${clientY}px)`];
|
||||
|
||||
transition.ready.then(() => {
|
||||
document.documentElement.animate(
|
||||
{
|
||||
clipPath: isDark ? [...clipPath].reverse() : clipPath,
|
||||
},
|
||||
{
|
||||
duration: 500,
|
||||
easing: isDark ? 'ease-out' : 'ease-in',
|
||||
fill: 'both', // 保持动画结束状态,避免闪烁
|
||||
pseudoElement: isDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function toggle() {
|
||||
var highlight_white_zt = 'enlighter-t-' + _win.highlight_white_zt;
|
||||
var highlight_dark_zt = 'enlighter-t-' + _win.highlight_dark_zt;
|
||||
|
||||
jQuery('img[switch-src]').each(function () {
|
||||
var _this = jQuery(this);
|
||||
var _src = _this.attr('data-src') || _this.attr('src');
|
||||
var _s_src = _this.attr('switch-src');
|
||||
_this.attr('src', _s_src).attr('switch-src', _src).attr('data-src', '');
|
||||
});
|
||||
|
||||
jQuery('img[white-src],img[dark-src]').each(function () {
|
||||
var _this = jQuery(this);
|
||||
var _s_src = isDark ? _this.attr('white-src') : _this.attr('dark-src');
|
||||
|
||||
if (!_s_src) {
|
||||
return;
|
||||
}
|
||||
_this.attr('src', _s_src);
|
||||
});
|
||||
|
||||
var _enlighter = jQuery('.enlighter-default');
|
||||
var _body = jQuery('body');
|
||||
var _tinymce_body = jQuery('#post_content_ifr').contents().find('body');
|
||||
|
||||
if (!isDark) {
|
||||
jQuery('meta[name="theme-color"]').attr('content', '#2F3135');
|
||||
document.documentElement.classList.add('dark');
|
||||
_tinymce_body.addClass('dark-theme');
|
||||
_enlighter.removeClass(highlight_white_zt).addClass(highlight_dark_zt);
|
||||
_body.addClass('dark-theme'),
|
||||
jQuery.cookie('theme_mode', 'dark-theme', {
|
||||
path: '/',
|
||||
});
|
||||
} else {
|
||||
jQuery('meta[name="theme-color"]').attr('content', '#FDFCFE');
|
||||
document.documentElement.classList.remove('dark');
|
||||
_tinymce_body.removeClass('dark-theme');
|
||||
_enlighter.removeClass(highlight_dark_zt).addClass(highlight_white_zt);
|
||||
_body.removeClass('dark-theme'),
|
||||
jQuery.cookie('theme_mode', 'white-theme', {
|
||||
path: '/',
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_win.bd.on('click', '[ajax-action]', function () {
|
||||
var _this = jQuery(this);
|
||||
if (_this.attr('disabled')) return false;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(function($,window2,document2){"use strict";function closeNotyf($element){$element.addClass("notyn-out"),window2.setTimeout(function(){$element.remove()},1e3)}function notyf2(message,type,time,id){var $body=jQuery(document2.body);jQuery(".notyn").length||$body.append('<div class="notyn"></div>'),type=type||"success",type==="error"&&(type="danger"),time=time||5e3,time=time<100?time*1e3:time;var idAttribute=id?' id="'+id+'"':"",$notification=jQuery('<div class="noty1"'+idAttribute+'><div class="notyf '+type+'">'+message+"</div></div>"),shouldClose=!id;id&&jQuery("#"+id).length?(jQuery("#"+id).find(".notyf").removeClass().addClass("notyf "+type).html(message),$notification=jQuery("#"+id),shouldClose=!0):jQuery(".notyn").append($notification),shouldClose&&window2.setTimeout(function(){closeNotyf($notification)},time)}jQuery(document2.body).on("click",".noty1",function(){closeNotyf(jQuery(this))}),window2.notyf=notyf2})(jQuery,window,document),(function(window2){"use strict";var allowedKinds={identity:!0,badges:!0,orders:!0,vip:!0},allowedEvents={click:!0,shell:!0,"first-content":!0,ready:!0,"action-start":!0,"action-end":!0,unauthorized:!0,error:!0},sessions=Object.create(null),sequence=0,maxSessions=100;function normalize(value,fallback){var normalized=String(value||fallback||"").toLowerCase().replace(/[^a-z0-9-]/g,"");return normalized||fallback}function now(){return window2.performance&&typeof window2.performance.now=="function"?window2.performance.now():0}function markName(session,event){return"jio-modal-"+session.kind+"-"+session.id+"-"+event}function emit(session,event){if(!(!window2.performance||typeof window2.performance.mark!="function")){var name=markName(session,event);if(window2.performance.mark(name),session.marks[event]=name,typeof window2.performance.measure=="function"&&session.marks.click&&event!=="click")try{window2.performance.measure("jio-modal-"+session.kind+"-"+session.id+"-click-to-"+event,session.marks.click,name)}catch{}}}function start(kind){var safeKind=normalize(kind,"unknown");allowedKinds[safeKind]||(safeKind="unknown"),sequence+=1;var id=String(sequence),session={id,kind:safeKind,startedAt:now(),marks:Object.create(null)};sessions[id]=session,emit(session,"click");for(var ids=Object.keys(sessions);ids.length>maxSessions;)delete sessions[ids.shift()];return id}function mark(id,event){var session=sessions[String(id||"")],safeEvent=normalize(event,"error");!session||!allowedEvents[safeEvent]||emit(session,safeEvent)}function finish(id){mark(id,"ready")}function fail(id){mark(id,"error")}window2.JioModalTelemetry={start,mark,finish,error:fail}})(window),(function(window2){"use strict";function data(){return window2.jioData||window2.jio||{}}function createIdempotencyKey(){if(window2.crypto&&typeof window2.crypto.randomUUID=="function")return window2.crypto.randomUUID();if(!window2.crypto||typeof window2.crypto.getRandomValues!="function")throw new Error("当前浏览器无法生成安全的操作标识");var bytes=new Uint8Array(16);window2.crypto.getRandomValues(bytes),bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;var hex=Array.prototype.map.call(bytes,function(value){return value.toString(16).padStart(2,"0")}).join("");return hex.slice(0,8)+"-"+hex.slice(8,12)+"-"+hex.slice(12,16)+"-"+hex.slice(16,20)+"-"+hex.slice(20)}function restBase(){var config=data(),raw=config.restUrl||config.apiUrl||config.rest_url||"",siteUrl=config.siteUrl||config.homeUrl||window2.location.origin+"/";return window2.location.protocol==="https:"&&siteUrl.substring(0,5)==="http:"&&(siteUrl="https:"+siteUrl.substring(5)),raw?String(raw).replace(/\/$/,""):String(siteUrl).replace(/\/$/,"")+"/index.php?rest_route=/jio/v1"}function appendQuery(url2,query){if(!query)return url2;var parts=[];return typeof query=="string"?parts=query.replace(/^\?/,"").split("&").filter(Boolean):typeof query=="object"&&Object.keys(query).forEach(function(key){query[key]===void 0||query[key]===null||parts.push(encodeURIComponent(key)+"="+encodeURIComponent(String(query[key])))}),parts.length?url2+(url2.indexOf("?")>=0?"&":"?")+parts.join("&"):url2}function url(path,query){path=String(path||"");var inlineQuery="",queryIndex=path.indexOf("?");if(queryIndex>=0&&(inlineQuery=path.slice(queryIndex+1),path=path.slice(0,queryIndex)),/^https?:\/\//i.test(path))return appendQuery(path,query||inlineQuery);path.charAt(0)!=="/"&&(path="/"+path);var base=restBase(),result=(base.indexOf("rest_route=")>=0,base+path);return appendQuery(result,query||inlineQuery)}function headers(options){var config=data(),source=options&&options.headers||{},result={},nonce=config.restNonce||config.nonce||"";return Object.keys(source).forEach(function(key){result[key]=source[key]}),result.Accept||(result.Accept="application/json, text/html;q=0.9, */*;q=0.8"),nonce&&!result["X-WP-Nonce"]&&(result["X-WP-Nonce"]=nonce),options&&options.body!==void 0&&options.body!==null&&!(window2.FormData&&options.body instanceof window2.FormData)&&!result["Content-Type"]&&(result["CoLine truncated
|
||||
(function($,window2,document2){"use strict";function closeNotyf($element){$element.addClass("notyn-out"),window2.setTimeout(function(){$element.remove()},1e3)}function notyf2(message,type,time,id){var $body=jQuery(document2.body);jQuery(".notyn").length||$body.append('<div class="notyn"></div>'),type=type||"success",type==="error"&&(type="danger"),time=time||5e3,time=time<100?time*1e3:time;var idAttribute=id?' id="'+id+'"':"",$notification=jQuery('<div class="noty1"'+idAttribute+'><div class="notyf '+type+'">'+message+"</div></div>"),shouldClose=!id;id&&jQuery("#"+id).length?(jQuery("#"+id).find(".notyf").removeClass().addClass("notyf "+type).html(message),$notification=jQuery("#"+id),shouldClose=!0):jQuery(".notyn").append($notification),shouldClose&&window2.setTimeout(function(){closeNotyf($notification)},time)}jQuery(document2.body).on("click",".noty1",function(){closeNotyf(jQuery(this))}),window2.notyf=notyf2})(jQuery,window,document),(function(window2){"use strict";var allowedKinds={identity:!0,badges:!0,orders:!0,vip:!0},allowedEvents={click:!0,shell:!0,"first-content":!0,ready:!0,"action-start":!0,"action-end":!0,unauthorized:!0,error:!0},sessions=Object.create(null),sequence=0,maxSessions=100;function normalize(value,fallback){var normalized=String(value||fallback||"").toLowerCase().replace(/[^a-z0-9-]/g,"");return normalized||fallback}function now(){return window2.performance&&typeof window2.performance.now=="function"?window2.performance.now():0}function markName(session,event){return"jio-modal-"+session.kind+"-"+session.id+"-"+event}function emit(session,event){if(!(!window2.performance||typeof window2.performance.mark!="function")){var name=markName(session,event);if(window2.performance.mark(name),session.marks[event]=name,typeof window2.performance.measure=="function"&&session.marks.click&&event!=="click")try{window2.performance.measure("jio-modal-"+session.kind+"-"+session.id+"-click-to-"+event,session.marks.click,name)}catch{}}}function start(kind){var safeKind=normalize(kind,"unknown");allowedKinds[safeKind]||(safeKind="unknown"),sequence+=1;var id=String(sequence),session={id,kind:safeKind,startedAt:now(),marks:Object.create(null)};sessions[id]=session,emit(session,"click");for(var ids=Object.keys(sessions);ids.length>maxSessions;)delete sessions[ids.shift()];return id}function mark(id,event){var session=sessions[String(id||"")],safeEvent=normalize(event,"error");!session||!allowedEvents[safeEvent]||emit(session,safeEvent)}function finish(id){mark(id,"ready")}function fail(id){mark(id,"error")}window2.JioModalTelemetry={start,mark,finish,error:fail}})(window),(function(window2){"use strict";function data(){return window2.jioData||window2.jio||{}}function createIdempotencyKey(){if(window2.crypto&&typeof window2.crypto.randomUUID=="function")return window2.crypto.randomUUID();if(!window2.crypto||typeof window2.crypto.getRandomValues!="function")throw new Error("当前浏览器无法生成安全的操作标识");var bytes=new Uint8Array(16);window2.crypto.getRandomValues(bytes),bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;var hex=Array.prototype.map.call(bytes,function(value){return value.toString(16).padStart(2,"0")}).join("");return hex.slice(0,8)+"-"+hex.slice(8,12)+"-"+hex.slice(12,16)+"-"+hex.slice(16,20)+"-"+hex.slice(20)}function restBase(){var config=data(),raw=config.restUrl||config.apiUrl||config.rest_url||"",siteUrl=config.siteUrl||config.homeUrl||window2.location.origin+"/";return window2.location.protocol==="https:"&&siteUrl.substring(0,5)==="http:"&&(siteUrl="https:"+siteUrl.substring(5)),raw?String(raw).replace(/\/$/,""):String(siteUrl).replace(/\/$/,"")+"/index.php?rest_route=/jio/v1"}function appendQuery(url2,query){if(!query)return url2;var parts=[];return typeof query=="string"?parts=query.replace(/^\?/,"").split("&").filter(Boolean):typeof query=="object"&&Object.keys(query).forEach(function(key){query[key]===void 0||query[key]===null||parts.push(encodeURIComponent(key)+"="+encodeURIComponent(String(query[key])))}),parts.length?url2+(url2.indexOf("?")>=0?"&":"?")+parts.join("&"):url2}function url(path,query){path=String(path||"");var inlineQuery="",queryIndex=path.indexOf("?");if(queryIndex>=0&&(inlineQuery=path.slice(queryIndex+1),path=path.slice(0,queryIndex)),/^https?:\/\//i.test(path))return appendQuery(path,query||inlineQuery);path.charAt(0)!=="/"&&(path="/"+path);var base=restBase(),result=(base.indexOf("rest_route=")>=0,base+path);return appendQuery(result,query||inlineQuery)}function headers(options){var config=data(),source=options&&options.headers||{},result={},nonce=config.restNonce||config.nonce||"";return Object.keys(source).forEach(function(key){result[key]=source[key]}),result.Accept||(result.Accept="application/json, text/html;q=0.9, */*;q=0.8"),nonce&&!result["X-WP-Nonce"]&&(result["X-WP-Nonce"]=nonce),options&&options.body!==void 0&&options.body!==null&&!(window2.FormData&&options.body instanceof window2.FormData)&&!result["Content-Type"]&&(result["CoLine truncated
|
||||
@@ -63,7 +63,7 @@ if (!function_exists('jio_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__('切换亮暗色', 'jio') . '">';
|
||||
$top_btns .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '<i class="fa fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '</a>';
|
||||
}
|
||||
if ('center' !== ($ctx['mobile_layout'] ?? 'center')) {
|
||||
|
||||
@@ -324,7 +324,7 @@ if (!function_exists('jio_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__('切换亮暗色', 'jio') . '">';
|
||||
$utility_buttons .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '<i class="fa fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '</a>';
|
||||
}
|
||||
if (function_exists('jio_get_translate_language_btn')) {
|
||||
|
||||
@@ -168,7 +168,7 @@ if (!function_exists('jio_float_right')) :
|
||||
|
||||
switch ($type) {
|
||||
case 'theme_mode':
|
||||
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . jio_float_btn_tooltip_attr(__('切换主题', 'jio'), $is_mobile) . ' href="javascript:;"><i class="fa fas fa-toggle-theme"></i></a>';
|
||||
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . jio_float_btn_tooltip_attr(__('切换主题', 'jio'), $is_mobile) . ' href="javascript:;"><i class="fa fa-toggle-theme"></i></a>';
|
||||
break;
|
||||
|
||||
case 'back_top':
|
||||
|
||||
Reference in new issue
Block a user