File size: 2,271 Bytes
3e78dbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4f10121
 
 
3e78dbc
 
 
4f10121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Global functions and event listeners
document.addEventListener('DOMContentLoaded', () => {
    // Initialize any global functionality
    console.log('DocuShield Sentinel initialized');
});
// File processing function
function processFiles(files) {
    // This would be replaced with actual API calls to your backend
    console.log('Processing files:', files);
    
    // Show loading state
    const dropZone = document.getElementById('dropZone');
    dropZone.innerHTML = `
        <div class="flex flex-col items-center justify-center h-full">
            <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500 mb-4"></div>
            <p class="text-gray-700">Analyzing document for sensitive data...</p>
            <div class="w-full bg-gray-200 rounded-full h-2 mt-4 max-w-xs">
                <div id="progressBar" class="bg-blue-600 h-2 rounded-full" style="width: 0%"></div>
            </div>
        </div>
    `;
    
    // Simulate progress
    let progress = 0;
    const progressInterval = setInterval(() => {
        progress += 5;
        document.getElementById('progressBar').style.width = `${progress}%`;
        
        if (progress >= 100) {
            clearInterval(progressInterval);
            // Redirect to results page with file data
            const url = new URL('results.html', window.location.href);
            url.searchParams.set('files', files.length);
            window.location.href = url.toString();
        }
    }, 100);
}

// Handle results page initialization
function initResultsPage() {
    if (window.location.pathname.includes('results.html')) {
        // Parse URL parameters
        const urlParams = new URLSearchParams(window.location.search);
        const fileCount = urlParams.get('files') || 1;
        
        // Update UI based on parameters
        console.log(`Displaying results for ${fileCount} files`);
        
        // Additional initialization for results page
        feather.replace();
    }
}

// Initialize appropriate page functions
document.addEventListener('DOMContentLoaded', () => {
    if (window.location.pathname.includes('results.html')) {
        initResultsPage();
    } else {
        console.log('DocuShield Sentinel initialized');
    }
});