Greasy Fork 支持简体中文。

妖火网增强脚本Plus

让妖火再次变得伟大(手动狗头.jpg)

// ==UserScript==
// @name            妖火网增强脚本Plus
// @namespace       https://www.yaohuo.me/
// @version         1.6.1
// @description     让妖火再次变得伟大(手动狗头.jpg)
// @author          柠檬没有汁@27894
// @match           *://yaohuo.me/*
// @match           *://*.yaohuo.me/*
// @icon            https://yaohuo.me/css/favicon.ico
// @run-at          document-body
// @license         MIT
// @grant           none
// @noframes
// @homepage        https://www.yaohuo.me/bbs/userinfo.aspx?touserid=27894
// @supportURL      https://www.yaohuo.me/bbs/userinfo.aspx?touserid=27894
// ==/UserScript==

/* ================================================== 变量开始 ================================================== */

// 脚本默认设置
const defaultSetting = {
  version: "1.6.1", // 脚本版本
  checkVersion: true, // 检查更新

  firstLoadScript: true, // 第一次加载脚本
  showSettingIcon: true, // 显示设置 logo
  settingIconSize: 50, // 设置 logo 大小
  showTopAndDownBtn: true, // 显示一键回到顶部/底部
  hideXunzhang: false, // 隐藏勋章

  showBookViewUbb: false, // 发帖 ubb 展开
  showBookViewEmoji: false, // 发帖表情展开
  showHuifuUbb: false, // 回帖 ubb 展开
  showHuifuEmoji: false, // 回帖表情展开

  imgThumbWidth: 200, // 图片缩小后显示宽度
  useRight: false, // 下一页显示在右边
  autoLoadMoreBookList: false, // 帖子列表自动加载更多
  autoLoadMoreHuifuList: false, // 回复列表自动加载更多
  openLayerForBook: false, // pc 端帖子在弹窗中打开

  imgUploadApiUrl: ["https://aapi.helioho.st/upload.php", "https://img.ink/api/upload"],
  imgUploadSelOpt: 0, // 使用图床
  suimoToken: "", // 水墨图床 token

  showMoreSetting: true, // 高级设置
  oneClickCollectMoney: false, // 一键吃肉
  showChuiniuHistory: false, // 显示吹牛发布者历史
  showHuifuCopy: false, // 复读机(回复+1)
  huifuCopyAutoSubmit: false, // 复读机自动提交
};
// 自定义样式
const customCSS = `
  .reset{
    margin:0;
    padding:0;
  }
  /* 设置弹出框 样式 */
  .setting-div ul li{
    display:flex;
    margin:10px auto;
    justify-content: center;
    align-items: center;
  }
  .setting-div ul li + .setting-li-between{
    padding:0 10px;
    justify-content: space-between;
  }
  .setting-div ul li + .setting-li-tips{
    font-size: 12px;
    line-height: 14px;
    display: block;
    padding: 0 10px;
    margin: -10px 0 0;
    color: red;
    text-align: left;
  }
  .setting-li-title hr{
    flex:1;
  }
  .setting-li-title hr:nth-of-type(1){
    margin-right:10px;
  }
  .setting-li-title hr:nth-of-type(2){
    margin-left:10px;
  }
  .setting-cancel-btn {
    background-color: #999;
    color: #fff;
    border-radius:5px;
    padding: 5px 10px;
  }
  .setting-confirm-btn {
    background-color: #1677ff;
    color: #fff;
    border-radius:5px;
    padding: 5px 10px;
    margin-left: 10px;
  }
  .setting-li-input{
    width:50px;
    padding-left:10px;
    height:15px;
  }
  ::-webkit-input-placeholder {
    font-size:12px;
  }
  ::-moz-placeholder {
    font-size:12px;
  }

  /* 开关 样式 */
  .switch {
    position: relative;
    float: left;
    width: 60px;
    margin: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
  }
  .switch-checkbox {display: none;}
  .switch-label {
    display: block;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #999999;
    border-radius: 20px;
  }
  .switch-inner {
    display: block;
    width: 200%;
    margin-left: -100%;
  }
  .switch-inner::before,
  .switch-inner::after {
    display: block;
    float: right;
    width: 50%;
    height: 20px;
    line-height: 20px;
    padding: 0;
    font-size: 14px;
    color: white;
    font-family: Trebuchet, Arial, sans-serif;
    font-weight: bold;
    box-sizing: border-box;
  }
  .switch-inner::after {
    content: attr(data-on);
    padding-left: 10px;
    background-color: #00e500;
    color: #FFFFFF;
    text-align:left;
  }
  .switch-inner::before {
    content: attr(data-off);
    padding-right: 10px;
    background-color: #EEEEEE;
    color: #999999;
    text-align: right;
  }
  .switch-switch {
    position: absolute;
    top: 0;
    bottom: 0;
    /*right: 72px;*/
    display: block;
    width: 14px;
    height: 14px;
    margin: 3px;
    background: #FFFFFF;
    border: 2px solid #999999;
    border-radius: 50%;
  }
  .switch-checkbox:checked + .switch-label .switch-inner {
    margin-left: 0;
  }
  .switch-checkbox:checked + .switch-label .switch-switch {
    right: 0px;
  }
  /* 复读机按钮 样式 */
  .huifu-copy{
    padding:5px 10px;
    text-align:center;
    color:#fff;
    margin-left:20px;
    background-color: #407088;
    border-radius: 5px;
    white-space:nowrap;
  }

  .custom-toggle-btn{
    background-image: linear-gradient(#f4f4f4,#ececec);
    display: inline-block;
    overflow: visible;
    margin: 0 5px 7px;
    padding: .5em 1em;
    outline: 0;
    border: 1px solid #d4d4d4;
    color: orangered;
    text-decoration: none;
    white-space: nowrap;
    font: 11px/normal sans-serif;
    cursor: pointer;
    border-radius: 5px;
  }
  /* 表情增强 样式 */
  .emojilist-div{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    grid-gap: 2px;
    /*display: flex;
    justify-content: space-between;
    flex-wrap: wrap;*/
    padding: 5px;
    margin-bottom:5px;
    font-size: 12px;
    border: 1px solid #eee;
    border-radius: 5px;
  }
  .emojilist-img{
    width:50px;
    height:50px;
  }
  .huifu-emoji{
    margin:0 1% 5px;
    border-color:#d4d4d4;
  }
  /* ubb 增强 样式 */
  .ubblist-div{
    display:flex;
    flex-wrap: wrap;
    gap: 4px 4px;
    justify-content: space-between;
    margin-bottom:5px;
    padding:5px;
    font-size:12px;
    border: 1px solid #eee;
    border-radius: 5px;
  }
  .ubb-item{
    height:25px;
    line-height:25px;
    /*margin:0 5px 5px 0;*/
    padding:0 10px;
    display:inline-block;
    border: 1px solid #1abc9c;
    color: #333;
    text-decoration: none;
    border-radius:30px;
  }
  .huifu-ubb{
    margin:0 1% 5px;
    border-color:#d4d4d4;
  }

  .clear-setting{
    color:#3d68a8;
    margin-left:-4px;
  }

  /* 等待提示框 样式 */
  .wait-box-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
  }
  .wait-box-modal {
    background: white;
    padding: 20px 20px 10px;
    border-radius: 10px;
    text-align: center;
  }
  .wait-box-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #09f;
    animation: spin 1s linear infinite;
    margin: 0 auto;
  }
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  .huifu-ubb-list-div{
    margin: 0 1%;
    padding:10px;
    font-size:12px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
  }
  .huifu-ubb-list-title{
    height:14px;
    display:flex;
    justify-content: center;
    align-items: center;
    color:red;
  }
  .huifu-ubb-list-title hr{
    flex:1;
  }
  .huifu-ubb-list-title hr:nth-of-type(1){
    margin-right:10px;
  }
  .huifu-ubb-list-title hr:nth-of-type(2){
    margin-left:10px;
  }
  .huifu-ubb-box{
    display:flex;
    flex-wrap: wrap;
    gap: 4px 4px;
    justify-content: space-between;
    margin:6px 0;
  }

  .input-popup-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }
  .input-popup {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    width: 600px;
    max-width:80%;
  }
  .input-popup-label {
    display: block;
    font-weight: bold;
  }
  .input-popup-textarea {
    width: 100%;
    min-height: 40px;
    resize: vertical;
  }
  .input-popup-buttons {
    text-align: center;
  }
  .input-popup-submit-btn, .input-popup-cancel-btn {
    margin: 0 10px;
    border:0;
  }
  .input-popup-submit-btn{
    background-color: #1677ff;
    color: #fff;
    border-radius: 5px;
    padding: 5px 10px;
    margin-left: 10px;
  }
  .input-popup-cancel-btn {
    background-color: #999;
    color: #fff;
    border-radius: 5px;
    padding: 5px 10px;
  }
`;
// 表情
const emojiList = [
  // 论坛自带表情
  "face/踩.gif",
  "face/狂踩.gif",
  "face/淡定.gif",
  "face/囧.gif",
  "face/不要.gif",
  "face/重拳出击.gif",
  "face/砳砳.gif",
  "face/滑稽砳砳.gif",
  "face/沙发.gif",
  "face/汗.gif",
  "face/亲亲.gif",
  "face/太开心.gif",
  "face/酷.gif",
  "face/思考.gif",
  "face/发呆.gif",
  "face/得瑟.gif",
  "face/哈哈.gif",
  "face/泪流满面.gif",
  "face/放电.gif",
  "face/困.gif",
  "face/超人.gif",
  "face/害羞.gif",
  "face/呃.gif",
  "face/哇哦.gif",
  "face/要死了.gif",
  "face/谢谢.gif",
  "face/抓狂.gif",
  "face/无奈.gif",
  "face/不好笑.gif",
  "face/呦呵.gif",
  "face/感动.gif",
  "face/喜欢.gif",
  "face/疑问.gif",
  "face/委屈.gif",
  "face/你不行.gif",
  "face/流口水.gif",
  "face/潜水.gif",
  "face/咒骂.gif",
  "face/耶耶.gif",
  "face/被揍.gif",
  "face/抱走.gif",

  // 自定义表情
  "https://pic2.ziyuan.wang/2022/6b2857ec93b23.gif",
  "https://pic2.ziyuan.wang/2022/3d176931b571d.gif",
  "https://pic2.ziyuan.wang/2022/23dbe8320804b.gif",
  "https://pic2.ziyuan.wang/2022/85c0f23af52f8.gif",
  "https://pic2.ziyuan.wang/2022/30146c4263f7f.gif",
  "https://pic2.ziyuan.wang/2022/13647c01da5c7.gif",
  "https://pic2.ziyuan.wang/2022/c31080af1c609.gif",
  "https://pic2.ziyuan.wang/2022/d6dec6e4b4604.gif",
  "https://pic2.ziyuan.wang/2022/719048ed3ab42.gif",
  "https://pic2.ziyuan.wang/2022/f45c0bd755356.gif",
  "https://pic2.ziyuan.wang/2022/faa0d0cfff161.gif",
  "https://pic2.ziyuan.wang/2022/27cee304cda79.gif",
  "https://pic2.ziyuan.wang/2023/10/05/yaohuo007_6d248534e18f5.gif",
  "https://pic2.ziyuan.wang/2023/05/02/17a86bd7372d8.GIF",
  "https://pic2.ziyuan.wang/2023/05/17/177e4e0e2f28d.gif",
  "https://pic2.ziyuan.wang/2023/06/19/f50dc2fbf34ac.gif",
  "https://pic2.ziyuan.wang/user/13530769942/2023/12/yaohuo.me_694810949_5f454a4387b2d.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/FkyiMRaJI1BfuA6T3w4Z9mJh1qbg_3e38409950af1.gif",
  "https://pic2.ziyuan.wang/2023/05/16/5152d0749ff41.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/FpZEifxiFGs1BWtHjFsk5tJJNKSE_8b6f63437539d.gif",
  "https://pic2.ziyuan.wang/2023/06/15/5640689a44056.GIF",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/FvMXbnIX8RavSBAhflxf1zomD1ov_902abba24378b.gif",
  "https://pic2.ziyuan.wang/2023/07/11/30aff1eed1845.GIF",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/FkeVK5icB5-Pc7mbZitDTX1AqfNO_3a687a8c7683f.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/Fit100hjJ-T5RwQxeNdoVWplvNvU_96758df767a69.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/v2-568bb2311e00c3ecbc4dd49ab0709f09_b_5215574668d2f.gif",
  "https://pic2.ziyuan.wang/user/sub/2024/04/458ed8da862d4a71bc5ab4c2435711fd_088c2fc6f5680.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_76964470c8b1b.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_0318a6f925fbc.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_4629d7fff2f0a.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_99ab94aa14e58.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_4917d00f77b70.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_7b42669bad9e0.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_3cb79bd54abd2.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_ae29120dd414c.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_d729e16f5178a.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_f17b227dc0b65.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_32ca0d60dcdcc.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_f524ab469146c.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_f72a3922675d8.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_a1114209167b6.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_91e15b0079ada.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_38a61440b1cd3.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_933c24257fae8.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_f0f73185a8b01.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_a56ac656a1148.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_f0562dacf1bfd.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_eff33afa00163.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_070ec2f5a6118.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_dc0b98359052f.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_163be41a06cf1.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_fa50e82d42778.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_4b51d01f83ef7.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_a14862d0f2c7d.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_34e4ae7e3abeb.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_c42a350bb7511.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_846823994eb82.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_b166edaec1bc4.png",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_e22a601c90e31.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_233e5e38d4d5d.png",
  "https://pic2.ziyuan.wang/2023/06/15/fb73ec52bc113.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_6453568bc84d7.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_609d4a06138ec.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_59e60f0a98da8.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_6723d2f29219d.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_0c538a929de62.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2024/12/webwxgetmsgimg_05208a26bf538.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_80e3cbbc106d8.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_7a85e377185b6.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_17024a36c62c1.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_aa11042623721.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_0b17ce20017e5.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_0b3366c8e4f2c.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_f5e49c8b9fb10.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_d7784aa75cade.png",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_da4d598a0038a.jpg",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_e1edb813037b0.gif",
  "https://pic2.ziyuan.wang/user/v2jun/2025/01/webwxgetmsgimg_acce220dbe392.gif",
];
// ubb
const ubbList = [
  {
    name: "超链接",
    inputTitle: ["网址", "网址说明"],
    ubbHandle: (inputValues) => `[url=${inputValues[0]}]${inputValues[1]}[/url]`,
  },
  {
    name: "红字",
    inputTitle: ["红字内容"],
    ubbHandle: (inputValues) => `[forecolor=red]${inputValues[0]}[/forecolor]`,
  },
  {
    name: "加粗",
    inputTitle: ["加粗内容"],
    ubbHandle: (inputValues) => `[b]${inputValues[0]}[/b]`,
  },
  {
    name: "斜体",
    inputTitle: ["斜体内容"],
    ubbHandle: (inputValues) => `[i]${inputValues[0]}[/i]`,
  },
  {
    name: "下划线",
    inputTitle: ["下划线内容"],
    ubbHandle: (inputValues) => `[u]${inputValues[0]}[/u]`,
  },
  {
    name: "删除线",
    inputTitle: ["删除线内容"],
    ubbHandle: (inputValues) => `[strike]${inputValues[0]}[/strike]`,
  },
  {
    name: "分割线",
    inputTitle: ["不需要输入内容,直接点击确定即可"],
    ubbHandle: (inputValues) => `[hr]`,
  },
  {
    name: "代码",
    inputTitle: ["代码内容"],
    ubbHandle: (inputValues) => `[code]${inputValues[0]}[/code]`,
  },
  { name: "拨号", inputTitle: ["手机号码"], ubbHandle: (inputValues) => `[call]${inputValues[0]}[/call]` },
  {
    name: "发短信",
    inputTitle: ["手机号码", "短信内容"],
    ubbHandle: (inputValues) => `[url=sms:${inputValues[0]}?body=${inputValues[0]}]点此发送[/url]`,
  },
  {
    name: "当前时间",
    inputTitle: ["不需要输入内容,直接点击确定即可"],
    ubbHandle: (inputValues) => `[now]`,
  },
  {
    name: "倒计时天数",
    inputTitle: ["需要倒计时的日期(格式:2030-01-01)"],
    ubbHandle: (inputValues) => `[codo]${inputValues[0]}[/codo]`,
  },
  {
    name: "QQ音乐",
    inputTitle: ["QQ音乐歌曲链接或ID"],
    ubbHandle: (inputValues) => `[qqmusic]${inputValues[0]}[/qqmusic]`,
  },
  {
    name: "网易云音乐",
    inputTitle: ["网易云音乐歌曲链接或ID"],
    ubbHandle: (inputValues) => `[wymusic]${inputValues[0]}[/wymusic]`,
  },
  {
    name: "图片(外链)",
    inputTitle: ["图片链接"],
    ubbHandle: (inputValues) => `[img]${inputValues[0]}[/img]`,
  },
  // { name: "短链生成" },
  {
    name: "图片(上传)",
    ubbHandle: (inputValues) => `[img]${inputValues[0]}[/img]`,
    upload: {
      type: "img",
      accept: "image/*",
    },
  },
  {
    name: "视频",
    inputTitle: ["视频外链(未能找到合适的文件站,如有可提供给我)"],
    ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]`,
    upload: {
      type: "movie",
      accept: "video/*",
    },
  },
  {
    name: "音频",
    inputTitle: ["音频外链(未能找到合适的文件站,如有可提供给我)"],
    ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]`,
    upload: {
      type: "audio",
      accept: "audio/*",
    },
  },
  // {
  //   name: "抖音解析",
  //   inputTitle: ["链接(不需要去除中文和多余字符)"],
  //   apiUrl: "https://v.695402.xyz/dyzl",
  //   ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]`,
  // },
  // { name: "快手解析", inputTitle: ["链接(不需要去除中文和多余字符)"], jxApiUrl: "", ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]` },
  // { name: "B站解析", inputTitle: ["链接(不需要去除中文和多余字符)"], jxApiUrl: "", ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]` },
  // { name: "皮皮虾解析", inputTitle: ["链接(不需要去除中文和多余字符)"], jxApiUrl: "", ubbHandle: (inputValues) => `[movie]${inputValues[0]}[/movie]` },
  // { name: "屋舍文件" },
];
// 设置图标
const settingIconBase64 =
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXXl0FMW6/3pC2BdlkYCAIKIoyo4gICKbKKKi7Lug7EsGTSZczzsv748rSdBMrgYFUZRVNgVXVtkFUUBAuRdBRRAlLN57WQQhOPXOryGeEGa6q3q6e7qn6zuH430v1VVf/ap/01X1bQpJkQhIBCIioEhsJAISgcgISILIt0MioIGAJIh8PSQCkiDyHZAIGENAfkGM4Saf8ggCkiAeWWg5TWMISIIYw00+5REEJEE8stBymsYQkAQxhpt8yiMIuJYgL730UmXGEpMuXw4lKUooiciXxFiorEfWzdHTVBTlEmNKXkJCKI/Il8dYsbwLF37LS09PDzla8TDKuYIgWVnBNowpfYlYKyJKuvqvmNvAlvrSCSLKI6L9Pp9vYfnyJT8eOXJkvpNxcSxBpkwJdvD5lK6KwvoyRjWdDKLUzTACF4looaIoH5Upk7hq7Nix5wz3ZNGDjiJIRkbwYUWhLkTUjYjqWTRn2a0jEWCnFUX5QFF8q1JSJi5wioqOIEhWVvYDjCnjiKinU4CResQUgW2Msdy0tEkxJ0pMCZKVFWx8hRhseEyXQw7uUASUlT4fy01J8X8SKwVjQpApU4K3KooyTlEYvhqJsZq8HNc1CCxWFJabmjpps90a206QKVNeTvf5fGOJqLLdk5XjuR0BZebly/Q/L7yQfNyumdhGkPT09LIlS5afoyhKD7smJ8eJSwT2hkIsZfLkSavtmJ0tBMnIeLm1ovjmEFFdOyYlx4h/BBijlLQ0/0tWz9RygmRmZo8iUl63eiKyf08iMDcQ8A+2cuaWEiQzM/t1ImWUlROQfXsegb2BgL+RVShYRpDMzOCnRPSwVYrLfiUChREIBPyWvMuWdJqVFRzPGL0il1AiYCMCKwIB/yNmj2c6QTIyctoqCrP9vtp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f4xds3QVoJgUhkZ2d2JlHHSd8uuJY6bcfYRsVyzr3H10LGdIAUKXfECThgrXeX1lsjbf0cuK8ZC03y+UG5KSsrvdqMRM4IUTPRq0NU4GZlo99I7ezzG6AyRkluiBMv1+/1IMxUTiTlBrpxNMsspSuJYbL1kIoiYvAcOG1TJ/fPPy9P+9rfn98daMUcQpACEF1/MreTzXe6mKKwbEeFfmVgDJMe3BwFFobWM0SeK4vskNXXiQXtG1R/FUQQprO60adPKnjt38Sl4BzOmkkUmzNZfT7e12EKkLPf58t9PSUk55ETlHUuQwmAhq3zJkuWf9PmUFkRKEhFLYoySiNR/cVkz0YkvixGdFIXOMEZ5RAX/lDzG2IE//6T3X3ghdmcL3rm4giBak7lSkqFiEtHlpFBIKcs7cdnOOgQUJXSJMV/exYul89LTR4rVhLNOLUM9u54ghmYtH5IIcCIgCcIJlGzmTQQkQby57nLWnAhIgnACJZt5EwFJEG+uu5w1JwKSIJxAyWbeREASxJvrLmfNiYAkCCdQspk3EZAE8ea6y1lzIiAJwgmUbOZNBP4f1t8HuWlcA3kAAAAASUVORK5CYII=";
/* ================================================== 变量结束 ================================================== */

