$(document).ready(function() {
// Function to create and append the overlay
function createOverlay() {
// Disable scrolling on the body
$('body').css({
'overflow': 'hidden',
'height': '100vh'
});
// Wrap all body content except scripts in a container for blurring
if ($('#content-to-blur').length === 0) {
$('body').children().not('script').wrapAll('
').attr('id', 'lock-overlay').css({
position: 'fixed',
top: 0,
left: 0,
width: '100%',
height: '100%',
backgroundColor: 'rgba(0, 0, 0, 0.6)',
zIndex: 1000,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column'
});
// Add click handler to overlay to prevent propagation
$overlay.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
});
// Create and style the image
var $image = $('
![]()
').attr({
src: '/themes/d4system/assets/img/stop.png',
alt: 'Stop'
}).css({
width: '150px',
height: 'auto',
marginBottom: '15px'
});
// Create and style the message box
var $message = $('
').text('Storitev e-karate.si izklopljena zaradi neplačanih obveznosti.').css({
border: 'none',
padding: '15px',
backgroundColor: '#000',
borderRadius: '10px',
opacity: '0.8',
color: '#fff',
fontSize: '24px',
textAlign: 'center',
zIndex: 1010
});
// Append the image and message to the overlay
$overlay.append($image).append($message);
return $overlay;
}
// Initial overlay creation
$('body').append(createOverlay());
// Check every 5 seconds if the overlay exists
setInterval(function() {
if ($('#lock-overlay').length === 0) {
// Re-create and append the overlay if it was removed
$('body').append(createOverlay());
}
// Ensure body scrolling remains disabled
$('body').css({
'overflow': 'hidden',
'height': '100vh'
});
// Ensure blur and pointer-events remain applied
$('#content-to-blur').css({
'-webkit-filter': 'blur(5px)',
'-moz-filter': 'blur(5px)',
'-o-filter': 'blur(5px)',
'filter': 'blur(5px)',
'height': '100%',
'overflow': 'hidden',
'pointer-events': 'none'
});
// Rebind click handler in case content-to-blur was tampered with
$('#content-to-blur').off('click').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
});
}, 5000);
});