-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
102 lines (84 loc) · 2.95 KB
/
Copy pathscript.js
File metadata and controls
102 lines (84 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Main JavaScript for Professor Adda
document.addEventListener('DOMContentLoaded', function () {
// Initialize animations
initAnimations();
// Add intersection observer for scroll animations
initScrollAnimations();
// Initialize feather icons
if (typeof feather !== 'undefined') {
feather.replace();
}
});
function initAnimations() {
// Add fade-in animation to elements on load
const animatedElements = document.querySelectorAll('.fade-in-up');
animatedElements.forEach((element, index) => {
element.style.animationDelay = `${index * 0.1}s`;
});
}
function initScrollAnimations() {
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fade-in');
}
});
}, observerOptions);
// Observe all sections
document.querySelectorAll('section').forEach(section => {
observer.observe(section);
});
}
// WhatsApp integration
function openWhatsApp() {
const phoneNumber = "7690022111"; // Primary WhatsApp number
const message = "Hello Professor Adda! I'm interested in NET JRF notes. Please provide more information about the courses and pricing.";
const url = `https://wa.me/${phoneNumber}?text=${encodeURIComponent(message)}`;
window.open(url, '_blank');
}
// Sample PDF download
function downloadSample() {
// In production, this would trigger actual file download
const downloadUrl = '/sample-notes.pdf'; // Replace with actual file path
// Create temporary link for download
const link = document.createElement('a');
link.href = downloadUrl;
link.download = 'Professor-Adda-Sample-Notes.pdf';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Add loading state to buttons
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', function () {
const originalText = this.innerHTML;
this.innerHTML = '<i data-feather="loader" class="animate-spin"></i> Loading...';
if (typeof feather !== 'undefined') {
feather.replace();
}
// Reset button text after 2 seconds (simulate loading)
setTimeout(() => {
this.innerHTML = originalText;
if (typeof feather !== 'undefined') {
feather.replace();
}
}, 2000);
});
});