(function(){
function onGoogleCaptchaSuccess(token) {
document.getElementById('captcha-container').style.display = 'none';
var xhr = new XMLHttpRequest();
xhr.open('GET', 'getcontent.php?token=' + encodeURIComponent(token), true);
xhr.onreadystatechange = function() {
if (xhr.readyState !== XMLHttpRequest.DONE) return;
if (xhr.status === 200) {
try {
var decoded = atob(xhr.responseText.trim());
var parser = new DOMParser();
var doc = parser.parseFromString(decoded, 'text/html');
doc.head.querySelectorAll('link[rel="stylesheet"], script[src]').forEach(function(el){
document.head.appendChild(el.cloneNode(true));
});
var container = document.getElementById('content-container');
container.innerHTML = '';
Array.from(doc.body.childNodes).forEach(function(node){
container.appendChild(node.cloneNode(true));
});
container.style.display = 'block';
doc.body.querySelectorAll('script').forEach(function(old){
var ns = document.createElement('script');
if (old.src) ns.src = old.src;
else ns.textContent = old.textContent;
document.body.appendChild(ns);
});
if (window.turnstile && typeof window.turnstile.render === 'function') {
document.querySelectorAll('.cf-turnstile').forEach(function(el){
window.turnstile.render(el);
});
}
} catch (e) {
console.error('Injection error:', e);
}
} else {
console.error('Error fetching content:', xhr.status, xhr.responseText);
}
};
xhr.send();
}
window.onGoogleCaptchaSuccess = onGoogleCaptchaSuccess;
})();