(async function () {
  "use strict";

  if (!checkLocation()) return;

  const jqueryIsLoad = await loadAndExecuteScript("https://code.jquery.com/jquery-3.7.1.min.js", "jquery-3.7.1.min");
  if (!jqueryIsLoad) return;

  const setttingIsInit = await initSetting();
  if (!setttingIsInit) return;

  const userSetting = JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting"));

  if (userSetting["firstLoadScript"]) {
    alert("请合理/合法使用本脚本,不要影响论坛正常看帖/回帖!!!如因使用本脚本而被封号/小黑屋,雨我无瓜(免责声明.jpg)");
    saveUserSetting("firstLoadScript", false);
  }

  addCustomStyle();
  // 页面解析完成后再执行代码,否则 jquery 可能会获取不到 document 内容导致脚本执行失败
  $(document).ready(() => {
    createScriptSetting();
    userSetting["showTopAndDownBtn"] && addTopAndDown();
    userSetting["showChuiniuHistory"] && executeFunctionForURL("/games/chuiniu/doit.aspx", chuiniuHistory);
    userSetting["oneClickCollectMoney"] && executeFunctionForURL(/^\/bbs-.*\.html$/, speedEatMoney, true);
    userSetting["hideXunzhang"] && executeFunctionForURL(/^\/bbs-.*\.html$/, hideXunzhang, true);
    userSetting["showHuifuCopy"] && executeFunctionForURL(/^\/bbs-.*\.html$/, huifuCopy, true);
    executeFunctionForURL(/^\/bbs\/book_view_.*\.aspx$/, bookViewBetter, true);
    executeFunctionForURL(/^\/bbs-.*\.html$/, huifuBetter, true);
    userSetting["useRight"] && executeFunctionForURL("/bbs/book_list.aspx", useRightNextBtn);
  });
  // 页面加载完成后再执行代码,否则页面资源可能会获取不到,导致玄学bug,比如图片等
  $(window).on("load", () => {
    executeFunctionForURL(/^\/bbs-.*\.html$/, changeImgSize, true);
    userSetting["autoLoadMoreBookList"] && executeFunctionForURL("/bbs/book_list.aspx", autoLoadMoreBookList);
    userSetting["autoLoadMoreHuifuList"] && executeFunctionForURL(/^\/bbs-.*\.html$/, autoLoadMoreHuifuList, true);
    userSetting["openLayerForBook"] && executeFunctionForURL("/bbs/book_list.aspx", openLayer);
  });

  checkVersion();
})();
// 检查更新
function checkVersion() {
  sessionStorage.removeItem("canUpdate");
  sessionStorage.removeItem("newVersion");
  myAjax("https://greasyfork.org/scripts/504289.json").then((data) => {
    const { version } = data;
    if (version == defaultSetting.version || !getUserSetting("checkVersion")) return;
    notifyBox("已有新版本,请自行更新。如不需要更新,可在设置里关闭", false, 3000);
    sessionStorage.setItem("canUpdate", true);
    sessionStorage.setItem("newVersion", version);
  });
}
// PC端点击帖子弹窗打开
function openLayer(url) {
  if (!isPC()) return;
  // 监听点击事件
  $(document)
    .off("click", ".listdata .topic-link")
    .on("click", ".listdata .topic-link", function (event) {
      event.preventDefault(); // 阻止默认链接行为
      const url = $(this).attr("href"); // 获取链接的 href 属性
      openLayer(url);
    });
  if (!url || url.length < 1) return;
  // 创建背景层
  let background_layer = $("<div>").css({
    display: "none",
    position: "fixed",
    top: "0",
    left: "0",
    width: "100%",
    height: "100%",
    backgroundColor: "gray",
    zIndex: "1001",
    opacity: "0.8",
  });
  // 创建弹出层
  let open_layer = $("<div>").css({
    display: "none",
    position: "fixed",
    top: "50%",
    left: "50%",
    transform: "translate(-50%, -50%)",
    width: "80%",
    maxWidth: "720px",
    height: "96%",
    border: "1px solid lightblue",
    borderRadius: "10px",
    boxShadow: "4px 4px 10px #171414",
    backgroundColor: "white",
    zIndex: "1002",
    overflow: "auto",
    margin: "0",
    padding: "0",
  });
  // 创建 iframe
  let iframe = $("<iframe>")
    .attr("src", url || "")
    .css({
      width: "100%",
      height: "100%",
      border: "0",
      display: "block",
    });

  // 将 iframe 添加到弹出层
  open_layer.append(iframe);
  // 将弹出层和背景层添加到 body
  $("body").append(open_layer).append(background_layer);
  // 显示弹出层和背景层
  open_layer.show();
  background_layer.show();
  // 点击背景层时关闭弹出层
  background_layer.on("click", function () {
    open_layer.remove();
    background_layer.remove();
  });
}
// 回复列表自动加载更多
function autoLoadMoreHuifuList() {
  // 获取加载更多按钮
  const loadMoreButton = $(".viewContent .more a:contains('加载更多')");
  // 设置一个标志位,用于判断是否已经触发过点击事件
  let hasTriggered = false;

  // 监听滚动事件
  $(window).scroll(function () {
    // 获取页面滚动的位置和文档高度
    const scrollTop = $(this).scrollTop();
    const windowHeight = $(this).height();
    const documentHeight = $(document).height();
    // 检查是否滚动到距离底部400px,并且还没有触发过点击事件
    if (documentHeight - (scrollTop + windowHeight) <= 500 && !hasTriggered) {
      // 自动点击加载更多按钮
      console.log("%c ===> [ 自动点击加载回复 ] <===", "font-size:13px; background:pink; color:#bf2c9f;");
      loadMoreButton.click();
      // 设置标志位为已触发
      hasTriggered = true;
    } else if (documentHeight - (scrollTop + windowHeight) > 500) {
      // 如果滚动距离超过200px,重置标志位
      hasTriggered = false;
    }
  });
}
// 帖子列表自动加载更多
function autoLoadMoreBookList() {
  // 获取加载更多按钮
  const loadMoreButton = $(".btBox .bt1 a:contains('加载更多')");
  // 设置一个标志位,用于判断是否已经触发过点击事件
  let hasTriggered = false;

  // 监听滚动事件
  $(window).scroll(function () {
    // 获取页面滚动的位置和文档高度
    const scrollTop = $(this).scrollTop();
    const windowHeight = $(this).height();
    const documentHeight = $(document).height();
    // 检查是否滚动到距离底部200px,并且还没有触发过点击事件
    if (documentHeight - (scrollTop + windowHeight) <= 500 && !hasTriggered) {
      // 自动点击加载更多按钮
      console.log("%c ===> [ 自动点击加载帖子 ] <===", "font-size:13px; background:pink; color:#bf2c9f;");
      loadMoreButton.click();
      // 设置标志位为已触发
      hasTriggered = true;
    } else if (documentHeight - (scrollTop + windowHeight) > 500) {
      // 如果滚动距离超过200px,重置标志位
      hasTriggered = false;
    }
  });
}
// 帖子页面上一页,下一页按钮互换位置
function useRightNextBtn() {
  // 获取上一页和下一页的按钮
  const prevLink = $('.btBox .bt2 a:contains("上一页")');
  const nextLink = $('.btBox .bt2 a:contains("下一页")');

  // 交换位置
  prevLink.after(nextLink.clone());
  nextLink.after(prevLink.clone());
  prevLink.remove();
  nextLink.remove();
}
// 回帖 增强
function huifuBetter() {
  // 移除帖子快速回复旁“文件回帖”按钮
  $(".kuaisuhuifu a").remove();
  // 移除默认表情展开按钮及弹出内容区域
  $(".viewContent .ulselect").remove();
  $(".viewContent .emoticon-popup").remove();

  createToggleEle();

  $(".viewContent .centered-container").before('<div class="emojilist-div huifu-emoji"></div>');
  createEmojiHtml(".viewContent .sticky [name='content']");
  $(".viewContent .sticky").after('<div class="ubblist-div huifu-ubb"></div>');
  createUbbHtml(".viewContent .sticky [name='content']");

  !getUserSetting("showHuifuEmoji") && $(".emojilist-div.huifu-emoji").hide();
  !getUserSetting("showHuifuUbb") && $(".ubblist-div.huifu-ubb").hide();

  function createToggleEle() {
    const toggleEle = $(`<span class="custom-toggle-btn">${getUserSetting("showHuifuUbb") ? "UBB 折叠" : "UBB 展开"}</span>`);
    toggleEle.click(function () {
      $(".ubblist-div").toggle();
      const showHuifuUbb = getUserSetting("showHuifuUbb");
      if (showHuifuUbb) {
        saveUserSetting("showHuifuUbb", false);
        $(this).text("UBB 展开");
      } else {
        saveUserSetting("showHuifuUbb", true);
        $(this).text("UBB 折叠");
      }
    });
    $(".viewContent .kuaisuhuifu").append(toggleEle);

    const vSpan = $(`<span class='custom-toggle-btn'>${getUserSetting("showHuifuEmoji") ? "表情 折叠" : "表情 展开"}</span>`);
    vSpan.css({
      "margin-left": "10px",
      "padding": "2px 10px",
    });
    vSpan.insertBefore(".viewContent .tongzhi");
    vSpan.click(function () {
      $(".emojilist-div").toggle();
      const showHuifuEmoji = getUserSetting("showHuifuEmoji");
      if (showHuifuEmoji) {
        saveUserSetting("showHuifuEmoji", false);
        $(this).text("表情 展开");
      } else {
        saveUserSetting("showHuifuEmoji", true);
        $(this).text("表情 折叠");
      }
    });
  }
}
// 发帖/修改帖 增强
function bookViewBetter() {
  createToggleEle();

  let contentHeader = $(".upload-container .form-group .content-header").eq(1); // 发布帖子
  if (window.location.pathname != "/bbs/book_view_add.aspx") {
    contentHeader = $(".upload-container .form-group .content-header"); // 修改帖子
  }
  contentHeader.after('<div class="emojilist-div bookview-emoji"></div>');
  createEmojiHtml(".upload-container .form-group [name='book_content']");
  contentHeader.after('<div class="ubblist-div bookview-ubb"></div>');
  createUbbHtml(".upload-container .form-group [name='book_content']");

  // 读取设置,当折叠时隐藏
  !getUserSetting("showBookViewEmoji") && $(".emojilist-div.bookview-emoji").hide();
  !getUserSetting("showBookViewUbb") && $(".ubblist-div.bookview-ubb").hide();

  // 生成按钮
  function createToggleEle() {
    const toggleEle = $(
      `<span class="custom-toggle-btn ubb-btn" style="font-size:10px;margin-right:0;">${
        getUserSetting("showBookViewUbb") ? "UBB 折叠" : "UBB 展开"
      }</span>
      <span class="custom-toggle-btn emoji-btn" style="font-size:10px;margin-left:0;">${
        getUserSetting("showBookViewEmoji") ? "表情 折叠" : "表情 展开"
      }</span>
      `
    );
    if (window.location.pathname === "/bbs/book_view_mod.aspx") {
      // 修改帖子
      $("label").each(function () {
        const labelContent = $(this).html();
        if (labelContent == "内容") {
          $(this).replaceWith(`
            <div class="content-header"><label>内容</label><div class="textarea-actions"></div>
          `);
        }
      });
      $(".upload-container .form-group .textarea-actions").append(toggleEle);
    } else {
      // 发布帖子
      $(".content .textarea-actions #saveDraftButton").before(toggleEle);
    }
    // ubb 展开按钮
    $(".custom-toggle-btn.ubb-btn").click(function () {
      $(".ubblist-div").toggle();
      const showBookViewUbb = getUserSetting("showBookViewUbb");
      if (showBookViewUbb) {
        saveUserSetting("showBookViewUbb", false);
        $(this).text("UBB 展开");
      } else {
        saveUserSetting("showBookViewUbb", true);
        $(this).text("UBB 折叠");
      }
    });
    // 表情展开按钮
    $(".custom-toggle-btn+.emoji-btn").click(function () {
      $(".emojilist-div").toggle();
      const showBookViewEmoji = getUserSetting("showBookViewEmoji");
      if (showBookViewEmoji) {
        saveUserSetting("showBookViewEmoji", false);
        $(this).text("表情 展开");
      } else {
        saveUserSetting("showBookViewEmoji", true);
        $(this).text("表情 折叠");
      }
    });
  }
}
// ubb 节点
function createUbbHtml(insertEle) {
  // 生成 ubb 按钮
  const ubbListHtml = [];
  ubbList.forEach((ubbItem) => {
    const { name, upload } = ubbItem;
    let ubbSpanEle = null;
    if (upload?.type?.length > 0) {
      ubbSpanEle = $(`
            <input type="file" id="upload-${upload.type}" style="display: none;" accept="${upload.accept}" multiple/>
            <span class="ubb-item">${name}</span>
        `);
    } else {
      ubbSpanEle = $(`<span class="ubb-item">${name}</span>`);
    }
    ubbListHtml.push(ubbSpanEle);
  });
  $(".ubblist-div").append(ubbListHtml);
  // 设置 ubb 点击功能,生成时设置会导致某些ubb点击无法生效
  ubbList.forEach((ubbItem) => {
    const { name, inputTitle, ubbHandle, upload, jxApiUrl } = ubbItem;
    $(`.ubblist-div .ubb-item:contains("${name}")`).click(() => {
      if (inputTitle?.length > 0 && !jxApiUrl) {
        // 输入域
        showInputPopup(inputTitle, (inputResult) => inputResult && insetCustomContent(ubbHandle(inputResult), insertEle, true));
      } else if (inputTitle?.length > 0 && jxApiUrl?.length > 0) {
        // 外链解析
        showInputPopup(inputTitle, async (inputResult) => {
          const targetUrl = /https:\/\/v\.d.+?\/\w+/.exec(inputResult[0]);
          await getVideoPlayUrl(targetUrl[0]);
        });
      } else if (upload) {
        // 点击隐藏的上传选择文件按钮
        $(`.ubblist-div #upload-${upload.type}`).click();
        // 文件选择回调事件
        $(`.ubblist-div #upload-${upload.type}`)
          .off("input")
          .on("input", function () {
            const fileInput = this;
            const tempFiles = this.files;
            if (tempFiles.length == 0) {
              notifyBox("请选择文件", false);
              return;
            }
            if (tempFiles.length > 10) {
              notifyBox("一次最多选择 10 个文件", false);
              return;
            }

            showWaitBox("上传中…"); // 上传等待提示
            const uploadCount = { success: 0, fail: 0 }; // 存储上传结果数量
            for (const file of tempFiles) {
              switch (upload.type) {
                case "img":
                  const url = defaultSetting.imgUploadApiUrl[getUserSetting("imgUploadSelOpt")];
                  const options = {};
                  if (getUserSetting("imgUploadSelOpt") == 1) {
                    // 水墨图床添加 token
                    options.headers = { token: getUserSetting("suimoToken") };
                  }
                  const data = new FormData();
                  data.append("image", file);
                  uploadFiles(url, data, options, (response) => {
                    const { code, msg, data } = response;
                    if (code == 200) {
                      insetCustomContent(ubbHandle([data.url]), insertEle, true);
                      uploadCount.success++;
                    } else {
                      uploadCount.fail++;
                      // notifyBox(msg, false);
                    }
                    if (uploadCount.success + uploadCount.fail == tempFiles.length) {
                      $(".wait-box-overlay").remove(); // 关闭等待提示
                      setTimeout(() => notifyBox(`已成功上传 ${uploadCount.success} 个文件,失败 ${uploadCount.fail} 个文件`), 300);
                      $(fileInput).val(""); // 上传完成后清空文件选择,解决某些浏览器上出现的重复上传及选择相同文件时不上传问题
                    }
                  });
                  break;
                case "movie":
                  $(".wait-box-overlay").remove();
                  break;
                case "audio":
                  $(".wait-box-overlay").remove();
                  break;
                default:
                  notifyBox(`非法选择`);
                  $(".wait-box-overlay").remove();
                  break;
              }
            }
          });
      }
    });
  });
}
// 表情 节点
function createEmojiHtml(insertEle) {
  const emojiListHtml = [];
  emojiList.forEach((faceitem) => {
    const img = $("<img/>", {
      class: "emojilist-img",
      src: faceitem,
    });
    $(img).click(() => insetCustomContent(`[img]${faceitem}[/img]`, insertEle, true));
    emojiListHtml.push(img);
  });
  $(".emojilist-div").append(emojiListHtml);
}
// 修改图片大小
function changeImgSize() {
  setBbsContentImg();
  setReContentImg();

  function setReContentImg() {
    $(".recontent img").each(function () {
      if (this.complete) {
        handleImageLoad(this);
      } else {
        $(this).on("load", function () {
          handleImageLoad(this);
        });
      }
    });
    $("body").on("load", "img", function () {
      handleImageLoad(this);
    });
    function handleImageLoad(img) {
      if ($(img).width() <= 120) return; // 排除论坛自带表情,不缩放

      $(img).css({
        width: "100px",
        height: "auto", // 按比例缩放
        display: "block", // 设置为 block
      });
    }
  }
  function setBbsContentImg() {
    // 监测已有图片
    $(".bbscontent img").each(function () {
      if (this.complete) {
        handleImageLoad(this); // 如果图片已经加载完成
      } else {
        $(this).on("load", function () {
          handleImageLoad(this);
        });
      }
    });
    // 监测新增图片
    $("body").on("load", "img", function () {
      handleImageLoad(this);
    });
    $("body").on("click", "img", function (e) {
      e.preventDefault(); // 取消默认点击行为,避免进入预览窗口
      $(this).toggleClass("img-thumb"); // 给图片添加点击事件,添加/移除指定class,以实时修改图片大小
    });

    function shouldExclude(img) {
      const excludedClasses = []; // 需要排除的 class
      const excludedIds = ["settingICon"]; // 需要排除的 id

      // 判断是否包含排除的 class 或 id
      return excludedClasses.some((cls) => $(img).hasClass(cls)) || excludedIds.includes($(img).attr("id"));
    }
    // 图片加载完成
    function handleImageLoad(img) {
      // console.log("图片加载完成:", img.src);
      const imgThumbWidth = getUserSetting("imgThumbWidth");
      if (!imgThumbWidth) return; // 防止设置为0时依旧添加点击事件,导致点击后页面内图片丢失
      if ($(img).width() <= 120) return; // 排除论坛自带表情,不缩放
      if (shouldExclude(img)) return; // 跳过指定 class 或 id 的图片

      $("head").append(`<style>.img-thumb{max-width:${imgThumbWidth}px;display: block;}`); // 将图片缩小样式添加到页面中
      $(img).addClass("img-thumb"); // 为页面内所有img标签添加class,修改显示大小
    }
  }
}
// 复读机(回帖+1)
function huifuCopy() {
  const customLayoutEnabled = JSON.parse(localStorage.getItem("customLayoutEnabled"));
  if (customLayoutEnabled) {
    // 新版回帖
    $(".forum-post .post-content .retext").each(function () {
      const spanEle = $("<span class='huifu-copy'>+1</span>");
      $(this).append(spanEle);
      spanEle.click((e) => {
        e.stopPropagation();
        const parentText = $(this).clone().children(".huifu-copy").remove().end().text().trim();
        insetCustomContent(parentText, ".centered-container .retextarea");
        scrollToEle(".centered-container .retextarea", 80);
        setTimeout(() => {
          getUserSetting("huifuCopyAutoSubmit") && $(".kuaisuhuifu input").trigger("click");
        }, 150);
      });
    });
  } else {
    // 旧版回帖
    $(".reline.list-reply .retext").each(function () {
      const spanEle = $("<span class='huifu-copy'>+1</span>");
      $(this).append(spanEle);
      spanEle.click((e) => {
        e.stopPropagation();
        const parentText = $(this).clone().children(".huifu-copy").remove().end().text().trim();
        insetCustomContent(parentText, ".centered-container .retextarea");
        scrollToEle(".centered-container .retextarea", 80);
        setTimeout(() => {
          getUserSetting("huifuCopyAutoSubmit") && $(".kuaisuhuifu input").trigger("click");
        }, 150);
      });
    });
  }
}
// 隐藏楼主勋章
function hideXunzhang() {
  $(".xunzhang").remove();
}
// 一键吃肉
function speedEatMoney() {
  const vBtn = $("<span class='custom-toggle-btn'>一键吃肉</span>");
  vBtn.click(() => {
    const isPaibi = $("div").hasClass("paibi");
    if (isPaibi) {
      const shengyuNum = $(".paibi .yushuzi").text();
      if (shengyuNum > 0) {
        const eatWordsArr = [
          "吃",
          "吃吃",
          "吃吃.",
          "吃吃。",
          "吃吃..",
          "吃吃。。",
          "吃了",
          "吃肉",
          "来吃肉",
          "吃.",
          "吃。",
          "吃了.",
          "吃了。",
          "吃肉.",
          "吃肉。",
          "来吃肉.",
          "来吃肉。",
          "吃..",
          "吃。。",
          "吃了..",
          "吃了。。",
          "吃肉..",
          "先吃肉",
        ];
        const index = Math.floor(Math.random() * eatWordsArr.length);
        insetCustomContent(eatWordsArr[index], ".centered-container .retextarea");
        setTimeout(() => {
          $(".kuaisuhuifu input").trigger("click");
        }, 300);
      } else {
        notifyBox("已经没有肉了,错过了一个亿~", false);
      }
    } else {
      notifyBox("不是派币贴,你吃个 der", false);
    }
  });
  $(".viewContent .kuaisuhuifu").append(vBtn);
}
// 查询吹牛发布者历史大话选项
async function chuiniuHistory() {
  const elementsWithText = $("body").find(":contains('自己挑战的只能由其它友友应战!')");
  if (elementsWithText.length > 0) return;

  // 创建胜率结果显示容器,写入提示信息
  $(
    `<p id="chuiniuWinningEle" style="background:#f0f9eb;color:gray;text-align:center;margin:0 auto;padding:0 20px;">历史记录获取中...</p>`
  ).insertBefore($(".subtitle"));

  const userinfoEle = $('a[href*="userinfo.aspx"]');
  const chuiniuQueUserId = getUrlParam("touserid", userinfoEle.attr("href")); // 发布者ID
  const chuiniuQueUserNickname = userinfoEle.text(); // 发布者昵称
  const queHistoryArr = Array.from(await getQueUserHistoryArr(chuiniuQueUserId)); // 发布者历史大话ID

  if (queHistoryArr.length > 0) {
    //  获取成功
    const queHistoryAnswers = await Promise.all(queHistoryArr.map(getChuiniuAnswer));
    const countAnswer1 = queHistoryAnswers.filter((v) => v === "1").length;
    const countAnswer2 = queHistoryAnswers.filter((v) => v === "2").length;
    $("#chuiniuWinningEle")
      .css({
        "text-align": "left",
      })
      .html(
        `“<span style="color:#3d68a8;">${chuiniuQueUserNickname}</span>”最近<span style="color:blue;font-weight:bold;">${queHistoryAnswers.length}</span>次已完成大话选项:答案<span style="color:blue;font-weight:bold;">1</span>次数:<span style="color:red;font-weight:bold;">${countAnswer1}</span>,答案<span style="color:blue;font-weight:bold;">2</span>次数: <span style="color:red;font-weight:bold;">${countAnswer2}</span>`
      );
  } else {
    // 获取失败
    $("#chuiniuWinningEle").html(`<span style="color:red;">未知错误,获取历史数据失败,请私信反馈</span>`);
  }

  // 获取指定大话答案
  async function getChuiniuAnswer(chuiniuId) {
    const chuiniuRes = await getPageContent(`/games/chuiniu/book_view.aspx?id=${chuiniuId}`);
    const ansRule1 = chuiniuRes.match(/挑战方出的是\[答案1\]/);
    const ansRule2 = chuiniuRes.match(/挑战方出的是\[答案2\]/);
    if (ansRule1) return "1";
    if (ansRule2) return "2";
  }
  // 获取对方大话指定条数历史记录ID
  async function getQueUserHistoryArr(toUserId, computeTotal = 15) {
    return new Promise(async (resolve, reject) => {
      const idArr = new Set(); // 存放大话ID,利用Set特性去重(翻页时会有重复项出现,非本脚本bug)
      let historyPage = 1; // 翻页,达到预设值时停止

      const historyText = await getPageContent(`/games/chuiniu/book_list.aspx?type=0&touserid=${toUserId}`);
      const userHistoryTotal = historyText.slice(historyText.indexOf("页,共 ") + 4, historyText.indexOf(" 条")); // 吹牛历史总条数

      const getQueUserHistoryid = async () => {
        const tempElements = $(historyText).filter(".line1, .line2");
        for (const line of tempElements) {
          const idLink = line.querySelector('a[href*="book_view.aspx"]');
          if (idLink && !line.textContent.includes("进行中")) {
            const dahuaId = getUrlParam("id", idLink.href);
            if (dahuaId) idArr.add(dahuaId);
            if (idArr.length >= computeTotal) break;
          }
        }
        if (idArr.length < 15 && userHistoryTotal > 15) {
          historyPage++;
          getQueUserHistoryid();
        } else {
          resolve(idArr);
        }
      };
      getQueUserHistoryid();
    });
  }
}
// 一键回到顶部/底部,在原作者基础上做了删减、改动,原作者发布地址:https://greasyfork.org/zh-CN/scripts/38899-回到顶部-底部
function addTopAndDown() {
  if (window.self != window.top) return;
  function ce(n) {
    return document.createElement(n);
  }

  function addStyle(css) {
    let head = document.head || document.getElementsByTagName("head")[0];
    if (head) {
      let style = ce("style");
      style.type = "text/css";
      style.appendChild(document.createTextNode(css));
      head.appendChild(style);
    }
  }

  let el = navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("MSIE") != -1 ? document.documentElement : document.body,
    t1,
    t2,
    speed_by_click = 200,
    zIindex = 1001;

  function getDocumentHeight() {
    return document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight;
  }
  function get_scroll(a) {
    let d = document,
      b = d.body,
      e = d.documentElement,
      c = "client" + a,
      f = "scroll" + a;
    return /CSS/.test(d.compatMode) ? e[c] < e[f] : b[c] < b[f];
  }
  function scrollTo(element, to, duration) {
    (start = document.documentElement.scrollTop || document.body.scrollTop),
      (change = to - start),
      (currentTime = 0),
      (increment = 20),
      (newDuration = typeof duration === "undefined" ? 500 : duration);

    let animateScroll = function () {
      currentTime += increment;
      let val = Math.easeInOutQuad(currentTime, start, change, newDuration);
      window.scrollTo(0, val);
      if (currentTime < newDuration) {
        setTimeout(animateScroll, increment);
      }
    };
    animateScroll();
  }

  Math.easeInOutQuad = function (t, b, c, d) {
    t /= d / 2;
    if (t < 1) return (c / 2) * t * t + b;
    t--;
    return (-c / 2) * (t * (t - 2) - 1) + b;
  };

  function shareCSS() {
    let s = "",
      img_up,
      img_dn;

    img_up =
      "data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB+SURBVDhPY1i1atV/amAGahgCMoNhaIGlS5cKAp19BoRBbLJcj2QILDJINwzoAmMgfoclIkBixkS5DI8hMJcRNgxoSBoOl6CnNZBhaVhdBjWE1MSJahjQkA4KEmYH2GUrV66cSYEhYB+AzKBtFiHkQqKiH6Ro1CDCQTWgYQQAs81DU0G/83sAAAAASUVORK5CYII=";
    img_dn =
      "data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACPSURBVDhPY2DAAlatWvUfH8amB6vYqEGEg2pgw4iQ7cTKM6xcuXImsYpxqQOZAQ4woIIOCgzrQAl1oEFpZBiWhitFgwx7R4SBIDXYDYGZDFRgTMAwkCHGhBMRJMxwGUa8ITCbli5dKgg08AySN8+AxIhyCboiJMPIN4Qsm6miiYioxltawvSDYogohYTUAQC80UNTOht/YwAAAABJRU5ErkJggg==";
    s +=
      "#play_btn_up { position:fixed; right:0; top:54%;z-index:" +
      zIindex +
      "; height:40px; width:36px; cursor:pointer; background:url(" +
      img_up +
      ") no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); border-radius:5px 0 0 5px; margin-top:-24px; }";
    s +=
      "#play_btn_dn { position:fixed; right:0; top:60%;   z-index:" +
      zIindex +
      "; height:40px; width:36px; cursor:pointer; background:url(" +
      img_dn +
      ") no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); border-radius:5px 0 0 5px; margin-top:-24px; }";

    s +=
      ".play_btn { -webkit-transition-duration:0.5s linear; -o-transition-duration:0.5s linear; -moz-transition-duration:0.5s linear; transition-duration:0.5s linear; opacity:0.65; }";
    s += ".play_btn:hover { opacity:1; }";

    addStyle("" + s);
  }

  function create_btn_element() {
    let up,
      dn,
      scrolled,
      h = get_scroll("Height");
    if (!h) {
      return;
    }
    shareCSS();

    if (el) {
      up = ce("span");
      dn = ce("span");
      up.setAttribute("id", "play_btn_up");
      dn.setAttribute("id", "play_btn_dn");
      up.className = "play_btn";
      dn.className = "play_btn";
      document.body.appendChild(up);
      document.body.appendChild(dn);

      scrolled = window.pageYOffset || document.documentElement.scrollTop;
      up.style.display = scrolled > 0 ? "" : "none";

      up.addEventListener(
        "mouseout",
        function () {
          clearTimeout(t1);
        },
        false
      );
      dn.addEventListener(
        "mouseout",
        function () {
          clearTimeout(t2);
        },
        false
      );
      up.addEventListener(
        "click",
        function () {
          scrollTo(el, 0, speed_by_click);
        },
        false
      );
      dn.addEventListener(
        "click",
        function () {
          scrollTo(el, getDocumentHeight(), speed_by_click);
        },
        false
      );

      window.onscroll = function () {
        let scrolled = document.documentElement.scrollTop,
          diffHeight = document.body.scrollHeight - window.innerHeight;
        up.style.display = scrolled > 0 ? "" : "none";
        dn.style.display = diffHeight > scrolled ? "" : "none";
      };
    }
  }

  create_btn_element();
}

