CoolFace
Apppublic

hamzawal3/priority-sultan-the-royal-task-master

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
script.js60 linesDownload Raw Back to root
1 2function checkAuth() {3    // In a real app, this would check authentication status4    const isVerified = false; // Simulate unverified user5    6    if (!isVerified && window.location.pathname !== '/email-verification.html') {7        window.location.href = '/email-verification.html';8    }9}10 11document.addEventListener('DOMContentLoaded', () => {12    checkAuth();13// Theme toggle functionality14    const themeToggle = document.getElementById('theme-toggle');15    if (themeToggle) {16        themeToggle.addEventListener('click', () => {17            document.documentElement.classList.toggle('dark');18            localStorage.setItem('darkMode', document.documentElement.classList.contains('dark'));19        });20    }21 22    // Add new priority box23    const addBoxBtn = document.getElementById('add-box');24    const gridContainer = document.querySelector('.grid');25    const template = document.getElementById('priority-template');26    27    if (addBoxBtn && gridContainer && template) {28        addBoxBtn.addEventListener('click', () => {29            const newBox = template.content.cloneNode(true);30            gridContainer.appendChild(newBox);31        });32    }33 34    // Check for saved theme preference35    if (localStorage.getItem('darkMode') === 'true') {36        document.documentElement.classList.add('dark');37    }38});39// Support dialog functionality40function openSupport() {41    const message = prompt("اكتب مشكلتك هنا...");42    if (message) {43        const phone = "0775785492";44        const url = `https://wa.me/964${phone.substring(1)}?text=${encodeURIComponent(message)}`;45        window.open(url, '_blank');46    }47}48 49// Language toggle functionality50function toggleLanguage() {51    const elements = document.querySelectorAll('[data-lang]');52    elements.forEach(el => {53        if (el.dataset.lang === 'ar') {54            el.style.display = el.style.display === 'none' ? 'block' : 'none';55        } else if (el.dataset.lang === 'en') {56            el.style.display = el.style.display === 'block' ? 'none' : 'block';57        }58    });59}60