| | |
| | | return div.innerHTML; |
| | | } |
| | | |
| | | window.generateID = function(prefix = 'jvb') { |
| | | return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2,9)}`; |
| | | } |
| | | |
| | | window.showProgress = function(elements, current, total, message = '', icon = '') { |
| | | const show = current < total; |
| | | if (elements.progress && show) { |
| | | window.fade(elements.progress, true); |
| | | } |
| | | const percent = total > 0 ? (current / total) * 100 : 0; |
| | | if (elements.fill) elements.fill.style.width = `${percent}%`; |
| | | if (elements.details) elements.details.textContent = message; |
| | | if (elements.count) elements.count.textContent = `${current}/${total}`; |
| | | if (elements.icon) elements.icon.className = (icon === '') ? 'icon' : 'icon icon-'+icon; |
| | | |
| | | if (elements.progress && current === total) { |
| | | window.fade(elements.progress, false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Format a date string for display |
| | | * @param {string} dateString - ISO date string |