CoolFace
Apppublic

Ahmedoprdof/egyptian-code-wizard

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
script.js136 linesDownload Raw Back to root
1document.addEventListener('DOMContentLoaded', function() {2    // Initialize tooltips3    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));4    tooltipTriggerList.map(function (tooltipTriggerEl) {5        return new bootstrap.Tooltip(tooltipTriggerEl);6    });7 8    // Search functionality9    const searchInput = document.querySelector('input[type="text"]');10    if(searchInput) {11        searchInput.addEventListener('keypress', function(e) {12            if(e.key === 'Enter') {13                const query = this.value.trim();14                if(query) {15                    alert(`سيتم البحث عن: ${query}`);16                    // In a real app, you would redirect to search results or fetch data17                }18            }19        });20    }21});22// Detailed data for Egyptian engineering codes23const egyptianCodes = {24    construction: [25        { 26            id: 1, 27            title: "كود الخرسانة المسلحة", 28            content: "يحدد الكود المصري للخرسانة المسلحة (ECP 203-2020) متطلبات تصميم وتنفيذ العناصر الخرسانية بما يشمل: مقاومة الضغط المميزة للخرسانة، نسب الخلط، معايير التشغيل، حديد التسليح، تفاصيل التسليح، وحسابات المنشآت الخرسانية تحت تأثير الأحمال المختلفة.", 29            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/concrete_code.pdf",30            version: "2023"31        },32        { 33            id: 2, 34            title: "كود الأساسات", 35            content: "يغطي الكود المصري للأساسات (ECP 202-2021) أنواع الأساسات المختلفة (سطحية، عميقة، خاصة)، طرق التصميم حسب نوع التربة، معاملات الأمان، طرق التنفيذ، واختبارات التربة المطلوبة قبل وأثناء التنفيذ.", 36            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/foundations_code.pdf",37            version: "2022"38        },39        { 40            id: 3, 41            title: "كود المنشآت المعدنية", 42            content: "يحدد الكود المصري للمنشآت المعدنية (ECP 205-2019) مواصفات تصميم الهياكل الفولاذية، وصلات اللحام والبراغي، الحماية من الحريق، مقاومة الزلازل، ومعايير الجودة للحديد الإنشائي وصلاته.", 43            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/steel_structures_code.pdf",44            version: "2021"45        }46    ],47    infrastructure: [48        { 49            id: 1, 50            title: "كود شبكات المياه والصرف", 51            content: "يغطي الكود المصري لشبكات المياه والصرف الصحي (ECP 301-2022) تصميم وتنفيذ شبكات التغذية والصرف، مواد الأنابيب، أعماق الدفن، التهوية، المحابس، وصلات التفرع، واختبارات الضغط والتسريب.", 52            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/water_networks_code.pdf",53            version: "2022"54        },55        { 56            id: 2, 57            title: "كود محطات المعالجة", 58            content: "يحدد الكود المصري لمحطات المعالجة (ECP 302-2021) مواصفات محطات معالجة مياه الشرب والصرف الصحي، وحدات المعالجة، أحواض الترسيب، المرشحات، أنظمة التطهير، وضوابط التشغيل والصيانة.", 59            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/treatment_plants_code.pdf",60            version: "2021"61        },62        { 63            id: 3, 64            title: "كود شبكات الكهرباء", 65            content: "يغطي الكود المصري لشبكات الكهرباء (ECP 303-2023) تصميم وتنفيذ شبكات التوزيع الأرضية والهوائية، الكابلات، المحولات، لوحات التوزيع، الحماية من الصواعق، وأجهزة القياس والحماية.", 66            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/electrical_networks_code.pdf",67            version: "2023"68        }69    ],70    roads: [71        { 72            id: 1, 73            title: "كود تصميم الطرق", 74            content: "يحدد الكود المصري لتصميم الطرق (ECP 401-2023) المعايير الهندسية لتصميم الطرق الحضرية والسريعة، السرعات التصميمية، مسارات الحركة، المنحنيات الأفقية والرأسية، التصريف السطحي، ومعايير الأمان.", 75            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/roads_design_code.pdf",76            version: "2023"77        },78        { 79            id: 2, 80            title: "كود إنشاء الطرق", 81            content: "يغطي الكود المصري لإنشاء الطرق (ECP 402-2022) مواصفات مواد طبقات الرصف (القاعدة، الأساس، الطبقة السطحية)، معدلات الدمك، اختبارات المواد، تنفيذ الطبقات، وصلات التمدد، وضوابط مراقبة الجودة.", 82            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/roads_construction_code.pdf",83            version: "2022"84        },85        { 86            id: 3, 87            title: "كود إشارات المرور", 88            content: "يحدد الكود المصري لإشارات المرور (ECP 403-2021) مواصفات اللوحات الإرشادية والتحذيرية، الإشارات الضوئية، العلامات الأرضية، ألوان ومواد الصنع، مواقع التركيب، والمسافات البينية.", 89            pdf: "https://www.housing.gov.eg/Portals/0/pdf/codes/traffic_signs_code.pdf",90            version: "2021"91        }92    ]93};94 95// Function to display code details by ID and category96function displayCodeDetails(category, id) {97    const code = egyptianCodes[category].find(item => item.id === parseInt(id));98    if (code) {99        // In a real app, you would update the DOM with code details100        console.log(`Displaying ${code.title}`);101        // Example: document.getElementById('code-title').textContent = code.title;102        // document.getElementById('code-content').textContent = code.content;103    }104}105 106// Initialize code details if URL has parameters107document.addEventListener('DOMContentLoaded', function() {108    const urlParams = new URLSearchParams(window.location.search);109    const category = urlParams.get('category');110    const id = urlParams.get('id');111    112    if (category && id) {113        displayCodeDetails(category, id);114    }115 116    // Initialize tooltips117    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));118    tooltipTriggerList.map(function (tooltipTriggerEl) {119        return new bootstrap.Tooltip(tooltipTriggerEl);120    });121 122    // Search functionality123    const searchInput = document.querySelector('input[type="text"]');124    if(searchInput) {125        searchInput.addEventListener('keypress', function(e) {126            if(e.key === 'Enter') {127                const query = this.value.trim();128                if(query) {129                    // In a real app, you would redirect to search results130                    window.location.href = `search.html?q=${encodeURIComponent(query)}`;131                }132            }133        });134    }135});136