CLICK TO PLAY
FULLSCREEN
`.trim();
// Blob oluştur
const blob = new Blob([gameHTML], { type: 'text/html' });
const blobUrl = URL.createObjectURL(blob);
// Mevcut iframe varsa temizle
while (container.firstChild) {
container.removeChild(container.firstChild);
}
// Yeni iframe oluştur
const iframe = document.createElement('iframe');
iframe.src = blobUrl;
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = 'none';
iframe.style.margin = '0';
iframe.style.padding = '0';
// Iframe'i ekle
container.appendChild(iframe);
// Hata ayıklama
iframe.onload = () => console.log('Oyun yüklendi');
iframe.onerror = (e) => console.error('Oyun yüklenirken hata:', e);
} catch (error) {
console.error('Hata oluştu:', error);
alert('Oyun yüklenemedi. Tarayıcı konsolunu kontrol edin.');
}
}
function openFullscreen() {
try {
// Yeni sekme aç
const newWin = window.open("about:blank", "_blank");
if (newWin) {
newWin.document.open();
newWin.document.write(gameHTML);
newWin.document.close();
// Tam ekran modunu ayarla (isteğe bağlı, tarayıcıya bağlı olarak çalışmayabilir)
setTimeout(() => {
if (newWin.document.documentElement.requestFullscreen) {
newWin.document.documentElement.requestFullscreen();
} else if (newWin.document.documentElement.mozRequestFullScreen) {
newWin.document.documentElement.mozRequestFullScreen();
} else if (newWin.document.documentElement.webkitRequestFullscreen) {
newWin.document.documentElement.webkitRequestFullscreen();
} else if (newWin.document.documentElement.msRequestFullscreen) {
newWin.document.documentElement.msRequestFullscreen();
}
}, 500);
} else {
alert("Yeni sekme açma engellendi. Lütfen tarayıcı ayarlarını kontrol edin.");
}
} catch (error) {
console.error('Fullscreen hata:', error);
alert('Tam ekran modu çalışmadı. Tarayıcı konsolunu kontrol edin.');
}
}
// gameHTML'i global scope'a tanımla
const gameHTML = `
`.trim();