Download index.html from amrora00/https-enzostvs-deepsite-hf-space: direct link, hf CLI and curl.
- Browser
- Download file 38.8 kB
-
https://huggingface.co/spaces/amrora00/https-enzostvs-deepsite-hf-space/resolve/main/index.html
- Command line
-
hf download hf://spaces/amrora00/https-enzostvs-deepsite-hf-space/index.html
-
curl -L -o index.html https://huggingface.co/spaces/amrora00/https-enzostvs-deepsite-hf-space/resolve/main/index.html
38.8 kB
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>جاري - تأجير الأغراض بين الأفراد</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> | |
| @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap'); | |
| body { | |
| font-family: 'Tajawal', sans-serif; | |
| } | |
| .country-flag { | |
| width: 30px; | |
| height: 20px; | |
| object-fit: cover; | |
| border-radius: 2px; | |
| margin-left: 8px; | |
| } | |
| .item-card { | |
| transition: transform 0.3s ease, box-shadow 0.3s ease; | |
| } | |
| .item-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50"> | |
| <!-- Country Selection Modal --> | |
| <div id="countryModal" class="fixed inset-0 bg-gray-900 bg-opacity-50 flex items-center justify-center z-50"> | |
| <div class="bg-white rounded-lg p-8 w-full max-w-md mx-4"> | |
| <h2 class="text-2xl font-bold text-center mb-6">اختر بلدك</h2> | |
| <div class="flex flex-col space-y-4"> | |
| <button onclick="selectCountry('sa')" class="flex items-center justify-center py-4 px-6 border border-gray-300 rounded-lg hover:bg-gray-100 transition"> | |
| <img src="https://flagcdn.com/w20/sa.png" class="country-flag" alt="Saudi Arabia"> | |
| <span class="font-medium">السعودية (ريال سعودي)</span> | |
| </button> | |
| <button onclick="selectCountry('eg')" class="flex items-center justify-center py-4 px-6 border border-gray-300 rounded-lg hover:bg-gray-100 transition"> | |
| <img src="https://flagcdn.com/w20/eg.png" class="country-flag" alt="Egypt"> | |
| <span class="font-medium">مصر (جنيه مصري)</span> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Navigation --> | |
| <nav class="bg-white shadow-sm sticky top-0 z-40"> | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div class="flex justify-between h-16"> | |
| <div class="flex items-center"> | |
| <a href="#" onclick="showHome()" class="flex-shrink-0 flex items-center"> | |
| <span class="text-blue-600 font-bold text-xl">جاري</span> | |
| </a> | |
| </div> | |
| <div class="hidden md:ml-6 md:flex md:items-center md:space-x-4 space-x-reverse"> | |
| <button id="homeTab" onclick="showHome()" class="px-3 py-2 text-sm font-medium tab-active">الرئيسية</button> | |
| <button id="addItemTab" onclick="showAddItem()" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-blue-600">إضافة غرض</button> | |
| <button id="loginTab" onclick="showLogin()" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-blue-600">تسجيل الدخول</button> | |
| <div id="countrySelector" class="flex items-center"> | |
| <span id="currentCountry" class="text-sm text-gray-600"></span> | |
| <button onclick="changeCountry()" class="ml-2 text-blue-600 hover:text-blue-800 text-sm"> | |
| <i class="fas fa-exchange-alt"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="-mr-2 flex items-center md:hidden"> | |
| <button onclick="toggleMobileMenu()" class="inline-flex items-center justify-center p-2 rounded-md text-gray-700 hover:text-blue-600 hover:bg-gray-100 focus:outline-none"> | |
| <i class="fas fa-bars text-xl"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Mobile menu --> | |
| <div id="mobileMenu" class="hidden md:hidden bg-white border-t"> | |
| <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3"> | |
| <button onclick="showHome()" class="block w-full text-right px-3 py-2 text-base font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-50">الرئيسية</button> | |
| <button onclick="showAddItem()" class="block w-full text-right px-3 py-2 text-base font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-50">إضافة غرض</button> | |
| <button onclick="showLogin()" class="block w-full text-right px-3 py-2 text-base font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-50">تسجيل الدخول</button> | |
| <div class="flex items-center justify-between px-3 py-2"> | |
| <span id="mobileCurrentCountry" class="text-sm text-gray-600"></span> | |
| <button onclick="changeCountry()" class="text-blue-600 hover:text-blue-800 text-sm"> | |
| <i class="fas fa-exchange-alt"></i> تغيير البلد | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Main Content --> | |
| <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"> | |
| <!-- Home Page --> | |
| <div id="homePage"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h1 class="text-2xl font-bold text-gray-900">الأغراض المتاحة للإيجار</h1> | |
| <div class="flex items-center"> | |
| <select id="cityFilter" class="border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option value="">كل المدن</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div id="itemsContainer" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"> | |
| <!-- Items will be loaded here --> | |
| </div> | |
| </div> | |
| <!-- Add Item Page --> | |
| <div id="addItemPage" class="hidden max-w-2xl mx-auto"> | |
| <h1 class="text-2xl font-bold text-gray-900 mb-6">إضافة غرض جديد للإيجار</h1> | |
| <form id="addItemForm" class="space-y-4"> | |
| <div> | |
| <label for="itemTitle" class="block text-sm font-medium text-gray-700">عنوان الغرض</label> | |
| <input type="text" id="itemTitle" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="itemDescription" class="block text-sm font-medium text-gray-700">وصف الغرض</label> | |
| <textarea id="itemDescription" rows="4" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"></textarea> | |
| </div> | |
| <div> | |
| <label for="itemImage" class="block text-sm font-medium text-gray-700">صورة الغرض</label> | |
| <input type="file" id="itemImage" accept="image/*" class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100"> | |
| <div id="imagePreview" class="mt-2 hidden"> | |
| <img id="previewImage" src="#" alt="Preview" class="h-32 object-cover rounded-md"> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label for="itemPrice" class="block text-sm font-medium text-gray-700">السعر اليومي</label> | |
| <div class="mt-1 relative rounded-md shadow-sm"> | |
| <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
| <span id="priceCurrency" class="text-gray-500 sm:text-sm">ريال</span> | |
| </div> | |
| <input type="number" id="itemPrice" min="1" required class="focus:ring-blue-500 focus:border-blue-500 block w-full pr-12 pl-16 py-2 sm:text-sm border-gray-300 rounded-md"> | |
| </div> | |
| </div> | |
| <div> | |
| <label for="itemCity" class="block text-sm font-medium text-gray-700">المدينة</label> | |
| <select id="itemCity" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| <option value="">اختر المدينة</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div> | |
| <label for="itemCategory" class="block text-sm font-medium text-gray-700">التصنيف</label> | |
| <select id="itemCategory" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| <option value="">اختر التصنيف</option> | |
| <option value="electronics">إلكترونيات</option> | |
| <option value="tools">أدوات</option> | |
| <option value="sports">رياضة</option> | |
| <option value="fashion">أزياء</option> | |
| <option value="home">أدوات منزلية</option> | |
| <option value="other">أخرى</option> | |
| </select> | |
| </div> | |
| <div class="pt-4"> | |
| <button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| إضافة الغرض | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| <!-- Login/Register Page --> | |
| <div id="loginPage" class="hidden max-w-md mx-auto"> | |
| <div class="bg-white py-8 px-4 shadow rounded-lg sm:px-10"> | |
| <div class="text-center mb-8"> | |
| <h1 class="text-2xl font-bold text-gray-900">مرحباً بك في جاري</h1> | |
| <p class="mt-2 text-sm text-gray-600">سجل الدخول أو أنشئ حساباً جديداً</p> | |
| </div> | |
| <div class="flex border-b mb-6"> | |
| <button id="loginTabBtn" class="flex-1 py-2 px-4 text-center font-medium tab-active">تسجيل الدخول</button> | |
| <button id="registerTabBtn" class="flex-1 py-2 px-4 text-center font-medium text-gray-500 hover:text-blue-600">إنشاء حساب</button> | |
| </div> | |
| <form id="loginForm" class="space-y-4"> | |
| <div> | |
| <label for="loginEmail" class="block text-sm font-medium text-gray-700">البريد الإلكتروني</label> | |
| <input type="email" id="loginEmail" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="loginPassword" class="block text-sm font-medium text-gray-700">كلمة المرور</label> | |
| <input type="password" id="loginPassword" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| تسجيل الدخول | |
| </button> | |
| </div> | |
| </form> | |
| <form id="registerForm" class="hidden space-y-4"> | |
| <div> | |
| <label for="registerName" class="block text-sm font-medium text-gray-700">الاسم الكامل</label> | |
| <input type="text" id="registerName" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="registerEmail" class="block text-sm font-medium text-gray-700">البريد الإلكتروني</label> | |
| <input type="email" id="registerEmail" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="registerPhone" class="block text-sm font-medium text-gray-700">رقم الهاتف</label> | |
| <input type="tel" id="registerPhone" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="registerPassword" class="block text-sm font-medium text-gray-700">كلمة المرور</label> | |
| <input type="password" id="registerPassword" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="registerConfirmPassword" class="block text-sm font-medium text-gray-700">تأكيد كلمة المرور</label> | |
| <input type="password" id="registerConfirmPassword" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| إنشاء حساب | |
| </button> | |
| </div> | |
| </form> | |
| <div class="mt-4 text-center"> | |
| <p class="text-sm text-gray-600"> | |
| بمتابعتك أنت توافق على | |
| <a href="#" class="font-medium text-blue-600 hover:text-blue-500">شروط الاستخدام</a> | |
| و | |
| <a href="#" class="font-medium text-blue-600 hover:text-blue-500">سياسة الخصوصية</a> | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="bg-white border-t mt-12"> | |
| <div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 lg:px-8"> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-8"> | |
| <div> | |
| <h3 class="text-lg font-medium text-gray-900 mb-4">جاري</h3> | |
| <p id="footerDescription" class="text-gray-500 text-sm">منصة لتأجير الأغراض الشخصية بين الأفراد</p> | |
| </div> | |
| <div> | |
| <h3 class="text-lg font-medium text-gray-900 mb-4">روابط سريعة</h3> | |
| <ul class="space-y-2"> | |
| <li><a href="#" onclick="showHome()" class="text-gray-500 hover:text-blue-600 text-sm">الرئيسية</a></li> | |
| <li><a href="#" onclick="showAddItem()" class="text-gray-500 hover:text-blue-600 text-sm">إضافة غرض</a></li> | |
| <li><a href="#" onclick="showLogin()" class="text-gray-500 hover:text-blue-600 text-sm">تسجيل الدخول</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h3 class="text-lg font-medium text-gray-900 mb-4">تواصل معنا</h3> | |
| <div class="flex space-x-4 space-x-reverse"> | |
| <a href="#" class="text-gray-500 hover:text-blue-600"> | |
| <i class="fab fa-facebook-f"></i> | |
| </a> | |
| <a href="#" class="text-gray-500 hover:text-blue-600"> | |
| <i class="fab fa-twitter"></i> | |
| </a> | |
| <a href="#" class="text-gray-500 hover:text-blue-600"> | |
| <i class="fab fa-instagram"></i> | |
| </a> | |
| </div> | |
| <p class="text-gray-500 text-sm mt-4">info@jari.com</p> | |
| </div> | |
| </div> | |
| <div class="mt-8 pt-8 border-t border-gray-200 text-center"> | |
| <p class="text-gray-500 text-sm">© 2023 جاري. جميع الحقوق محفوظة.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <!-- Loading Spinner --> | |
| <div id="loadingSpinner" class="fixed inset-0 bg-gray-900 bg-opacity-50 flex items-center justify-center z-50 hidden"> | |
| <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500"></div> | |
| </div> | |
| <!-- Success Notification --> | |
| <div id="successNotification" class="fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-md shadow-lg flex items-center hidden z-50"> | |
| <i class="fas fa-check-circle mr-2"></i> | |
| <span id="successMessage"></span> | |
| </div> | |
| <!-- Error Notification --> | |
| <div id="errorNotification" class="fixed bottom-4 right-4 bg-red-500 text-white px-4 py-2 rounded-md shadow-lg flex items-center hidden z-50"> | |
| <i class="fas fa-exclamation-circle mr-2"></i> | |
| <span id="errorMessage"></span> | |
| </div> | |
| <script> | |
| // App State | |
| let selectedCountry = null; | |
| let currentPage = null; | |
| // Cities data | |
| const cities = { | |
| sa: ['الرياض', 'جدة', 'مكة المكرمة', 'المدينة المنورة', 'الدمام', 'الخبر', 'الطائف', 'بريدة', 'تبوك', 'نجران'], | |
| eg: ['القاهرة', 'الجيزة', 'الإسكندرية', 'المنصورة', 'طنطا', 'المنيا', 'أسيوط', 'سوهاج', 'الأقصر', 'أسوان'] | |
| }; | |
| // Sample items data | |
| const sampleItems = { | |
| sa: [ | |
| { | |
| id: 1, | |
| title: "كاميرا احترافية", | |
| description: "كاميرا كانون EOS 5D مارك الرابع مع عدسة 24-70mm، حالة ممتازة", | |
| price: 150, | |
| city: "الرياض", | |
| category: "electronics", | |
| image: "https://images.unsplash.com/photo-1516035069371-29a1b244cc32?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| }, | |
| { | |
| id: 2, | |
| title: "دراجة هوائية", | |
| description: "دراجة هوائية ماركة تريك بحالة جيدة، مناسبة للطرق الوعرة", | |
| price: 80, | |
| city: "جدة", | |
| category: "sports", | |
| image: "https://images.unsplash.com/photo-1485965120184-e220f721d03e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| }, | |
| { | |
| id: 3, | |
| title: "أدوات كهربائية", | |
| description: "مجموعة أدوات كهربائية كاملة مع صندوق تخزين، جديدة تماماً", | |
| price: 50, | |
| city: "الدمام", | |
| category: "tools", | |
| image: "https://images.unsplash.com/photo-1585771724684-38269d6639fd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| } | |
| ], | |
| eg: [ | |
| { | |
| id: 1, | |
| title: "كاميرا احترافية", | |
| description: "كاميرا نيكون D850 مع عدسة 24-70mm، حالة ممتازة", | |
| price: 200, | |
| city: "القاهرة", | |
| category: "electronics", | |
| image: "https://images.unsplash.com/photo-1516035069371-29a1b244cc32?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| }, | |
| { | |
| id: 2, | |
| title: "ماكينة خياطة", | |
| description: "ماكينة خياطة سنجر جديدة، مع جميع الملحقات", | |
| price: 40, | |
| city: "الجيزة", | |
| category: "home", | |
| image: "https://images.unsplash.com/photo-1565350736281-0510a3a1b5e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| }, | |
| { | |
| id: 3, | |
| title: "مولد كهرباء", | |
| description: "مولد كهرباء 5 كيلو وات، يعمل بالبنزين، بحالة جيدة", | |
| price: 120, | |
| city: "الإسكندرية", | |
| category: "tools", | |
| image: "https://images.unsplash.com/photo-1615242860221-8a9d594f2a4a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" | |
| } | |
| ] | |
| }; | |
| // Initialize the app | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Check if country is already selected | |
| const savedCountry = localStorage.getItem('country'); | |
| if (savedCountry) { | |
| selectedCountry = savedCountry; | |
| initApp(); | |
| } else { | |
| // Show country selection modal | |
| document.getElementById('countryModal').classList.remove('hidden'); | |
| } | |
| // Setup event listeners | |
| setupEventListeners(); | |
| }); | |
| // Country selection | |
| function selectCountry(country) { | |
| selectedCountry = country; | |
| localStorage.setItem('country', country); | |
| document.getElementById('countryModal').classList.add('hidden'); | |
| initApp(); | |
| } | |
| // Change country | |
| function changeCountry() { | |
| localStorage.removeItem('country'); | |
| selectedCountry = null; | |
| document.getElementById('countryModal').classList.remove('hidden'); | |
| } | |
| // Initialize the app after country selection | |
| function initApp() { | |
| // Set currency and cities based on country | |
| const currency = selectedCountry === 'sa' ? 'ريال' : 'جنيه'; | |
| const countryName = selectedCountry === 'sa' ? 'السعودية' : 'مصر'; | |
| document.getElementById('priceCurrency').textContent = currency; | |
| document.getElementById('currentCountry').textContent = countryName; | |
| document.getElementById('mobileCurrentCountry').textContent = countryName; | |
| // Update footer description | |
| document.getElementById('footerDescription').textContent = | |
| `منصة لتأجير الأغراض الشخصية بين الأفراد في ${countryName}`; | |
| // Populate city filters | |
| populateCitySelect('cityFilter', 'كل المدن'); | |
| populateCitySelect('itemCity', 'اختر المدينة'); | |
| // Load items for selected country | |
| loadItems(); | |
| // Load home page by default | |
| showHome(); | |
| } | |
| // Populate city select dropdown | |
| function populateCitySelect(selectId, defaultText) { | |
| const select = document.getElementById(selectId); | |
| select.innerHTML = ''; | |
| const defaultOption = document.createElement('option'); | |
| defaultOption.value = ''; | |
| defaultOption.textContent = defaultText; | |
| select.appendChild(defaultOption); | |
| cities[selectedCountry].forEach(city => { | |
| const option = document.createElement('option'); | |
| option.value = city; | |
| option.textContent = city; | |
| select.appendChild(option); | |
| }); | |
| } | |
| // Setup event listeners | |
| function setupEventListeners() { | |
| // Image preview for add item | |
| document.getElementById('itemImage').addEventListener('change', function(e) { | |
| if (e.target.files.length > 0) { | |
| const reader = new FileReader(); | |
| reader.onload = function(event) { | |
| document.getElementById('previewImage').src = event.target.result; | |
| document.getElementById('imagePreview').classList.remove('hidden'); | |
| }; | |
| reader.readAsDataURL(e.target.files[0]); | |
| } | |
| }); | |
| // City filter change | |
| document.getElementById('cityFilter').addEventListener('change', function() { | |
| loadItems(); | |
| }); | |
| // Login/Register tab switch | |
| document.getElementById('loginTabBtn').addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.getElementById('loginForm').classList.remove('hidden'); | |
| document.getElementById('registerForm').classList.add('hidden'); | |
| document.getElementById('loginTabBtn').classList.add('tab-active'); | |
| document.getElementById('registerTabBtn').classList.remove('tab-active'); | |
| }); | |
| document.getElementById('registerTabBtn').addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.getElementById('loginForm').classList.add('hidden'); | |
| document.getElementById('registerForm').classList.remove('hidden'); | |
| document.getElementById('loginTabBtn').classList.remove('tab-active'); | |
| document.getElementById('registerTabBtn').classList.add('tab-active'); | |
| }); | |
| // Form submissions | |
| document.getElementById('loginForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| login(); | |
| }); | |
| document.getElementById('registerForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| register(); | |
| }); | |
| document.getElementById('addItemForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| addItem(); | |
| }); | |
| } | |
| // Show loading spinner | |
| function showLoading() { | |
| document.getElementById('loadingSpinner').classList.remove('hidden'); | |
| } | |
| // Hide loading spinner | |
| function hideLoading() { | |
| document.getElementById('loadingSpinner').classList.add('hidden'); | |
| } | |
| // Show success notification | |
| function showSuccess(message) { | |
| const notification = document.getElementById('successNotification'); | |
| document.getElementById('successMessage').textContent = message; | |
| notification.classList.remove('hidden'); | |
| setTimeout(() => { | |
| notification.classList.add('hidden'); | |
| }, 3000); | |
| } | |
| // Show error notification | |
| function showError(message) { | |
| const notification = document.getElementById('errorNotification'); | |
| document.getElementById('errorMessage').textContent = message; | |
| notification.classList.remove('hidden'); | |
| setTimeout(() => { | |
| notification.classList.add('hidden'); | |
| }, 3000); | |
| } | |
| // Toggle mobile menu | |
| function toggleMobileMenu() { | |
| document.getElementById('mobileMenu').classList.toggle('hidden'); | |
| } | |
| // Page navigation functions | |
| function showHome() { | |
| if (!selectedCountry) { | |
| document.getElementById('countryModal').classList.remove('hidden'); | |
| return; | |
| } | |
| hideAllPages(); | |
| document.getElementById('homePage').classList.remove('hidden'); | |
| document.getElementById('homeTab').classList.add('tab-active'); | |
| document.getElementById('addItemTab').classList.remove('tab-active'); | |
| document.getElementById('loginTab').classList.remove('tab-active'); | |
| currentPage = 'home'; | |
| } | |
| function showAddItem() { | |
| if (!selectedCountry) { | |
| document.getElementById('countryModal').classList.remove('hidden'); | |
| return; | |
| } | |
| hideAllPages(); | |
| document.getElementById('addItemPage').classList.remove('hidden'); | |
| document.getElementById('homeTab').classList.remove('tab-active'); | |
| document.getElementById('addItemTab').classList.add('tab-active'); | |
| document.getElementById('loginTab').classList.remove('tab-active'); | |
| currentPage = 'addItem'; | |
| } | |
| function showLogin() { | |
| if (!selectedCountry) { | |
| document.getElementById('countryModal').classList.remove('hidden'); | |
| return; | |
| } | |
| hideAllPages(); | |
| document.getElementById('loginPage').classList.remove('hidden'); | |
| document.getElementById('homeTab').classList.remove('tab-active'); | |
| document.getElementById('addItemTab').classList.remove('tab-active'); | |
| document.getElementById('loginTab').classList.add('tab-active'); | |
| currentPage = 'login'; | |
| } | |
| function hideAllPages() { | |
| const pages = ['homePage', 'addItemPage', 'loginPage']; | |
| pages.forEach(page => { | |
| document.getElementById(page).classList.add('hidden'); | |
| }); | |
| } | |
| // Load items for home page | |
| function loadItems() { | |
| if (!selectedCountry) return; | |
| const cityFilter = document.getElementById('cityFilter').value; | |
| let items = sampleItems[selectedCountry]; | |
| // Filter by city if selected | |
| if (cityFilter) { | |
| items = items.filter(item => item.city === cityFilter); | |
| } | |
| const itemsContainer = document.getElementById('itemsContainer'); | |
| itemsContainer.innerHTML = ''; | |
| if (items.length === 0) { | |
| itemsContainer.innerHTML = ` | |
| <div class="col-span-full text-center py-12"> | |
| <i class="fas fa-box-open text-4xl text-gray-300 mb-4"></i> | |
| <p class="text-gray-500">لا توجد أغراض متاحة للإيجار حالياً</p> | |
| </div> | |
| `; | |
| return; | |
| } | |
| const currency = selectedCountry === 'sa' ? 'ريال' : 'جنيه'; | |
| items.forEach(item => { | |
| const itemCard = document.createElement('div'); | |
| itemCard.className = 'bg-white rounded-lg shadow-md overflow-hidden item-card'; | |
| itemCard.innerHTML = ` | |
| <div class="h-48 bg-gray-200 relative"> | |
| <img src="${item.image}" alt="${item.title}" class="w-full h-full object-cover"> | |
| <div class="absolute bottom-2 left-2 bg-blue-600 text-white px-2 py-1 rounded text-sm"> | |
| ${item.price} ${currency} / يوم | |
| </div> | |
| </div> | |
| <div class="p-4"> | |
| <h3 class="font-bold text-lg mb-1">${item.title}</h3> | |
| <p class="text-gray-600 text-sm mb-2">${item.city}</p> | |
| <p class="text-gray-700 text-sm mb-4 line-clamp-2">${item.description}</p> | |
| <div class="flex justify-between items-center"> | |
| <button class="text-blue-600 hover:text-blue-800 text-sm font-medium"> | |
| <i class="fas fa-comment-dots mr-1"></i> تواصل | |
| </button> | |
| <span class="text-xs text-gray-500">منذ يومين</span> | |
| </div> | |
| </div> | |
| `; | |
| itemsContainer.appendChild(itemCard); | |
| }); | |
| } | |
| // Login function (simulated) | |
| function login() { | |
| const email = document.getElementById('loginEmail').value; | |
| const password = document.getElementById('loginPassword').value; | |
| if (!email || !password) { | |
| showError('الرجاء إدخال البريد الإلكتروني وكلمة المرور'); | |
| return; | |
| } | |
| showLoading(); | |
| // Simulate API call | |
| setTimeout(() => { | |
| hideLoading(); | |
| showSuccess('تم تسجيل الدخول بنجاح'); | |
| showHome(); | |
| }, 1000); | |
| } | |
| // Register function (simulated) | |
| function register() { | |
| const name = document.getElementById('registerName').value; | |
| const email = document.getElementById('registerEmail').value; | |
| const phone = document.getElementById('registerPhone').value; | |
| const password = document.getElementById('registerPassword').value; | |
| const confirmPassword = document.getElementById('registerConfirmPassword').value; | |
| if (!name || !email || !phone || !password || !confirmPassword) { | |
| showError('الرجاء ملء جميع الحقول'); | |
| return; | |
| } | |
| if (password !== confirmPassword) { | |
| showError('كلمة المرور غير متطابقة'); | |
| return; | |
| } | |
| if (password.length < 6) { | |
| showError('كلمة المرور يجب أن تكون 6 أحرف على الأقل'); | |
| return; | |
| } | |
| showLoading(); | |
| // Simulate API call | |
| setTimeout(() => { | |
| hideLoading(); | |
| showSuccess('تم إنشاء الحساب بنجاح، الرجاء تسجيل الدخول'); | |
| document.getElementById('loginTabBtn').click(); | |
| document.getElementById('loginEmail').value = email; | |
| document.getElementById('loginPassword').value = ''; | |
| }, 1500); | |
| } | |
| // Add item function (simulated) | |
| function addItem() { | |
| const title = document.getElementById('itemTitle').value; | |
| const description = document.getElementById('itemDescription').value; | |
| const price = document.getElementById('itemPrice').value; | |
| const city = document.getElementById('itemCity').value; | |
| const category = document.getElementById('itemCategory').value; | |
| const imageFile = document.getElementById('itemImage').files[0]; | |
| if (!title || !description || !price || !city || !category) { | |
| showError('الرجاء ملء جميع الحقول المطلوبة'); | |
| return; | |
| } | |
| showLoading(); | |
| // Simulate API call | |
| setTimeout(() => { | |
| hideLoading(); | |
| // Reset form | |
| document.getElementById('addItemForm').reset(); | |
| document.getElementById('imagePreview').classList.add('hidden'); | |
| showSuccess('تم إضافة الغرض بنجاح'); | |
| showHome(); | |
| }, 1500); | |
| } | |
| </script> | |
| <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=amrora00/https-enzostvs-deepsite-hf-space" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |