topRightOverlay.style.cssText = `
position: absolute;
top: 10px;
right: 10px;
width: 50px;
height: 35px;
background: rgba(0,0,0,0.8);
z-index: 1000;
pointer-events: none;
border-radius: 4px;
`;
iframeContainer.appendChild(topRightOverlay);
// Bottom left overlay to hide remaining branding
const bottomLeftOverlay = document.createElement('div');
bottomLeftOverlay.style.cssText = `
position: absolute;
bottom: 0;
left: 0;
width: 150px;
height: 50px;
background: linear-gradient(90deg, rgba(0,0,0,0.7) 0%, transparent 100%);
z-index: 999;
pointer-events: none;
border-radius: 0 0 0 12px;
`;
iframeContainer.appendChild(bottomLeftOverlay);
}
function addBackToPlayerButton(iframeContainer, player, playerEl) {
// Add a back button to return to custom player
const backButton = document.createElement('div');
backButton.style.cssText = `
position: absolute;
top: 15px;
left: 15px;
background: rgba(0,0,0,0.8);
color: white;
padding: 8px 15px;
border-radius: 20px;
cursor: pointer;
font-size: 12px;
font-weight: 600;
z-index: 1001;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 6px;
backdrop-filter: blur(10px);
`;
backButton.innerHTML = `
Back to Player
`;
// Add hover effect
backButton.addEventListener('mouseenter', function() {
this.style.background = 'rgba(0,0,0,0.95)';
this.style.transform = 'scale(1.05)';
});
backButton.addEventListener('mouseleave', function() {
this.style.background = 'rgba(0,0,0,0.8)';
this.style.transform = 'scale(1)';
});
// Add click handler to go back to custom player
backButton.addEventListener('click', function() {
// Remove YouTube container
iframeContainer.remove();
// Show Video.js player again
playerEl.style.display = 'block';
// Reset player
player.pause();
player.currentTime(0);
});
iframeContainer.appendChild(backButton);
}
function extractYouTubeId(url) {
const match = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
return match ? match[1] : null;
}
function hideLoadingOverlay(loadingOverlay) {
if (loadingOverlay) {
loadingOverlay.style.display = 'none';
}
}
function showErrorMessage(videoElement, loadingOverlay) {
hideLoadingOverlay(loadingOverlay);
const container = videoElement.parentElement;
container.innerHTML = `
Video Not Available
Please check back later or contact support.
`;
}
// Real-time Final Exam Approval Polling
let approvalPollingInterval = null;
let currentQuizId = 3;
let isPollingActive = false;
function startApprovalPolling() {
}
function stopApprovalPolling() {
if (approvalPollingInterval) {
clearInterval(approvalPollingInterval);
approvalPollingInterval = null;
isPollingActive = false;
console.log('Stopped final exam approval polling');
}
}
function checkFinalExamApprovalStatus() {
fetch(`/student/final-exam/status?quiz_id=${currentQuizId}`, {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'X-CSRF-TOKEN': 'hpawJKCEBqL9qhEAVBCRWf2GrSXoa3mwnO1b8u3Z'
}
})
.then(response => response.json())
.then(data => {
if (data.success && data.request) {
if (data.request.status === 'approved') {
// Approval detected! Update UI and stop polling
console.log('Final exam approved! Updating UI...');
stopApprovalPolling();
handleFinalExamApproval();
} else if (data.request.status === 'rejected') {
// Request was rejected, stop polling
console.log('Final exam request rejected');
stopApprovalPolling();
handleFinalExamRejection();
}
}
})
.catch(error => {
console.error('Error checking final exam status:', error);
});
}
function handleFinalExamApproval() {
// Show success notification
showNotification('🎉 Final Exam Approved!', 'Your final exam request has been approved. Starting exam...', 'success');
// Update the UI by removing pending button and adding exam button
updateExamButtons();
// Auto-start the final exam after a short delay
setTimeout(() => {
window.location.href = `/student/quiz/${currentQuizId}/start?mode=exam`;
}, 2000);
}
function handleFinalExamRejection() {
// Show rejection notification
showNotification('Final Exam Request Update', 'Your final exam request needs review. Please check the details.', 'warning');
// Reload page to show updated status
setTimeout(() => {
window.location.reload();
}, 3000);
}
function updateExamButtons() {
// Find the pending button and replace with exam button
const pendingButton = document.querySelector('.action-btn.final.pending');
if (pendingButton) {
pendingButton.outerHTML = `
`;
}
}
function startFinalExam() {
window.location.href = `/student/quiz/${currentQuizId}/start?mode=exam`;
}
function showNotification(title, message, type = 'info') {
// Create notification element
const notification = document.createElement('div');
notification.className = `quiz-notification quiz-notification-${type}`;
notification.innerHTML = `
`;
// Add styles if not already present
if (!document.getElementById('notification-styles')) {
const styles = document.createElement('style');
styles.id = 'notification-styles';
styles.textContent = `
.quiz-notification {
position: fixed;
top: 20px;
right: 20px;
background: white;
border-radius: 12px;
padding: 16px;
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
z-index: 10000;
max-width: 350px;
border-left: 4px solid #007bff;
}
.quiz-notification-success { border-left-color: #28a745; }
.quiz-notification-warning { border-left-color: #ffc107; }
.quiz-notification-error { border-left-color: #dc3545; }
.notification-content h4 { margin: 0 0 8px 0; font-size: 16px; }
.notification-content p { margin: 0; font-size: 14px; color: #666; }
.notification-close {
position: absolute;
top: 8px;
right: 12px;
background: none;
border: none;
font-size: 20px;
cursor: pointer;
color: #999;
}
`;
document.head.appendChild(styles);
}
// Add to page
document.body.appendChild(notification);
// Auto-remove after 5 seconds
setTimeout(() => {
if (notification.parentElement) {
notification.remove();
}
}, 5000);
}
// Start polling when page loads
document.addEventListener('DOMContentLoaded', function() {
startApprovalPolling();
// Stop polling when user leaves page
window.addEventListener('beforeunload', stopApprovalPolling);
// Stop polling when page becomes hidden
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
stopApprovalPolling();
} else {
startApprovalPolling();
}
});
});
Day Contest3 - Quiz Details - DITRP
Quiz Overview
Contest Category: railway
Questions per Exam
20
(randomly selected from 205 questions)
Start Date
25 Jul 2025, 14:16 PM
End Date
25 Jul 2025, 14:16 PM
Description
Enter contest description...
Eligibility
Enter eligibility criteria...
Certificate Sample
Certificate Available!
Certificate Information
- Minimum score: 60%
- PDF format
- Issued instantly
- Digitally signed
Certificate Text:
This is to certify that {name} has successfully completed the {quiz} with a score of {score}%.