未登录
中文(中国大陆)
创建账号
登录
SOKA CAFE
搜索
查看“信仰指数”的源代码
来自SOKA CAFE
命名空间
页面
讨论
更多
更多
页面操作
阅读
查看源代码
历史
←
信仰指数
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
{{全屏| <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>信仰指数测试</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; } body { /* Changed background to blue, yellow, and red gradient */ background: linear-gradient(135deg, #0052a5 0%, #f9e300 50%, #d40000 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; } .container { background: rgba(255, 255, 255, 0.25); backdrop-filter: blur(12px); border-radius: 20px; padding: 40px; width: 100%; max-width: 500px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.4); text-align: center; } h1 { color: #2c3e50; margin-bottom: 10px; font-size: 2.2rem; font-weight: 600; } .subtitle { color: #34495e; margin-bottom: 30px; font-size: 1rem; } .input-group { margin-bottom: 25px; text-align: left; } label { display: block; color: #2c3e50; margin-bottom: 8px; font-weight: 500; } input { width: 100%; padding: 15px; border-radius: 12px; border: none; background: rgba(255, 255, 255, 0.5); color: #2c3e50; font-size: 1rem; transition: all 0.3s ease; border: 1px solid rgba(255, 255, 255, 0.5); } input:focus { outline: none; background: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.2); } button { background: linear-gradient(to right, #34495e, #2c3e50); color: white; border: none; padding: 15px 30px; border-radius: 12px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; width: 100%; margin-top: 10px; box-shadow: 0 5px 15px rgba(44, 62, 80, 0.3); display: flex; justify-content: center; align-items: center; gap: 10px; } button:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(44, 62, 80, 0.4); } button:active { transform: translateY(0); } button:disabled { opacity: 0.7; cursor: not-allowed; transform: none; } .loader { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top: 2px solid white; animation: spin 1s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .result { margin-top: 30px; padding: 25px; border-radius: 15px; background: rgba(255, 255, 255, 0.3); display: none; animation: fadeIn 0.5s ease; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .result h2 { color: #2c3e50; margin-bottom: 15px; } .score { font-size: 3.5rem; font-weight: 800; margin: 15px 0; color: #2c3e50; } .comment { font-size: 1.2rem; color: #2c3e50; margin: 15px 0; padding: 15px; border-radius: 10px; background: rgba(255, 255, 255, 0.4); text-align: left; line-height: 1.5; } .meter { height: 20px; background: rgba(0, 0, 0, 0.1); border-radius: 10px; margin: 20px 0; overflow: hidden; } .meter-fill { height: 100%; border-radius: 10px; transition: width 1s ease; background: linear-gradient(to right, #0052a5, #f9e300, #d40000); } .ranges { display: flex; justify-content: space-between; margin-top: 10px; color: #34495e; font-size: 0.85rem; } .footer { margin-top: 30px; color: #34495e; font-size: 0.9rem; } .error { color: #d9534f; background: rgba(217, 83, 79, 0.1); padding: 10px; border-radius: 8px; margin-top: 10px; display: none; } @media (max-width: 600px) { .container { padding: 25px; } h1 { font-size: 1.8rem; } } </style> </head> <body> <div class="container"> <h1>信仰指数测试</h1> <p class="subtitle">测测你的信仰有多虔诚</p> <div class="input-group"> <label for="username">请输入您的名字:</label> <input type="text" id="username" placeholder="输入名字..." autocomplete="off"> </div> <button id="analyzeBtn"> <span id="btnText">开始测试</span> <div class="loader" id="loader" style="display: none;"></div> </button> <div class="error" id="errorMsg"></div> <div class="result" id="result"> <h2>测试结果</h2> <p>姓名: <span id="resultUsername"></span></p> <div class="score" id="scoreDisplay">0%</div> <div class="meter"> <div class="meter-fill" id="meterFill" style="width: 0%;"></div> </div> <div class="ranges"> <span>0-20</span> <span>21-40</span> <span>41-60</span> <span>61-80</span> <span>81-100</span> </div> <div class="comment" id="comment"></div> <p class="footer">* 本结果为娱乐目的,基于名字的随机计算,每次查询结果相同</p> </div> </div> <script> document.getElementById('analyzeBtn').addEventListener('click', function() { const username = document.getElementById('username').value.trim(); const resultDiv = document.getElementById('result'); if (!username) { showError('请输入您的名字!'); resultDiv.style.display = 'none'; return; } hideError(); // 计算信仰指数 const score = calculateFaithIndex(username); // 获取评价 const comment = getFaithComment(score); // 显示结果 document.getElementById('resultUsername').textContent = username; document.getElementById('scoreDisplay').textContent = score + '%'; document.getElementById('comment').textContent = comment; resultDiv.style.display = 'block'; // 延迟设置宽度以触发动画 setTimeout(() => { document.getElementById('meterFill').style.width = score + '%'; }, 100); }); // 确定性算法计算信仰指数(0-100) function calculateFaithIndex(username) { let hash = 0; for (let i = 0; i < username.length; i++) { const char = username.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // 转换为32位整数 } // 将哈希值映射到0-100的范围 return Math.abs(hash) % 101; } // 根据分数生成评价 function getFaithComment(score) { if (score <= 20) { return "信仰指数较低,信心还需磨练。请多参加活动,加强学习,在广布的道路上继续精进!"; } else if (score <= 40) { return "作为一名初信者,你的信心正在萌芽。坚持每日的实践,你将见证不可思议的功德!"; } else if (score <= 60) { return "信心坚定,是广布的有力实践者。你的存在本身就是胜利的证明,请继续鼓励身边的同志!"; } else if (score <= 80) { return "不愧是池田门生,信心强盛如狮子王!你的祈愿必将实现,继续作为常胜的先驱奋斗吧!"; } else { return "了不起!你拥有佛的生命,是人间革命的先锋。你的生命正在闪耀着最尊贵的光芒!"; } } // 显示错误信息 function showError(message) { const errorMsg = document.getElementById('errorMsg'); errorMsg.textContent = message; errorMsg.style.display = 'block'; } // 隐藏错误信息 function hideError() { const errorMsg = document.getElementById('errorMsg'); errorMsg.style.display = 'none'; } // 按Enter键也可以触发查询 document.getElementById('username').addEventListener('keypress', function(e) { if (e.key === 'Enter') { document.getElementById('analyzeBtn').click(); } }); </script> </body> </html> }}
本页使用的模板:
模板:全屏
(
查看源代码
)
返回
信仰指数
。
导航
导航
首页
最近更改
随机页面
知识集锦
活动公告
讨论版块
档案区
人物图鉴
团体势力
地点区域
登场作品
历史事件
创作区
词典概念
作品推荐
世界设定
创作作者
创作团体
编辑帮助
查找页面
入站须知
测试页面
任务计划
官方教程
wiki工具
wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志