|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
console.log('The Ultimate Blank Canvas App is ready!'); |
|
|
|
|
|
|
|
|
document.body.style.opacity = '0'; |
|
|
setTimeout(() => { |
|
|
document.body.style.transition = 'opacity 0.5s ease-in'; |
|
|
document.body.style.opacity = '1'; |
|
|
}, 100); |
|
|
|
|
|
|
|
|
if (window.location.pathname.includes('projects.html')) { |
|
|
loadProjects(); |
|
|
} |
|
|
}); |
|
|
|
|
|
async function loadProjects() { |
|
|
try { |
|
|
const response = await axios.get('https://jsonplaceholder.typicode.com/posts?_limit=6'); |
|
|
const projectsContainer = document.getElementById('projects-container'); |
|
|
projectsContainer.innerHTML = response.data.map(project => ` |
|
|
<div class="bg-white p-4 rounded-lg shadow border hover:shadow-md transition"> |
|
|
<h3 class="font-medium mb-2">${project.title}</h3> |
|
|
<p class="text-sm text-gray-600 mb-2">Created: ${new Date().toLocaleDateString()}</p> |
|
|
<a href="#" class="text-blue-600 text-sm">Open β</a> |
|
|
</div> |
|
|
`).join(''); |
|
|
} catch (error) { |
|
|
console.error('Failed to load projects:', error); |
|
|
} |
|
|
} |
|
|
|