Team Ai
Apppublic

Tomerg7898/annotateflow-data-annotation-command-center

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
script.js81 linesDownload Raw Back to root
1// Global configuration2document.addEventListener('DOMContentLoaded', () => {3    // Initialize tooltips4    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));5    tooltipTriggerList.map(function (tooltipTriggerEl) {6        return new bootstrap.Tooltip(tooltipTriggerEl);7    });8 9    // Handle active navigation items10    const currentPath = window.location.pathname.split('/').pop() || 'index.html';11    document.querySelectorAll('.nav-link').forEach(link => {12        if (link.getAttribute('href') === currentPath) {13            link.classList.add('active');14        }15    });16});17 18// API integration functions19async function fetchProjects() {20    try {21        const response = await fetch('/api/projects');22        return await response.json();23    } catch (error) {24        console.error('Error fetching projects:', error);25        return [];26    }27}28 29async function fetchWorkers() {30    try {31        const response = await fetch('/api/workers');32        return await response.json();33    } catch (error) {34        console.error('Error fetching workers:', error);35        return [];36    }37}38 39// Google Drive integration helpers40function loadGoogleDriveFile(fileId, callback) {41    gapi.client.drive.files.get({42        fileId: fileId,43        alt: 'media'44    }).then(response => {45        callback(response.body);46    });47}48// Time tracking functions49function fetchProjects() {50    return [51        { id: 1, name: "Autonomous Vehicles", client: "Acme Corp" },52        { id: 2, name: "Medical Imaging", client: "MediCare" },53        { id: 3, name: "Text Classification", client: "TechSolutions" }54    ];55}56 57function fetchTasks() {58    return [59        { id: 1, name: "Image Annotation" },60        { id: 2, name: "Text Labeling" },61        { id: 3, name: "Data Cleaning" },62        { id: 4, name: "Quality Check" }63    ];64}65 66// Utility functions67function formatDate(dateString) {68    const options = { year: 'numeric', month: 'short', day: 'numeric' };69    return new Date(dateString).toLocaleDateString(undefined, options);70}71 72function debounce(func, wait) {73    let timeout;74    return function() {75        const context = this, args = arguments;76        clearTimeout(timeout);77        timeout = setTimeout(() => {78            func.apply(context, args);79        }, wait);80    };81}