-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
67 lines (60 loc) · 2.15 KB
/
Copy pathscript.js
File metadata and controls
67 lines (60 loc) · 2.15 KB
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
63
64
65
66
67
document.addEventListener('DOMContentLoaded', function() {
// 1. Display current verification timestamp
updateTimestamp();
// 2. Simulate verification success animation (already handled by CSS classes)
console.log("Verification process initialized...");
// 3. Dynamic Data Placeholder Comments
/*
SCALABILITY NOTE:
To load data from Firebase/SQL/API:
fetch('https://api.mediahouse.co.za/v1/verify/MH-2025-001')
.then(response => response.json())
.then(data => {
document.querySelector('.employee-details h3').textContent = data.name;
document.getElementById('verificationCode').textContent = data.securityCode;
// ... update other fields
});
*/
});
/**
* Updates the verification timestamp to the current date and time
*/
function updateTimestamp() {
const timestampElement = document.getElementById('timestamp');
if (timestampElement) {
const now = new Date();
const options = {
day: '2-digit',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
};
timestampElement.textContent = now.toLocaleString('en-GB', options);
}
}
/**
* Copies the unique verification code to the clipboard
*/
function copyCode() {
const code = document.getElementById('verificationCode').textContent;
navigator.clipboard.writeText(code).then(() => {
// Simple visual feedback
const btn = document.querySelector('button[onclick="copyCode()"]');
const originalIcon = btn.innerHTML;
btn.innerHTML = '<i class="bi bi-check2"></i>';
btn.classList.replace('btn-outline-light', 'btn-success');
setTimeout(() => {
btn.innerHTML = originalIcon;
btn.classList.replace('btn-success', 'btn-outline-light');
}, 2000);
}).catch(err => {
console.error('Failed to copy: ', err);
});
}
/**
* Print functionality is handled by window.print() in the HTML
* CSS handles the print-specific visibility
*/