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
+26
-25
@@ -1872,7 +1872,7 @@ function post_ajax(_this, con, jcon, item, loader, pag, next, trigger, replace,
|
||||
}
|
||||
|
||||
swiper_tab_AutoHeight($con);
|
||||
window.AksrtFrontend.rehydrate($con[0], 'ajax');
|
||||
auto_fun();
|
||||
},
|
||||
});
|
||||
return !1;
|
||||
@@ -1884,7 +1884,7 @@ _win.bd.on('click', '[remote-box]', function () {
|
||||
if (remote) {
|
||||
jQuery.post(remote, null, function (data) {
|
||||
_this.html(data).removeAttr('remote-box');
|
||||
window.AksrtFrontend.rehydrate(_this[0], 'ajax');
|
||||
auto_fun();
|
||||
_this.trigger('aksrt:remote-loaded');
|
||||
});
|
||||
}
|
||||
@@ -2176,7 +2176,7 @@ _win.bd.on('show.bs.modal loaded.bs.modal', '.modal:not(.flex)', function () {
|
||||
});
|
||||
|
||||
_win.bd.on('show.bs.modal loaded.bs.modal', '.modal', function () {
|
||||
window.AksrtFrontend.rehydrate(this, 'modal');
|
||||
auto_fun();
|
||||
});
|
||||
|
||||
_win.modal_z_index = 1050;
|
||||
@@ -2420,9 +2420,7 @@ function z_auto() {
|
||||
}
|
||||
}
|
||||
|
||||
window.auto_fun = debounce(function (root) {
|
||||
window.AksrtFrontend.rehydrate(root && root.nodeType ? root : document, 'ajax');
|
||||
}, 100);
|
||||
window.auto_fun = debounce(z_auto_fun, 100);
|
||||
function z_auto_fun() {
|
||||
jQuery(document).trigger('auto_fun');
|
||||
|
||||
@@ -2435,15 +2433,12 @@ function z_auto_fun() {
|
||||
//可复制
|
||||
jQuery('.cloneable').cloneable();
|
||||
|
||||
//倒计时
|
||||
jQuery('[data-countdown]').countdown();
|
||||
|
||||
auto_maxHeight();
|
||||
//兼容性图片懒加载
|
||||
jQuery('img[data-src]:not(.lazyload,.lazyloaded,.lazyloading,.swiper-lazy)').addClass('lazyload');
|
||||
//瀑布流布局,暂未启用,要抖动,且需要修改div结构
|
||||
/**
|
||||
tbquire(['waterfall'], function () {
|
||||
jQuery('.waterfall-box').waterfall();
|
||||
});
|
||||
*/
|
||||
|
||||
/* 提示工具*/
|
||||
jQuery("[data-toggle='tooltip']").tooltip({
|
||||
@@ -2496,6 +2491,9 @@ function z_auto_fun() {
|
||||
theme: _win.highlight_zt,
|
||||
});
|
||||
});
|
||||
|
||||
//图片灯箱
|
||||
_win.imgbox && jQuery('.alone-imgbox-img,a[data-imgbox],.comment-content .box-img,.wp-posts-content img,.imgbox-container').length && tbquire(['imgbox']);
|
||||
}
|
||||
|
||||
//页面滚动监听函数
|
||||
@@ -3087,6 +3085,10 @@ _win.bd.on('input focus', 'textarea[autoHeight]', function () {
|
||||
_win.bd.on('click', '.rewards', function () {
|
||||
jQuery('#rewards-popover').modal('show');
|
||||
});
|
||||
|
||||
//作者页、文章导航、前台编辑、通用模板、微信分享均由 AKSRT 自有脚本按路由入队,
|
||||
//legacy main 不再通过 tbquire 重复加载同功能的旧模块副本。
|
||||
|
||||
//搜索关键词高亮
|
||||
if (_win.bd.hasClass('search')) {
|
||||
var val = jQuery('.search-desc-text .search-key').text();
|
||||
@@ -3497,7 +3499,7 @@ jQuery.fn.AutoSearch = function () {
|
||||
_this.removeClass(loading);
|
||||
_remind.html(result.remind || '');
|
||||
_icon.html(_icon_html);
|
||||
window.AksrtFrontend.rehydrate(_container[0], 'ajax');
|
||||
auto_fun();
|
||||
},
|
||||
'json'
|
||||
);
|
||||
@@ -3874,7 +3876,7 @@ function aksrt_ajax(_this, data, success, noty, no_loading) {
|
||||
notyf(n.msg, ys);
|
||||
}
|
||||
|
||||
_this.attr('disabled', false).html(_text).trigger('aksrt_ajax.success', n); //完成
|
||||
_this.attr('disabled', false).html(_text).trigger('zib_ajax.success', n); //完成
|
||||
jQuery.isFunction(success) && success(n, _this, data);
|
||||
|
||||
if (n.hide_modal) {
|
||||
@@ -3893,7 +3895,7 @@ function aksrt_ajax(_this, data, success, noty, no_loading) {
|
||||
}
|
||||
|
||||
//AJAX执行完成后自动切换到下一个tab
|
||||
_win.bd.on('aksrt_ajax.success', '[next-tab]', function (e, n) {
|
||||
_win.bd.on('zib_ajax.success', '[next-tab]', function (e, n) {
|
||||
var _next = jQuery(this).attr('next-tab');
|
||||
if (_next && n && !n.error) {
|
||||
jQuery('a[href="#' + _next + '"]').tab('show');
|
||||
@@ -3946,6 +3948,12 @@ function posts_limit_height() {
|
||||
}
|
||||
}
|
||||
|
||||
auto_fun();
|
||||
thumb_dplayer(_wid > 640 ? '.posts-item .item-thumbnail,.forum-lists-cover' : '.posts-item,.forum-posts', '.video-thumb-box[video-url]');
|
||||
|
||||
//页面加载之后自动点击
|
||||
jQuery('[load-click]').attr('no-scroll', true).click();
|
||||
|
||||
//图片延迟懒加载-ias自动加载
|
||||
jQuery(document).on('lazybeforeunveil', function (e) {
|
||||
var _this = jQuery(e.target);
|
||||
@@ -4524,7 +4532,7 @@ _win.bd.on('click', '.customize-preview-widget-edit', function (e) {
|
||||
});
|
||||
|
||||
//页面加载完毕之后加载的函数
|
||||
function initLegacyDocumentReady() {
|
||||
jQuery(document).ready(function () {
|
||||
setTimeout(function () {
|
||||
//页面加载完毕之后再延迟两秒加载的函数
|
||||
|
||||
@@ -4670,7 +4678,8 @@ function initLegacyDocumentReady() {
|
||||
yiyan_nr(jQuery(this));
|
||||
});
|
||||
|
||||
/*文章目录*/
|
||||
/*文章目录由 AKSRT section-navs 按需入队,legacy 不再重复加载。*/
|
||||
|
||||
//手势控制
|
||||
jQuery('[mini-touch]').each(function () {
|
||||
var _this = jQuery(this);
|
||||
@@ -4687,12 +4696,4 @@ function initLegacyDocumentReady() {
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
window.AksrtFrontend.register('aksrt-legacy-main', function (root, reason) {
|
||||
z_auto_fun();
|
||||
if (reason !== 'init') return;
|
||||
initLegacyDocumentReady();
|
||||
thumb_dplayer(_wid > 640 ? '.posts-item .item-thumbnail,.forum-lists-cover' : '.posts-item,.forum-posts', '.video-thumb-box[video-url]');
|
||||
jQuery('[load-click]').attr('no-scroll', true).click();
|
||||
});
|
||||
Reference in new issue
Block a user