function goToLogin() { window.location.href = "/login"; } function goToApplay() { window.location.href = "/apply/"; } function getInTouch(vall) { window.open(vall, "_blank"); } function WhatsgetInTouch() { window.open( "https://wa.me/919787466226?text=Hi%20KodePilot%20Team%2C%0A%0AI%20came%20across%20your%20website%20and%20would%20like%20to%20know%20more%20about%20your%20Career%20Guidance%20and%20Placement%20support%20services.%20Could%20you%20please%20share%20the%20details%3F%0A%0AThanks%21", "_blank" ); } function getInZoho() { window.open("https://forms.zohopublic.in/krishnakode1/form/KodePilotRegistrationForm/formperma/A2L8xK6T13A9-s5Kxj8BqRTGsgmpKDHM0DDcZQWye5E"); } class Slide1rSlider { constructor({ trackId = 'slide1rTrack', prevId = 'prevBtn', nextId = 'nextBtn', autoPlayDuration = 5000, invert = true } = {}) { this.trackId = trackId; this.prevId = prevId; this.nextId = nextId; this.autoPlayDuration = autoPlayDuration; this.invert = invert; if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => this.initSlider()); else this.initSlider(); } initSlider() { this.track = document.getElementById(this.trackId); if (!this.track) return console.warn('slide track not found:', this.trackId); this.originalSlides = Array.from(this.track.querySelectorAll('.slide1')); if (this.originalSlides.length === 0) return console.warn('no .slide1 found'); this.prevBtn = document.getElementById(this.prevId); this.nextBtn = document.getElementById(this.nextId); this.setupStructure(); this.bindEvents(); this.currentIndex = 1; this.updateSlider(false); this.startAutoPlay(); } setupStructure() { this.track.style.display = 'flex'; this.track.style.transition = 'transform 0.5s ease'; this.track.querySelectorAll('.slide1').forEach(s => { s.style.minWidth = '100%'; s.style.boxSizing = 'border-box'; }); const first = this.originalSlides[0].cloneNode(true); const last = this.originalSlides[this.originalSlides.length - 1].cloneNode(true); this.track.insertBefore(last, this.track.firstChild); this.track.appendChild(first); this.slides = Array.from(this.track.querySelectorAll('.slide1')); this.totalSlides = this.slides.length; } updateSlider(animate = true) { this.track.style.transition = animate ? 'transform 0.5s ease' : 'none'; this.track.style.transform = `translateX(-${this.currentIndex * 100}%)`; } nextSlide() { if (this.invert) { this.currentIndex--; this.updateSlider(true); if (this.currentIndex === 0) { setTimeout(() => { this.track.style.transition = 'none'; this.currentIndex = this.slides.length - 2; this.updateSlider(false); }, 500); } } else { this.currentIndex++; this.updateSlider(true); if (this.currentIndex === this.slides.length - 1) { setTimeout(() => { this.track.style.transition = 'none'; this.currentIndex = 1; this.updateSlider(false); }, 500); } } this.restartAutoPlay(); } prevSlide() { if (this.invert) { this.currentIndex++; this.updateSlider(true); if (this.currentIndex === this.slides.length - 1) { setTimeout(() => { this.track.style.transition = 'none'; this.currentIndex = 1; this.updateSlider(false); }, 500); } } else { this.currentIndex--; this.updateSlider(true); if (this.currentIndex === 0) { setTimeout(() => { this.track.style.transition = 'none'; this.currentIndex = this.slides.length - 2; this.updateSlider(false); }, 500); } } this.restartAutoPlay(); } startAutoPlay() { this.stopAutoPlay(); this.autoPlayInterval = setInterval(() => this.nextSlide(), this.autoPlayDuration); } stopAutoPlay() { if (this.autoPlayInterval) { clearInterval(this.autoPlayInterval); this.autoPlayInterval = null; } } restartAutoPlay() { this.stopAutoPlay(); this.startAutoPlay(); } bindEvents() { if (this.nextBtn) this.nextBtn.addEventListener('click', () => this.nextSlide()); if (this.prevBtn) this.prevBtn.addEventListener('click', () => this.prevSlide()); const container = this.track.closest('.slide1r-container') || this.track.parentElement; if (container) { container.addEventListener('mouseenter', () => this.stopAutoPlay()); container.addEventListener('mouseleave', () => this.startAutoPlay()); } let startX = 0, endX = 0; this.track.addEventListener('touchstart', (e) => { startX = e.touches[0].clientX; this.stopAutoPlay(); }); this.track.addEventListener('touchmove', (e) => { endX = e.touches[0].clientX; }); this.track.addEventListener('touchend', () => { const delta = startX - endX; if (Math.abs(delta) > 50) { if (delta > 0) this.nextSlide(); else this.prevSlide(); } this.startAutoPlay(); }); document.addEventListener('keydown', (e) => { const containerEl = document.querySelector('.slide1r-container'); if (!containerEl) return; if (e.key === 'ArrowLeft') this.prevSlide(); if (e.key === 'ArrowRight') this.nextSlide(); }); } } new Slide1rSlider({ invert: true, autoPlayDuration: 4000 }); const statItems = document.querySelectorAll('.stat-item'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { const index = Array.from(statItems).indexOf(entry.target); entry.target.style.transitionDelay = `${(index + 1) * 0.1}s`; entry.target.classList.add('visible'); } }); }, { threshold: 0.2 }); console.log("test"); document.addEventListener('DOMContentLoaded', async () => { const allCourses = []; const baseUrl = 'https://kodepilot.in/course/index.php'; const res = await fetch(baseUrl); const html = await res.text(); const categoryRegex = /
(.*?)<\/p>/g;
while ((match = courseRegex.exec(cleanHtml)) !== null) {
allCourses.push({
category: match[4].trim(),
link: match[1].trim(),
image: match[2].trim(),
name: match[3].trim(),
description: match[5].replace(/
/g, ' ').trim()
});
}
}
console.table(allCourses);
renderCourses(allCourses);
});
function renderCourses(allCourses) {
const container = document.querySelector('.corces');
if (!container) return;
container.innerHTML = '';
const grouped = {};
allCourses.forEach(course => {
if (!grouped[course.category]) grouped[course.category] = [];
grouped[course.category].push(course);
});
let sections = Object.entries(grouped).map(([category, courses]) => ({ category, courses }));
let mergedSections = [];
let temp = { category: '', courses: [] };
sections.forEach(section => {
if (section.courses.length >= 4) {
mergedSections.push(section);
} else {
if (temp.category) temp.category += '/' + section.category;
else temp.category = section.category;
temp.courses.push(...section.courses);
if (temp.courses.length >= 4) {
mergedSections.push({ category: temp.category, courses: temp.courses });
temp = { category: '', courses: [] };
}
}
});
if (temp.courses.length >= 4) {
mergedSections.push(temp);
}
mergedSections.forEach(sectionData => {
const section = document.createElement('div');
section.className = 'course-section';
section.innerHTML = `