Cleanup artifacts from node build flow
This commit is contained in:
18
web/js/util.js
Normal file
18
web/js/util.js
Normal file
@ -0,0 +1,18 @@
|
||||
export function isOverflown(element) {
|
||||
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
||||
}
|
||||
|
||||
export function setProgressBar(bar, progress, text = '') {
|
||||
const progPos = (-1 * (1 - progress) * bar.scrollWidth).toString();
|
||||
const progStr = (progress * 100).toString();
|
||||
bar.setAttribute('aria-valuenow', progStr);
|
||||
bar.style.transform = 'translateX(' + progPos + 'px)';
|
||||
bar.textContent = text;
|
||||
}
|
||||
|
||||
export function secondsToStr(seconds) {
|
||||
seconds = Math.floor(seconds);
|
||||
const mins = Math.floor(seconds / 60);
|
||||
const secs = seconds % 60;
|
||||
return ('00' + mins).slice(-2) + ':' + ('00' + secs).slice(-2);
|
||||
}
|
Reference in New Issue
Block a user