refactor(modal): remove legacy compatibility paths

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-08-05 00:06:37 +08:00
1 parent bdfe3a461d
commit 34150f3358
18 files changed
+188 -380

No files matched your search

+6 -64
View File
@@ -5,7 +5,6 @@
* aksrt.tbquire(deps, cb) — lazy script/CSS loader
* aksrt.notyf(msg, opts) — unified toast (same-ID update)
* aksrt.confirm(msg, opts) — i18n confirm dialog
* aksrt.refreshModal(opts) — remote content modal
* aksrt.scrollTopTo(target, off) — smart scroll with header offset
* aksrt.loading(el, show) — element-level loading overlay
* aksrt.Drawer(opts) — mobile fullscreen drawer + route
@@ -313,68 +312,6 @@
el.appendChild(mask);
};
// ══════════════════════════════════════════════════════════════
// §10.10 — refreshModal: remote content modal
// ══════════════════════════════════════════════════════════════
function closeRefreshModal() {
if (window.AksrtModalRuntime && typeof window.AksrtModalRuntime.close === 'function') {
window.AksrtModalRuntime.close('refresh-modal');
}
}
aksrt.refreshModal = function (opts) {
opts = opts || {};
var runtime = window.AksrtModalRuntime;
if (!runtime || typeof runtime.open !== 'function' || typeof runtime.openRemote !== 'function') {
return Promise.reject(new Error('modal runtime unavailable'));
}
var base = {
title: opts.title || '',
className: opts.class || '',
bottom: opts.mobile_from_bottom === true,
mobileBottom: opts.mobile_from_bottom === true,
cache: opts.cache !== false,
cacheTtl: opts.cacheTtl || 15000,
cacheTags: opts.cacheTags || opts.tags || [],
kind: opts.kind || 'generic',
};
if (opts.content !== undefined) {
return Promise.resolve(runtime.open(Object.assign({}, base, { html: opts.content })))
.catch(function () { return null; });
}
if (opts.remote) {
return runtime.openRemote(Object.assign({}, base, {
url: opts.remote,
method: opts.method || 'GET',
}));
}
if (opts.action) {
var ajaxUrl = (window.aksrtData && window.aksrtData.ajaxUrl) || '/wp-admin/admin-ajax.php';
var params = new URLSearchParams();
params.set('action', opts.action);
if (window.aksrtData && window.aksrtData.nonce) params.set('nonce', window.aksrtData.nonce);
if (opts.data) {
Object.keys(opts.data).forEach(function (key) { params.set(key, opts.data[key]); });
}
return runtime.openRemote(Object.assign({}, base, {
url: ajaxUrl,
method: 'POST',
cache: false,
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
body: params.toString(),
}));
}
return Promise.resolve(runtime.open(base));
};
aksrt.refreshModal.close = closeRefreshModal;
// ══════════════════════════════════════════════════════════════
// §10.11 — Drawer: mobile fullscreen slide-in + route
// ══════════════════════════════════════════════════════════════
@@ -707,7 +644,12 @@
btn.classList.remove('is-loading');
if (json && json.success) {
if (json.data && json.data.show_modal) {
aksrt.refreshModal({ content: json.data.show_modal, mobile_from_bottom: true });
window.AksrtModalRuntime.open({
html: json.data.show_modal,
bottom: true,
mobileBottom: true,
kind: 'generic',
});
} else if (json.data && json.data.message) {
aksrt.notyf(json.data.message, 'success');
}