// 生成设置相关内容
function createScriptSetting() {
  createIcon();

  // 关闭设置弹框
  function closePopupContainer() {
    // 恢复body内容滚动
    $("body").css("overflow", "auto");
    // 移除蒙版和弹出内容容器
    $(".popup-overlay").remove();
  }
  // 设置弹框
  function createPopupContainer() {
    // 蒙版
    const overlay = $("<div>").addClass("popup-overlay").appendTo("body").click(closePopupContainer);
    // 弹出内容容器
    const container = $("<div>")
      .addClass("popup-container")
      .appendTo(overlay)
      .click((event) => {
        event.stopPropagation(); // 阻止事件冒泡
      });

    // 设置蒙版的样式
    overlay.css({
      "background-color": "rgba(0, 0, 0, 0.6)",
      "position": "fixed",
      "top": 0,
      "left": 0,
      "width": "100%",
      "height": "100%",
      "z-index": 9999,
      "display": "flex",
      "justify-content": "center",
      "align-items": "center",
    });

    // 设置弹出内容容器的样式
    container.css({
      "background-color": "white",
      "width": "80%",
      "max-width": "400px",
      "max-height": "80%",
      "overflow-y": "auto",
      "padding": "20px",
      "text-align": "center",
      "border-radius": "5px",
    });

    // 添加弹出内容
    const vSettingEle = `
      <form name="settingForm">
      <div class="setting-div">
        <h2 class="reset setting-title">妖火增强插件Plus</h2>
        <p class="reset" style="font-size:12px;">
          Author:<a href="/bbs/userinfo.aspx?touserid=27894" style="font-size:12px;">柠檬没有汁@27894</a>
        </p>
        <p class="reset" style="font-size:12px;margin-top:-15px;">
          Version:${defaultSetting.version}
        </p>
        <p style="font-size:12px;margin-top:-15px;color:red;${sessionStorage.getItem("canUpdate") ? "" : "display:none;"}">
          已有新版本:<span style="color:green;">${sessionStorage.getItem("newVersion")}</span>,请及时更新
        </p>
        <ul style="margin:0;padding:0;">
          <li class="setting-li-title"><hr><b>关于脚本</b><hr></li>
          <li class="setting-li-between">
            <span>脚本安装/升级</span>
            <span>
              <a href="https://greasyfork.org/zh-CN/scripts/504289-妖火网增强脚本plus" target="_blank">GreasyFork 直达</a>
            </span>
          </li>
          <li class="setting-li-between">
            <span>开源地址</span>
            <span>
              <a href="https://github.com/v2jun/yaohuo_better_plus" target="_blank">Github</a>
            </span>
          </li>
          <li class="setting-li-between">
            <span>重置设置</span>
            <span class='clear-setting'>点击运行</span>
          </li>
          <li class="setting-li-tips">
            <span>如出现玄学bug,可尝试重置脚本设置</span>
          </li>

          <li class="setting-li-title"><hr><b>设置</b><hr></li>
          <li class="setting-li-between">
            <span>设置图标大小(px)</span>
            <input name="settingIconSize" class="setting-li-input" type="number" value="${getUserSetting("settingIconSize")}"/>
          </li>
          <li class="setting-li-tips">
            <span>设置入口图标大小,设置为 0 时不显示</span>
          </li>
          <li class="setting-li-between">
            <span>检查更新</span>
            <div class="switch">
              <input name="checkVersion" value="true" ${
                getUserSetting("checkVersion") ? "checked" : ""
              }  class="switch-checkbox" id="checkVersion" type="checkbox">
              <label class="switch-label" for="checkVersion">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between">
            <span>一键回到顶部/底部</span>
            <div class="switch">
              <input name="showTopAndDownBtn" value="true" ${
                getUserSetting("showTopAndDownBtn") ? "checked" : ""
              }  class="switch-checkbox" id="showTopAndDownBtn" type="checkbox">
              <label class="switch-label" for="showTopAndDownBtn">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between">
            <span>隐藏楼主勋章</span>
            <div class="switch">
              <input name="hideXunzhang" value="true" ${
                getUserSetting("hideXunzhang") ? "checked" : ""
              }  class="switch-checkbox" id="hideXunzhang" type="checkbox">
              <label class="switch-label" for="hideXunzhang">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between">
            <span>图片宽度(px)</span>
            <input name="imgThumbWidth" class="setting-li-input" type="number" value="${getUserSetting("imgThumbWidth")}"/>
          </li>
          <li class="setting-li-tips">缩放页面中图片到指定宽度,设置为 0 时不缩放</li>
          <li class="setting-li-between">
            <span>图床选择</span>
            <select name='imgUploadSelOpt' class="reset" style="font-size: 12px;width:116px;padding-left:8px;height:25px;">
              <option value="0" ${getUserSetting("imgUploadSelOpt") == 0 ? "selected" : ""}>美团</option>
              <option value="1" ${getUserSetting("imgUploadSelOpt") == 1 ? "selected" : ""}>水墨</option>
            </select>
          </li>
          <li class="setting-li-between sel-suimo">
            <span><a href="https://img.ink/user/settings.html" target="_blank">水墨图床token</a></span>
            <input style="width:100px;" class="setting-li-input" value="${getUserSetting(
              "suimoToken"
            )}" name="suimoToken" id="suimoToken" type="text" placeholder="为空则不会上传…"/>
          </li>
          <li class="setting-li-between">
            <span>我要用右手</span>
            <div class="switch">
              <input name="useRight" value="true" ${
                getUserSetting("useRight") ? "checked" : ""
              }  class="switch-checkbox" id="useRight" type="checkbox">
              <label class="switch-label" for="useRight">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-tips">将帖子列表的下一页按钮显示在右边</li>
          <li class="setting-li-between">
            <span>帖子自动加载</span>
            <div class="switch">
              <input name="autoLoadMoreBookList" value="true" ${
                getUserSetting("autoLoadMoreBookList") ? "checked" : ""
              }  class="switch-checkbox" id="autoLoadMoreBookList" type="checkbox">
              <label class="switch-label" for="autoLoadMoreBookList">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between">
            <span>回复自动加载</span>
            <div class="switch">
              <input name="autoLoadMoreHuifuList" value="true" ${
                getUserSetting("autoLoadMoreHuifuList") ? "checked" : ""
              }  class="switch-checkbox" id="autoLoadMoreHuifuList" type="checkbox">
              <label class="switch-label" for="autoLoadMoreHuifuList">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between">
            <span>帖子在弹窗中打开</span>
            <div class="switch">
              <input name="openLayerForBook" value="true" ${
                getUserSetting("openLayerForBook") ? "checked" : ""
              }  class="switch-checkbox" id="openLayerForBook" type="checkbox">
              <label class="switch-label" for="openLayerForBook">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-tips">仅在PC端生效,且弹窗中无法使用脚本</li>

          <li class="setting-li-title more-setting more-setting-click" style="margin-bottom:0;"><hr><b>高级设置</b><hr></li>
          <li class="more-setting" style="font-size:12px;text-align:center;margin:-16px 0;color:red;">使用以下功能前请先熟读并背诵版规(手动狗头.jpg)</li>
          <li class="setting-li-between more-setting">
            <span>一键吃肉</span>
            <div class="switch">
              <input name="oneClickCollectMoney" value="true" ${
                getUserSetting("oneClickCollectMoney") ? "checked" : ""
              }  class="switch-checkbox" id="oneClickCollectMoney" type="checkbox">
              <label class="switch-label" for="oneClickCollectMoney">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between more-setting">
            <span>吹牛历史查询</span>
            <div class="switch">
              <input name="showChuiniuHistory" value="true" ${
                getUserSetting("showChuiniuHistory") ? "checked" : ""
              }  class="switch-checkbox" id="showChuiniuHistory" type="checkbox">
              <label class="switch-label" for="showChuiniuHistory">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between extra-setting" style="display:none;">
            <span>复读机(回帖+1)</span>
            <div class="switch">
              <input name="showHuifuCopy" value="true" ${
                getUserSetting("showHuifuCopy") ? "checked" : ""
              }  class="switch-checkbox" id="showHuifuCopy" type="checkbox">
              <label class="switch-label" for="showHuifuCopy">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
          <li class="setting-li-between extra-setting" style="display:none;">
            <span>复读机自动提交</span>
            <div class="switch">
              <input name="huifuCopyAutoSubmit" value="true" ${
                getUserSetting("huifuCopyAutoSubmit") ? "checked" : ""
              }  class="switch-checkbox" id="huifuCopyAutoSubmit" type="checkbox">
              <label class="switch-label" for="huifuCopyAutoSubmit">
                <span class="switch-inner" data-on="开" data-off="关"></span>
                <span class="switch-switch"></span>
              </label>
            </div>
          </li>
        </ul>
        <footer>
          <hr>
          <span class="setting-cancel-btn">取消</span>
          <span class="setting-confirm-btn">保存</span>
        </footer>
      </form>
      </div>
    `;
    container.append(vSettingEle);
    // 监听下拉选择,改变其他元素状态
    $('form[name="settingForm"]')
      .find("select")
      .on("change", function () {
        const selectName = $(this).attr("name");
        const selectedValue = $(this).val();

        if (selectName === "imgUploadSelOpt") {
          if (selectedValue == 0) $(".setting-div .sel-suimo").hide();
          else if (selectedValue == 1) $(".setting-div .sel-suimo").show();
        }
      });
    // 禁止蒙版下的body内容滚动
    $("body").css("overflow", "hidden");
    // 高级设置——额外设置
    $(".setting-div .more-setting-click").click(
      clickCounter(
        ".setting-div .more-setting-click",
        () => {
          $(".setting-div .extra-setting").toggle();
        },
        3,
        3
      )
    );
    // 清除缓存
    $(".setting-div .clear-setting").click((e) => {
      localStorage.removeItem("yaohuoBetterPlusSetting");
      localStorage.removeItem("jquery-3.7.1.min");
      setTimeout(() => {
        window.location.reload();
      }, 300);
    });
    // 取消按钮
    $(".setting-div .setting-cancel-btn").click(closePopupContainer);
    // 提交按钮
    $(".setting-div .setting-confirm-btn").click(() => {
      const formData = {};
      $('form[name="settingForm"]')
        .find("input, select")
        .each(function () {
          // 根据不同输入方式格式化值,否则全部为字符串
          if ($(this).is(":checkbox")) {
            formData[this.name] = this.checked;
          } else if ($(this).is(":radio")) {
            const checkedValue = $('form[name="settingForm"]')
              .find('[name="' + this.name + '"]:checked')
              .val();
            formData[this.name] = checkedValue !== undefined ? checkedValue : null;
          } else if ($(this).attr("type") === "number") {
            formData[this.name] = parseFloat(this.value);
          } else if ($(this).attr("type") === "date") {
            formData[this.name] = new Date(this.value);
          } else if ($(this).is("select")) {
            formData[this.name] = parseFloat(this.value);
          } else {
            formData[this.name] = this.value;
          }
        });

      const cacheSetting = JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting"));
      for (const key of Object.keys(formData)) {
        cacheSetting[key] = formData[key];
      }
      console.log("%c ===> [ cacheSetting ] <===", "font-size:13px; background:pink; color:#bf2c9f;", cacheSetting);
      try {
        localStorage.setItem("yaohuoBetterPlusSetting", JSON.stringify(cacheSetting));
        notifyBox("保存成功");
      } catch (error) {
        notifyBox("保存失败", false);
      }
      // 刷新页面以应用新设置
      setTimeout(() => {
        window.location.reload();
      }, 300);
    });
    // 根据用户设置决定是否显示水墨图床 token 设置
    if (getUserSetting("imgUploadSelOpt") != 1) $(".setting-div .sel-suimo").hide();
  }
  // 设置 icon
  function createIcon() {
    // 页面内设置按钮,避免icon被设置为 0 时无法重置设置
    $(".subtitle2")
      .append("<span style='color:red;margin-left:15px;font-weight:bold;'>脚本设置</span>")
      .find("span")
      .click(() => {
        createPopupContainer();
      });

    const windowWidth = $(window).width();
    const bodyContentWidth = $("body").width();
    const iconSize = getUserSetting("settingIconSize") + "px";
    $("<img>")
      .attr("id", "settingICon")
      .attr("src", `${settingIconBase64}`)
      .css({
        "position": "fixed",
        "top": "10px",
        "right": "10px",
        "width": iconSize,
        "height": iconSize,
        "z-index": 9998,
      })
      .appendTo("body")
      .click(() => {
        createPopupContainer();
      });
    // PC端设置右偏移量
    if (windowWidth > bodyContentWidth) {
      const rightOffset = (windowWidth - bodyContentWidth) / 2 + 10;
      $("#settingICon").css("right", rightOffset + "px");
    }
  }
}

