Greasyfork Beautify

优化导航栏样式 / 脚本列表改为卡片布局 / 代码高亮(atom-one-dark + vscode 风格) 等……融入式美化,自然、优雅,没有突兀感,仿佛页面原本就是如此……(更多优化逐步完善中!)

  1. // ==UserScript==
  2. // @name Greasyfork Beautify
  3. // @namespace https://github.com/kiccer
  4. // @version 1.6.4
  5. // @description 优化导航栏样式 / 脚本列表改为卡片布局 / 代码高亮(atom-one-dark + vscode 风格) 等……融入式美化,自然、优雅,没有突兀感,仿佛页面原本就是如此……(更多优化逐步完善中!)
  6. // @description:en Optimize the navigation bar style / script list to card layout / code highlighting (atom-one-dark + vscode style), etc. Into the style of beautification, more natural, more elegant, no sense of abruptness, as if the page is originally so. (more optimization in progress!)
  7. // @author kiccer<1072907338@qq.com>
  8. // @supportURL https://github.com/kiccer/TampermonkeyScripts/issues
  9. // @license MIT
  10. // @match https://gf.qytechs.cn/*
  11. // @match https://sleazyfork.org/*
  12. // @icon https://gf.qytechs.cn/packs/media/images/blacklogo96-b2384000fca45aa17e45eb417cbcbb59.png
  13. // @require https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.min.js
  14. // @require https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.9/index.min.js
  15. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
  16. // @require https://cdn.bootcdn.net/ajax/libs/javascript-detect-element-resize/0.5.3/jquery.resize.min.js
  17. // @require https://cdn.bootcdn.net/ajax/libs/less.js/4.1.3/less.min.js
  18. // @require https://cdn.bootcdn.net/ajax/libs/highlight.js/11.5.1/highlight.min.js
  19. // @require https://cdn.bootcdn.net/ajax/libs/highlight.js/11.5.1/languages/javascript.min.js
  20. // @require https://gf.qytechs.cn/scripts/447149-checkversion/code/checkVersion.js?version=1065242
  21. // @resource normalize.css https://cdn.bootcdn.net/ajax/libs/normalize/8.0.1/normalize.min.css
  22. // @resource element-ui.css https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.9/theme-chalk/index.min.css
  23. // @resource element-icons https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.9/theme-chalk/fonts/element-icons.ttf
  24. // @resource atom-one-dark.css https://cdn.bootcdn.net/ajax/libs/highlight.js/11.5.1/styles/atom-one-dark.min.css
  25. // @run-at document-start
  26. // @grant GM_info
  27. // @grant GM_setValue
  28. // @grant GM_getValue
  29. // @grant GM_addStyle
  30. // @grant GM_getResourceURL
  31. // @grant GM_getResourceText
  32. // @grant GM_registerMenuCommand
  33. // ==/UserScript==
  34.  
  35. /* globals $ less Vue hljs checkVersion ELEMENT */
  36.  
  37. Vue.use(ELEMENT)
  38.  
  39. if (/\(Development\)$/i.test(GM_info.script.name)) {
  40. Vue.config.devtools = true
  41. }
  42.  
  43. // 默认设置
  44. const defaultSettings = {
  45. script_list_columns_num: 2,
  46. show_install_button_in_card: true,
  47. show_version_info_in_card: true
  48. }
  49.  
  50. // 获取设置
  51. const getSettings = () => {
  52. return Object.assign(
  53. {},
  54. defaultSettings,
  55. JSON.parse(GM_getValue('formData') || '{}')
  56. )
  57. }
  58.  
  59. const VERSION = GM_info.script.version
  60. const settings = getSettings()
  61.  
  62. // 样式注入
  63. GM_addStyle(GM_getResourceText('normalize.css'))
  64. GM_addStyle(GM_getResourceText('element-ui.css'))
  65. GM_addStyle(GM_getResourceText('atom-one-dark.css'))
  66.  
  67. const lessOptions = {}
  68.  
  69. const lessInput = `
  70. // --------------------------------------------- 变量
  71.  
  72. @nav_height: 60px;
  73. @user_container_height: 24px;
  74.  
  75. // --------------------------------------------- 混合宏
  76.  
  77. .ellipsis (@lines) {
  78. display: -webkit-box;
  79. -webkit-box-orient: vertical;
  80. overflow: hidden;
  81. line-height: 1.5;
  82. -webkit-line-clamp: @lines;
  83. }
  84.  
  85. // --------------------------------------------- 通用样式
  86.  
  87. * {
  88. box-sizing: border-box;
  89. outline: none;
  90. }
  91.  
  92. body {
  93. line-height: 1.5;
  94. min-height: 100vh;
  95. background-color: #f7f7f7;
  96.  
  97. > .width-constraint {
  98. min-height: 100vh;
  99. background-color: #fff;
  100. padding: 20px;
  101. padding-top: calc(@nav_height + @user_container_height + 20px);
  102. .text-content {
  103. border: 0;
  104. box-shadow: none;
  105. padding: 0;
  106. }
  107. }
  108. }
  109.  
  110. a {
  111. color: rgb(38, 38, 38);
  112. text-decoration: none;
  113.  
  114. &:hover {
  115. text-decoration: underline;
  116. }
  117.  
  118. &:visited {
  119. color: rgb(38, 38, 38);
  120. }
  121. }
  122.  
  123. // --------------------------------------------- element-ui
  124.  
  125. // 解决 element-icons 图标引用不到问题
  126. @font-face {
  127. font-family: element-icons;
  128. src: url(${GM_getResourceURL('element-icons')}),
  129. }
  130.  
  131. // --------------------------------------------- 代码高亮
  132.  
  133. .code-container {
  134. background-color: #282c34;
  135. border-radius: 8px;
  136. max-height: 100%;
  137. overflow: visible;
  138.  
  139. // 定义滚动条
  140. ::-webkit-scrollbar {
  141. width: 14px;
  142. height: 14px;
  143. background-color: transparent;
  144. }
  145.  
  146. // 定义滚动条轨道
  147. ::-webkit-scrollbar-track {
  148. background-color: transparent;
  149. }
  150.  
  151. // 定义滑块
  152. ::-webkit-scrollbar-thumb {
  153. background-color: rgba(78, 86, 102, 0);
  154. }
  155.  
  156. // 定义边角
  157. ::-webkit-scrollbar-corner {
  158. background-color: transparent;
  159. }
  160.  
  161. &:hover {
  162. ::-webkit-scrollbar-thumb {
  163. background-color: rgba(78, 86, 102, .5);
  164. }
  165. }
  166.  
  167. ::selection {
  168. background-color: rgb(51, 56, 66);
  169. }
  170.  
  171. pre {
  172. code {
  173. padding: 0;
  174. font-family: Consolas;
  175. cursor: text;
  176. overflow: auto;
  177.  
  178. .marker {
  179. display: inline-block;
  180. color: #636d83;
  181. text-align: right;
  182. padding-right: 20px;
  183. user-select: none;
  184. cursor: auto;
  185. }
  186. }
  187. }
  188. }
  189.  
  190. // --------------------------------------------- 页码
  191.  
  192. .pagination {
  193. margin-top: 20px !important;
  194. user-select: none;
  195.  
  196. > * {
  197. padding: 0 .5em !important;
  198. min-width: 2em;
  199. height: 2em;
  200. line-height: 2;
  201. text-align: center;
  202. text-decoration: none !important;
  203. }
  204.  
  205. > a {
  206. background-color: #f7f7f7 !important;
  207.  
  208. &:hover {
  209. background-color: #e1e1e1 !important;
  210. }
  211. }
  212. }
  213.  
  214. // --------------------------------------------- 输入框
  215.  
  216. input[type=search] {
  217. padding: 3px 6px;
  218. padding-right: 2.4em !important;
  219. border: 1px solid #bfbfbf;
  220. border-radius: 4px;
  221. }
  222.  
  223. form {
  224. input.search-submit {
  225. top: 50% !important;
  226. transform: translateY(-50%);
  227. cursor: pointer;
  228. }
  229. }
  230.  
  231. .home-search {
  232. margin-bottom: 20px;
  233. }
  234.  
  235. .sidebar-search {
  236. margin-bottom: 20px;
  237.  
  238. input[type="search"] {
  239. margin: 0;
  240. }
  241. }
  242.  
  243. // --------------------------------------------- header
  244.  
  245. #main-header {
  246. background-color: #000;
  247. background-image: none;
  248. width: 100%;
  249. padding: 0;
  250. position: fixed;
  251. top: 0;
  252. z-index: 1;
  253. user-select: none;
  254. box-shadow: 0 0 5px 2px rgb(0 0 0 / 50%);
  255.  
  256. .width-constraint {
  257. display: flex;
  258. justify-content: space-between;
  259. height: 100%;
  260. padding: 0;
  261.  
  262. #site-name {
  263. display: flex;
  264. align-items: center;
  265. a {
  266. display: block;
  267. }
  268.  
  269. img {
  270. width: auto;
  271. height: 50px;
  272. }
  273.  
  274. #site-name-text {
  275. margin-left: 10px;
  276.  
  277. h1 {
  278. font-size: 36px;
  279. }
  280. }
  281. }
  282. }
  283.  
  284. #user-container {
  285. width: 100%;
  286. height: @user_container_height;
  287. background-color: #343434;
  288.  
  289. .user-main {
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. margin: auto;
  294. max-width: 1200px;
  295. height: @user_container_height;
  296. padding-right: 10px;
  297.  
  298. @media screen and (max-width: 1228px) {
  299. margin: auto 1.2vw;
  300. }
  301.  
  302. .script-version {
  303. font-size: 12px;
  304. letter-spacing: 1px;
  305. font-family: "微软雅黑";
  306. font-weight: 200;
  307. color: rgba(255, 255, 255, .3);
  308.  
  309. .has-new-version {
  310. color: lime;
  311. margin-left: 5px;
  312. }
  313. }
  314.  
  315. .login-info {
  316. font-size: 14px;
  317. }
  318. }
  319. }
  320. }
  321.  
  322. #site-nav {
  323. width: 0;
  324. height: 0;
  325. border: 0;
  326. padding: 0;
  327. overflow: hidden;
  328. position: relative;
  329. }
  330.  
  331. #site-nav-vue {
  332. display: flex;
  333. .nav-item {
  334. line-height: @nav_height;
  335. padding: 0 10px;
  336. transition: all .2s ease;
  337. text-decoration: none;
  338. position: relative;
  339. white-space: nowrap;
  340.  
  341. &:hover {
  342. background-color: rgba(255, 255, 255, .2);
  343.  
  344. .sub-nav {
  345. display: flex;
  346. }
  347. }
  348.  
  349. .sub-nav {
  350. display: none;
  351. flex-direction: column;
  352. position: absolute;
  353. top: 100%;
  354. right: 0;
  355. background-color: rgba(0, 0, 0, .8);
  356.  
  357. .nav-item {
  358. line-height: 40px;
  359. }
  360. }
  361. }
  362. }
  363.  
  364. // --------------------------------------------- 脚本列表
  365.  
  366. #user-library-script-list,
  367. #user-script-list,
  368. #user-deleted-script-list,
  369. #browse-script-list {
  370. display: grid;
  371. grid-template-columns: repeat(${settings.script_list_columns_num}, 1fr);
  372. grid-gap: 20px;
  373. border: 0;
  374. box-shadow: none;
  375.  
  376. @media screen and (max-width: 1228px) {
  377. grid-template-columns: repeat(1, 1fr);
  378. }
  379.  
  380. li {
  381. border: 1px solid #bbb;
  382. box-shadow: 0 0 5px #ddd;
  383. border-radius: 5px;
  384. padding: 10px;
  385. position: relative;
  386. word-break: break-all;
  387.  
  388. a.script-link {
  389. .ellipsis(2);
  390. height: calc(3em + 8px);
  391. font-size: 16px;
  392. margin: 4px -10px 4px -14px;
  393. padding: 4px 10px;
  394. background: linear-gradient(#fff, #eee);
  395. border-left: 7px solid #800;
  396. box-shadow: inset 0 1px rgb(0 0 0 / 10%), inset 0 -1px rgb(0 0 0 / 10%);
  397. }
  398.  
  399. & > article {
  400. & > h2 {
  401. & > .badge,
  402. & > .name-description-separator,
  403. & > strong {
  404. display: none; // 兼容 “大人的Greasyfork”
  405. }
  406.  
  407. .script-description {
  408. .ellipsis(3);
  409. text-indent: 2em;
  410. margin: 10px 0 10px;
  411. height: 4.5em;
  412. font-size: 14px;
  413. strong,
  414. #install-area {
  415. display: none; // 兼容 “大人的Greasyfork”
  416. }
  417. }
  418. }
  419. }
  420.  
  421. .inline-script-stats {
  422. padding: 10px 0;
  423. // margin-bottom: 10px;
  424. border-top: 1px solid #ebebeb;
  425. // border-bottom: 1px solid #ebebeb;
  426.  
  427. dt {
  428. // width: 40%;
  429. }
  430.  
  431. dd {
  432. width: 60%;
  433. }
  434. }
  435.  
  436. .install-link {
  437. float: right;
  438. font-size: 12px;
  439.  
  440. &:hover {
  441. transition: box-shadow .2s;
  442. box-shadow: 0 8px 16px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
  443. }
  444.  
  445. &.lum-lightbox-loader {
  446. border-left: 10px solid #005200;
  447. border-right: 10px solid #005200;
  448. position: relative;
  449. min-height: 30px;
  450. min-width: 70px;
  451.  
  452. &::before,
  453. &::after {
  454. width: 1em;
  455. height: 1em;
  456. margin-top: -0.5em;
  457. border-radius: 1em;
  458. background: hsla(0, 0%, 100%, .5);
  459. }
  460. }
  461. }
  462. }
  463. }
  464.  
  465. // --------------------------------------------- 列表右侧选项组
  466.  
  467. .list-option-groups {
  468. #language-selector {
  469. + * {
  470. margin-top: 10px;
  471. }
  472. #language-selector-locale {
  473. width: 100%;
  474. border: 1px solid #bfbfbf;
  475. border-radius: 4px;
  476. }
  477. }
  478. }
  479. `
  480.  
  481. less.render(lessInput, lessOptions).then(output => {
  482. // output.css = string of css
  483. // output.map = string of sourcemap
  484. // output.imports = array of string filenames of the imports referenced
  485.  
  486. GM_addStyle(output.css)
  487. }, err => {
  488. console.error(err)
  489. })
  490.  
  491. // 查看代码页面简化,隐藏信息
  492. if (/https:\/\/greasyfork\.org\/[a-zA-Z-]+\/scripts\/\d+-.+\/code/.test(location.href)) {
  493. GM_addStyle(`
  494. #script-info header,
  495. #install-area,
  496. #script-feedback-suggestion {
  497. display: none;
  498. }
  499.  
  500. #script-content {
  501. margin-top: 16px;
  502. }
  503.  
  504. .code-container pre code {
  505. max-height: calc(100vh - 267px);
  506. }
  507. `)
  508. }
  509.  
  510. // 脚本卡片美化
  511. function scriptCardBeautify () {
  512. $(`
  513. #user-script-list li[data-script-id],
  514. #user-deleted-script-list li[data-script-id],
  515. #browse-script-list li[data-script-id]
  516. `).each((i, n) => {
  517. const card = $(n)
  518. const href = card.find('> article a.script-link').attr('href')
  519.  
  520. // TODO 显示脚本图标 (看情况,如果加了图标不好布局就算了)
  521.  
  522. // 判断这个卡片是否已经美化过了
  523. const hasVersionTag = card.find('.script-show-version').length > 0
  524. const hasDownloadBtn = card.find('.install-link-copy').length > 0
  525.  
  526. if (!(hasVersionTag && hasDownloadBtn)) {
  527. // 信息占位
  528. if (settings.show_version_info_in_card) {
  529. card.find('.inline-script-stats').append(`
  530. <dt class="script-show-version"><span>...</span></dt>
  531. <dd class="script-show-version"><span></span></dd>
  532. `)
  533. }
  534.  
  535. // 下载按钮占位
  536. if (settings.show_install_button_in_card) {
  537. card.append(`
  538. <a class="install-link lum-lightbox-loader"></a>
  539. `)
  540. }
  541.  
  542. // 增加延时,避免请求过多导致 503 错误 (每秒最多 10 个请求)
  543. setTimeout(() => {
  544. $.ajax({
  545. type: 'get',
  546. url: href,
  547. success: res => {
  548. const html = $(res)
  549.  
  550. if (settings.show_version_info_in_card) {
  551. // 删除占位元素
  552. card.find('.script-show-version').remove()
  553.  
  554. // 版本
  555. card.find('.inline-script-stats').append(
  556. html.find('.script-show-version')
  557. )
  558. }
  559.  
  560. if (settings.show_install_button_in_card) {
  561. // 删除占位元素
  562. card.find('.install-link.lum-lightbox-loader').remove()
  563.  
  564. // 下载按钮
  565. card.append(
  566. html.find('#install-area .install-link').eq(0).addClass('install-link-copy')
  567. )
  568.  
  569. // 下载按钮文案根据已安装的版本号调整
  570. setTimeout(() => {
  571. const btn = card.find('.install-link-copy')[0]
  572. if (btn) checkVersion.checkForUpdatesJS(btn, true)
  573. })
  574. }
  575. }
  576. })
  577. }, (i % 5) * 2e3)
  578. }
  579. })
  580. }
  581.  
  582. // 页面获得焦点时
  583. window.addEventListener('focus', e => {
  584. // 自动更新安装状态
  585. $('.script-list li[data-script-id] a.install-link-copy').each((i, n) => {
  586. checkVersion.checkForUpdatesJS(n, true)
  587. })
  588. })
  589.  
  590. // 卡片数量记录
  591. let cardCountRecord = 0
  592.  
  593. // 兼容无限翻页插件
  594. function compatibleWithInfiniteScroll () {
  595. const cardCount = $('.script-list li[data-script-id]').length
  596.  
  597. if (cardCountRecord !== cardCount) {
  598. cardCountRecord = cardCount
  599. scriptCardBeautify()
  600. }
  601. }
  602.  
  603. // 页面加载完成后执行
  604. $(() => {
  605. // 导航
  606. const navContainer = document.createElement('div')
  607. navContainer.id = 'site-nav-vue'
  608. document.querySelector('.width-constraint').appendChild(navContainer)
  609.  
  610. // eslint-disable-next-line no-unused-vars
  611. const navApp = new Vue({
  612. el: '#site-nav-vue',
  613.  
  614. template: `
  615. <div id="site-nav-vue">
  616. <a
  617. class="nav-item"
  618. v-for="(nav, nav_i) in navList"
  619. :key="nav_i"
  620. :href="nav.url"
  621. >
  622. <span>{{ nav.label }}</span>
  623.  
  624. <div class="sub-nav" v-if="nav.list?.length">
  625. <a
  626. class="nav-item"
  627. v-for="(sub, sub_i) in nav.list"
  628. :key="sub_i"
  629. :href="sub.url"
  630. >
  631. <span>{{ sub.label }}</span>
  632. </a>
  633. </div>
  634. </a>
  635. </div>
  636. `,
  637.  
  638. data () {
  639. return {
  640. navList: [...$('#site-nav > nav > li')].map(n => {
  641. const a = $(n).find('> a')
  642. const subNav = [...$(n).find('> nav > li')]
  643.  
  644. return {
  645. label: a.text() || $(n).text(),
  646. url: a.attr('href'),
  647. list: subNav.map(m => {
  648. const subA = $(m).find('> a')
  649.  
  650. return {
  651. label: subA.text(),
  652. url: subA.attr('href')
  653. }
  654. })
  655. }
  656. })
  657. }
  658. }
  659. })
  660.  
  661. // 用户
  662. const userContainer = document.createElement('div')
  663. userContainer.id = 'user-container'
  664. document.querySelector('#main-header').appendChild(userContainer)
  665.  
  666. // eslint-disable-next-line no-unused-vars
  667. const userApp = new Vue({
  668. el: '#user-container',
  669. template: `
  670. <div id="user-container">
  671. <div class="user-main">
  672. <div class="script-version">
  673. Greasyfork Beautify v${VERSION}
  674. <a
  675. class="has-new-version"
  676. href="https://gf.qytechs.cn/scripts/446849-greasyfork-beautify/code/Greasyfork%20Beautify.user.js"
  677. v-if="lastVersion !== '${VERSION}'"
  678. >Update to v{{ lastVersion }}</a>
  679. </div>
  680.  
  681. <div class="login-info">
  682. <a
  683. :href="dom.attr('href')"
  684. >{{ dom.text() }}</a>
  685.  
  686. <template v-if="isLogin">
  687. [<a :href="logoutDom.attr('href')">{{ logoutDom.text() }}</a>]
  688. </template>
  689. </div>
  690. </div>
  691. </div>
  692. `,
  693.  
  694. data () {
  695. return {
  696. lastVersion: VERSION,
  697. dom: $('#nav-user-info .user-profile-link a, #nav-user-info .sign-in-link a'),
  698. logoutDom: $('.sign-out-link a'),
  699. isLogin: $('.sign-out-link').length > 0 // 存在登出按钮则表示已登录(不可用)
  700. }
  701. },
  702.  
  703. created () {
  704. this.versionCheck()
  705. },
  706.  
  707. methods: {
  708. versionCheck () {
  709. $.ajax({
  710. url: 'https://gf.qytechs.cn/zh-CN/scripts/446849-greasyfork-beautify',
  711. success: res => {
  712. const html = $(res)
  713. this.lastVersion = html.find('dd.script-show-version span').text()
  714. }
  715. })
  716. }
  717. }
  718. })
  719.  
  720. // 代码高亮
  721. $('pre.lang-js').each((pre_i, pre) => {
  722. // 调整代码,给一些压缩代码增加换行
  723. $(pre).find('li').append('\n')
  724. const code = $('<code class="language-javascript">').html(
  725. pre.innerHTML
  726. )
  727.  
  728. // 清空原始代码容器,放置新容器
  729. $(pre)
  730. .removeClass()
  731. .html('')
  732. .append(code)
  733.  
  734. // 高亮
  735. hljs.highlightElement(pre.querySelector('code'))
  736.  
  737. // 增加行号
  738. const html = $(pre).find('code').html()
  739. const htmlSplit = html.split('\n')
  740. const totalLines = htmlSplit.length
  741.  
  742. $(pre).find('code').html(
  743. htmlSplit.map((n, i) => `<span class="marker" style="width: calc(${String(totalLines).length * 0.5}em + 20px);">${i + 1}</span>${n}`).join('\n')
  744. )
  745. })
  746.  
  747. // 脚本列表页面,卡片
  748. if (settings.show_install_button_in_card || settings.show_version_info_in_card) {
  749. compatibleWithInfiniteScroll()
  750. $('.script-list ').resize(compatibleWithInfiniteScroll)
  751. }
  752.  
  753. // 列表右侧选项组
  754. $('.list-option-groups > *:eq(0)').before(
  755. // 设置语言
  756. $('#language-selector')
  757. )
  758.  
  759. // 注册(不可用)菜单
  760. $('body').append($('<div id="greasyfork-beautify-settings">'))
  761.  
  762. const settingsApp = new Vue({
  763. el: '#greasyfork-beautify-settings',
  764.  
  765. template: `
  766. <el-dialog
  767. width="600px"
  768. title="Greasyfork Beautify v${VERSION}"
  769. :visible.sync="show"
  770. @closed="onClosed"
  771. >
  772. <el-form
  773. size="mini"
  774. label-width="120px"
  775. :model="formData"
  776. >
  777. <el-form-item label="脚本列表列数">
  778. <el-input-number
  779. label="描述文字"
  780. v-model="formData.script_list_columns_num"
  781. :min="1"
  782. :max="2"
  783. />
  784. </el-form-item>
  785.  
  786. <el-form-item label="显示安装按钮">
  787. <el-switch
  788. v-model="formData.show_install_button_in_card"
  789. />
  790. </el-form-item>
  791.  
  792. <el-form-item label="显示版本信息">
  793. <el-switch
  794. v-model="formData.show_version_info_in_card"
  795. />
  796. </el-form-item>
  797. </el-form>
  798.  
  799. <span slot="footer" class="dialog-footer">
  800. <el-button @click="onReset">重 置</el-button>
  801. <el-button type="primary" @click="onSubmit">确 定</el-button>
  802. </span>
  803. </el-dialog>
  804. `,
  805.  
  806. data () {
  807. return {
  808. show: false,
  809. formData: getSettings()
  810. }
  811. },
  812.  
  813. methods: {
  814. onClosed () {
  815. Object.assign(this.formData, getSettings())
  816. },
  817.  
  818. onReset () {
  819. Object.assign(this.formData, defaultSettings)
  820. },
  821.  
  822. onSubmit () {
  823. GM_setValue('formData', JSON.stringify(this.formData))
  824. location.reload()
  825. }
  826. }
  827. })
  828.  
  829. GM_registerMenuCommand('美化设置', e => {
  830. settingsApp.show = true
  831. })
  832. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址