Flatlogic Bot c04ecb54c7 2.o
2025-11-22 18:52:00 +00:00

46 lines
1.6 KiB
JavaScript

document.getElementById('analysis-form').addEventListener('submit', function(e) {
e.preventDefault();
const audioFile = document.getElementById('audio-file').files[0];
if (!audioFile) {
alert('Please select an audio file.');
return;
}
const analysisResult = document.getElementById('analysis-result');
const spinner = document.getElementById('spinner');
const alertPlaceholder = document.getElementById('alert-placeholder');
analysisResult.style.display = 'block';
spinner.style.display = 'flex';
alertPlaceholder.innerHTML = '';
setTimeout(() => {
spinner.style.display = 'none';
const isHarmful = Math.random() < 0.5;
let alertHtml = '';
if (isHarmful) {
alertHtml = `
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading">Harmful Content Detected!</h4>
<p>Our analysis indicates that this call may contain harmful content. We recommend reviewing the call details.</p>
<hr>
<p class="mb-0">Timestamp: ${new Date().toLocaleString()}</p>
</div>
`;
} else {
alertHtml = `
<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Call is Safe</h4>
<p>No harmful content was detected in this call.</p>
<hr>
<p class="mb-0">Timestamp: ${new Date().toLocaleString()}</p>
</div>
`;
}
alertPlaceholder.innerHTML = alertHtml;
}, 2500);
});