- rehydrate.js 新增 boot()/aksrt:ready 事件,支持 boot 后晚注册立即以 init 触发 - aksrt-runtime.js 初始加载改走 AksrtFrontend.boot,tooltip/倒计时注册为组件 - 约 30 个前端脚本(首页、评论、支付、路由、页面叶子、widgets) 从直接 DOMContentLoaded 迁移为 AksrtFrontend.register,并加幂等标记 - section-navs 依赖改为 aksrt-runtime,保证注册时序 - 清理死代码:删除孤儿 loader.js/main.js 及 runtime/page-navs 遗留副本 - loader.js 移除已迁移模块的 tbquire 路径映射,main.js 相应瘦身 - build-public-assets.mjs 增加 runtime/main.min.js 自动压缩步骤 - 新增 4 个契约测试(homepage-dom/rehydrate-runtime/global-dom-init/ public-bundle-parity),3 个既有 harness 适配注册表初始化方式
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
/**
|
|
* AKSRT Download Status
|
|
*
|
|
* Handles download center page interactions:
|
|
* - Resource type filter animation
|
|
* - Price badge hover effects
|
|
* - Status bar refresh on download completion
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
var DownloadStatus = {
|
|
init: function (root) {
|
|
this.root = root || document;
|
|
this.initFilterHighlight();
|
|
this.initCardHover();
|
|
},
|
|
|
|
/**
|
|
* Animate filter button active state
|
|
*/
|
|
initFilterHighlight: function () {
|
|
var filters = this.root.nodeType === 1 && this.root.matches('.aksrt-download-hero__filter')
|
|
? [this.root] : this.root.querySelectorAll('.aksrt-download-hero__filter');
|
|
if (filters.length === 0) return;
|
|
|
|
filters.forEach(function (btn) {
|
|
if (btn.dataset.aksrtDownloadHoverBound === '1') return;
|
|
btn.dataset.aksrtDownloadHoverBound = '1';
|
|
btn.addEventListener('mouseenter', function () {
|
|
btn.style.transform = 'translateY(-1px)';
|
|
});
|
|
btn.addEventListener('mouseleave', function () {
|
|
btn.style.transform = '';
|
|
});
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Card hover depth effect
|
|
*/
|
|
initCardHover: function () {
|
|
var cards = this.root.nodeType === 1 && this.root.matches('.aksrt-download-card')
|
|
? [this.root] : this.root.querySelectorAll('.aksrt-download-card');
|
|
if (cards.length === 0) return;
|
|
|
|
cards.forEach(function (card) {
|
|
if (card.dataset.aksrtDownloadHoverBound === '1') return;
|
|
card.dataset.aksrtDownloadHoverBound = '1';
|
|
card.addEventListener('mouseenter', function () {
|
|
card.style.transform = 'translateY(-2px)';
|
|
});
|
|
card.addEventListener('mouseleave', function () {
|
|
card.style.transform = '';
|
|
});
|
|
});
|
|
},
|
|
};
|
|
|
|
window.AksrtFrontend.register('aksrt-download-status', function (root) {
|
|
DownloadStatus.init(root);
|
|
});
|
|
})();
|