feat(widgets): feature intro shared JS + plate info count-mates
Move FeatureIntro tab/media script into widget-set.js; align plate info stats with zibll count-mates layout and residual CSS.
This commit is contained in:
1 parent
e4662cd4d9
commit
152772ea60
4 files changed
+60
-25
No files matched your search
@@ -2517,3 +2517,19 @@ a.main-color > .icon-cover-card:hover,
|
||||
.aksrt-product-tab__skeleton .placeholder.s1 { width: 48%; }
|
||||
.aksrt-main-posts[data-load-mode="ajax"].is-ajax-loading { opacity: .85; }
|
||||
.widget-search-box.is-affix { position: sticky; top: 72px; }
|
||||
|
||||
|
||||
/* batch40-42 residual */
|
||||
.aksrt-plate-info .count-mates {
|
||||
gap: 8px; margin-top: 12px; padding-top: 10px;
|
||||
border-top: 1px solid var(--color-line, rgba(0,0,0,.06));
|
||||
}
|
||||
.aksrt-plate-info .count-mates item,
|
||||
.aksrt-plate-info .count-mates .mate-views,
|
||||
.aksrt-plate-info .count-mates .mate-reply,
|
||||
.aksrt-plate-info .count-mates .mate-follow {
|
||||
flex: 1 1 0; min-width: 0; text-align: center;
|
||||
}
|
||||
.aksrt-plate-info .count-mates .em14 { font-weight: 700; line-height: 1.2; }
|
||||
.aksrt-fi[data-aksrt-feature-intro] .aksrt-fi__panel { display: none; }
|
||||
.aksrt-fi[data-aksrt-feature-intro] .aksrt-fi__panel.is-active { display: block; }
|
||||
@@ -344,6 +344,41 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Feature intro media tabs.
|
||||
function initFeatureIntro() {
|
||||
document.querySelectorAll('[data-aksrt-feature-intro]').forEach(function (root) {
|
||||
if (root.dataset.aksrtFiBound === '1') return;
|
||||
root.dataset.aksrtFiBound = '1';
|
||||
var tabs = [].slice.call(root.querySelectorAll('.aksrt-fi__tab'));
|
||||
var panels = [].slice.call(root.querySelectorAll('.aksrt-fi__panel'));
|
||||
if (!tabs.length || !panels.length) return;
|
||||
function go(i) {
|
||||
tabs.forEach(function (t, idx) {
|
||||
t.classList.toggle('is-active', idx === i);
|
||||
});
|
||||
panels.forEach(function (p, idx) {
|
||||
p.classList.toggle('is-active', idx === i);
|
||||
var v = p.querySelector('video');
|
||||
if (!v) return;
|
||||
if (idx === i) {
|
||||
if (!v.getAttribute('src') && v.getAttribute('data-src')) {
|
||||
v.setAttribute('src', v.getAttribute('data-src'));
|
||||
}
|
||||
if (v.play) v.play().catch(function () {});
|
||||
} else if (v.pause) {
|
||||
v.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
tabs.forEach(function (t) {
|
||||
t.addEventListener('click', function () {
|
||||
go(parseInt(t.getAttribute('data-index') || '0', 10));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initFloatingQRCodes() {
|
||||
var wrap = document.querySelector('.float-right');
|
||||
if (!wrap) return;
|
||||
@@ -388,6 +423,7 @@
|
||||
initForumTabTopics();
|
||||
initProductTabs();
|
||||
initMainPostsLazy();
|
||||
initFeatureIntro();
|
||||
initFloatingQRCodes();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user