From ca6484aa139e59ce5eba4bb9c7e40efdbeedb159 Mon Sep 17 00:00:00 2001 From: Jethro Lin Date: Mon, 11 Nov 2024 10:00:15 +0800 Subject: [PATCH] add new files --- .idea/.gitignore | 8 ++++ .idea/modules.xml | 8 ++++ .idea/php.xml | 20 +++++++++ .idea/talama.iml | 8 ++++ .idea/vcs.xml | 6 +++ index.html | 54 +++++++++++++++++++++++ script.js | 107 ++++++++++++++++++++++++++++++++++++++++++++++ styles.css | 67 +++++++++++++++++++++++++++++ 8 files changed, 278 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/talama.iml create mode 100644 .idea/vcs.xml create mode 100755 index.html create mode 100755 script.js create mode 100755 styles.css diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0091e0b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..e84699f --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/talama.iml b/.idea/talama.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/talama.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100755 index 0000000..3687c3d --- /dev/null +++ b/index.html @@ -0,0 +1,54 @@ + + + + + + 塔罗牌占卜 + + + + + + + +
+
+

塔罗牌占卜

+

选择您的牌阵,探索未来的奥秘

+
+ +
+
+ + +
+
+ +
+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/script.js b/script.js new file mode 100755 index 0000000..b3a2be9 --- /dev/null +++ b/script.js @@ -0,0 +1,107 @@ +$(document).ready(function() { + // 大阿尔克那牌组 + const majorArcana = [ + "愚者", "魔术师", "女祭司", "女皇", "皇帝", "教皇", "恋人", "战车", + "力量", "隐士", "命运之轮", "正义", "倒吊人", "死神", "节制", + "恶魔", "塔", "星星", "月亮", "太阳", "审判", "世界" + ]; + + // 中文数字数组 + const chineseNumbers = ["一", "二", "三", "四", "五"]; + + // 牌阵定义 + const spreads = { + "3": { + name: "圣三角牌阵", + description: ["我以为的状态", "真实的状态", "建言"], + template: "我以为的状态➊ 》真实的状态➋ 》建言 - {牌一}-{牌二}-{牌三}" + }, + "4": { + name: "四张牌牌阵", + description: ["问题核心", "障碍", "对策", "优势"], + template: "问题核心➊ 》障碍➋ 》对策➌ 》优势➍ - {牌一}-{牌二}-{牌三}-{牌四}" + }, + "5": { + name: "二选一牌阵", + description: ["选项A的状态", "选项B的状态", "选项A可能的结果", "选项B可能的结果", "当事人的状态"], + template: "选项A的状态➊ 》选项B的状态➋ 》选项A可能的结果➌ 》选项B可能的结果➍ 》当事人的状态➎ - {牌一}-{牌二}-{牌三}-{牌四}-{牌五}" + }, + "5_standard": { + name: "五张牌牌阵", + description: ["位置1", "位置2", "位置3", "位置4", "位置5"], + template: "位置1➊ 》位置2➋ 》位置3➌ 》位置4➍ 》位置5➎ - {牌一}-{牌二}-{牌三}-{牌四}-{牌五}" + }, + "5_love": { + name: "感情五张牌牌阵", + description: ["我的状态", "本人对我的感情态度", "对方的状态", "对方对我的感情态度", "可能的结果"], + template: "我的状态➊ 》本人对我的感情态度➋ 》对方的状态➌ 》对方对我的感情态度➍ 》可能的结果➎ - {牌一}-{牌二}-{牌三}-{牌四}-{牌五}" + } + }; + + // 随机抽取不重复的牌 + function drawCards(count) { + let shuffled = [...majorArcana].sort(() => 0.5 - Math.random()); + return shuffled.slice(0, count).map(card => { + return { + name: card, + position: Math.random() > 0.5 ? "正位" : "逆位" + }; + }); + } + + // 更新UI显示牌 + function displayCards(cards) { + let container = $("#cardContainer"); + container.empty(); + cards.forEach((card, index) => { + let cardDiv = $(` +
+
${card.name}
+
${card.position}
+
+ `); + container.append(cardDiv); + }); + } + + // 生成描述模板 + function generateTemplate(spreadKey, cards) { + let spread = spreads[spreadKey]; + if (!spread) return ""; + let template = spread.template; + cards.forEach((card, index) => { + // 使用中文数字替换占位符 + template = template.replace(`{牌${chineseNumbers[index]}}`, `${card.name} ${card.position}`); + }); + return template; + } + + // 处理抽牌按钮点击 + $("#drawButton").click(function() { + let spreadKey = $("#spreadSelect").val(); + if (!spreadKey) { + alert("请选择一个牌阵!"); + return; + } + + let spread = spreads[spreadKey]; + let cardCount = spread.description.length; + let drawnCards = drawCards(cardCount); + + displayCards(drawnCards); + + let template = generateTemplate(spreadKey, drawnCards); + $("#templateText").text(template); + $("#templateSection").show(); + }); + + // 复制模板功能 + $("#copyButton").click(function() { + let text = $("#templateText").text(); + navigator.clipboard.writeText(text).then(() => { + alert("模板已复制!"); + }).catch(err => { + alert("复制失败,请手动复制。"); + }); + }); +}); diff --git a/styles.css b/styles.css new file mode 100755 index 0000000..2e5fe9b --- /dev/null +++ b/styles.css @@ -0,0 +1,67 @@ +body { + background-color: #2e2e2e; + color: #ffffff; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} +.container { + margin-top: 50px; +} +.card-container { + display: flex; + justify-content: center; + flex-wrap: wrap; + margin-top: 30px; +} +.tarot-card { + background-color: #444; + border: 2px solid #555; + border-radius: 10px; + width: 150px; + height: 250px; + margin: 10px; + padding: 10px; + text-align: center; + position: relative; + cursor: pointer; + transition: transform 0.3s; +} +.tarot-card:hover { + transform: scale(1.05); +} +.card-name { + font-weight: bold; + margin-top: 100px; +} +.card-position { + position: absolute; + bottom: 10px; + width: 100%; + font-style: italic; + color: #ccc; +} +.template-section { + margin-top: 30px; + background-color: #333; + padding: 20px; + border-radius: 10px; +} +.template-text { + white-space: pre-wrap; + word-wrap: break-word; +} +.copy-btn { + margin-top: 10px; +} +.header { + text-align: center; + margin-bottom: 30px; +} +.header h1 { + font-size: 3em; + color: #f1c40f; + text-shadow: 2px 2px #000; +} +.dropdown-label { + margin-bottom: 10px; + font-weight: bold; +}