You don't have an active subscription. Subscribe to access premium features.
Select the options you want to include in your subscription:
Sruthi (Pitch)
Instruments
Instrument Type
Tuning System
Your Subscription
Active Subscription
Plan:Annual Premium
Status:Active
Next billing date:December 15, 2024
Amount:₹2,499
No Active Subscription
You don't have an active subscription. Subscribe to access premium content and features.
element.classList.toggle('selected');
console.log(`Toggled selection for ${element.getAttribute('data-note')}`);
}
};
// Global function to handle subscription
window.handleSubscription = function() {
const selectedNotes = document.querySelectorAll('.sruthi-note.selected');
if (selectedNotes.length === 0) {
alert('Please select at least one note to subscribe to.');
return;
}
// Get current purchased notes
let purchasedNotes = [];
try {
const subscriptionPreferences = localStorage.getItem('subscriptionPreferences');
if (subscriptionPreferences) {
const preferences = JSON.parse(subscriptionPreferences);
if (preferences.sruthi && Array.isArray(preferences.sruthi)) {
purchasedNotes = preferences.sruthi;
}
}
} catch (error) {
console.error('Error parsing purchased notes:', error);
}
// Collect newly selected notes
const newlySubscribedNotes = [];
selectedNotes.forEach(note => {
const noteValue = note.getAttribute('data-note');
if (!purchasedNotes.includes(noteValue)) {
purchasedNotes.push(noteValue);
newlySubscribedNotes.push(noteValue);
}
note.classList.remove('selected');
note.classList.add('purchased');
});
// Save to localStorage (in a real app, this would be saved to the server)
localStorage.setItem('subscriptionPreferences', JSON.stringify({
sruthi: purchasedNotes
}));
// Update the available swaras in the player
if (window.updateAvailableSwaras) {
window.updateAvailableSwaras(purchasedNotes);
}
// Show success message with the newly subscribed notes
if (newlySubscribedNotes.length > 0) {
alert(`You have successfully subscribed to the following notes: ${newlySubscribedNotes.join(', ')}`);
} else {
alert('Your subscription has been updated successfully!');
}
// Update the UI to reflect the changes
updatePurchasedNotes();
};
// Debug function to help troubleshoot subscription issues
window.debugSubscription = function() {
console.log('Debugging subscription panel:');
const sruthiNotes = document.querySelectorAll('.sruthi-note');
console.log(`Found ${sruthiNotes.length} sruthi notes in the panel`);
sruthiNotes.forEach(note => {
const noteValue = note.getAttribute('data-note');
const isPurchased = note.classList.contains('purchased');
const isSelected = note.classList.contains('selected');
const isActive = note.classList.contains('current-active');
console.log(`Note: ${noteValue}, Purchased: ${isPurchased}, Selected: ${isSelected}, Active: ${isActive}`);
});
// Test click on first non-purchased note
const nonPurchasedNote = Array.from(sruthiNotes).find(note => !note.classList.contains('purchased'));
if (nonPurchasedNote) {
console.log(`Testing click on non-purchased note: ${nonPurchasedNote.getAttribute('data-note')}`);
nonPurchasedNote.click();
setTimeout(() => {
console.log(`After click, selected: ${nonPurchasedNote.classList.contains('selected')}`);
}, 100);
}
};
});
Sruthi Subscription
Your Subscribed Sruthis
Highlighted notes are already subscribed. Currently active note is highlighted in blue.
Select additional Sruthi (pitch) notes you want to subscribe to:
a#
0.5 kattai
Purchased
b
0.75 kattai
Purchased
c
1 kattai
Purchased
c#
1.5 kattai
Purchased
d
2 kattai
Purchased
d#
2.5 kattai
Purchased
e
3 kattai
Purchased
f
4 kattai
Purchased
f#
4.5 kattai
Purchased
g
5 kattai
Purchased
g#
5.5 kattai
Purchased
A
6 kattai
Purchased
A#
6.5 kattai
Purchased
B
7 kattai
Purchased
C
8 kattai
Purchased
Click on a note with + to select it for subscription