fix(runtime): remove obsolete jQuery compatibility assets

This commit is contained in:
2026-09-05 21:31:11 +08:00
parent 4a12de38cb
commit 49ffdc6ab2
11 changed files with 5 additions and 805 deletions
+1 -1
View File
@@ -936,7 +936,7 @@ strong, b {
* The --this-* DEFAULTS are set on the base rule here (BEFORE the .b-* and .jb-* * The --this-* DEFAULTS are set on the base rule here (BEFORE the .b-* and .jb-*
* modifiers) so the cascade resolves colored variants correctly; scoped to * modifiers) so the cascade resolves colored variants correctly; scoped to
* .but/.badg (never :root) so .float-btn's own var(--this-*, fallback) stays intact. * .but/.badg (never :root) so .float-btn's own var(--this-*, fallback) stays intact.
* Consumes --focus-color-opacity* from compat-vars.css. * Uses --focus-color-opacity* tokens with local fallbacks.
* ============================================================ */ * ============================================================ */
/* Base (legacy .but / .badg) */ /* Base (legacy .but / .badg) */
+1 -1
View File
@@ -149,7 +149,7 @@
* The --this-* DEFAULTS are set on the base rule here (BEFORE the .b-* and .jb-* * The --this-* DEFAULTS are set on the base rule here (BEFORE the .b-* and .jb-*
* modifiers) so the cascade resolves colored variants correctly; scoped to * modifiers) so the cascade resolves colored variants correctly; scoped to
* .but/.badg (never :root) so .float-btn's own var(--this-*, fallback) stays intact. * .but/.badg (never :root) so .float-btn's own var(--this-*, fallback) stays intact.
* Consumes --focus-color-opacity* from compat-vars.css. * Uses --focus-color-opacity* tokens with local fallbacks.
* ============================================================ */ * ============================================================ */
/* Base (legacy .but / .badg) */ /* Base (legacy .but / .badg) */
-97
View File
@@ -1,97 +0,0 @@
/**
* legacy Variable Compatibility Layer — Global Bridge
*
* Maps legacy CSS variable names to AKSRT design tokens.
* This file allows existing legacy-style markup and third-party components
* that reference legacy variables to work correctly in AKSRT.
*
* @package AKSRT
*/
/* ============================================================
* Global bridge (all pages)
* Maps legacy variables → AKSRT tokens so any legacy-style markup works.
* ============================================================ */
:root {
/* Layout (legacy typo preserved for compat) */
--mian-max-width: var(--container, 1200px);
/* Theme color — now matches legacy #f04494 */
--theme-color: var(--color-primary, #f04494);
--focus-color: var(--color-primary, #f04494);
/* legacy focus glow = fixed #fd53a1 @ 0.4 (not the faint primary-soft) */
--focus-shadow-color: rgba(253, 83, 161, 0.4);
/* legacy --focus-color-opacityX — theme-color at fixed alphas.
Tracks the runtime theme via --color-primary-rgb (injected by
AKSRT_Scripts::inline_css_vars); fallback RGB = #f04494. */
--focus-color-opacity1: rgba(var(--color-primary-rgb, 240, 68, 148), 0.1);
--focus-color-opacity05: rgba(var(--color-primary-rgb, 240, 68, 148), 0.05);
--focus-color-opacity3: rgba(var(--color-primary-rgb, 240, 68, 148), 0.3);
/* Text hierarchy */
--key-color: var(--color-ink);
--main-color: var(--color-ink-2);
--muted-color: var(--color-ink-3);
--muted-2-color: var(--color-ink-4);
--muted-3-color: #b1b1b1;
--muted-4-color: #d2d2d2;
/* Surfaces & borders */
--body-bg-color: var(--surface-page);
--main-bg-color: var(--surface-1);
--muted-bg-color: var(--surface-2);
--main-border-color: var(--color-line);
--muted-border-color: var(--color-line-soft);
--main-shadow: rgba(116, 116, 116, 0.08);
--main-radius: var(--radius, 8px);
/* Radius variants */
--mini-radius: calc(var(--main-radius) / 1.4);
/* Blur / glass */
--blur-bg: rgba(255, 255, 255, 0.8);
--float-btn-bg: rgba(200, 200, 200, 0.4);
/* Header / footer composites */
--header-bg: var(--blur-bg);
--header-color: var(--color-ink-2);
--footer-bg: var(--surface-1);
--footer-color: var(--color-ink-4);
/* Cards — 对齐 legacy 70% */
--posts-card-scale: 70%;
--posts-list-scale: 70%;
}
/* legacy --this-* context-coloring DEFAULTS live with the .but system in
* assets/css/core/buttons.css — they must precede the .b-*/.jb-* color
* modifiers in source order for the cascade to resolve colored variants
* correctly, so they cannot sit in this later-loaded bridge file.
* (Scoped to .but/.badg there, never :root, so .float-btn stays intact.) */
/* ============================================================
* Dark mode bridge — 对齐 legacy dark theme
* ============================================================ */
html.dark,
body.dark-theme {
--theme-color: var(--color-primary);
--focus-color: var(--color-primary);
--focus-shadow-color: rgba(253, 83, 161, 0.25);
--key-color: var(--color-ink);
--main-color: var(--color-ink-2);
--muted-color: var(--color-ink-3);
--muted-2-color: var(--color-ink-4);
--muted-3-color: #636469;
--muted-4-color: #43454a;
--body-bg-color: var(--surface-page);
--main-bg-color: var(--surface-1);
--muted-bg-color: var(--surface-2);
--main-border-color: var(--color-line);
--muted-border-color: var(--color-line-soft);
--main-shadow: rgba(24, 24, 24, 0.1);
--blur-bg: rgba(50, 51, 53, 0.8);
--float-btn-bg: rgba(70, 70, 70, 0.4);
--header-color: var(--color-ink-2);
--footer-color: var(--color-ink-4);
}
-100
View File
@@ -1,100 +0,0 @@
(function (e, t) {
function n(e, t) {
var n = e.createElement("p"),
i = e.getElementsByTagName("head")[0] || e.documentElement;
return n.innerHTML = "x<style>" + t + "</style>", i.insertBefore(n.lastChild, i.firstChild)
}
function i() {
var e = m.elements;
return "string" == typeof e ? e.split(" ") : e
}
function r(e) {
var t = {},
n = e.createElement,
r = e.createDocumentFragment,
o = r();
e.createElement = function (e) {
m.shivMethods || n(e);
var i;
return i = t[e] ? t[e].cloneNode() : g.test(e) ? (t[e] = n(e)).cloneNode() : n(e), i.canHaveChildren && !f.test(e) ? o.appendChild(i) : i
}, e.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + i().join().replace(/\w+/g, function (e) {
return t[e] = n(e), o.createElement(e), 'c("' + e + '")'
}) + ");return n}")(m, o)
}
function o(e) {
var t;
return e.documentShived ? e : (m.shivCSS && !d && (t = !!n(e, "article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")), h || (t = !r(e)), t && (e.documentShived = t), e)
}
function a(e) {
for (var t, n = e.getElementsByTagName("*"), r = n.length, o = RegExp("^(?:" + i().join("|") + ")$", "i"), a = []; r--;) t = n[r], o.test(t.nodeName) && a.push(t.applyElement(s(t)));
return a
}
function s(e) {
for (var t, n = e.attributes, i = n.length, r = e.ownerDocument.createElement(b + ":" + e.nodeName); i--;) t = n[i], t.specified && r.setAttribute(t.nodeName, t.nodeValue);
return r.style.cssText = e.style.cssText, r
}
function l(e) {
for (var t, n = e.split("{"), r = n.length, o = RegExp("(^|[\\s,>+~])(" + i().join("|") + ")(?=[[\\s,>+~#.:]|$)", "gi"), a = "$1" + b + "\\:$2"; r--;) t = n[r] = n[r].split("}"), t[t.length - 1] = t[t.length - 1].replace(o, a), n[r] = t.join("}");
return n.join("{")
}
function c(e) {
for (var t = e.length; t--;) e[t].removeNode()
}
function u(e) {
var t, i, r = e.namespaces,
o = e.parentWindow;
return !y || e.printShived ? e : (r[b] === void 0 && r.add(b), o.attachEvent("onbeforeprint", function () {
for (var r, o, s, c = e.styleSheets, u = [], d = c.length, h = Array(d); d--;) h[d] = c[d];
for (; s = h.pop();)
if (!s.disabled && v.test(s.media)) {
for (r = s.imports, d = 0, o = r.length; o > d; d++) h.push(r[d]);
try {
u.push(s.cssText)
} catch (p) {}
} u = l(u.reverse().join("")), i = a(e), t = n(e, u)
}), o.attachEvent("onafterprint", function () {
c(i), t.removeNode(!0)
}), e.printShived = !0, e)
}
var d, h, p = e.html5 || {},
f = /^<|^(?:button|form|map|select|textarea|object|iframe)$/i,
g = /^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i;
(function () {
var n = t.createElement("a");
n.innerHTML = "<xyz></xyz>", d = "hidden" in n, d && "function" == typeof injectElementWithStyles && injectElementWithStyles("#modernizr{}", function (t) {
t.hidden = !0, d = "none" == (e.getComputedStyle ? getComputedStyle(t, null) : t.currentStyle).display
}), h = 1 == n.childNodes.length || function () {
try {
t.createElement("a")
} catch (e) {
return !0
}
var n = t.createDocumentFragment();
return n.cloneNode === void 0 || n.createDocumentFragment === void 0 || n.createElement === void 0
}()
})();
var m = {
elements: p.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",
shivCSS: p.shivCSS !== !1,
shivMethods: p.shivMethods !== !1,
type: "default",
shivDocument: o
};
e.html5 = m, o(t);
alert("你好,我是一个警告框!");
var v = /^$|\b(?:all|print)\b/,
b = "html5shiv",
y = !h && function () {
var n = t.documentElement;
return t.namespaces !== void 0 && t.parentWindow !== void 0 && n.applyElement !== void 0 && n.removeNode !== void 0 && e.attachEvent !== void 0
}();
m.type += " print", m.shivPrint = u, u(t)
})(this, document);
File diff suppressed because one or more lines are too long
-17
View File
@@ -146,23 +146,6 @@ function aksrt_is_user_home_page(): bool {
} }
endif; endif;
if (!function_exists('aksrt_get_profile_url')) :
/**
* 兼容层:获取用户主页 URL
*
* @deprecated 使用 aksrt_get_user_center_url() 或 aksrt_get_user_home_url() 替代
* @param WP_User|int|string|null $user
* @return string
*/
function aksrt_get_profile_url($user = null): string {
// 无参调用 → 当前用户主页(公开页)
if ($user === null) {
return aksrt_get_user_home_url();
}
return aksrt_get_user_home_url($user);
}
endif;
if (!function_exists('aksrt_get_sign_page_url')) : if (!function_exists('aksrt_get_sign_page_url')) :
/** /**
* Get the only public authentication page URL. * Get the only public authentication page URL.
@@ -47,6 +47,9 @@ test('front submit uses the WordPress-managed jQuery runtime', () => {
assert.doesNotMatch(source, /wp_deregister_script\('jquery'\)/); assert.doesNotMatch(source, /wp_deregister_script\('jquery'\)/);
assert.doesNotMatch(source, /wp_register_script\('jquery'/); assert.doesNotMatch(source, /wp_register_script\('jquery'/);
assert.doesNotMatch(source, /jquery-migrate/); assert.doesNotMatch(source, /jquery-migrate/);
assert.equal(fs.existsSync(path.join(root, 'assets/js/runtime/libs/jquery.min.js')), false);
assert.equal(fs.existsSync(path.join(root, 'assets/js/runtime/libs/jquery-ui.min.js')), false);
assert.doesNotMatch(read('inc/modules/user-parts/urls.php'), /aksrt_get_profile_url/);
const page = read('templates/pages/page-submit.php'); const page = read('templates/pages/page-submit.php');
assert.match(page, /\['loader_js', 'aksrt-front-submit-editor', 'aksrt-front-submit-pay-download'\]/); assert.match(page, /\['loader_js', 'aksrt-front-submit-editor', 'aksrt-front-submit-pay-download'\]/);
@@ -55,19 +58,8 @@ test('front submit uses the WordPress-managed jQuery runtime', () => {
test('legacy runtime modules use jQuery explicitly without a dollar alias', () => { test('legacy runtime modules use jQuery explicitly without a dollar alias', () => {
const modules = [ const modules = [
'main', 'main',
'captcha',
'comment',
'input-expand',
'mini-touch',
'mini-upload',
'page-edit',
'page-navs',
'page-template',
'poster-share',
'section-navs',
'svg-icon', 'svg-icon',
'waterfall', 'waterfall',
'weixin-share',
]; ];
for (const module of modules) { for (const module of modules) {
@@ -128,7 +128,6 @@ test('single cover css owns no fallback padding and the scale var is gone', () =
'assets/css/main.css', 'assets/css/main.css',
'assets/css/main.min.css', 'assets/css/main.min.css',
'assets/css/core/tokens.css', 'assets/css/core/tokens.css',
'assets/css/frontend/compat-vars.css',
'assets/css/build/public.css', 'assets/css/build/public.css',
'assets/css/build/public.min.css', 'assets/css/build/public.min.css',
]) { ]) {
-47
View File
@@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>cover repro2 - with swiper init</title>
<link rel="stylesheet" href="../assets/css/main.min.css">
<link rel="stylesheet" href="../assets/css/swiper.css">
<link rel="stylesheet" href="../assets/css/frontend/single-post/cover.css">
<style> body { padding: 20px; max-width: 800px; } h4 { margin: 10px 0; } </style>
</head>
<body>
<h4>A+Swiper: 当前 markup + 主题同参初始化</h4>
<div class="single-head-cover">
<div class="aksrt-slider-wrapper mb20 single-cover-slide imgbox-container aksrt-slider-wrapper--scale aksrt-slider-wrapper--has-overlay" style="position:relative;padding-bottom:calc(35% + 50px);"><div class="new-swiper slide-index single-cover single-cover--slide" data-effect="slide" data-loop data-autoplay data-interval="5000" style="--pc-height:100%;--m-height:100%;position:absolute;inset:0;width:100%;height:100%;"><div class="swiper-wrapper"><div class="swiper-slide"><img class="lazyload fit-cover" src="img-a.svg" alt="a"></div><div class="swiper-slide"><img class="lazyload fit-cover" src="img-b.svg" alt="b"></div></div><div class="swiper-button-prev"></div><div class="swiper-button-next"></div><div class="swiper-pagination"></div></div><div class="aksrt-slider-overlay"><div class="abs-center left-bottom single-cover-con"><h1 class="article-title title-h-left">标题测试</h1></div></div></div>
</div>
<script src="../assets/js/runtime/libs/jquery.min.js"></script>
<script src="../assets/js/runtime/libs/swiper.min.js"></script>
<script>
jQuery(function ($) {
$('.new-swiper').each(function (e) {
var _this = $(this);
_this.addClass('swiper-eq-' + e);
var loop = _this.attr('data-loop') ? true : false;
var autoplay = _this.attr('data-autoplay') ? { delay: 5000, disableOnInteraction: false } : false;
new Swiper('.new-swiper.swiper-eq-' + e, {
loop: loop,
autoHeight: false,
direction: 'horizontal',
spaceBetween: 0,
parallax: false,
effect: 'slide',
lazy: { loadPrevNext: true },
autoplay: autoplay,
speed: 400,
pagination: { el: '.new-swiper.swiper-eq-' + e + ' .swiper-pagination', type: 'bullets', clickable: true },
navigation: { nextEl: '.new-swiper.swiper-eq-' + e + ' .swiper-button-next', prevEl: '.new-swiper.swiper-eq-' + e + ' .swiper-button-prev' },
on: {
init: function () {
if (loop) { _this.find('.swiper-slide-duplicate img').addClass('no-imgbox'); }
}
}
});
});
});
</script>
</body>
</html>
-20
View File
@@ -1,20 +0,0 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>cover repro3 - full runtime</title>
<link rel="stylesheet" href="../assets/css/main.min.css">
<link rel="stylesheet" href="../assets/css/swiper.css">
<link rel="stylesheet" href="../assets/css/frontend/single-post/cover.css">
<style> body { padding: 20px; max-width: 800px; } h4 { margin: 10px 0; } </style>
</head>
<body>
<h4>真实运行时(loader+main+lazysizes+Swiper)+ 懒加载占位形态</h4>
<div class="single-head-cover">
<div class="aksrt-slider-wrapper mb20 single-cover-slide imgbox-container aksrt-slider-wrapper--scale aksrt-slider-wrapper--has-overlay" style="position:relative;padding-bottom:calc(35% + 50px);"><div class="new-swiper slide-index single-cover single-cover--slide" data-effect="slide" data-loop data-autoplay data-interval="5000" style="--pc-height:100%;--m-height:100%;position:absolute;inset:0;width:100%;height:100%;"><div class="swiper-wrapper"><div class="swiper-slide"><img class="lazyload fit-cover" src="../assets/img/thumbnail-lg.svg" data-src="img-a.svg" alt="a"></div><div class="swiper-slide"><img class="lazyload fit-cover" src="../assets/img/thumbnail-lg.svg" data-src="img-b.svg" alt="b"></div></div><div class="swiper-button-prev"></div><div class="swiper-button-next"></div><div class="swiper-pagination"></div></div><div class="aksrt-slider-overlay"><div class="abs-center left-bottom single-cover-con"><h1 class="article-title title-h-left">标题测试</h1></div></div></div>
</div>
<script src="../assets/js/runtime/libs/jquery.min.js"></script>
<script src="../assets/js/runtime/loader.js"></script>
<script src="../assets/js/runtime/main.min.js"></script>
</body>
</html>
-505
View File
File diff suppressed because one or more lines are too long