test / index.html
absalum's picture
J'ai copié les fichiers index.html et style.css sur mon pc, mais sur mon navigateur en local, je ne parviens pas à ouvrir les liens. Sais-tu pourquoi ? - Follow Up Deployment
1c1021e verified
Raw History Blame Contribute Delete
33.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App Launchpad</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom styles for the glass effect */
.glass-card {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.app-icon {
transition: all 0.2s ease;
}
.app-icon:hover {
transform: scale(1.1);
filter: brightness(1.1);
}
.app-icon:active {
transform: scale(0.95);
}
.folder-icon {
background: rgba(255, 255, 255, 0.15);
transition: all 0.2s ease;
}
.folder-icon:hover {
background: rgba(255, 255, 255, 0.25);
transform: scale(1.05);
}
.folder-preview {
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
background: rgba(30, 30, 30, 0.95);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-radius: 16px;
padding: 16px;
min-width: 240px;
z-index: 100;
display: none;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 15px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.folder-preview::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border-width: 8px;
border-style: solid;
border-color: rgba(30, 30, 30, 0.95) transparent transparent transparent;
}
.folder-item .folder-preview.show {
display: grid;
animation: modalFadeIn 0.15s ease-out forwards;
}
.folder-item {
position: relative;
}
.folder-preview-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 8px;
border-radius: 8px;
transition: all 0.2s ease;
cursor: pointer;
}
.folder-preview-item:hover {
background: rgba(255, 255, 255, 0.1);
transform: scale(1.05);
}
.dragging {
opacity: 0.5;
}
.dropzone {
transition: all 0.2s ease;
}
.dropzone.highlight {
background: rgba(255, 255, 255, 0.1);
border: 1px dashed rgba(255, 255, 255, 0.3);
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
border-radius: 4px;
}
/* Modal animation */
@keyframes modalFadeIn {
from { opacity: 0; transform: scale(0.9); }
to { opacity: 1; transform: scale(1); }
}
.modal-animation {
animation: modalFadeIn 0.2s ease-out forwards;
}
</style>
</head>
<body class="bg-gradient-to-br from-gray-900 to-black min-h-screen text-white overflow-x-hidden">
<!-- Header -->
<header class="fixed top-0 left-0 right-0 z-50 glass-card p-4 mx-4 mt-4 flex justify-between items-center">
<h1 class="text-2xl font-semibold">App Launchpad</h1>
<div class="flex space-x-2">
<button id="add-app-btn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition">
<i class="fas fa-plus mr-2"></i>Add App
</button>
<button id="add-folder-btn" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition">
<i class="fas fa-folder mr-2"></i>Create Folder
</button>
</div>
</header>
<!-- Main Content - App Grid -->
<main class="container mx-auto px-4 pt-24 pb-16">
<div id="app-grid" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-6 place-items-center">
<!-- Default apps -->
<div class="app-item" data-name="Google" data-url="https://www.google.com" data-icon="fab fa-google" draggable="true">
<div class="app-icon flex flex-col items-center cursor-pointer" draggable="false">
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-red-500 to-blue-500 flex items-center justify-center mb-2">
<i class="fab fa-google text-white text-2xl"></i>
</div>
<span class="text-sm text-center">Google</span>
</div>
</div>
<div class="app-item" data-name="YouTube" data-url="https://www.youtube.com" data-icon="fab fa-youtube">
<div class="app-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-red-600 to-red-400 flex items-center justify-center mb-2">
<i class="fab fa-youtube text-white text-2xl"></i>
</div>
<span class="text-sm text-center">YouTube</span>
</div>
</div>
<div class="app-item" data-name="GitHub" data-url="https://www.github.com" data-icon="fab fa-github">
<div class="app-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-gray-800 to-gray-600 flex items-center justify-center mb-2">
<i class="fab fa-github text-white text-2xl"></i>
</div>
<span class="text-sm text-center">GitHub</span>
</div>
</div>
<div class="app-item" data-name="Twitter" data-url="https://www.twitter.com" data-icon="fab fa-twitter">
<div class="app-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center mb-2">
<i class="fab fa-twitter text-white text-2xl"></i>
</div>
<span class="text-sm text-center">Twitter</span>
</div>
</div>
<!-- Test Folder -->
<div class="app-item folder-item" data-name="Test Folder" data-type="folder">
<div class="app-icon folder-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl flex items-center justify-center mb-2">
<i class="fas fa-folder text-yellow-400 text-3xl"></i>
</div>
<span class="text-sm text-center">Test Folder</span>
</div>
<div class="folder-preview">
<div class="folder-preview-item">
<div class="w-12 h-12 rounded-xl bg-gradient-to-br from-red-500 to-blue-500 flex items-center justify-center mb-1">
<i class="fab fa-google text-white text-xl"></i>
</div>
<span class="text-xs text-center truncate w-full">Google</span>
</div>
<div class="folder-preview-item">
<div class="w-12 h-12 rounded-xl bg-gradient-to-br from-red-600 to-red-400 flex items-center justify-center mb-1">
<i class="fab fa-youtube text-white text-xl"></i>
</div>
<span class="text-xs text-center truncate w-full">YouTube</span>
</div>
</div>
</div>
</div>
</main>
<!-- Add App Modal -->
<div id="add-app-modal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-70 p-4">
<div class="glass-card p-6 rounded-xl w-full max-w-md modal-animation">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold">Add New App</h2>
<button id="close-modal-btn" class="text-gray-400 hover:text-white">
<i class="fas fa-times"></i>
</button>
</div>
<form id="app-form" class="space-y-4">
<div>
<label for="app-name" class="block text-sm font-medium mb-1">App Name</label>
<input type="text" id="app-name" required class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label for="app-url" class="block text-sm font-medium mb-1">URL</label>
<input type="url" id="app-url" required class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="https://">
</div>
<div>
<label for="app-icon" class="block text-sm font-medium mb-1">Icon</label>
<select id="app-icon" class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="fas fa-globe">Globe</option>
<option value="fab fa-google">Google</option>
<option value="fab fa-youtube">YouTube</option>
<option value="fab fa-github">GitHub</option>
<option value="fab fa-twitter">Twitter</option>
<option value="fab fa-facebook">Facebook</option>
<option value="fab fa-instagram">Instagram</option>
<option value="fab fa-linkedin">LinkedIn</option>
<option value="fab fa-reddit">Reddit</option>
<option value="fab fa-whatsapp">WhatsApp</option>
<option value="fas fa-envelope">Email</option>
<option value="fas fa-music">Music</option>
<option value="fas fa-video">Video</option>
<option value="fas fa-gamepad">Games</option>
<option value="fas fa-shopping-cart">Shopping</option>
</select>
</div>
<div>
<label for="app-color" class="block text-sm font-medium mb-1">Color</label>
<select id="app-color" class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="from-blue-500 to-blue-600">Blue</option>
<option value="from-red-500 to-red-600">Red</option>
<option value="from-green-500 to-green-600">Green</option>
<option value="from-yellow-500 to-yellow-600">Yellow</option>
<option value="from-purple-500 to-purple-600">Purple</option>
<option value="from-pink-500 to-pink-600">Pink</option>
<option value="from-indigo-500 to-indigo-600">Indigo</option>
<option value="from-gray-500 to-gray-600">Gray</option>
<option value="from-orange-500 to-orange-600">Orange</option>
<option value="from-teal-500 to-teal-600">Teal</option>
</select>
</div>
<div class="flex justify-end space-x-3 pt-4">
<button type="button" id="cancel-btn" class="px-4 py-2 rounded-lg border border-gray-600 hover:bg-gray-700 transition">Cancel</button>
<button type="submit" class="px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 transition">Add App</button>
</div>
</form>
</div>
</div>
<!-- App Context Menu -->
<div id="context-menu" class="fixed hidden glass-card p-2 rounded-lg shadow-lg z-50 min-w-[150px]">
<button class="context-menu-item w-full text-left px-3 py-2 hover:bg-gray-700 rounded" data-action="open"><i class="fas fa-external-link-alt mr-2"></i>Open</button>
<button class="context-menu-item w-full text-left px-3 py-2 hover:bg-gray-700 rounded" data-action="edit"><i class="fas fa-edit mr-2"></i>Edit</button>
<button class="context-menu-item w-full text-left px-3 py-2 hover:bg-gray-700 rounded text-red-400" data-action="delete"><i class="fas fa-trash mr-2"></i>Delete</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const appGrid = document.getElementById('app-grid');
const addAppBtn = document.getElementById('add-app-btn');
const addFolderBtn = document.getElementById('add-folder-btn');
const addAppModal = document.getElementById('add-app-modal');
const closeModalBtn = document.getElementById('close-modal-btn');
const cancelBtn = document.getElementById('cancel-btn');
const appForm = document.getElementById('app-form');
const contextMenu = document.getElementById('context-menu');
let selectedApp = null;
// Load apps from localStorage
loadApps();
// Create new folder
addFolderBtn.addEventListener('click', function() {
const folderName = prompt('Enter folder name:', 'New Folder');
if (folderName) {
createFolder(folderName);
}
});
function createFolder(name) {
const folderItem = document.createElement('div');
folderItem.className = 'app-item folder-item';
folderItem.dataset.name = name;
folderItem.dataset.type = 'folder';
folderItem.innerHTML = `
<div class="app-icon folder-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl flex items-center justify-center mb-2">
<i class="fas fa-folder text-yellow-400 text-3xl"></i>
</div>
<span class="text-sm text-center">${name}</span>
</div>
<div class="folder-preview"></div>
`;
appGrid.appendChild(folderItem);
// Make folder a drop target
folderItem.addEventListener('dragover', function(e) {
e.preventDefault();
this.classList.add('highlight');
});
folderItem.addEventListener('dragleave', function() {
this.classList.remove('highlight');
});
folderItem.addEventListener('drop', function(e) {
e.preventDefault();
this.classList.remove('highlight');
const draggingItem = document.querySelector('.dragging');
if (draggingItem) {
const dragData = JSON.parse(e.dataTransfer.getData('text/plain'));
// Only proceed if this is an app (not a folder)
if (!draggingItem.dataset.type || draggingItem.dataset.type !== 'folder') {
// Move app to folder
draggingItem.dataset.folder = name;
const preview = this.querySelector('.folder-preview');
// Create a mini version for the preview
const miniApp = document.createElement('div');
miniApp.className = 'folder-preview-item';
miniApp.innerHTML = `
<div class="w-12 h-12 rounded-xl ${dragData.color ? 'bg-gradient-to-br ' + dragData.color : 'bg-gray-600'} flex items-center justify-center mb-1">
<i class="${dragData.icon} text-white text-xl"></i>
</div>
<span class="text-xs text-center truncate w-full">${dragData.name}</span>
`;
miniApp.addEventListener('click', (e) => {
e.stopPropagation();
const url = dragData.url;
if (url.startsWith('http://') || url.startsWith('https://')) {
window.open(url, '_blank');
} else {
window.location.href = url;
}
});
preview.appendChild(miniApp);
// Hide the original app (it's now in the folder)
draggingItem.style.display = 'none';
saveApps();
}
}
});
saveApps();
}
// Show add app modal
addAppBtn.addEventListener('click', () => {
addAppModal.classList.remove('hidden');
document.getElementById('app-name').focus();
});
// Close modal
function closeModal() {
addAppModal.classList.add('hidden');
appForm.reset();
selectedApp = null;
}
closeModalBtn.addEventListener('click', closeModal);
cancelBtn.addEventListener('click', closeModal);
// Handle form submission
appForm.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('app-name').value;
const url = document.getElementById('app-url').value;
const icon = document.getElementById('app-icon').value;
const color = document.getElementById('app-color').value;
if (selectedApp) {
// Edit existing app
updateApp(selectedApp, name, url, icon, color);
} else {
// Add new app
addApp(name, url, icon, color);
}
closeModal();
});
// Add new app
function addApp(name, url, icon, color) {
const appItem = document.createElement('div');
appItem.className = 'app-item';
appItem.dataset.name = name;
appItem.dataset.url = url;
appItem.dataset.icon = icon;
appItem.dataset.color = color;
const iconParts = icon.split(' ');
const iconClass = iconParts[1] ? iconParts[1] : 'fa-globe';
appItem.innerHTML = `
<div class="app-icon flex flex-col items-center cursor-pointer">
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br ${color} flex items-center justify-center mb-2">
<i class="${icon} text-white text-2xl"></i>
</div>
<span class="text-sm text-center">${name}</span>
</div>
`;
// Insert new app at the end by default
appGrid.appendChild(appItem);
addAppListeners(appItem);
setupDragAndDrop(appItem);
saveApps();
}
// Update existing app
function updateApp(appElement, name, url, icon, color) {
appElement.dataset.name = name;
appElement.dataset.url = url;
appElement.dataset.icon = icon;
appElement.dataset.color = color;
const iconDiv = appElement.querySelector('.app-icon');
iconDiv.innerHTML = `
<div class="w-16 h-16 rounded-2xl bg-gradient-to-br ${color} flex items-center justify-center mb-2">
<i class="${icon} text-white text-2xl"></i>
</div>
<span class="text-sm text-center">${name}</span>
`;
saveApps();
}
// Add event listeners to app items
function addAppListeners(appItem) {
// Single click to open
appItem.querySelector('.app-icon').addEventListener('click', function(e) {
if (e.button === 0) { // Left click
// Check if URL starts with http/https or is relative
const url = appItem.dataset.url;
if (url.startsWith('http://') || url.startsWith('https://')) {
window.open(url, '_blank');
} else {
// For local files, we'll use a different approach
window.location.href = url;
}
}
});
// Right click for context menu
appItem.addEventListener('contextmenu', function(e) {
e.preventDefault();
selectedApp = appItem;
// Position the context menu
const x = e.clientX;
const y = e.clientY;
contextMenu.style.left = `${x}px`;
contextMenu.style.top = `${y}px`;
contextMenu.classList.remove('hidden');
});
}
// Initialize existing app listeners
document.querySelectorAll('.app-item').forEach(appItem => {
addAppListeners(appItem);
setupDragAndDrop(appItem);
if (appItem.classList.contains('folder-item')) {
const folderIcon = appItem.querySelector('.folder-icon');
const folderPreview = appItem.querySelector('.folder-preview');
let hideTimeout;
folderIcon.addEventListener('mouseenter', () => {
clearTimeout(hideTimeout);
folderPreview.classList.add('show');
});
folderIcon.addEventListener('mouseleave', () => {
hideTimeout = setTimeout(() => {
folderPreview.classList.remove('show');
}, 1000);
});
folderPreview.addEventListener('mouseenter', () => {
clearTimeout(hideTimeout);
});
folderPreview.addEventListener('mouseleave', () => {
hideTimeout = setTimeout(() => {
folderPreview.classList.remove('show');
}, 1000);
});
}
});
function setupDragAndDrop(item) {
item.setAttribute('draggable', true);
item.addEventListener('dragstart', function(e) {
this.classList.add('dragging');
// Include app data in the drag event
e.dataTransfer.setData('text/plain', JSON.stringify({
name: this.dataset.name,
url: this.dataset.url,
icon: this.dataset.icon,
color: this.dataset.color
}));
});
item.addEventListener('dragend', function() {
this.classList.remove('dragging');
});
}
// Handle drop zones
appGrid.addEventListener('dragover', function(e) {
e.preventDefault();
const draggingItem = document.querySelector('.dragging');
if (!draggingItem) return;
const afterElement = getDragAfterElement(appGrid, e.clientY);
if (afterElement && afterElement !== draggingItem.nextElementSibling) {
appGrid.insertBefore(draggingItem, afterElement);
}
saveApps();
});
function getDragAfterElement(container, y) {
const draggableElements = [...container.querySelectorAll('.app-item:not(.dragging)')];
return draggableElements.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
// Check if we're hovering over the top half of the element
if (offset < 0 && offset > closest.offset) {
return { offset: offset, element: child };
}
// Check if we're hovering over the bottom half of the element
else if (offset > 0 && offset < closest.offset) {
return { offset: offset, element: child.nextElementSibling };
}
return closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Context menu actions
document.querySelectorAll('.context-menu-item').forEach(item => {
item.addEventListener('click', function() {
const action = this.dataset.action;
if (selectedApp) {
switch(action) {
case 'open':
window.open(selectedApp.dataset.url, '_blank');
break;
case 'edit':
document.getElementById('app-name').value = selectedApp.dataset.name;
document.getElementById('app-url').value = selectedApp.dataset.url;
document.getElementById('app-icon').value = selectedApp.dataset.icon;
document.getElementById('app-color').value = selectedApp.dataset.color;
addAppModal.classList.remove('hidden');
break;
case 'delete':
if (confirm('Are you sure you want to delete this app?')) {
selectedApp.remove();
saveApps();
}
break;
}
contextMenu.classList.add('hidden');
}
});
});
// Close context menu when clicking elsewhere
document.addEventListener('click', function() {
contextMenu.classList.add('hidden');
});
// Save apps to localStorage
function saveApps() {
const apps = [];
document.querySelectorAll('.app-item').forEach(item => {
if (item.dataset.type === 'folder') {
const folderApps = [];
const preview = item.querySelector('.folder-preview');
if (preview) {
preview.querySelectorAll('div').forEach(miniApp => {
const icon = miniApp.querySelector('i').className;
const color = miniApp.querySelector('div').className.match(/bg-gradient-to-br\s(.*?)\s/)[1];
folderApps.push({ icon, color });
});
}
apps.push({
type: 'folder',
name: item.dataset.name,
apps: folderApps
});
} else {
apps.push({
type: 'app',
name: item.dataset.name,
url: item.dataset.url,
icon: item.dataset.icon,
color: item.dataset.color,
folder: item.dataset.folder || null
});
}
});
localStorage.setItem('apps', JSON.stringify(apps));
}
// Load apps from localStorage
function loadApps() {
const savedApps = localStorage.getItem('apps');
if (savedApps) {
const apps = JSON.parse(savedApps);
// Clear default apps if we have saved ones
if (apps.length > 0) {
appGrid.innerHTML = '';
}
apps.forEach(app => {
if (app.type === 'folder') {
const folder = createFolder(app.name);
if (app.apps && app.apps.length > 0) {
const preview = folder.querySelector('.folder-preview');
app.apps.forEach(appData => {
const miniApp = document.createElement('div');
miniApp.className = 'folder-preview-item';
miniApp.innerHTML = `
<div class="w-12 h-12 rounded-xl bg-gradient-to-br ${appData.color} flex items-center justify-center mb-1">
<i class="${appData.icon} text-white text-xl"></i>
</div>
<span class="text-xs text-center truncate w-full">${appData.name}</span>
`;
miniApp.addEventListener('click', () => {
window.open(appData.url, '_blank');
});
preview.appendChild(miniApp);
});
}
} else {
const newApp = addApp(app.name, app.url, app.icon, app.color);
if (app.folder) {
newApp.dataset.folder = app.folder;
}
}
});
}
}
});
</script>
<!-- Folder Preview Template -->
<template id="folder-preview-template">
<div class="folder-preview"></div>
</template>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=absalum/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>