diff --git a/main.js b/main.js index 2318c21..a8d0a1d 100644 --- a/main.js +++ b/main.js @@ -24,7 +24,6 @@ function goToLogin() { if (!this.track || this.slides.length === 0) { console.warn("Slider DOM elements not found. Retrying..."); - // Retry after a short delay setTimeout(() => this.initSlider(), 200); return; } @@ -126,14 +125,12 @@ function goToLogin() { this.prevBtn.addEventListener('click', () => this.prevSlide()); } - // Pause on hover const container = document.querySelector('.slide1r-container'); if (container) { container.addEventListener('mouseenter', () => this.stopAutoPlay()); container.addEventListener('mouseleave', () => this.startAutoPlay()); } - // Touch support let startX = 0; let endX = 0; @@ -165,9 +162,7 @@ function goToLogin() { } bindKeyboardEvents() { - // Use a more specific event listener to avoid conflicts const keyHandler = (e) => { - // Only respond if the slider container is visible const container = document.querySelector('.slide1r-container'); if (container && this.isElementInViewport(container)) { if (e.key === 'ArrowLeft') { @@ -192,7 +187,6 @@ function goToLogin() { } } - // Initialize the slider immediately new Slide1rSlider(); })(); @@ -223,7 +217,6 @@ const allCourses = [ (async () => { const baseUrl = 'https://kodepilot.in/course/index.php'; - // Step 1: Fetch categories dynamically const res = await fetch(baseUrl); const html = await res.text(); const categoryRegex = /
(.*?)<\/p>/g;
+ let found = false;
while ((match = courseRegex.exec(cleanHtml)) !== null) {
+ found = true;
allCourses.push({
category: match[4].trim(),
link: match[1].trim(),
@@ -256,19 +245,22 @@ const allCourses = [
description: match[5].replace(/
/g, ' ').trim()
});
}
+
+ if (!found) {
+ console.warn("⚠️ Could not parse category:", category.url);
+ console.log(cleanHtml.substring(0, 500) + " ...");
+ }
}
- console.log('All courses:', allCourses);
+ console.log("✅ Extracted courses:", allCourses);
})();
-
-// Test printing all courses
console.log("Testing allCourses array:");
const container = document.querySelector('.corces');
allCourses.forEach(course => {
const courseDiv = document.createElement('div');
- courseDiv.className = 'course-card'; // you can style this class later
+ courseDiv.className = 'course-card';
courseDiv.innerHTML = `