// 初始化本地设置文件(存放于localStorage,清除浏览器缓存会让设置失效)
function initSetting() {
  return new Promise((resolve, reject) => {
    const localSetting = JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting")) || {};
    const saveSetting = { ...defaultSetting, ...localSetting }; // 合并设置,自定义项覆盖默认选项,避免添加新功能时已缓存设置没有新功能相关从而产生bug
    try {
      localStorage.setItem("yaohuoBetterPlusSetting", JSON.stringify(saveSetting));
      console.log("======> [ 已成功初始化设置 ]");
      resolve(true);
    } catch (error) {
      notifyBox("未知错误,初始化设置失败,请联系作者反馈bug…");
      reject(false);
    }
  });
}

// 判断是否是在网站中(有些手机端浏览器无法识别油猴 @match 标识,导致在所有网站都会执行脚本)
function checkLocation() {
  const currentHost = window.location.host;
  const targetHostArr = ["yaohuo.me", "www.yaohuo.me"];

  if (targetHostArr.includes(currentHost)) return true;
  else return false;
}

/* ================================================== 自定义方法开始 ================================================== */

// 加载并执行远程js文件,将其存入 localstorage
function loadAndExecuteScript(url, loaclStorageKey) {
  return new Promise((resolve, reject) => {
    const cacheScript = localStorage.getItem(loaclStorageKey);
    if (cacheScript && cacheScript.length > 0) {
      executeScript(cacheScript); // 执行缓存 js
      resolve(true);
    } else {
      fetch(url) // 加载远程 js
        .then((response) => response.text())
        .then((fetchScriptContent) => {
          executeScript(fetchScriptContent);
          localStorage.setItem(loaclStorageKey, fetchScriptContent);
          resolve(true);
        })
        .catch((err) => {
          notifyBox("未知错误,Jquery 加载失败,请刷新重试…", false);
          reject(false);
        });
    }
  });
}
// 执行指定内容 js 代码
function executeScript(scriptContent) {
  const script = document.createElement("script"); // 创建script元素
  script.text = scriptContent; // 设置脚本内容
  document.head.appendChild(script); // 执行脚本
}
// 解析各大视频平台url
function getVideoPlayUrl(url) {
  return new Promise((resolve, reject) => {
    if (url.includes("douyin")) {
      resolve(dy());
    } else if (url.includes("kuaishou")) {
    } else if (url.includes("bilibili")) {
    } else {
      reject();
    }
  });
  function dy() {
    const dyData = myAjax(url, { url }, "post", { headers: { "Access-Control-Allow-Origin": "*" } });
    console.log("%c ===> [ dyData ] <===", "font-size:13px; background:pink; color:#bf2c9f;", dyData);
  }
}

