补充主题静态资源与归档模板

This commit is contained in:
2026-07-03 23:15:11 +08:00
parent 1268a55dd0
commit 3247db7ed1
265 changed files with 59174 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
/**
* AKSRT CMS Home Modules
*
* - Tab 切换:[data-aksrt-tabs] / [data-tab-target] / [data-tab-id]
*/
(function () {
'use strict';
function initTabs(scope) {
const tablists = (scope || document).querySelectorAll('[data-aksrt-tabs]');
tablists.forEach(function (list) {
const buttons = list.querySelectorAll('.home-module__tab');
const section = list.closest('.home-module--tabs');
if (!section) return;
const panels = section.querySelectorAll('.home-module__tab-panel');
buttons.forEach(function (btn) {
btn.addEventListener('click', function () {
const target = btn.getAttribute('data-tab-target');
if (!target) return;
buttons.forEach(function (b) {
b.classList.toggle('is-active', b === btn);
b.setAttribute('aria-selected', b === btn ? 'true' : 'false');
});
panels.forEach(function (p) {
const isMatch = p.getAttribute('data-tab-id') === target;
p.classList.toggle('is-active', isMatch);
if (isMatch) {
p.removeAttribute('hidden');
} else {
p.setAttribute('hidden', '');
}
});
});
});
});
}
// 监听 postMessage:iframe 预览模式下接收 reload 请求
window.addEventListener('message', function (e) {
if (!e.data || e.data.type !== 'aksrt-preview-reload') return;
// 简单做:直接 reload
window.location.reload();
});
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () { initTabs(); });
} else {
initTabs();
}
})();