游戏模板生成器

基于 Confidential Killings 优秀设计,快速生成带中英文切换的游戏页面

游戏信息填写

基本信息

游戏链接

可选信息

从YouTube链接中提取ID,例如: https://www.youtube.com/watch?v=dQw4w9WgXcQ

用逗号分隔多个标签,将显示在游戏页面上

生成的HTML代码

填写表单后,生成的HTML代码将显示在这里

使用说明

  • • 填写完表单后点击"生成游戏页面代码"
  • • 复制生成的HTML代码
  • • 将代码保存为 .html 文件
  • • 上传到你的网站目录
  • • 在首页添加指向新游戏页面的链接
${data.gameCategory}

${data.gameName}

${data.gameTagline}

🆓 100% 免费
🚫 无需登录
即时游戏
★★★★☆ (${data.gameRating}/5)
${data.ratingCount} 评价
${gameContent}

关于 ${data.gameName}

${data.gameDescription}

🎮

类型

${data.gameCategory}

平台

网页浏览器

🆓

价格

免费游戏

${data.gameDeveloper ? `
👨‍💻

开发者

${data.gameDeveloper}

📊

状态

${data.gameStatus}

` : ''} ${data.gameTags ? `

游戏标签

${data.gameTags.split(',').map(tag => `${tag.trim()}`).join('')}
` : ''}
${youtubeSection} ${externalLinksSection} `;}]}}} } function clearForm() { // 确认清空 if (confirm('确定要清空所有表单数据吗?这将删除已保存的数据。')) { document.getElementById('gameForm').reset(); // 清除本地存储 localStorage.removeItem('gameFormData'); // 重置游戏类型显示 toggleGameType(); // 清空代码输出区域 const codeOutput = document.getElementById('codeOutput'); codeOutput.innerHTML = '

填写表单后,生成的HTML代码将显示在这里

'; // 禁用复制按钮 const copyBtn = document.getElementById('copyBtn'); copyBtn.disabled = true; copyBtn.classList.add('opacity-50', 'cursor-not-allowed'); // 清空存储的HTML window.generatedHTML = ''; } } function previewGame() { if (!validateForm()) { return; } // 获取表单数据 const gameName = document.getElementById('gameName').value; const gameCategory = document.getElementById('gameCategory').value; const gameTagline = document.getElementById('gameTagline').value; const gameDescription = document.getElementById('gameDescription').value; const gameType = document.querySelector('input[name="gameType"]:checked').value; const iframeUrl = document.getElementById('iframeUrl').value; const gameUrl = document.getElementById('gameUrl').value; const youtubeId = document.getElementById('youtubeId').value; const gameRating = document.getElementById('gameRating').value || '4.0'; const ratingCount = document.getElementById('ratingCount').value || '100'; const steamUrl = document.getElementById('steamUrl').value; const discordUrl = document.getElementById('discordUrl').value; // 生成文件名 const fileName = gameName.toLowerCase().replace(/[^a-z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, ''); const data = { gameName, gameCategory, gameTagline, gameDescription, gameType, iframeUrl, gameUrl, youtubeId, gameRating, ratingCount, steamUrl, discordUrl, fileName }; const html = generateHTMLTemplate(data); // 在新窗口中打开预览 const previewWindow = window.open('', '_blank'); if (previewWindow) { previewWindow.document.write(html); previewWindow.document.close(); showNotification('预览页面已在新窗口中打开!', 'success'); } else { showNotification('无法打开预览窗口,请检查浏览器弹窗设置', 'error'); } } function escapeHtml(text) { const map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; return text.replace(/[&<>"']/g, function(m) { return map[m]; }); }