/**
 * 上传文件到指定api
 * @param {*} url api地址
 * @param {*} data 数据
 * @param {*} options 附加请求数据
 * @param {*} callback 回调函数
 * @param {*} type 请求方法
 */
function uploadFiles(url, data, options = {}, callback, type = "POST") {
  $.ajax({
    url,
    type,
    data,
    contentType: false,
    processData: false,
    dataType: "json", // 期望返回的数据格式
    ...options,
    success: (response) => {
      callback(response);
    },
    error: (error) => {
      console.error("未知错误,上传失败", error);
    },
  });
}

// 生成输入内容域
function showInputPopup(inputTitle, callback) {
  // 创建蒙版
  const mask = $('<div class="input-popup-mask"></div>');
  mask.click(function (event) {
    if (event.target === mask[0]) {
      mask.remove();
      callback(null);
    }
  });
  // 创建弹出框
  const popup = $('<div class="input-popup"></div>');
  // 创建输入框
  for (let i = 0; i < inputTitle.length; i++) {
    const inputBox = $(
      '<div class="input-popup-input"><label class="input-popup-label">' +
        inputTitle[i] +
        ':</label><textarea class="input-popup-textarea" rows="2" placeholder="请输入..."></textarea></div>'
    );
    popup.append(inputBox);
  }
  // 创建按钮容器
  const buttonsContainer = $('<div class="input-popup-buttons"></div>');
  // 创建取消按钮
  const cancelBtn = $('<button class="input-popup-cancel-btn">取消</button>');
  cancelBtn.click(function () {
    mask.remove();
    callback(null);
  });
  // 创建确定按钮
  const submitBtn = $('<button class="input-popup-submit-btn">确定</button>');
  submitBtn.click(function () {
    const inputs = $(".input-popup-textarea");
    const inputValues = [];
    inputs.each(function () {
      inputValues.push($(this).val());
    });
    mask.remove();
    callback(inputValues);
  });
  // 将按钮添加到按钮容器
  buttonsContainer.append(cancelBtn);
  buttonsContainer.append(submitBtn);
  // 将按钮容器添加到弹出框
  popup.append(buttonsContainer);
  // 将弹出框添加到蒙版
  mask.append(popup);

  // 将蒙版添加到页面
  $("body").append(mask);
}

