PageSourceSearch

https://www.firecomms.com/js/files.js

js firecomms.com collected 2026-10-04 02:47:22 UTC 3,326 bytes, 75 lines download raw bytes

1// Show password modal
2function showPasswordModal(fileType, productId, fileName) {
3    document.getElementById('fileType').value = fileType;
4    document.getElementById('productId').value = productId;
5    document.getElementById('fileName').value = fileName;
6    document.getElementById('filePassword').value = '';
7    document.getElementById('passwordError').style.display = 'none';
8    document.getElementById('filePasswordModal').style.display = 'block';
9}
10
11// Close password modal
12function closePasswordModal() {
13    document.getElementById('filePasswordModal').style.display = 'none';
14}
15
16// Validate password
17function validatePassword() {
18    var password = document.getElementById('filePassword').value;
19    var productId = document.getElementById('productId').value;
20    var fileType = document.getElementById('fileType').value;
21    var fileName = document.getElementById('fileName').value;
22    
23    console.log('Validating password for: ' + fileType + ', productId: ' + productId + ', fileName: ' + fileName);
24    
25    // AJAX call to verify password
26    var xhr = new XMLHttpRequest();
27    xhr.open('POST', 'index.cfm?action=gdcdata.files.ActAjaxVerifyFilePassword', true);
28    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
29    xhr.onreadystatechange = function() {
30        if (xhr.readyState === 4 && xhr.status === 200) {
31            console.log('Password validation response: ' + xhr.responseText);
32            
33            if (xhr.responseText.trim() === 'true') {
34                console.log('Password correct, opening file');
35                // Password correct, download file
36                trackFileDownload(productId, fileName, fileType === 'pcb' ? 'PCB Layout' : 'STP File');
37                closePasswordModal();
38                
39                // Open file in a new tab
40                var filePath = fileType === 'pcb' ? 
41                    'contentFiles/pcblayouts/' + fileName : 
42                    'contentFiles/stpfiles/' + fileName;
43                
44                console.log('Opening file: ' + filePath);
45                window.open(filePath, '_blank');
46            } else {
47                console.log('Password incorrect');
48                // Password incorrect
49                document.getElementById('passwordError').style.display = 'block';
50            }
51        }
52    };
53    xhr.send('productId=' + encodeURIComponent(productId) + '&password=' + encodeURIComponent(password));
54}
55
56// Track file download
57function trackFileDownload(productId, fileName, fileType) {
58    var xhr = new XMLHttpRequest();
59    xhr.open('POST', 'index.cfm?action=gdcdata.files.ActAjaxTrackFileDownload', true);
60    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
61    xhr.send('productId=' + encodeURIComponent(productId) + 
62            '&fileName=' + encodeURIComponent(fileName) + 
63            '&fileType=' + encodeURIComponent(fileType));
64}
65
66// Download file directly (for non-password-protected files)
67function downloadFile(filePath, fileName, productId, fileType) {
68    // Track the download
69    trackFileDownload(productId, fileName, fileType);
70    
71    // Open file in a new tab
72    window.open(filePath, '_blank');
73    
74    return false; // Prevent default link behavior
75}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.