// ==UserScript== // @name FF14石之家美化 // @description 美化,自动签到 // @namespace none // @version 0.0.2 // @author gogofishman // @license MIT // @match *://*.ff14risingstones.web.sdo.com/* // @run-at document-start // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant unsafeWindow // @downloadURL none // ==/UserScript== "use strict"; GM_addStyle(`/*头部和背景*/ #app.overflow { padding: 0; } .headerCls .head_line { display: none !important; } .headerCls + div { background-image: url('https://p.sda1.dev/14/ab5d5f5a6351d6a35ca8fffaca8e581b/1.webp'); background-attachment: fixed; background-repeat: no-repeat; background-size: cover; } .main-layout { width: 1250px !important; } /*帖子区域*/ .tiebox { border-radius: 4px; overflow: hidden; & li { border-bottom: 1px solid #434343; color: white; &:hover .post-main { background-color: rgba(60, 60, 60, .8) !important; } & .post-main { backdrop-filter: blur(3px); transition: background-color .2s; background-color: rgba(11, 11, 11, .8) !important; & .comment-num { margin-left: 45px !important; } & .tag { width: 146px !important; padding-left: 66px !important; } } & .comment-num { background-color: #ffffff38 !important; & span { color: #aaa !important; } } } & .tieCont { margin: 0 !important; } & .info_area { color: #aaa; & .name { color: #ffffff; padding: 0; } & .a_box { flex-direction: row-reverse; } } & .el-col-3 { max-width: 15% !important; flex: 0 0 15% !important; } & .el-col-13 { max-width: 60% !important; flex: 0 0 60% !important; } & .el-col-8 { max-width: 25% !important; flex: 0 0 25% !important; } } .mt3 { margin-top: 20px !important; } .el-tabs__item { color: #a5a8ae !important; } .mb10 { margin: 0 !important;; } .bdr10 { border-radius: 0 !important; } .post-main { border-radius: 0 !important; } /*右侧区域*/ .el-card { backdrop-filter: blur(3px); border: 0 !important; background-color: rgba(11, 11, 11, .8) !important; color: rgb(225, 225, 225) !important; & .el-divider--horizontal { border-top: 1px #4d4d4d var(--el-border-style); } } /*最前端*/ .el-image-viewer__mask { opacity: .8 !important; } .el-image-viewer__canvas img { transform: scale(0.8) !important; } `); window.onload = () => { // GM_xmlhttpRequest({ // method: 'POST', // url: 'https://apiff14risingstones.web.sdo.com/api/home/sign/signIn', // headers: { // 'Origin': 'https://ff14risingstones.web.sdo.com', // 'Referer': 'https://ff14risingstones.web.sdo.com/' // }, // onload: function (response) { // let re = JSON.parse(response.response) // console.log(re.msg) // }, // }) // WaitUntilAction(() => document.querySelector('button[class="el-button text-center signin"]') // , (e) => { // e.click() // }) } function sleep (ms) { return new Promise((resolve) => setTimeout(resolve, ms)) } /** * 异步执行当某个元素出现时立马某个动作 * @param {function} element 返回指定元素的函数 * @param {function} action 执行动作,参数为element得到的元素,默认remove * @param {number} num action执行次数,默认1次,-1为不限定次数直到超时才停止 * @param {number} step 每次检查间隔时间 ms * @param {number} timeOut 超时时间 ms * @returns {Promise} * @constructor */ async function WaitUntilAction (element, action = () => {}, num = 1, step = 50, timeOut = 1000 * 10) { let count = 0 let _num = 0 let outCount = timeOut / step try { while (count <= outCount) { count++ await sleep(step) let _c = element() if (_c) { //执行动作 action(_c) if (_num < num) { break } _num++ } } } catch (e) { console.log('WaitUntilAction错误:', e) } }