// 判断是否为pc端浏览器打开
function isPC() {
  let userAgentInfo = navigator.userAgent;
  let mobileAgents = ["Android", "iPhone", "iPad", "iPod", "Windows Phone"];
  let isPC = true;
  for (let i = 0; i < mobileAgents.length; i++) {
    if (userAgentInfo.indexOf(mobileAgents[i]) > -1) {
      isPC = false;
      break;
    }
  }
  return isPC;
}

// 滚动页面到指定标签,并显示在屏幕中间
function scrollToEle(toEle, animateTime = 500) {
  const targetElement = $(toEle); // 使用适当的选择器选择目标元素
  const windowHeight = $(window).height(); // 获取窗口的高度
  const elementOffset = targetElement.offset().top; // 获取目标元素相对于文档顶部的偏移量
  const offset = elementOffset - windowHeight / 2; // 计算滚动的偏移量

  $("html, body").animate(
    {
      scrollTop: offset,
    },
    animateTime
  ); // 平滑滚动到计算的偏移量位置
}

// Ajax 请求
function myAjax(url, data, method = "Get", options) {
  return new Promise((resolve, reject) => {
    $.ajax({
      url,
      method,
      data,
      success: (response) => {
        resolve(response);
      },
      error: (error) => {
        reject(error);
      },
      ...options,
    });
  });
}

