const accessKeys = { 'dual1': ["DSA", "DDCO"], 'dual2': ["OS", "OOJ"], 'ind1': ["DSA"], 'ind2': ["DDCO"], 'ind3': ["OS"], 'ind4': ["OOJ"], "all@123": ["DSA", "DDCO", "OS", "OOJ"], "12345": "" }; let allowedSections = []; window.onload = () => { document.getElementById('inputModal').classList.add('show'); }; function checkSecretKey() { const enteredKey = document.getElementById('secretKey').value; if (accessKeys[enteredKey]) { allowedSections = accessKeys[enteredKey]; document.getElementById('inputModal').classList.remove('show'); document.getElementById('section-content').classList.remove('blur'); document.getElementById('sidebar').classList.remove('blur'); document.getElementById('navbar').classList.remove('blur'); filterSections(); document.getElementById('secretKey').value = ''; } else if (enteredKey === '12345') { window.location.href = "https://examuse.neocities.org/hello"; } else { alert("Invalid key. Access Denied."); window.location.href = "https://www.google.com"; } } function filterSections() { const sections = document.querySelectorAll('.section-link'); sections.forEach(section => { if (!allowedSections.includes(section.getAttribute('data-section'))) { section.style.display = 'none'; } }); } function showSection(section) { if (!allowedSections.includes(section)) { alert("You do not have access to this section."); return; } const container = document.getElementById('section-content'); container.innerHTML = `
Please choose a program:
`; const programs = { DSA: [ { name: 'program1', code: `function reverseString(str) { return str.split('').reverse().join(''); }`, output: 'olleH' }, { name: 'Factorial', code: `function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }`, output: '120' } ], DDCO: [ { name: 'Binary Search', code: `function binarySearch(arr, target) { let left = 0, right = arr.length - 1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (arr[mid] === target) return mid; else if (arr[mid] < target) left = mid + 1; else right = mid - 1; } return -1; }`, output: '4' } ], OS: [ { name: 'Process Scheduling', code: `// Pseudocode for scheduling`, output: 'Gantt Chart' } ], OOJ: [ { name: 'Class Definition', code: `class Animal { constructor(name) { this.name = name; } }`, output: 'Class Animal created.' } ], }; programs[section].forEach(program => { const btn = document.createElement('div'); btn.className = 'program-btn'; btn.innerText = program.name; btn.onclick = () => openProgramModal(program); container.appendChild(btn); }); } function openProgramModal(program) { document.getElementById('programText').innerText = program.name; document.getElementById('programCode').innerText = program.code; document.getElementById('programModal').classList.add('show'); document.getElementById('outputCode').innerText = program.output; } function closeProgramModal() { document.getElementById('programModal').classList.remove('show'); } function copyText() { const code = document.getElementById('programCode').innerText; navigator.clipboard.writeText(code).then(() => { alert('Code copied to clipboard!'); }); } function showOutput() { document.getElementById('outputModal').classList.add('show'); } function closeOutputModal() { document.getElementById('outputModal').classList.remove('show'); } function toggleSidebar() { const sidebar = document.getElementById('sidebar'); sidebar.classList.toggle('active'); const content = document.getElementById('section-content'); content.style.marginLeft = sidebar.classList.contains('active') ? '60px' : '220px'; }