fix(runtime): 按参考主题硬切换为 loader/main/auto_fun 单一 DOM 生命周期
- 删除 AksrtFrontend registry/rehydrate 双路架构及 build/public.js 拼包入口,
前台唯一初始路径为 PHP 本地栈(jQuery 1.9.1 → Bootstrap 3.4.1)
→ loader_js(_win/aksrtData 唯一注入)→ tbquire(['main']) → runtime/main.min.js
- window.auto_fun = debounce(z_auto_fun, 100) 为唯一重扫入口;所有模块改为
执行一次 + off/on('auto_fun.aksrt-*') 命名空间重扫,data/class 标记幂等
- 局部更新协议统一:HTML 注入 → post_ajax.ed → auto_fun();
远程 modal → loaded.bs.modal → auto_fun();JSON 成功 → zib_ajax.success
- 灯箱恢复 Miniimgbox/imgbox 唯一 owner(imgbox-container、a[data-imgbox]、
imgbox_data),删除 AksrtLightbox/data-aksrt-lightbox 第二实现及 CSS/overlay,
_win.imgbox* 重新接上 post-display 设置
- 死代码清理:runtime 下 11 组被自有实现替代的旧模块副本、无消费 vendored 库、
顶层 grade.min.js、revenue.js、无调用方的 aksrt_get_win_runtime_config(),
以及 loader 中 16 条死 mapping
- PHP 入队改为本地栈 + loader_js,routed/widget/submit 依赖统一换绑;
用户卡片发布按钮恢复 nav_user_newposts_btn 设置门控
- 测试对齐:新增 frontend-lifecycle-contract,重写 navigation/lazyload/toast/
auth-source/comment/page-display/post-visual 等断言为目标架构契约
验证:node --test widget-system+navigation 223 通过 0 失败;
构建脚本重建 main/imgbox min 与 CSS bundles;改动 PHP php -l、JS node --check
全部通过;git diff --check 干净;credits 重入 harness 通过。
This commit is contained in:
1 parent
1cd81fb61a
commit
5fd7c212ed
124 files changed
+2128
-17328
No files matched your search
+17
-42
@@ -8,8 +8,6 @@
|
||||
var modal = null;
|
||||
var lastModalTrigger = null;
|
||||
var qrStates = [];
|
||||
var globalEventsBound = false;
|
||||
var oauthResultChecked = false;
|
||||
var oauthErrorMessages = {
|
||||
access_denied: '已取消第三方授权',
|
||||
cancelled: '已取消第三方授权',
|
||||
@@ -509,17 +507,6 @@
|
||||
}
|
||||
|
||||
function initRoot(root) {
|
||||
root = root || document;
|
||||
if (root.nodeType === 1 && root.matches('[data-aksrt-auth]')) {
|
||||
initAuthRoot(root);
|
||||
return;
|
||||
}
|
||||
if (root.querySelectorAll) root.querySelectorAll('[data-aksrt-auth]').forEach(initAuthRoot);
|
||||
}
|
||||
|
||||
function initAuthRoot(root) {
|
||||
if (root.dataset.aksrtAuthInitialized === '1') return;
|
||||
root.dataset.aksrtAuthInitialized = '1';
|
||||
root.querySelectorAll('input').forEach(function (input) {
|
||||
if (!input.hasAttribute('placeholder')) input.setAttribute('placeholder', ' ');
|
||||
});
|
||||
@@ -675,14 +662,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function initGlobal() {
|
||||
function init() {
|
||||
if (document.documentElement.dataset.aksrtAuthInitialized === '1') return;
|
||||
document.documentElement.dataset.aksrtAuthInitialized = '1';
|
||||
showOAuthResultToast();
|
||||
document.querySelectorAll('[data-aksrt-auth]').forEach(initRoot);
|
||||
modal = document.querySelector('[data-auth-modal]');
|
||||
if (!oauthResultChecked) {
|
||||
oauthResultChecked = true;
|
||||
showOAuthResultToast();
|
||||
}
|
||||
if (globalEventsBound) return;
|
||||
globalEventsBound = true;
|
||||
document.addEventListener('click', function (event) {
|
||||
var trigger = event.target.closest('[data-aksrt-auth-required], .aksrt-login-trigger, #nav-login-btn, .signin-loader, .signup-loader, .qrcode-signin');
|
||||
if (!trigger) return;
|
||||
@@ -690,7 +675,17 @@
|
||||
var tab = trigger.classList.contains('signup-loader') ? 'signup' : (trigger.classList.contains('qrcode-signin') ? 'oauth' : 'signin');
|
||||
openModal(tab, trigger.dataset.authRedirect || window.location.href, trigger);
|
||||
});
|
||||
document.addEventListener('keydown', handleModalKeydown);
|
||||
if (modal) {
|
||||
modal.addEventListener('click', function (event) {
|
||||
if (event.target.closest('[data-auth-close]')) closeModal(true);
|
||||
});
|
||||
document.addEventListener('keydown', handleModalKeydown);
|
||||
if (modal.dataset.auto === '1' && Number(window.localStorage.getItem('aksrtAuthAutoUntil') || 0) < Date.now()) {
|
||||
window.setTimeout(function () {
|
||||
openModal(modal.querySelector('[data-aksrt-auth]').dataset.initialTab || 'signin', window.location.href, null);
|
||||
}, Math.max(1, Number(modal.dataset.autoWait) || 5) * 1000);
|
||||
}
|
||||
}
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
qrStates.forEach(function (state) {
|
||||
if (document.visibilityState !== 'visible') stopQr(state.root);
|
||||
@@ -699,25 +694,5 @@
|
||||
});
|
||||
}
|
||||
|
||||
function initModal() {
|
||||
if (!modal || modal.dataset.aksrtAuthModalInitialized === '1') return;
|
||||
modal.dataset.aksrtAuthModalInitialized = '1';
|
||||
modal.addEventListener('click', function (event) {
|
||||
if (event.target.closest('[data-auth-close]')) closeModal(true);
|
||||
});
|
||||
if (modal.dataset.auto === '1' && Number(window.localStorage.getItem('aksrtAuthAutoUntil') || 0) < Date.now()) {
|
||||
window.setTimeout(function () {
|
||||
var root = modal.querySelector('[data-aksrt-auth]');
|
||||
if (root) openModal(root.dataset.initialTab || 'signin', window.location.href, null);
|
||||
}, Math.max(1, Number(modal.dataset.autoWait) || 5) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.AksrtFrontend && typeof window.AksrtFrontend.register === 'function') {
|
||||
window.AksrtFrontend.register('aksrt-auth', function (root) {
|
||||
initGlobal();
|
||||
initRoot(root);
|
||||
initModal();
|
||||
});
|
||||
}
|
||||
jQuery(document).off('auto_fun.aksrt-auth').on('auto_fun.aksrt-auth', init);
|
||||
}());
|
||||
Reference in new issue
Block a user