// 生成指定长度随机字符串
function generateRandomString(length) {
  let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  let randomString = "";

  for (let i = 0; i < length; i++) {
    let randomIndex = Math.floor(Math.random() * characters.length);
    randomString += characters[randomIndex];
  }

  return randomString;
}

/**
 * 指定元素被点击*次后执行指定函数
 * @param {*} clickEle 指定元素
 * @param {*} callback 回调函数
 * @param {*} clickLimit 点击次数
 * @param {*} timeLimit 连续点击限制时间,单位/s
 */
function clickCounter(clickEle, callback, clickLimit = 3, timeLimit = 1) {
  $(clickEle).on("click", function () {
    let $button = $(this);
    let clickCount = $button.data("clickCount") || 0; // 获取点击次数,如果不存在则默认为0
    clickCount++; // 点击次数加1
    $button.data("clickCount", clickCount); // 存储点击次数

    if (clickCount === 1) {
      // 如果是第一次点击
      $button.data(
        "timeout",
        setTimeout(function () {
          $button.removeData("clickCount"); // 超时后移除点击次数数据
        }, timeLimit * 1000)
      ); // 设置时间窗口,单位为毫秒
    } else if (clickCount === clickLimit) {
      // 如果点击次数达到设定的限制
      clearTimeout($button.data("timeout")); // 清除超时
      $button.removeData("clickCount"); // 清除点击次数数据
      callback(); // 执行指定的回调函数
    }
  });
}
// 向页面中添加指定样式
function addCustomStyle() {
  // console.log("%c ===> [ 添加自定义样式 ] <===", "font-size:13px; background:pink; color:#bf2c9f;");
  $("<style>").text(customCSS).appendTo("head");
}
/**
 * 防抖
 * @param {*} func
 * @param {*} delay
 * @returns
 */
