mirror of
https://github.com/Moe-Sakura/frontend.git
synced 2026-03-15 04:53:18 +08:00
250702
This commit is contained in:
11
index.html
11
index.html
@@ -14,7 +14,7 @@
|
||||
<div class="container">
|
||||
<h1>🎮 Galgame 聚合搜索</h1>
|
||||
<form id="searchForm">
|
||||
<label for="game">游戏名称 *</label>
|
||||
<label for="game">游戏名或关键词 *</label>
|
||||
<input
|
||||
type="text"
|
||||
id="game"
|
||||
@@ -22,17 +22,14 @@
|
||||
required
|
||||
placeholder="请输入游戏名称..."
|
||||
/>
|
||||
<div class="options">
|
||||
<input type="checkbox" id="magic" name="magic" />
|
||||
<label for="magic">启用魔法搜索</label>
|
||||
</div>
|
||||
<label for="zypassword">紫缘Gal 平台密码 (可选)</label>
|
||||
<label for="zypassword">紫缘 Gal 密码(可选)</label>
|
||||
<input
|
||||
type="password"
|
||||
id="zypassword"
|
||||
name="zypassword"
|
||||
placeholder="如需搜索紫缘Gal请填写"
|
||||
placeholder="如需搜索紫缘 Gal 请填写"
|
||||
/>
|
||||
<a href="https://galzy.eu.org/" target="_blank">点我获取密码</a>
|
||||
<button type="submit">开始搜索</button>
|
||||
</form>
|
||||
<div class="progress" id="progress"></div>
|
||||
|
||||
6
main.js
6
main.js
@@ -31,7 +31,6 @@ form.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
clearUI();
|
||||
const game = form.game.value.trim();
|
||||
const magic = form.magic.checked;
|
||||
const zypassword = form.zypassword.value.trim();
|
||||
if (!game) {
|
||||
errorDiv.textContent = "游戏名称不能为空";
|
||||
@@ -40,7 +39,7 @@ form.addEventListener("submit", async (e) => {
|
||||
form.querySelector("button").disabled = true;
|
||||
try {
|
||||
await searchGameStream(
|
||||
{ gameName: game, magic, zypassword },
|
||||
{ gameName: game, zypassword },
|
||||
{
|
||||
onProgress: (progress) => {
|
||||
progressDiv.textContent = `进度: ${progress.completed} / ${progress.total}`;
|
||||
@@ -65,13 +64,12 @@ form.addEventListener("submit", async (e) => {
|
||||
});
|
||||
|
||||
async function searchGameStream(
|
||||
{ gameName, magic = false, zypassword = "" },
|
||||
{ gameName, zypassword = "" },
|
||||
{ onProgress, onResult, onDone, onError }
|
||||
) {
|
||||
const url = "https://searchgal.homes/search";
|
||||
const formData = new FormData();
|
||||
formData.append("game", gameName);
|
||||
formData.append("magic", magic.toString());
|
||||
if (zypassword) formData.append("zypassword", zypassword);
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user