some more features and fixes (title and show info)
This commit is contained in:
@@ -111,26 +111,11 @@ App.player = App.player || {};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Title marquee (mirrors App.videos' card marquee math, scoped locally
|
||||
// since the player title isn't a `.video-card`).
|
||||
// Title marquee. Only one title is on screen here, so unlike the grid it
|
||||
// always scrolls when it overflows -- there's nothing to pick between.
|
||||
// ---------------------------------------------------------------------
|
||||
function measureTitle() {
|
||||
const wrap = q('.cp-title');
|
||||
const text = q('.cp-title-text');
|
||||
if (!wrap || !text) return;
|
||||
const overflow = text.scrollWidth - wrap.clientWidth;
|
||||
if (overflow > 4) {
|
||||
const distance = overflow + 12;
|
||||
const MARQUEE_SPEED = 28;
|
||||
const MARQUEE_MIN_DURATION = 6;
|
||||
const duration = Math.max(MARQUEE_MIN_DURATION, distance / MARQUEE_SPEED);
|
||||
text.style.setProperty('--marquee-distance', `${distance}px`);
|
||||
text.style.setProperty('--marquee-duration', `${duration.toFixed(2)}s`);
|
||||
wrap.classList.add('has-marquee');
|
||||
} else {
|
||||
wrap.classList.remove('has-marquee');
|
||||
text.style.removeProperty('--marquee-distance');
|
||||
}
|
||||
App.marquee.measure(q('.cp-title'), q('.cp-title-text'));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user