mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-12 17:10:54 +00:00
* Added: Setting to hide viewer counts from the side bar. * Changed: Allow use of time formats when creating a timeout action. (Closes #978) * Changed: Highlight My Message highlights can now be displayed in either Twitch style or FFZ style, in addition to disabling the highlight. FFZ Style remains the default. (Closes #972) * Fixed: Current Channel profile rules not functioning, either on normal channel pages or on mod view pages. (Closes #957) * Fixed: Current Category and Title profile rules not working on mod view. * Fixed: Channel color not being detected correctly. (Also Closes #972) * Fixed: Download Clip not displaying on clip pages. (Closes #960) * Fixed: Remove debug logging from `resizeInput` * Fixed: Popups, including channel rules, not rendering correctly in portrait mode. (Closes #979) * Fixed: Rendering for certain elements using `tw-pill` * Fixed: Vue balloon elements not rendering correctly.
66 lines
No EOL
1.7 KiB
JavaScript
66 lines
No EOL
1.7 KiB
JavaScript
'use strict';
|
|
|
|
export function getBuster(resolution = 5) {
|
|
const now = Math.floor(Date.now() / 1000);
|
|
return now - (now % resolution);
|
|
}
|
|
|
|
export function duration_to_string(elapsed, separate_days, days_only, no_hours, no_seconds) {
|
|
const seconds = elapsed % 60;
|
|
let minutes = Math.floor(elapsed / 60),
|
|
hours = Math.floor(minutes / 60),
|
|
days = '';
|
|
|
|
minutes = minutes % 60;
|
|
|
|
if ( separate_days ) {
|
|
days = Math.floor(hours / 24);
|
|
hours = hours % 24;
|
|
if ( days_only && days > 0 )
|
|
return `${days} days`;
|
|
|
|
days = days > 0 ? `${days} days, ` : '';
|
|
}
|
|
|
|
const show_hours = (!no_hours || days || hours);
|
|
|
|
return `${days}${
|
|
show_hours ? `${days && hours < 10 ? '0' : ''}${hours}:` : ''
|
|
}${show_hours && minutes < 10 ? '0' : ''}${minutes}${
|
|
no_seconds ? '' : `:${seconds < 10 ? '0' : ''}${seconds}`}`;
|
|
}
|
|
|
|
|
|
export function print_duration(seconds) {
|
|
let minutes = Math.floor(seconds / 60);
|
|
const hours = Math.floor(minutes / 60);
|
|
|
|
minutes %= 60;
|
|
seconds %= 60;
|
|
|
|
return `${hours > 0 ? `${hours}:${minutes < 10 ? '0' : ''}` : ''}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
|
|
}
|
|
|
|
|
|
export function durationForChat(elapsed) {
|
|
const seconds = elapsed % 60;
|
|
let minutes = Math.floor(elapsed / 60);
|
|
let hours = Math.floor(minutes / 60);
|
|
const days = Math.floor(hours / 24);
|
|
|
|
minutes = minutes % 60;
|
|
hours = hours % 24;
|
|
|
|
return `${days > 0 ? `${days}d` : ''}${hours > 0 ? `${hours}h` : ''}${minutes > 0 ? `${minutes}m` : ''}${seconds > 0 ? `${seconds}s` : ''}`;
|
|
}
|
|
|
|
|
|
export function durationForURL(elapsed) {
|
|
const seconds = elapsed % 60;
|
|
let minutes = Math.floor(elapsed / 60);
|
|
const hours = Math.floor(minutes / 60);
|
|
|
|
minutes = minutes % 60;
|
|
|
|
return `${hours > 0 ? `${hours}h` : ''}${minutes > 0 ? `${minutes}m` : ''}${seconds > 0 ? `${seconds}s` : ''}`;
|
|
} |