SKRIPTE EKOF > STATISTIKA > KURSEVI
  📚   Kurs za kolokvijum iz statistike 2025/26.

Drugi semestar 0 (0)
Drugi semestar 0 (0)
  📚   Kurs za ostatak lekcija iz statistike 2025/26.

Skripte Ekof 0 (0)
(function() { // We remove clearInterval to keep checking in case new cards load or data delay occurs const checkInterval = setInterval(() => { const list = window.expiring_courses; // If data isn't here yet, just wait for the next tick if (!list || list.length === 0) { console.log("Waiting for Expiring Courses data..."); return; } // Find all course containers const courseCards = document.querySelectorAll('.course-item-02'); if (courseCards.length === 0) return; courseCards.forEach(card => { // Avoid adding multiple badges to the same card if (card.querySelector('.expiry-badge-custom')) return; const anchor = card.querySelector('a'); const href = anchor ? anchor.getAttribute('href') : ""; if (!href) return; // Extract the slug (e.g., "osak1") to ensure a match regardless of /take/ prefix const courseSlug = href.split('/').filter(Boolean).pop(); // Find match in the PowerUp list const courseData = list.find(c => c.card_url.includes(courseSlug)); if (courseData) { const expiry = new Date(courseData.exp_ms * 1000); const daysLeft = Math.ceil((expiry - new Date()) / (1000 * 60 * 60 * 24)); const badge = document.createElement('div'); badge.className = 'expiry-badge-custom'; // Marker to prevent duplicates badge.innerHTML = `
Ističe za
${daysLeft} dana
`; // Styling badge.style.cssText = ` position: absolute; top: 8px; right: 8px; padding: 6px 8px; border-radius: 4px; background: #fef3c7; color: #78350f; z-index: 99; text-align: center; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); border: 1px solid #fcd34d; pointer-events: none; font-family: sans-serif; `; // Urgency Colors if (daysLeft <= 2) { badge.style.background = '#fee2e2'; badge.style.color = '#991b1b'; badge.style.borderColor = '#f87171'; } else if (daysLeft <= 7) { badge.style.background = '#ffedd5'; badge.style.color = '#9a3412'; badge.style.borderColor = '#fb923c'; } const thumb = card.querySelector('.course-header__thumbnail'); if (thumb) { thumb.style.position = 'relative'; thumb.appendChild(badge); } } }); }, 1000); // Check every 1 second })();