function debounce(func, delay = 800) {
  console.log("%c ===> [ 节流函数开始运行 ] <===", "font-size:13px; background:pink; color:#bf2c9f;");
  let timeoutId;

  return function () {
    clearTimeout(timeoutId);

    timeoutId = setTimeout(() => {
      func.apply(this, arguments);
    }, delay);
  };
}

/**
 * 在指定textarea/input当前光标处插入内容
 * @param {*} content 插入内容
 * @param {String} targetEle 插入目标 element(jquery可使用的选择器)
 * @param {Boolean} autoFocus 是否自动获取输入焦点
 */
function insetCustomContent(content, targetEle, autoFocus = false) {
  const textarea = $(targetEle); // 获取目标元素
  if (autoFocus) {
    const cursorPosition = textarea[0].selectionStart; // 获取当前光标位置
    const currentValue = textarea.val(); // 当前内容
    const newValue = currentValue.slice(0, cursorPosition) + content + currentValue.slice(cursorPosition); // 将内容插入当前光标处。如果未选择输入框则插入最后
    textarea.val(newValue); // 写入完整内容
    // 将光标移到插入内容的最后
    textarea[0].selectionStart = cursorPosition + content.length;
    textarea[0].selectionEnd = cursorPosition + content.length;
    textarea.focus();
  } else {
    textarea.val(content);
  }
}

/**
 * 当前页面为指定 url 时执行函数
 * @param {*} targetPath 指定 url,可为正则表达式
 * @param {Function} executeFunction 执行函数
 * @param {Boolean} isRegex 是否使用正则判断 url
 */
function executeFunctionForURL(targetPath, executeFunction, isRegex = false) {
  if (isRegex) {
    targetPath.test(window.location.pathname) && executeFunction();
  } else {
    if (typeof targetPath !== "string" || typeof executeFunction !== "function") {
      throw new Error("参数无效!");
    }
    window.location.pathname === targetPath && executeFunction();
  }
}

// 从指定url获取get参数`
function getUrlParam(paramName, targetUrl = window.location.href) {
  try {
    let urlObj = new URL(targetUrl, window.location.origin);
    return urlObj.searchParams.get(paramName);
  } catch (error) {
    console.error("无效的URL:", targetUrl, error);
    return null;
  }
}
// 获取指定页面内容
function getPageContent(path, method = "GET") {
  const url = `${window.location.origin}${path}`;
  return new Promise((resolve, reject) => {
    $.ajax({
      url,
      method,
      dataType: "html",
      success: (response) => {
        resolve(response);
      },
      error: (error) => {
        reject(error);
      },
    });
  });
}

// 设置保存
function saveUserSetting(setName, setValue) {
  let cacheSetting = JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting"));
  cacheSetting[setName] = setValue;
  try {
    localStorage.setItem("yaohuoBetterPlusSetting", JSON.stringify(cacheSetting));
    // notifyBox(successMsg);
  } catch (error) {
    // notifyBox(errorMsg, false);
    throw new Error("未知错误,保存设置失败");
  }
}
// 设置获取
function getUserSetting(name) {
  // let cacheSetting = JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting"));
  // console.log("%c ===> [ cacheSetting ] <===", "font-size:13px; background:pink; color:#bf2c9f;", cacheSetting);
  // return cacheSetting[name];
  try {
    return JSON.parse(localStorage.getItem("yaohuoBetterPlusSetting"))[name];
  } catch (error) {
    throw new Error("未知错误,获取设置失败");
  }
}
// 等待提示框
function showWaitBox(msg) {
  const overlay = $('<div class="wait-box-overlay"></div>');
  const modal = $('<div class="wait-box-modal"></div>');
  modal.append('<div class="wait-box-spinner"></div>');
  modal.append(`<span class="wait-box-text">${msg}</span>`);
  overlay.append(modal);
  $("body").append(overlay);
  overlay.on("click", function (e) {
    e.stopPropagation();
  });
  return overlay;
}

/**
 * 弹出提示
 * @param {String} message 提示内容
 * @param {Boolean} status 提示状态,true成功,false失败,默认true
 * @param {Number} delayTime 提示时间/ms,默认1500ms
 */
let offsetY = 0; // 消息框初始垂直偏移量
function notifyBox(message, status = true, delayTime = 1500) {
  // 消息父容器
  const containerDiv = $("<div>")
    .css({
      "position": "fixed",
      "top": `calc(100px + ${offsetY}px)`,
      "left": "50%",
      "transform": "translateX(-50%)",
      "width": "350px",
      "max-width": "80%",
      "text-align": "center",
      "z-index": 9999,
    })
    .appendTo("body");
  // 消息框创建
  const messageDiv = $("<div>")
    .text(message)
    .css({
      "background": status ? "#f0f9eb" : "#fef0f0",
      "color": status ? "#67c23a" : "#f56c6c",
      "padding": "5px 20px",
      "box-shadow": "0 2px 4px rgba(0, 0, 0, 0.2)",
      "white-space": "normal",
      "wordWrap": "break-word",
      "overflowWrap": "break-word",
      "hyphens": "auto",
      "border-radius": "5px",
      "max-width": "100%", // 设置消息框的最大宽度
    })
    .appendTo(containerDiv);
  // 延迟后消息框销毁
  messageDiv
    .fadeIn()
    .delay(delayTime)
    .fadeOut(function () {
      containerDiv.remove();
      offsetY -= 50; // 删除后减少50px的垂直偏移量
    });

  offsetY += 50; // 增加消息框的高度和间距
}

/* ================================================== 自定义方法结束 ================================================== */