// ==UserScript== // @name 小六壬起卦助手 - 全局赛博圣杯版 // @namespace http://tampermonkey.net/ // @version 4.3.1 // @description 全局页面运行支持,极致逼真筊杯动画,历史记忆,快捷注册通道与暖心鼓励 // @author Gemini // @match *://*/* // @match file:///* // @include * // @require https://unpkg.com/lunar-javascript/lunar.js // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_addStyle // @connect api.siliconflow.cn // ==/UserScript== (function() { 'use strict'; if (window.top !== window.self) { return; } const svgConvex = `data:image/svg+xml;utf8,`; const svgFlat = `data:image/svg+xml;utf8,`; // ========================================== // 1. 注入 CSS 样式 // ========================================== GM_addStyle(` #xlr-float-btn { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background-color: #F5F5F3; border: 2px solid #8B1D1D; border-radius: 8px; color: #8B1D1D; font-size: 24px; font-family: "Kaiti SC", "STKaiti", "Kaiti", serif; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 2147483647; box-shadow: 2px 2px 10px rgba(0,0,0,0.1); transition: all 0.3s ease; } #xlr-float-btn:hover { background-color: #8B1D1D; color: #F5F5F3; transform: scale(1.05); } #xlr-app-wrapper { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(3px); z-index: 2147483647; justify-content: center; align-items: center; font-family: "Kaiti SC", "STKaiti", "Kaiti", "Songti SC", "SimSun", serif; } #xlr-container { background-color: #F5F5F3; background-image: radial-gradient(#e2e2e2 1px, transparent 1px); background-size: 20px 20px; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; overflow-x: hidden; padding: 30px; border-radius: 8px; border: 1px solid #D3D3D3; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); position: relative; color: #333333; } .xlr-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; position: relative; z-index: 10; border-bottom: 1px solid #D3D3D3; padding-bottom: 10px; } .xlr-tab { font-size: 15px; color: #888; cursor: pointer; margin-right: 15px; transition: all 0.3s; padding-bottom: 5px; } .xlr-tab:hover { color: #8B1D1D; } .xlr-tab.active { color: #8B1D1D; font-weight: bold; border-bottom: 2px solid #8B1D1D; } #xlr-close-btn { font-size: 28px; cursor: pointer; color: #888; line-height: 1; margin-top: -5px; margin-right: -10px;} #xlr-close-btn:hover { color: #8B1D1D; } #xlr-container h1 { text-align: center; font-size: 26px; font-weight: normal; letter-spacing: 4px; margin-top: 20px; margin-bottom: 25px; color: #333; position: relative; } #xlr-container h1::after { content: "印"; position: absolute; top: -10px; right: 25%; font-size: 12px; color: #8B1D1D; border: 1px solid #8B1D1D; padding: 2px; border-radius: 2px; opacity: 0.8; transform: rotate(-10deg); } .section { margin-bottom: 20px; } #xlr-container label { display: block; margin-bottom: 8px; font-size: 16px; color: #555; } #xlr-container input[type="text"], #xlr-container input[type="password"], #xlr-container select { width: 100%; padding: 12px; border: 1px solid #D3D3D3; background: rgba(255,255,255,0.7); border-radius: 4px; font-family: inherit; font-size: 15px; box-sizing: border-box; transition: all 0.3s; } #xlr-container input:focus, #xlr-container select:focus { outline: none; border-color: #8B1D1D; box-shadow: 0 0 5px rgba(139, 29, 29, 0.2); } .xlr-btn { width: 100%; padding: 14px; background-color: transparent; border: 1px solid #8B1D1D; color: #8B1D1D; font-size: 18px; font-family: inherit; cursor: pointer; border-radius: 4px; letter-spacing: 2px; transition: all 0.3s ease; margin-top: 10px; font-weight: bold; } .xlr-btn:hover { background-color: #8B1D1D; color: #fff; } /* 注册快捷按钮 */ .xlr-btn-outline { display: block; width: 100%; padding: 10px; border: 1px dashed #8B1D1D; color: #8B1D1D; text-align: center; text-decoration: none; border-radius: 4px; font-size: 14px; transition: all 0.3s; box-sizing: border-box; margin-top: 10px; background: rgba(139,29,29,0.02); } .xlr-btn-outline:hover { background-color: rgba(139,29,29,0.08); color: #8B1D1D; text-decoration: none;} /* 作者抖音按钮 */ .xlr-btn-douyin { display: block; width: 100%; padding: 12px; border: 1px dashed #333; color: #333; text-align: center; text-decoration: none; border-radius: 4px; font-size: 15px; font-weight: bold; transition: all 0.3s; box-sizing: border-box; margin-top: 25px; background: rgba(0,0,0,0.02); } .xlr-btn-douyin:hover { background-color: #111; color: #fff; text-decoration: none; border: 1px solid #111;} .xlr-view { display: none; } .xlr-view.active { display: block; } /* 结果与历史区 */ #xlr-resultArea { display: none; margin-top: 25px; padding-top: 20px; border-top: 1px dashed #D3D3D3; } .gua-badge { display: inline-block; padding: 5px 15px; border-radius: 20px; border: 1px solid #8B1D1D; color: #8B1D1D; margin: 0 5px; font-size: 18px; background: rgba(139,29,29,0.05); } .gua-title-wrap { text-align: center; margin-bottom: 15px; } .gua-time { text-align: center; font-size: 13px; color: #777; margin-bottom: 15px; } .ai-response { line-height: 1.8; font-size: 16px; text-align: justify; white-space: pre-wrap; color: #333; } /* 暖心寄语固定底部 */ .xlr-encouragement { margin-top: 25px; padding-top: 20px; border-top: 1px solid rgba(139,29,29,0.1); text-align: center; color: #A32626; font-size: 15px; letter-spacing: 2px; line-height: 1.6; } .xlr-history-item { background: rgba(255,255,255,0.5); border: 1px solid #eee; padding: 15px; margin-bottom: 15px; border-radius: 4px; border-left: 3px solid #8B1D1D; } .xlr-h-time { font-size: 12px; color: #888; margin-bottom: 5px; } .xlr-h-q { font-size: 15px; color: #333; font-weight: bold; margin-bottom: 10px; } .xlr-h-a { font-size: 14px; color: #555; white-space: pre-wrap; display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ccc;} .xlr-h-toggle { font-size: 13px; color: #8B1D1D; cursor: pointer; user-select: none; } /* ================= 沉浸式动画遮罩 ================= */ #xlr-loadingOverlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(245, 245, 243, 0.95); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 20; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; border-radius: 8px; } #xlr-loadingOverlay.active { opacity: 1; pointer-events: all; } .xlr-loading-text { margin-top: 30px; font-size: 18px; letter-spacing: 2px; color: #555; } #xlr-anim-hand { width: 100px; height: 100px; background-image: url('https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.1.0/assets/svg/1f90f-1f3fb.svg'); background-size: contain; background-repeat: no-repeat; background-position: center; filter: sepia(0.6) hue-rotate(-15deg) contrast(1.1); animation: xlrCalculateAnim 0.6s infinite alternate ease-in-out; } @keyframes xlrCalculateAnim { 0% { transform: translateY(0) rotate(0deg) scale(1); } 100% { transform: translateY(-10px) rotate(-10deg) scale(1.05); } } #xlr-anim-jiaobei { display: none; position: relative; width: 150px; height: 120px; } .jb-cup { position: absolute; width: 50px; height: 100px; background-size: contain; background-repeat: no-repeat; background-position: center; background-image: url('${svgConvex}'); top: -200px; } .jb-cup.is-flat { background-image: url('${svgFlat}'); } .jb-left { left: 15px; } .jb-right { right: 15px; transform: scaleX(-1); } .anim-drop-left { animation: dropBouncingLeft 1.5s forwards cubic-bezier(0.28, 0.84, 0.42, 1); } .anim-drop-right { animation: dropBouncingRight 1.5s forwards cubic-bezier(0.28, 0.84, 0.42, 1); } @keyframes dropBouncingLeft { 0% { top: -200px; transform: rotate(0deg) scale(1.5); filter: drop-shadow(15px 30px 10px rgba(0,0,0,0.3)); } 40% { top: 30px; transform: rotate(-180deg) scale(1); filter: drop-shadow(2px 4px 3px rgba(0,0,0,0.6)); } 60% { top: -20px; transform: rotate(-240deg) scale(1.1); filter: drop-shadow(8px 15px 6px rgba(0,0,0,0.4)); } 80% { top: 20px; transform: rotate(-320deg) scale(1); filter: drop-shadow(2px 4px 3px rgba(0,0,0,0.6)); } 90% { top: 10px; transform: rotate(-340deg) scale(1); filter: drop-shadow(4px 8px 4px rgba(0,0,0,0.5)); } 100% { top: 15px; transform: rotate(-350deg) scale(1); filter: drop-shadow(3px 5px 4px rgba(0,0,0,0.6)); } } @keyframes dropBouncingRight { 0% { top: -200px; transform: scaleX(-1) rotate(0deg) scale(1.5); filter: drop-shadow(-15px 30px 10px rgba(0,0,0,0.3)); } 45% { top: 35px; transform: scaleX(-1) rotate(190deg) scale(1); filter: drop-shadow(-2px 4px 3px rgba(0,0,0,0.6)); } 65% { top: -15px; transform: scaleX(-1) rotate(260deg) scale(1.1); filter: drop-shadow(-8px 15px 6px rgba(0,0,0,0.4)); } 85% { top: 25px; transform: scaleX(-1) rotate(340deg) scale(1); filter: drop-shadow(-2px 4px 3px rgba(0,0,0,0.6)); } 95% { top: 15px; transform: scaleX(-1) rotate(355deg) scale(1); filter: drop-shadow(-4px 8px 4px rgba(0,0,0,0.5)); } 100% { top: 20px; transform: scaleX(-1) rotate(365deg) scale(1); filter: drop-shadow(-3px 5px 4px rgba(0,0,0,0.6)); } } `); // ========================================== // 2. 构建 HTML DOM // ========================================== const floatBtn = document.createElement('div'); floatBtn.id = 'xlr-float-btn'; floatBtn.innerHTML = '卦'; document.body.appendChild(floatBtn); const appWrapper = document.createElement('div'); appWrapper.id = 'xlr-app-wrapper'; appWrapper.innerHTML = `