V2EX Next V2Next

V2Next - 一个好用的V2EX脚本! 已适配移动端

当前为 2024-10-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name V2EX Next V2Next
  3. // @namespace http://tampermonkey.net/
  4. // @version 10.14
  5. // @author zyronon
  6. // @description V2Next - 一个好用的V2EX脚本! 已适配移动端
  7. // @license GPL License
  8. // @icon https://v2ex-script.vercel.app/favicon.ico
  9. // @homepage https://github.com/zyronon/web-scripts
  10. // @homepageURL https://github.com/zyronon/web-scripts
  11. // @supportURL https://update.greasyfork.org/scripts/458024/V2Next.user.js
  12. // @match https://v2ex.com/
  13. // @match https://v2ex.com/?tab=*
  14. // @match https://v2ex.com/t/*
  15. // @match https://v2ex.com/recent*
  16. // @match https://v2ex.com/go/*
  17. // @match https://v2ex.com/member/*
  18. // @match https://v2ex.com/changes*
  19. // @match https://*.v2ex.com/
  20. // @match https://*.v2ex.com/?tab=*
  21. // @match https://*.v2ex.com/t/*
  22. // @match https://*.v2ex.com/recent*
  23. // @match https://*.v2ex.com/go/*
  24. // @match https://*.v2ex.com/member/*
  25. // @match https://*.v2ex.com/changes*
  26. // @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
  27. // @require https://cdn.jsdelivr.net/npm/vue@3.4.14/dist/vue.global.prod.min.js
  28. // @grant GM_addStyle
  29. // @grant GM_openInTab
  30. // @grant GM_registerMenuCommand
  31. // ==/UserScript==
  32.  
  33. (o=>{if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const r=document.createElement("style");r.textContent=o,document.head.append(r)})(' .tip[data-v-ee672411]{position:fixed;font-size:1.6rem;z-index:9999;max-width:10rem;border-radius:.5rem;padding:1rem;color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.v-enter-active[data-v-e7c0fbef],.v-leave-active[data-v-e7c0fbef]{transition:opacity .3s ease}.v-enter-from[data-v-e7c0fbef],.v-leave-to[data-v-e7c0fbef]{opacity:0}.username[data-v-e7c0fbef]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-e7c0fbef]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-e7c0fbef]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-e7c0fbef]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-e7c0fbef]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-e7c0fbef]{display:inline}.my-tag .remove[data-v-e7c0fbef]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-e7c0fbef]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-e7c0fbef]{margin-left:.5rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-e7c0fbef]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--color-top-reply-wrap-bg: #f2f3f5;--color-top-reply-wrap-line: #d2d2d2}html.dark[data-v-e7c0fbef]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e;--color-top-reply-wrap-bg: #212f3e;--color-top-reply-wrap-line: #3b536d}html[data-v-e7c0fbef],body[data-v-e7c0fbef]{font-size:62.5%}[data-v-e7c0fbef]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-e7c0fbef]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-e7c0fbef]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-e7c0fbef]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-e7c0fbef]{justify-content:flex-end}.flex-center[data-v-e7c0fbef]{justify-content:center}.p1[data-v-e7c0fbef]{padding:1rem}.p2[data-v-e7c0fbef]{padding:2rem}.p0[data-v-e7c0fbef]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-e7c0fbef]{text-underline-offset:.7ex;text-decoration:underline 1px}a[data-v-e7c0fbef]{text-decoration:none;cursor:pointer}a[data-v-e7c0fbef]:hover{text-decoration:underline}.tool[data-v-e7c0fbef]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.2rem}.tool>svg[data-v-e7c0fbef]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-e7c0fbef]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-e7c0fbef]{cursor:default}.tool.no-hover[data-v-e7c0fbef]:hover{background:unset!important}.tool.disabled[data-v-e7c0fbef]{cursor:not-allowed}.tool.disabled[data-v-e7c0fbef]:hover{background:unset!important}.my-node[data-v-e7c0fbef]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-e7c0fbef]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-e7c0fbef]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-e7c0fbef]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-e7c0fbef]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-e7c0fbef]{position:fixed;z-index:1001;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-e7c0fbef]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-e7c0fbef]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-e7c0fbef]{position:relative}.modal .mask[data-v-e7c0fbef]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-e7c0fbef]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-e7c0fbef]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-e7c0fbef]:first-child{border-left:none}.radio-group2 .active[data-v-e7c0fbef]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-e7c0fbef]{position:relative;display:inline-flex;justify-content:center}input[data-v-e7c0fbef]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-e7c0fbef]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-e7c0fbef]:focus{border:1px solid var(--color-active)}.danger[data-v-e7c0fbef]{color:red!important}.pop-confirm-content[data-v-e7c0fbef]{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:1003}.pop-confirm-content .text[data-v-e7c0fbef]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-e7c0fbef]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.switch[data-v-e7c0fbef]{width:4.5rem;height:2.2rem;border-radius:2rem;position:relative;display:flex;align-items:center;background:var(--color-swtich-bg);transition:all .3s}.switch.active[data-v-e7c0fbef]{background:var(--color-active)}.switch.active[data-v-e7c0fbef]:before{right:.2rem}.switch[data-v-e7c0fbef]:before{position:absolute;content:" ";transition:all .3s;right:calc(100% - 2rem);width:1.8rem;height:1.8rem;background:white;border-radius:50%}.display-type[data-v-e4f684be]{height:3rem;padding:0 .3rem;background:var(--color-sp-btn-bg);border-radius:1rem;display:flex;font-size:1.4rem;align-items:center;color:#a9a9a9}.display-type .type[data-v-e4f684be]{border-radius:.8rem;padding:0 1.3rem;height:2.8rem;align-items:center;display:flex;position:relative;cursor:pointer}.display-type .type.active[data-v-e4f684be]{background:var(--color-second-bg);color:var(--color-font-pure);box-shadow:0 0 6px 0 var(--color-tooltip-shadow)}.display-type .type-list[data-v-e4f684be]{position:absolute;background:var(--color-sp-btn-bg);right:0;top:3rem;font-size:1.4rem;box-shadow:0 0 6px 0 var(--color-tooltip-shadow);border-radius:.6rem;z-index:9;color:var(--color-font)}.display-type .type-list .item[data-v-e4f684be]{word-break:keep-all;padding:.8rem 1rem;cursor:pointer}.display-type .type-list .item.active[data-v-e4f684be],.display-type .type-list .item[data-v-e4f684be]:hover{color:var(--color-font-pure)}.display-type svg[data-v-e4f684be]{width:1.5rem}.loading[data-v-2697baa2]{border:2px solid;border-color:var(--color-loading-2) var(--color-loading-1) var(--color-loading-1) var(--color-loading-1);border-radius:100%;animation:circle-2697baa2 infinite 1s linear;width:2rem;height:2rem}.loading.small[data-v-2697baa2]{width:1.2rem;height:1.2rem}.loading.large[data-v-2697baa2]{width:3rem;height:3rem}@keyframes circle-2697baa2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.base-button[data-v-5a7d79ba]{cursor:pointer;border-radius:.6rem;padding:0 1.5rem;display:inline-flex;align-items:center;justify-content:center;transition:all .3s;height:3.6rem;line-height:1;position:relative}.base-button .loading[data-v-5a7d79ba]{position:absolute}.base-button.disabled[data-v-5a7d79ba]{opacity:.6;cursor:not-allowed;-webkit-user-select:none;user-select:none}.base-button.small[data-v-5a7d79ba]{height:3rem}.base-button.small>span[data-v-5a7d79ba]{font-size:1.3rem}.base-button.large[data-v-5a7d79ba]{height:5rem;font-size:1.8rem;padding:0 2.2rem}.base-button.large>span[data-v-5a7d79ba]{font-size:1.8rem}.base-button[data-v-5a7d79ba]:hover:not(.link){opacity:.7}.base-button.primary[data-v-5a7d79ba]{background:var(--color-active)}.base-button.primary>span[data-v-5a7d79ba]{color:#fff}.base-button.gary[data-v-5a7d79ba]{background:#4b5563}.base-button.link[data-v-5a7d79ba]{border-radius:0;border-bottom:2px solid transparent}.base-button.link>span[data-v-5a7d79ba]{color:var(--color-font-8)}.base-button.link[data-v-5a7d79ba]:hover{border-bottom:2px solid var(--color-font-8)}.base-button.active[data-v-5a7d79ba]{opacity:.4}.key-notice[data-v-5a7d79ba]{margin-left:1rem;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:#fff}.key-notice .key[data-v-5a7d79ba]{transform:scale(.8)}.setting-modal .modal-root[data-v-386b43d0]{z-index:9;background:var(--color-main-bg);border-radius:1rem;font-size:1.4rem;overflow:hidden;color:var(--color-font-pure)}.setting-modal .modal-root .modal-header[data-v-386b43d0]{padding:1.4rem;display:flex;justify-content:center;position:relative}.setting-modal .modal-root .modal-header .title[data-v-386b43d0]{font-size:2.2rem;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header svg[data-v-386b43d0]{position:absolute;right:1rem;cursor:pointer;font-size:2.6rem}.setting-modal .modal-root .body[data-v-386b43d0]{width:60rem}.setting-modal .modal-root .body .modal-content[data-v-386b43d0]{background:var(--color-second-bg);flex:1;height:100%;box-sizing:border-box;padding:1rem 1rem 1rem 2rem;font-size:1.6rem;text-align:left;line-height:1.6}.setting-modal .modal-root .body .btns[data-v-386b43d0]{margin:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.setting-modal .modal-root[data-v-9e40bff6]{z-index:9;background:var(--color-main-bg);border-radius:1rem;font-size:1.4rem;overflow:hidden;color:var(--color-font-pure)}.setting-modal .modal-root .modal-header[data-v-9e40bff6]{padding:2.4rem;display:flex;justify-content:space-between}.setting-modal .modal-root .modal-header .title[data-v-9e40bff6]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header svg[data-v-9e40bff6]{cursor:pointer;font-size:2.6rem}.setting-modal .modal-root .body[data-v-9e40bff6]{width:45vw;height:70vh;display:flex}.setting-modal .modal-root .body .left[data-v-9e40bff6]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-size:1.8rem}.setting-modal .modal-root .body .left .tabs[data-v-9e40bff6]{padding:1rem 2rem;display:flex;flex-direction:column;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab[data-v-9e40bff6]{cursor:pointer;padding:1rem 1.5rem;border-radius:.8rem;display:flex;align-items:center;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab.active[data-v-9e40bff6]{background:var(--color-item-bg)}.setting-modal .modal-root .body .left .icons[data-v-9e40bff6]{display:flex;gap:1rem;margin-bottom:2rem;font-size:2.4rem}.setting-modal .modal-root .body .modal-content[data-v-9e40bff6]{background:var(--color-second-bg);flex:1;height:100%;box-sizing:border-box;padding:1rem 1rem 1rem 2rem;border-radius:1rem;display:flex}.setting-modal .modal-root .body .modal-content .scroll[data-v-9e40bff6]{flex:1;padding-right:1rem;overflow:auto}.setting-modal .modal-root .body .modal-content .scroll .row[data-v-9e40bff6]{min-height:5rem;display:flex;justify-content:space-between;align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper[data-v-9e40bff6]{height:3rem;flex:1;display:flex;justify-content:flex-end;align-items:center;gap:var(--space)}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper span[data-v-9e40bff6]{text-align:right;font-size:1.4rem;color:gray}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key[data-v-9e40bff6]{align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key input[data-v-9e40bff6]{width:15rem;box-sizing:border-box;margin-right:1rem;height:2.8rem;outline:none;font-size:1.6rem;border:1px solid gray;border-radius:.3rem;padding:0 .5rem;background:var(--color-second-bg);color:var(--color-font-1)}.setting-modal .modal-root .body .modal-content .scroll .row .main-title[data-v-9e40bff6]{font-size:2.2rem;font-weight:700;color:var(--color-font-8)}.setting-modal .modal-root .body .modal-content .scroll .row .item-title[data-v-9e40bff6]{font-size:1.8rem}.setting-modal .modal-root .body .modal-content .scroll .desc[data-v-9e40bff6]{margin-bottom:1rem;font-size:1.4rem;text-align:left;color:var(--color-font)}.setting-modal .modal-root .body .modal-content .scroll .project-desc[data-v-9e40bff6]{text-align:start;font-size:1.6rem;padding-bottom:10rem}.setting-modal .modal-root .body .modal-content .scroll .line[data-v-9e40bff6]{border-bottom:1px solid #c4c3c3}.sub-content[data-v-9e40bff6]{padding:0 2rem 1rem;border-radius:1rem;background:#f3f3f3;margin-bottom:1rem}.Author[data-v-64aa1930]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative}.Author.expand[data-v-64aa1930]{margin-bottom:0}.Author .Author-left[data-v-64aa1930]{display:flex;align-items:center;max-width:65%;word-break:break-all}.Author .Author-left .username[data-v-64aa1930]{font-size:1.4rem;margin-right:.6rem}.Author .Author-left .expand-icon[data-v-64aa1930]{cursor:pointer;margin-right:.6rem;width:2rem;height:2rem;transform:rotate(90deg)}.Author .Author-left .avatar[data-v-64aa1930]{margin-right:.8rem;display:flex}.Author .Author-left .avatar img[data-v-64aa1930]{width:2.8rem;height:2.8rem;border-radius:.4rem}.Author .Author-left .texts[data-v-64aa1930]{flex:1}.Author .Author-left .owner[data-v-64aa1930]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:.6rem;transform:scale(.8)}.Author .Author-left .dup[data-v-64aa1930]{display:inline-block;background-color:transparent;color:red;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid red;font-size:1.2rem;font-weight:700;margin-right:.6rem;transform:scale(.8)}.Author .Author-left .mod[data-v-64aa1930]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:.6rem}.Author:hover .add-tag[data-v-64aa1930]{display:inline-block}.Author .Author-right[data-v-64aa1930]{position:absolute;right:0;display:flex;align-items:center}.Author .Author-right .toolbar[data-v-64aa1930]{display:flex;align-items:center;color:var(--color-gray);opacity:0;gap:.2rem}.Author .Author-right .toolbar[data-v-64aa1930]:hover{opacity:1}.post-editor-wrapper[data-v-7fe2eb8d]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s;color:var(--color-font)}.post-editor-wrapper.reply-post .post-editor[data-v-7fe2eb8d]{border:1px solid var(--color-line)}.post-editor-wrapper.reply-post.isFocus .post-editor[data-v-7fe2eb8d]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment[data-v-7fe2eb8d]{border-radius:var(--box-border-radius);overflow:hidden;border:1px solid var(--color-line)}.post-editor-wrapper.reply-comment.isFocus[data-v-7fe2eb8d]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment .toolbar[data-v-7fe2eb8d]{background:var(--color-editor-toolbar)}.post-editor-wrapper .post-editor[data-v-7fe2eb8d]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent}.post-editor-wrapper .toolbar[data-v-7fe2eb8d]{box-sizing:border-box;padding:.5rem 1rem;width:100%;position:relative;display:flex;justify-content:space-between;align-items:center}.post-editor-wrapper .toolbar .left[data-v-7fe2eb8d]{display:flex;align-items:center;gap:1rem;font-size:2.6rem}.post-editor-wrapper .toolbar .left svg[data-v-7fe2eb8d]{cursor:pointer}.post-editor-wrapper .toolbar .left .upload[data-v-7fe2eb8d]{width:2.6rem;height:2.6rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.post-editor-wrapper .toolbar .left .upload input[data-v-7fe2eb8d]{width:2.6rem;height:2.6rem;cursor:pointer;position:absolute;opacity:0}.post-editor-wrapper .toolbar span[data-v-7fe2eb8d]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-7fe2eb8d]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent;position:absolute;top:0;z-index:-100}.post-editor-wrapper .emoticon-pack[data-v-7fe2eb8d]{z-index:999999999;border-radius:1rem;padding:1rem;width:31rem;max-width:31rem;height:30rem;max-height:30rem;overflow:auto;background:var(--color-third-bg);border:1px solid var(--color-font-3);box-shadow:0 9px 24px -3px #0000000f,0 4px 8px -1px #0000001f;position:fixed;bottom:11rem;left:14rem}.post-editor-wrapper .emoticon-pack svg[data-v-7fe2eb8d]{cursor:pointer;position:absolute;right:.8rem;font-size:2.4rem}.post-editor-wrapper .emoticon-pack .list[data-v-7fe2eb8d]{margin:1rem 0;display:flex;flex-wrap:wrap}.post-editor-wrapper .emoticon-pack img[data-v-7fe2eb8d]{cursor:pointer;width:calc(100% / 7);padding:.5rem;box-sizing:border-box}.post-editor-wrapper .emoticon-pack span[data-v-7fe2eb8d]{width:calc(100% / 7);display:inline-block;cursor:pointer;font-size:2.3rem;text-align:center}.v-enter-active[data-v-727ada32],.v-leave-active[data-v-727ada32]{transition:opacity .3s ease}.v-enter-from[data-v-727ada32],.v-leave-to[data-v-727ada32]{opacity:0}.username[data-v-727ada32]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-727ada32]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-727ada32]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-727ada32]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-727ada32]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-727ada32]{display:inline}.my-tag .remove[data-v-727ada32]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-727ada32]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-727ada32]{margin-left:.5rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-727ada32]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--color-top-reply-wrap-bg: #f2f3f5;--color-top-reply-wrap-line: #d2d2d2}html.dark[data-v-727ada32]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e;--color-top-reply-wrap-bg: #212f3e;--color-top-reply-wrap-line: #3b536d}html[data-v-727ada32],body[data-v-727ada32]{font-size:62.5%}[data-v-727ada32]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-727ada32]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-727ada32]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-727ada32]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-727ada32]{justify-content:flex-end}.flex-center[data-v-727ada32]{justify-content:center}.p1[data-v-727ada32]{padding:1rem}.p2[data-v-727ada32]{padding:2rem}.p0[data-v-727ada32]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-727ada32]{text-underline-offset:.7ex;text-decoration:underline 1px}a[data-v-727ada32]{text-decoration:none;cursor:pointer}a[data-v-727ada32]:hover{text-decoration:underline}.tool[data-v-727ada32]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.2rem}.tool>svg[data-v-727ada32]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-727ada32]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-727ada32]{cursor:default}.tool.no-hover[data-v-727ada32]:hover{background:unset!important}.tool.disabled[data-v-727ada32]{cursor:not-allowed}.tool.disabled[data-v-727ada32]:hover{background:unset!important}.my-node[data-v-727ada32]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-727ada32]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-727ada32]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-727ada32]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-727ada32]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-727ada32]{position:fixed;z-index:1001;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-727ada32]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-727ada32]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-727ada32]{position:relative}.modal .mask[data-v-727ada32]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-727ada32]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-727ada32]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-727ada32]:first-child{border-left:none}.radio-group2 .active[data-v-727ada32]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-727ada32]{position:relative;display:inline-flex;justify-content:center}input[data-v-727ada32]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-727ada32]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-727ada32]:focus{border:1px solid var(--color-active)}.danger[data-v-727ada32]{color:red!important}.pop-confirm-content[data-v-727ada32]{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:1003}.pop-confirm-content .text[data-v-727ada32]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-727ada32]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.html-wrapper[data-v-727ada32]{position:relative}.html-wrapper .mask[data-v-727ada32]{max-height:90rem;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 80%,transparent)}.html-wrapper .expand[data-v-727ada32]{position:absolute;z-index:1;bottom:2rem;padding:.2rem 1.5rem;border-radius:2rem;border:1px solid gray;background:white;color:gray;left:50%;transform:translate(-50%);cursor:pointer}.top-sub-comment[data-v-d3f8c94b]{width:100%;box-sizing:border-box;margin-top:.8rem;display:flex;position:relative}.top-sub-comment .expand-line[data-v-d3f8c94b]{width:1.6rem;position:relative}.top-sub-comment .expand-line[data-v-d3f8c94b]:after{position:absolute;left:50%;top:2%;content:" ";height:98%;width:0;border-right:1px solid var(--color-top-reply-wrap-line)}.top-sub-comment .right[data-v-d3f8c94b]{flex:1;width:calc(100% - 3rem)}.top-sub-comment .right .w .post-editor-wrapper[data-v-d3f8c94b]{margin-top:1rem}.top-sub-comment[data-v-d3f8c94b] .avatar{display:none!important}.top-sub-comment.top-sub-reply[data-v-d3f8c94b]:first-child{margin-top:0}.top-sub-comment.top-sub-reply>.expand-line[data-v-d3f8c94b]{width:1rem}.top-sub-comment.top-sub-reply>.expand-line[data-v-d3f8c94b]:after{display:none}.comment[data-v-67fa2f3f]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-67fa2f3f]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-67fa2f3f]{background:rgba(255,255,0,.3)!important}.comment.isSimple .avatar[data-v-67fa2f3f],.comment.isSimple .expand-line[data-v-67fa2f3f]{display:none}.comment.isSimple .simple-wrapper[data-v-67fa2f3f]{padding-left:2.8rem}.comment.isSimple .w[data-v-67fa2f3f]{padding-left:0!important;padding-top:.5rem}.comment .comment-content-w .more[data-v-67fa2f3f]{text-align:center;margin:2rem 0}.comment .comment-content[data-v-67fa2f3f]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-67fa2f3f]{cursor:pointer;margin-top:.6rem;width:2rem;min-width:2rem;position:relative}.comment .comment-content .expand-line[data-v-67fa2f3f]:after{position:absolute;left:50%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .expand-line[data-v-67fa2f3f]:hover:after{border-right:2px solid var(--color-active)}.comment .comment-content .right[data-v-67fa2f3f]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-67fa2f3f]{padding-left:1rem}.comment .comment-content .right .w .post-editor-wrapper[data-v-67fa2f3f]{margin-top:1rem}.wrong-wrapper[data-v-67fa2f3f]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper span[data-v-67fa2f3f]{cursor:pointer}.wrong-wrapper .del-line[data-v-67fa2f3f]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-67fa2f3f]{margin-left:.5rem}.wrong-wrapper .warning[data-v-67fa2f3f]{border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1;padding:1rem 0;margin-top:1rem;font-size:1.2rem;color:red}.reply-count[data-v-67fa2f3f]{padding:.8rem 0 .4rem;border-radius:.2rem;font-size:1.3rem;display:flex;align-items:center;color:gray;gap:1rem;cursor:pointer}.reply-count .gang[data-v-67fa2f3f]{width:2rem;height:0;border-bottom:1px solid #d5d5d5}.reply-count svg[data-v-67fa2f3f]{font-size:1rem}.top-reply-wrap[data-v-67fa2f3f]{background:var(--color-top-reply-wrap-bg);border-radius:.8rem;padding:.6rem;padding-left:0;margin-left:1rem}.toolbar[data-v-e86785e8]{border-top:1px solid var(--color-line);height:3.8rem;padding-left:.6rem;display:flex;align-items:center;color:var(--color-gray);font-size:1.2rem;gap:.5rem}.comment[data-v-4a063111]{width:100%;box-sizing:border-box;display:flex;gap:1rem;padding:1rem;border-bottom:1px solid var(--color-line)}.comment.isSimple .avatar[data-v-4a063111]{display:none}.comment.isSimple .reply_content[data-v-4a063111]{margin-top:.5rem!important}.comment .avatar[data-v-4a063111]{display:flex}.comment .avatar img[data-v-4a063111]{width:3.8rem;height:3.8rem;border-radius:.3rem}.comment .comment-body[data-v-4a063111]{flex:1;display:flex;flex-direction:column}.comment .comment-body .texts[data-v-4a063111]{display:flex;align-items:center}.comment .comment-body .reply_content[data-v-4a063111]{margin-top:1rem;max-width:calc(100% - 5rem)}.comment .isRight[data-v-4a063111]{align-items:flex-end}.comment .isRight .owner[data-v-4a063111],.comment .isRight .mod[data-v-4a063111],.comment .isRight .username[data-v-4a063111]{margin:0 0 0 1rem}.comment .Author-right[data-v-4a063111]{display:flex;flex-direction:column;align-items:center}.comment .Author-right .floor[data-v-4a063111]{margin-left:0}.comment .Author-right .jump[data-v-4a063111]{color:#929596;margin-top:.4rem;font-size:1.4rem}.comment .point[data-v-4a063111]{margin:0 .5rem;font-size:1.6rem;display:flex;gap:.5rem;align-items:center;font-weight:700;color:#000}.sticky{position:sticky;bottom:-2px;z-index:2;background:var(--box-background-hover-color)!important}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.preview-modal{position:fixed;width:100vw;height:100vh;left:0;top:-1000vh;z-index:9999}.preview-modal .close{font-size:2rem;color:#fff;position:absolute;right:2rem;top:2rem;cursor:pointer}.preview-modal .mask{position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.7);transition:all .3s}.v-enter-active[data-v-b5867eba],.v-leave-active[data-v-b5867eba]{transition:opacity .3s ease}.v-enter-from[data-v-b5867eba],.v-leave-to[data-v-b5867eba]{opacity:0}.username[data-v-b5867eba]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-b5867eba]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-b5867eba]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-b5867eba]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-b5867eba]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-b5867eba]{display:inline}.my-tag .remove[data-v-b5867eba]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-b5867eba]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-b5867eba]{margin-left:.5rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-b5867eba]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--color-top-reply-wrap-bg: #f2f3f5;--color-top-reply-wrap-line: #d2d2d2}html.dark[data-v-b5867eba]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e;--color-top-reply-wrap-bg: #212f3e;--color-top-reply-wrap-line: #3b536d}html[data-v-b5867eba],body[data-v-b5867eba]{font-size:62.5%}[data-v-b5867eba]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-b5867eba]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-b5867eba]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-b5867eba]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-b5867eba]{justify-content:flex-end}.flex-center[data-v-b5867eba]{justify-content:center}.p1[data-v-b5867eba]{padding:1rem}.p2[data-v-b5867eba]{padding:2rem}.p0[data-v-b5867eba]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-b5867eba]{text-underline-offset:.7ex;text-decoration:underline 1px}a[data-v-b5867eba]{text-decoration:none;cursor:pointer}a[data-v-b5867eba]:hover{text-decoration:underline}.tool[data-v-b5867eba]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.2rem}.tool>svg[data-v-b5867eba]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-b5867eba]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-b5867eba]{cursor:default}.tool.no-hover[data-v-b5867eba]:hover{background:unset!important}.tool.disabled[data-v-b5867eba]{cursor:not-allowed}.tool.disabled[data-v-b5867eba]:hover{background:unset!important}.my-node[data-v-b5867eba]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-b5867eba]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-b5867eba]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-b5867eba]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-b5867eba]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-b5867eba]{position:fixed;z-index:1001;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-b5867eba]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-b5867eba]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-b5867eba]{position:relative}.modal .mask[data-v-b5867eba]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-b5867eba]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-b5867eba]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-b5867eba]:first-child{border-left:none}.radio-group2 .active[data-v-b5867eba]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-b5867eba]{position:relative;display:inline-flex;justify-content:center}input[data-v-b5867eba]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-b5867eba]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-b5867eba]:focus{border:1px solid var(--color-active)}.danger[data-v-b5867eba]{color:red!important}.pop-confirm-content[data-v-b5867eba]{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:1003}.pop-confirm-content .text[data-v-b5867eba]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-b5867eba]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.Post[data-v-b5867eba]{position:unset!important;background:transparent!important;overflow:unset!important}.Post .main[data-v-b5867eba]{background:transparent!important;padding:unset!important;width:100%!important}.Post .close-btn[data-v-b5867eba]{display:none}.post-detail[data-v-b5867eba]{text-align:start;position:fixed;z-index:1002;left:0;right:0;bottom:0;top:0;background:rgba(46,47,48,.8);overflow:auto;font-size:1.4rem;display:flex;justify-content:center;flex-wrap:wrap}.post-detail[data-v-b5867eba] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-b5867eba] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .main[data-v-b5867eba]{display:flex;justify-content:flex-end;padding:3rem 8rem 15rem;background:var(--color-main-bg);position:relative;outline:none}.post-detail .main .main-wrapper[data-v-b5867eba]{width:77rem;padding-bottom:2rem;display:flex;flex-direction:column;align-items:center;position:relative}.post-detail .main .main-wrapper .post-wrapper .header:hover .add-tag[data-v-b5867eba]{display:inline-block}.post-detail .main .main-wrapper .loading-wrapper[data-v-b5867eba]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .main .main-wrapper #no-comments-yet[data-v-b5867eba]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin-bottom:2rem;box-sizing:border-box}.post-detail .main .relationReply[data-v-b5867eba]{position:fixed;width:25vw;top:6.5rem;bottom:15rem;z-index:100;transform:translate(calc(100% + 2rem));font-size:2rem;overflow:hidden}.post-detail .main .relationReply .my-cell[data-v-b5867eba]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .main .relationReply .comments[data-v-b5867eba]{max-height:calc(100% - 4.2rem);overflow:auto;background:var(--color-second-bg);border-radius:0 0 var(--box-border-radius) var(--box-border-radius)}.post-detail .main .call-list[data-v-b5867eba]{z-index:9;position:absolute;top:12rem;border:1px solid var(--color-main-bg);background:var(--color-call-list-bg);box-shadow:0 5px 15px #0000001a;overflow:auto;max-height:30rem;border-radius:var(--box-border-radius);min-width:8rem;box-sizing:content-box}.post-detail .main .call-list .call-item[data-v-b5867eba]{border-top:1px solid var(--color-main-bg);height:3rem;display:flex;padding:0 1rem;align-items:center;cursor:pointer;font-size:14px;box-sizing:border-box}.post-detail .main .call-list .call-item .select[data-v-b5867eba],.post-detail .main .call-list .call-item[data-v-b5867eba]:hover,.post-detail .main .call-list .call-item.select[data-v-b5867eba]{background:var(--color-main-bg);text-decoration:none}.post-detail .main .call-list .call-item[data-v-b5867eba]:nth-child(1){border-top:1px solid transparent}@media screen and (max-width: 1500px){.post-detail .main-wrapper[data-v-b5867eba]{width:65vw!important}}@media screen and (max-width: 1280px){.post-detail .main-wrapper[data-v-b5867eba]{width:75vw!important}}@media screen and (max-width: 960px){.post-detail .main-wrapper[data-v-b5867eba]{width:100vw!important}}.post-detail .scroll-top[data-v-b5867eba]{cursor:pointer;position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3)}.post-detail .scroll-top svg[data-v-b5867eba]{font-size:2.4rem}.post-detail .refresh[data-v-b5867eba]{cursor:pointer;position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3);bottom:23.5rem}.post-detail .refresh svg[data-v-b5867eba]{font-size:2.4rem}.post-detail .scroll-to[data-v-b5867eba]{cursor:pointer;position:fixed;border-radius:.6rem;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3);bottom:15rem;display:flex;flex-direction:column}.post-detail .scroll-to svg[data-v-b5867eba]{font-size:2.4rem}.post-detail .scroll-to input[data-v-b5867eba]{height:2.6rem;width:3.6rem;font-size:1.4rem;text-align:center;color:gray}.post-detail .msg[data-v-b5867eba]{cursor:pointer;position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3);bottom:5rem}.post-detail .msg svg[data-v-b5867eba]{font-size:2.4rem}.post-detail .close-btn[data-v-b5867eba]{color:var(--color-font-3);cursor:pointer;position:fixed;top:3rem;transform:translate(4rem);font-size:1.6rem}.post-detail .top-reply[data-v-b5867eba]{color:var(--color-font-3);cursor:pointer;font-size:2rem;display:flex}.base64_tooltip[data-v-c50fb66c]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:var(--color-third-bg);min-height:2.2rem;max-width:20rem;padding:1rem;position:fixed;z-index:9998;display:flex;align-items:center;border-radius:.5rem;cursor:pointer;line-break:anywhere;font-size:1.4rem;color:var(--color-font-8)}.base64_tooltip svg[data-v-c50fb66c]{margin-left:1rem;font-size:3rem;color:var(--color-gray)}.base64_tooltip[data-v-c50fb66c] .base-button{margin-left:1rem;margin-top:1rem}.msg[data-v-8bf692ea]{cursor:default;margin-bottom:2rem;display:flex;font-size:1.4rem;box-sizing:border-box;border-radius:var(--box-border-radius);color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.msg.success .left[data-v-8bf692ea]{background:var(--color-active)}.msg.warning .left[data-v-8bf692ea]{background:#c8c002}.msg.error .left[data-v-8bf692ea]{background:red}.msg .left[data-v-8bf692ea]{border-radius:var(--box-border-radius) 0 0 var(--box-border-radius);display:flex;align-items:center;background:var(--color-active);color:#fff;width:3.6rem;font-size:2.4rem;justify-content:center}.msg .left svg[data-v-8bf692ea]{cursor:pointer}.msg .right[data-v-8bf692ea]{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.tag-modal[data-v-eef9961d]{z-index:1003}.tag-modal .wrapper[data-v-eef9961d]{z-index:9;background:var(--color-main-bg);color:var(--color-font-8);border-radius:1rem;font-size:1.4rem;padding:2rem 4rem;width:25rem}.tag-modal .wrapper .title[data-v-eef9961d]{font-weight:700}.tag-modal .wrapper .btns[data-v-eef9961d]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.msgs[data-v-b73f4332]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.NotificationModal .modal-root[data-v-77aa374e]{z-index:9;background:var(--color-second-bg);color:var(--color-font-8);border-radius:1rem;font-size:1.4rem;width:50vw;height:80vh;display:flex;flex-direction:column;padding:1.4rem;gap:1rem}.NotificationModal .modal-root .modal-header[data-v-77aa374e]{display:flex;justify-content:space-between}.NotificationModal .modal-root .modal-header .title[data-v-77aa374e]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.NotificationModal .modal-root .modal-header i[data-v-77aa374e]{cursor:pointer;font-size:2.2rem}.NotificationModal .modal-root .modal-body[data-v-77aa374e]{padding-top:0;flex:1;gap:1rem;display:flex;flex-direction:column;overflow:hidden}.NotificationModal .modal-root .modal-body .filter[data-v-77aa374e]{display:flex;gap:1rem}.NotificationModal .modal-root .modal-body .filter div[data-v-77aa374e]{border-radius:.4rem;padding:.4rem 1rem;background:gainsboro;cursor:pointer}.NotificationModal .modal-root .modal-body .filter div.active[data-v-77aa374e]{background:#445;color:#fff}.NotificationModal .modal-root .modal-body .list-wrap[data-v-77aa374e]{flex:1;position:relative;overflow:hidden}.NotificationModal .modal-root .modal-body .list-wrap .loading-wrap[data-v-77aa374e]{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;background:rgba(255,255,255,.7)}.NotificationModal .modal-root .modal-body .list-wrap .notify-wrap[data-v-77aa374e]{overflow:auto;height:100%}.NotificationModal .modal-root .modal-body .list-wrap #notifications[data-v-77aa374e] .cell{display:none;padding:1.2rem 0}.NotificationModal .modal-root .modal-body .list-wrap #notifications[data-v-77aa374e] .cell a.node{padding:.6rem 1rem;border-radius:.4rem}.NotificationModal .modal-root .modal-body .list-wrap #notifications[data-v-77aa374e] .cell .payload{margin-top:.4rem;font-size:1.7rem}.NotificationModal .modal-root .modal-body #notifications.all[data-v-77aa374e] .cell,.NotificationModal .modal-root .modal-body #notifications.reply[data-v-77aa374e] .reply,.NotificationModal .modal-root .modal-body #notifications.star[data-v-77aa374e] .star,.NotificationModal .modal-root .modal-body #notifications.collect[data-v-77aa374e] .collect{display:block}.NotificationModal .modal-root .modal-body .footer[data-v-77aa374e]{width:100%;display:flex;align-items:center;gap:2rem}.NotificationModal .modal-root .modal-body .footer .pages[data-v-77aa374e]{flex:1}.NotificationModal .modal-root .modal-body .footer .total[data-v-77aa374e]{font-weight:700}.NotificationModal .modal-root .modal-body .footer .total span[data-v-77aa374e]{color:#d3d3d3;font-weight:400;margin-right:.4rem}.NotificationModal .modal-root .modal-body[data-v-77aa374e] .super.button{padding:0;background:unset;height:26px;width:37px}.NotificationModal .modal-root .modal-body[data-v-77aa374e] .super.button a{display:block}.NotificationModal .modal-root .modal-body[data-v-77aa374e] .super.button a:hover{text-decoration:none}.v-enter-active,.v-leave-active{transition:opacity .3s ease}.v-enter-from,.v-leave-to{opacity:0}.username{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove{display:inline}.my-tag .remove{cursor:pointer;margin-left:.5rem;display:none}.add-tag{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor{margin-left:.5rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--color-top-reply-wrap-bg: #f2f3f5;--color-top-reply-wrap-line: #d2d2d2}html.dark{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e;--color-top-reply-wrap-bg: #212f3e;--color-top-reply-wrap-line: #3b536d}html,body{font-size:62.5%}::-webkit-scrollbar{width:1rem;height:1rem}::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex{display:flex;align-items:center;justify-content:space-between}.flex-end{justify-content:flex-end}.flex-center{justify-content:center}.p1{padding:1rem}.p2{padding:2rem}.p0{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http]{text-underline-offset:.7ex;text-decoration:underline 1px}a{text-decoration:none;cursor:pointer}a:hover{text-decoration:underline}.tool{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.2rem}.tool>svg{width:1.6rem!important;height:1.6rem!important}.tool:hover{background:var(--color-third-bg)}.tool.no-hover{cursor:default}.tool.no-hover:hover{background:unset!important}.tool.disabled{cursor:not-allowed}.tool.disabled:hover{background:unset!important}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node:hover{text-decoration:none;background:#e2e2e2}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal{position:fixed;z-index:1001;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option{display:flex;align-items:center;padding:.6rem 0}.modal .option>span{position:relative}.modal .mask{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio:first-child{border-left:none}.radio-group2 .active{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm{position:relative;display:inline-flex;justify-content:center}input{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input:hover{border:1px solid var(--color-input-border-hover)}input:focus{border:1px solid var(--color-active)}.danger{color:red!important}.pop-confirm-content{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:1003}.pop-confirm-content .text{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.target-user-tags[data-v-bae2f48f]{background:var(--color-second-bg);color:var(--color-font);word-break:break-all;text-align:start;font-size:1.4rem;box-shadow:0 2px 3px #0000001a;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.target-user-tags .add-tag[data-v-bae2f48f]{display:inline-block}.loaded[data-v-bae2f48f]{font-size:1.4rem;display:flex;align-items:center;gap:1rem;color:var(--color-font-pure)} ');
  34.  
  35. (function (vue) {
  36. 'use strict';
  37.  
  38. var PageType = /* @__PURE__ */ ((PageType2) => {
  39. PageType2["Home"] = "Home";
  40. PageType2["Node"] = "Node";
  41. PageType2["Post"] = "Post";
  42. PageType2["Member"] = "Member";
  43. PageType2["Changes"] = "Changes";
  44. return PageType2;
  45. })(PageType || {});
  46. var CommentDisplayType = /* @__PURE__ */ ((CommentDisplayType2) => {
  47. CommentDisplayType2[CommentDisplayType2["FloorInFloor"] = 0] = "FloorInFloor";
  48. CommentDisplayType2[CommentDisplayType2["FloorInFloorNoCallUser"] = 4] = "FloorInFloorNoCallUser";
  49. CommentDisplayType2[CommentDisplayType2["FloorInFloorNested"] = 5] = "FloorInFloorNested";
  50. CommentDisplayType2[CommentDisplayType2["Like"] = 1] = "Like";
  51. CommentDisplayType2[CommentDisplayType2["V2exOrigin"] = 2] = "V2exOrigin";
  52. CommentDisplayType2[CommentDisplayType2["OnlyOp"] = 3] = "OnlyOp";
  53. CommentDisplayType2[CommentDisplayType2["New"] = 6] = "New";
  54. return CommentDisplayType2;
  55. })(CommentDisplayType || {});
  56. const MAX_REPLY_LIMIT = 400;
  57. const _sfc_main$m = {
  58. name: "Tooltip",
  59. props: {
  60. title: {
  61. type: String,
  62. default() {
  63. return "";
  64. }
  65. },
  66. disabled: {
  67. type: Boolean,
  68. default() {
  69. return false;
  70. }
  71. }
  72. },
  73. data() {
  74. return {
  75. show: false
  76. };
  77. },
  78. methods: {
  79. showPop(e2) {
  80. if (this.disabled)
  81. return;
  82. if (!this.title)
  83. return;
  84. e2.stopPropagation();
  85. let rect = e2.target.getBoundingClientRect();
  86. this.show = true;
  87. vue.nextTick(() => {
  88. var _a, _b;
  89. let tip = (_b = (_a = this.$refs) == null ? void 0 : _a.tip) == null ? void 0 : _b.getBoundingClientRect();
  90. if (!tip)
  91. return;
  92. if (rect.top < 50) {
  93. this.$refs.tip.style.top = rect.top + rect.height + 10 + "px";
  94. } else {
  95. this.$refs.tip.style.top = rect.top - tip.height - 10 + "px";
  96. }
  97. let tipWidth = tip.width;
  98. let rectWidth = rect.width;
  99. this.$refs.tip.style.left = rect.left - (tipWidth - rectWidth) / 2 + "px";
  100. });
  101. }
  102. },
  103. render() {
  104. let Vnode = this.$slots.default()[0];
  105. return vue.createVNode(vue.Fragment, null, [this.show && this.title && vue.createVNode(vue.Teleport, {
  106. "to": "body"
  107. }, {
  108. default: () => [vue.createVNode(vue.Transition, {
  109. "name": "fade"
  110. }, {
  111. default: () => [vue.createVNode("div", {
  112. "ref": "tip",
  113. "className": "tip"
  114. }, [this.title])]
  115. })]
  116. }), vue.createVNode(Vnode, {
  117. "onClick": () => this.show = false,
  118. "onmouseenter": (e2) => this.showPop(e2),
  119. "onmouseleave": () => this.show = false
  120. }, null)]);
  121. }
  122. };
  123. const _export_sfc = (sfc, props) => {
  124. const target = sfc.__vccOpts || sfc;
  125. for (const [key, val] of props) {
  126. target[key] = val;
  127. }
  128. return target;
  129. };
  130. const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-ee672411"]]);
  131. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  132. __name: "BaseSwitch",
  133. props: {
  134. modelValue: { type: Boolean }
  135. },
  136. emits: ["update:modelValue"],
  137. setup(__props, { emit: __emit }) {
  138. return (_ctx, _cache) => {
  139. return vue.openBlock(), vue.createElementBlock("div", {
  140. class: vue.normalizeClass(["switch", { active: _ctx.modelValue }]),
  141. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", !_ctx.modelValue))
  142. }, null, 2);
  143. };
  144. }
  145. });
  146. const BaseSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-e7c0fbef"]]);
  147. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  148. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  149. const functions = {
  150. async refreshOnce(once) {
  151. return new Promise((resolve) => {
  152. if (once) {
  153. if (typeof once === "string") {
  154. let res = once.match(/var once = "([\d]+)";/);
  155. if (res && res[1])
  156. resolve(Number(res[1]));
  157. }
  158. if (typeof once === "number")
  159. resolve(once);
  160. }
  161. window.fetchOnce().then((r2) => {
  162. resolve(r2);
  163. });
  164. });
  165. },
  166. clone: (val) => JSON.parse(JSON.stringify(val)),
  167. createList(post, replyList, withRedundList = true) {
  168. replyList = replyList.slice(0, 1);
  169. post.replyList = replyList;
  170. return post;
  171. },
  172. //获取所有回复
  173. getAllReply(repliesMap = []) {
  174. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  175. pre = pre.concat(i.replyList);
  176. return pre;
  177. }, []);
  178. },
  179. //查找子回复
  180. findChildren(item, endList, all, topReplyList) {
  181. var _a;
  182. const fn = (child, endList2, parent) => {
  183. child.level = parent.level + 1;
  184. let rIndex2 = all.findIndex((v) => v.floor === child.floor);
  185. if (rIndex2 > -1) {
  186. all[rIndex2].isUse = true;
  187. }
  188. parent.children.push(this.findChildren(child, endList2, all, topReplyList));
  189. };
  190. item.children = [];
  191. let floorReplyList = [];
  192. for (let i = 0; i < endList.length; i++) {
  193. let currentItem = endList[i];
  194. if (currentItem.isUse)
  195. continue;
  196. if (currentItem.replyFloor === item.floor) {
  197. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  198. currentItem.isUse = true;
  199. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  200. } else {
  201. currentItem.isWrong = true;
  202. }
  203. }
  204. }
  205. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  206. fn(currentItem, endList2, item);
  207. });
  208. let nextMeIndex = endList.findIndex((v) => {
  209. var _a2;
  210. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  211. });
  212. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  213. for (let i = 0; i < findList.length; i++) {
  214. let currentItem = findList[i];
  215. if (currentItem.isUse)
  216. continue;
  217. if (currentItem.replyUsers.length === 1) {
  218. if (currentItem.replyFloor !== -1) {
  219. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  220. continue;
  221. }
  222. }
  223. let endList2 = endList.slice(i + 1);
  224. if (currentItem.username === item.username) {
  225. if (currentItem.replyUsers[0] === item.username) {
  226. fn(currentItem, endList2, item);
  227. }
  228. break;
  229. } else {
  230. if (currentItem.replyUsers[0] === item.username) {
  231. fn(currentItem, endList2, item);
  232. }
  233. }
  234. } else {
  235. if (currentItem.username === item.username)
  236. break;
  237. }
  238. }
  239. item.children = item.children.sort((a, b) => a.floor - b.floor);
  240. item.replyCount = item.children.reduce((a, b) => {
  241. return a + (b.children.length ? b.replyCount + 1 : 1);
  242. }, 0);
  243. let rIndex = topReplyList.findIndex((v) => v.floor === item.floor);
  244. if (rIndex > -1) {
  245. topReplyList[rIndex].children = item.children;
  246. topReplyList[rIndex].replyCount = item.replyCount;
  247. }
  248. return item;
  249. },
  250. //生成嵌套回复
  251. createNestedList(allList = [], topReplyList = []) {
  252. if (!allList.length)
  253. return [];
  254. let list = allList;
  255. let nestedList = [];
  256. list.map((item, index) => {
  257. let startList = list.slice(0, index);
  258. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  259. let endList = list.slice(index + 1);
  260. if (index === 0) {
  261. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  262. } else {
  263. if (!item.isUse) {
  264. let isOneLevelReply = false;
  265. if (item.replyUsers.length) {
  266. if (item.replyUsers.length > 1) {
  267. isOneLevelReply = true;
  268. } else {
  269. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  270. }
  271. } else {
  272. isOneLevelReply = true;
  273. }
  274. if (isOneLevelReply) {
  275. item.level = 0;
  276. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  277. }
  278. }
  279. }
  280. });
  281. return nestedList;
  282. },
  283. //生成嵌套冗余回复
  284. createNestedRedundantList(allList = [], topReplyList) {
  285. if (!allList.length)
  286. return [];
  287. let list = allList;
  288. let nestedList = [];
  289. list.map((item, index) => {
  290. let startList = list.slice(0, index);
  291. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  292. let endList = list.slice(index + 1);
  293. if (index === 0) {
  294. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  295. } else {
  296. if (!item.isUse) {
  297. let isOneLevelReply = false;
  298. if (item.replyUsers.length) {
  299. if (item.replyUsers.length > 1) {
  300. isOneLevelReply = true;
  301. } else {
  302. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  303. }
  304. } else {
  305. isOneLevelReply = true;
  306. }
  307. if (isOneLevelReply) {
  308. item.level = 0;
  309. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  310. }
  311. } else {
  312. let newItem = this.clone(item);
  313. newItem.children = [];
  314. newItem.level = 0;
  315. newItem.isDup = true;
  316. nestedList.push(newItem);
  317. }
  318. }
  319. });
  320. return nestedList;
  321. },
  322. //解析A标签
  323. parseA(a) {
  324. let href = a.href;
  325. let id;
  326. if (href.includes("/t/")) {
  327. id = a.pathname.substring("/t/".length);
  328. }
  329. return { href, id, title: a.innerText };
  330. },
  331. //图片链接转Img标签
  332. checkPhotoLink2Img(str) {
  333. if (!str)
  334. return;
  335. try {
  336. let imgWebs = [
  337. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  338. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  339. ];
  340. imgWebs.map((v, i) => {
  341. let has = str.matchAll(v);
  342. let res2 = [...has];
  343. res2.map((r2) => {
  344. let p = i === 0 ? r2[4] : r2[5];
  345. if (p) {
  346. let link = p.toLowerCase();
  347. let src = p;
  348. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  349. } else {
  350. src = p + ".png";
  351. }
  352. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  353. }
  354. });
  355. });
  356. } catch (e2) {
  357. }
  358. return str;
  359. },
  360. //检测帖子回复长度
  361. async checkPostReplies(id, needOpen = true) {
  362. return new Promise(async (resolve) => {
  363. let res = await functions.getPostDetailByApi(id);
  364. if ((res == null ? void 0 : res.replies) > MAX_REPLY_LIMIT) {
  365. if (needOpen) {
  366. functions.openNewTab(`https://${location.origin}/t/${id}?p=1&script=1`);
  367. }
  368. return resolve(true);
  369. }
  370. resolve(false);
  371. });
  372. },
  373. async sleep(time) {
  374. return new Promise((resolve) => {
  375. setTimeout(resolve, time);
  376. });
  377. },
  378. //打开新标签页
  379. openNewTab(href, active = false) {
  380. let isSafariBrowser = /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
  381. if (isSafariBrowser) {
  382. let tempId = "a_blank_" + Date.now();
  383. let a = document.createElement("a");
  384. a.setAttribute("href", href);
  385. a.setAttribute("target", "_blank");
  386. a.setAttribute("id", tempId);
  387. a.setAttribute("script", "1");
  388. if (!document.getElementById(tempId)) {
  389. document.body.appendChild(a);
  390. }
  391. a.click();
  392. } else {
  393. _GM_openInTab(href, { active });
  394. }
  395. },
  396. async cbChecker(val, count = 0) {
  397. if (window.cb) {
  398. window.cb(val);
  399. } else {
  400. while (!window.cb && count < 30) {
  401. await functions.sleep(500);
  402. count++;
  403. }
  404. window.cb && window.cb(val);
  405. }
  406. },
  407. //初始化脚本菜单
  408. initMonkeyMenu() {
  409. try {
  410. _GM_registerMenuCommand("脚本设置", () => {
  411. functions.cbChecker({ type: "openSetting" });
  412. });
  413. _GM_registerMenuCommand("仓库地址", () => {
  414. functions.openNewTab(window.const.git);
  415. });
  416. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  417. } catch (e2) {
  418. }
  419. },
  420. clone(val) {
  421. return JSON.parse(JSON.stringify(val));
  422. },
  423. feedback() {
  424. functions.openNewTab(DefaultVal.issue);
  425. },
  426. //检测页面类型
  427. checkPageType(a) {
  428. let l = a || window.location;
  429. let data = { pageType: null, pageData: { id: "", pageNo: null }, username: "" };
  430. if (l.pathname === "/") {
  431. data.pageType = PageType.Home;
  432. } else if (l.pathname === "/changes") {
  433. data.pageType = PageType.Changes;
  434. } else if (l.pathname === "/recent") {
  435. data.pageType = PageType.Changes;
  436. } else if (l.href.match(/.com\/?tab=/)) {
  437. data.pageType = PageType.Home;
  438. } else if (l.href.match(/.com\/go\//)) {
  439. if (!l.href.includes("/links")) {
  440. data.pageType = PageType.Node;
  441. }
  442. } else if (l.href.match(/.com\/member/)) {
  443. data.pageType = PageType.Member;
  444. data.username = l.pathname.replace("/member/", "").replace("/replies", "").replace("/topics", "");
  445. } else {
  446. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  447. if (r2 && !l.pathname.includes("review") && !l.pathname.includes("info")) {
  448. data.pageType = PageType.Post;
  449. data.pageData.id = r2[1];
  450. if (l.search) {
  451. let pr = l.href.match(/\?p=([\d]+)/);
  452. if (pr)
  453. data.pageData.pageNo = Number(pr[1]);
  454. }
  455. }
  456. }
  457. return data;
  458. },
  459. //通过api获取主题详情
  460. getPostDetailByApi(id) {
  461. return new Promise((resolve) => {
  462. fetch(`${location.origin}/api/topics/show.json?id=${id}`).then(async (r2) => {
  463. if (r2.status === 200) {
  464. let res = await r2.json();
  465. if (res) {
  466. let d2 = res[0];
  467. resolve(d2);
  468. }
  469. }
  470. });
  471. });
  472. },
  473. appendPostContent(res, el) {
  474. let a = document.createElement("a");
  475. a.href = res.href;
  476. a.classList.add("post-content");
  477. let div = document.createElement("div");
  478. div.innerHTML = res.content_rendered;
  479. a.append(div);
  480. el.append(a);
  481. const checkHeight2 = () => {
  482. var _a;
  483. if (div.clientHeight < 300) {
  484. a.classList.add("show-all");
  485. } else {
  486. let showMore = document.createElement("div");
  487. showMore.classList.add("show-more");
  488. showMore.innerHTML = "显示更多/收起";
  489. showMore.onclick = function(e2) {
  490. e2.stopPropagation();
  491. a.classList.toggle("show-all");
  492. };
  493. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  494. }
  495. };
  496. checkHeight2();
  497. },
  498. //从本地读取配置
  499. initConfig() {
  500. let configStr = localStorage.getItem("v2ex-config");
  501. let configMap = {};
  502. let configObj = {};
  503. let userName = window.user.username || "default";
  504. if (configStr) {
  505. configMap = JSON.parse(configStr);
  506. configObj = configMap[userName];
  507. if (configObj) {
  508. window.config = functions.deepAssign(window.config, configObj);
  509. }
  510. }
  511. configMap[userName] = window.config;
  512. localStorage.setItem("v2ex-config", JSON.stringify(configMap));
  513. },
  514. deepAssign(...arg) {
  515. let name, options, src, copy;
  516. let length = arguments.length;
  517. let i = 1;
  518. let target = arguments[0] || {};
  519. if (typeof target !== "object") {
  520. target = {};
  521. }
  522. for (; i < length; i++) {
  523. options = arguments[i];
  524. if (options != null) {
  525. for (name in options) {
  526. src = target[name];
  527. copy = options[name];
  528. if (copy && typeof copy == "object") {
  529. target[name] = this.deepAssign(src, copy);
  530. } else if (copy !== void 0) {
  531. target[name] = copy;
  532. }
  533. }
  534. }
  535. }
  536. return target;
  537. },
  538. //生成dom,从html字符串
  539. genDomFromHtmlString(htmlText) {
  540. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  541. let body = document.createElement("html");
  542. body.innerHTML = bodyText[0];
  543. return body;
  544. }
  545. };
  546. const DefaultPost = {
  547. allReplyUsers: [],
  548. content_rendered: "",
  549. createDate: "",
  550. createDateAgo: "",
  551. lastReplyDate: "",
  552. lastReplyUsername: "",
  553. fr: "",
  554. replyList: [],
  555. topReplyList: [],
  556. nestedReplies: [],
  557. nestedRedundReplies: [],
  558. username: "",
  559. url: "",
  560. href: "",
  561. member: {
  562. avatar: "",
  563. username: ""
  564. },
  565. node: {
  566. title: "",
  567. url: ""
  568. },
  569. headerTemplate: "",
  570. title: "",
  571. id: "",
  572. type: "post",
  573. once: "",
  574. replyCount: 0,
  575. clickCount: 0,
  576. thankCount: 0,
  577. collectCount: 0,
  578. lastReadFloor: 0,
  579. isFavorite: false,
  580. isIgnore: false,
  581. isThanked: false,
  582. isReport: false,
  583. inList: false
  584. };
  585. const getDefaultPost = (val = {}) => {
  586. return Object.assign(functions.clone(DefaultPost), val);
  587. };
  588. const DefaultUser = {
  589. tagPrefix: "--用户标签--",
  590. tags: {},
  591. tagsId: "",
  592. username: "",
  593. avatar: "",
  594. readPrefix: "--已读楼层--",
  595. readNoteItemId: "",
  596. readList: {},
  597. imgurPrefix: "--imgur图片删除hash--",
  598. imgurList: {},
  599. imgurNoteId: "",
  600. configPrefix: "--config--",
  601. configNoteId: ""
  602. };
  603. const DefaultVal = {
  604. pageType: void 0,
  605. pageData: { pageNo: 1 },
  606. targetUserName: "",
  607. currentVersion: 2,
  608. isNight: false,
  609. cb: null,
  610. stopMe: null,
  611. postList: [],
  612. git: "https://github.com/zyronon/web-scripts",
  613. shortGit: "zyronon/web-scripts",
  614. issue: "https://github.com/zyronon/web-scripts/issues",
  615. pcLog: "https://greasyfork.org/zh-CN/scripts/458024/versions",
  616. pcScript: "https://greasyfork.org/zh-CN/scripts/458024",
  617. mobileScript: "https://greasyfork.org/zh-CN/scripts/485356",
  618. homeUrl: "https://v2ex-script.vercel.app/"
  619. };
  620. const DefaultConfig = {
  621. showToolbar: true,
  622. autoOpenDetail: true,
  623. openTag: false,
  624. //给用户打标签
  625. clickPostItemOpenDetail: true,
  626. closePostDetailBySpace: true,
  627. //点击空白处关闭详情
  628. contentAutoCollapse: true,
  629. //正文超长自动折叠
  630. viewType: "table",
  631. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  632. newTabOpen: false,
  633. //新标签打开
  634. newTabOpenActive: false,
  635. base64: true,
  636. //base功能
  637. sov2ex: false,
  638. postWidth: "",
  639. showTopReply: true,
  640. topReplyLoveMinCount: 3,
  641. topReplyCount: 5,
  642. autoJumpLastReadFloor: false,
  643. rememberLastReadFloor: false,
  644. autoSignin: true,
  645. customBgColor: "",
  646. version: DefaultVal.currentVersion,
  647. collectBrowserNotice: false,
  648. fontSizeType: "normal",
  649. notice: {
  650. uid: "",
  651. text: "",
  652. ddWebhook: "",
  653. takeOverNoticePage: true,
  654. whenNewNoticeGlimmer: false,
  655. loopCheckNotice: false,
  656. loopCheckNoticeInterval: 5
  657. }
  658. };
  659. function getDefaultConfig() {
  660. return { ...DefaultConfig };
  661. }
  662. const emojiEmoticons = [
  663. {
  664. title: "常用",
  665. list: [
  666. "😅",
  667. "😭",
  668. "😂",
  669. "🥰",
  670. "😰",
  671. "🤡",
  672. "👀",
  673. "🐴",
  674. "🐶",
  675. "❓",
  676. "❤️",
  677. "💔",
  678. "⭐",
  679. "🔥",
  680. "💩",
  681. "🔞",
  682. "⚠️",
  683. "🎁",
  684. "🎉"
  685. ]
  686. },
  687. {
  688. title: "小黄脸",
  689. list: [
  690. "😀",
  691. "😁",
  692. "😂",
  693. "🤣",
  694. "😅",
  695. "😊",
  696. "😋",
  697. "😘",
  698. "🥰",
  699. "😗",
  700. "🤩",
  701. "🤔",
  702. "🤨",
  703. "😐",
  704. "😑",
  705. "🙄",
  706. "😏",
  707. "😪",
  708. "😫",
  709. "🥱",
  710. "😜",
  711. "😒",
  712. "😔",
  713. "😨",
  714. "😰",
  715. "😱",
  716. "🥵",
  717. "😡",
  718. "🥳",
  719. "🥺",
  720. "🤭",
  721. "🧐",
  722. "😎",
  723. "🤓",
  724. "😭",
  725. "🤑",
  726. "🤮"
  727. ]
  728. },
  729. {
  730. title: "手势",
  731. list: [
  732. "🤏",
  733. "👉",
  734. "✌️",
  735. "👌",
  736. "👍",
  737. "👎",
  738. "🤝",
  739. "🙏",
  740. "👏"
  741. ]
  742. },
  743. {
  744. title: "其他",
  745. list: ["🔞", "👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶"]
  746. }
  747. ];
  748. const classicsEmoticons = [
  749. {
  750. name: "[狗头]",
  751. low: "https://i.imgur.com/io2SM1h.png",
  752. high: "https://i.imgur.com/0icl60r.png"
  753. },
  754. {
  755. name: "[doge]",
  756. low: "https://i.imgur.com/duWRpIu.png",
  757. high: "https://i.imgur.com/HyphI6d.png"
  758. },
  759. {
  760. name: "[受虐滑稽]",
  761. low: "https://i.imgur.com/Iy0taMy.png",
  762. high: "https://i.imgur.com/PS1pxd9.png"
  763. },
  764. {
  765. name: "[马]",
  766. low: "https://i.imgur.com/8EKZv7I.png",
  767. high: "https://i.imgur.com/ANFUX52.png"
  768. },
  769. {
  770. name: "[二哈]",
  771. low: "https://i.imgur.com/XKj1Tkx.png",
  772. high: "https://i.imgur.com/dOeP4XD.png"
  773. },
  774. {
  775. name: "[舔屏]",
  776. low: "https://i.imgur.com/Cvl7dyN.png",
  777. high: "https://i.imgur.com/LmETy9N.png"
  778. },
  779. {
  780. name: "[辣眼睛]",
  781. low: "https://i.imgur.com/cPNPYD5.png",
  782. high: "https://i.imgur.com/3fSUmi8.png"
  783. },
  784. {
  785. name: "[吃瓜]",
  786. low: "https://i.imgur.com/ee8Lq7H.png",
  787. high: "https://i.imgur.com/0L26og9.png"
  788. },
  789. {
  790. name: "[不高兴]",
  791. low: "https://i.imgur.com/huX6coX.png",
  792. high: "https://i.imgur.com/N7JEuvc.png"
  793. },
  794. // {
  795. // name: '[呵呵]',
  796. // low: 'https://i.imgur.com/RvoLAbX.png',
  797. // high: 'https://i.imgur.com/xSzIqrK.png'
  798. // },
  799. {
  800. name: "[真棒]",
  801. low: "https://i.imgur.com/xr1UOz1.png",
  802. high: "https://i.imgur.com/w8YEw9Q.png"
  803. },
  804. {
  805. name: "[鄙视]",
  806. low: "https://i.imgur.com/u6jlqVq.png",
  807. high: "https://i.imgur.com/8JFNANq.png"
  808. },
  809. {
  810. name: "[疑问]",
  811. low: "https://i.imgur.com/F29pmQ6.png",
  812. high: "https://i.imgur.com/EbbTQAR.png"
  813. },
  814. {
  815. name: "[吐舌]",
  816. low: "https://i.imgur.com/InmIzl9.png",
  817. high: "https://i.imgur.com/Ovj56Cd.png"
  818. },
  819. // {
  820. // name: '[嘲笑]',
  821. // low: 'https://i.imgur.com/BaWcsMR.png',
  822. // high: 'https://i.imgur.com/0OGfJw4.png'
  823. // },
  824. // {
  825. // name: '[滑稽]',
  826. // low: 'https://i.imgur.com/lmbN0yI.png',
  827. // high: 'https://i.imgur.com/Pc0wH85.png'
  828. // },
  829. {
  830. name: "[笑眼]",
  831. low: "https://i.imgur.com/ZveiiGy.png",
  832. high: "https://i.imgur.com/PI1CfEr.png"
  833. },
  834. // {
  835. // name: '[狂汗]',
  836. // low: 'https://i.imgur.com/veWihk6.png',
  837. // high: 'https://i.imgur.com/3LtHdQv.png'
  838. // },
  839. {
  840. name: "[大哭]",
  841. low: "https://i.imgur.com/hu4oR6C.png",
  842. high: "https://i.imgur.com/b4X9XLE.png"
  843. },
  844. {
  845. name: "[喷]",
  846. low: "https://i.imgur.com/bkw3VRr.png",
  847. high: "https://i.imgur.com/wnZL13L.png"
  848. },
  849. {
  850. name: "[苦笑]",
  851. low: "https://i.imgur.com/VUWFktU.png",
  852. high: "https://i.imgur.com/NAfspZ1.png"
  853. },
  854. {
  855. name: "[喝酒]",
  856. low: "https://i.imgur.com/2ZZSapE.png",
  857. high: "https://i.imgur.com/rVbSVak.png"
  858. },
  859. {
  860. name: "[捂脸]",
  861. low: "https://i.imgur.com/krir4IG.png",
  862. high: "https://i.imgur.com/qqBqgVm.png"
  863. },
  864. // {
  865. // name: '[呕]',
  866. // low: 'https://i.imgur.com/6CUiUxv.png',
  867. // high: 'https://i.imgur.com/kgdxRsG.png'
  868. // },
  869. {
  870. name: "[阴险]",
  871. low: "https://i.imgur.com/MA8YqTP.png",
  872. high: "https://i.imgur.com/e94jbaT.png"
  873. },
  874. {
  875. name: "[怒]",
  876. low: "https://i.imgur.com/n4kWfGB.png",
  877. high: "https://i.imgur.com/iMXxNxh.png"
  878. }
  879. // {
  880. // name: '[衰]',
  881. // low: 'https://i.imgur.com/voHFDyQ.png',
  882. // high: 'https://i.imgur.com/XffE6gu.png'
  883. // },
  884. // {
  885. // name: '[合十]',
  886. // low: 'https://i.imgur.com/I8x3ang.png',
  887. // high: 'https://i.imgur.com/T4rJVee.png'
  888. // },
  889. // {
  890. // name: '[赞]',
  891. // low: 'https://i.imgur.com/lG44yUl.png',
  892. // high: 'https://i.imgur.com/AoF5PLp.png'
  893. // },
  894. // {
  895. // name: '[踩]',
  896. // low: 'https://i.imgur.com/cJp0uKZ.png',
  897. // high: 'https://i.imgur.com/1XYGfXj.png'
  898. // },
  899. // {
  900. // name: '[爱心]',
  901. // low: 'https://i.imgur.com/sLENaF5.png',
  902. // high: 'https://i.imgur.com/dND56oX.png'
  903. // },
  904. //
  905. // {
  906. // name: '[心碎]',
  907. // low: 'https://i.imgur.com/AZxJzve.png',
  908. // high: 'https://i.imgur.com/RiUsPci.png'
  909. // },
  910. ];
  911. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  912. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  913. const colonSeparated = value.split(":");
  914. if (value.slice(0, 1) === "@") {
  915. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  916. return null;
  917. }
  918. provider = colonSeparated.shift().slice(1);
  919. }
  920. if (colonSeparated.length > 3 || !colonSeparated.length) {
  921. return null;
  922. }
  923. if (colonSeparated.length > 1) {
  924. const name2 = colonSeparated.pop();
  925. const prefix = colonSeparated.pop();
  926. const result = {
  927. // Allow provider without '@': "provider:prefix:name"
  928. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  929. prefix,
  930. name: name2
  931. };
  932. return validate && !validateIconName(result) ? null : result;
  933. }
  934. const name = colonSeparated[0];
  935. const dashSeparated = name.split("-");
  936. if (dashSeparated.length > 1) {
  937. const result = {
  938. provider,
  939. prefix: dashSeparated.shift(),
  940. name: dashSeparated.join("-")
  941. };
  942. return validate && !validateIconName(result) ? null : result;
  943. }
  944. if (allowSimpleName && provider === "") {
  945. const result = {
  946. provider,
  947. prefix: "",
  948. name
  949. };
  950. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  951. }
  952. return null;
  953. };
  954. const validateIconName = (icon, allowSimpleName) => {
  955. if (!icon) {
  956. return false;
  957. }
  958. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  959. };
  960. const defaultIconDimensions = Object.freeze(
  961. {
  962. left: 0,
  963. top: 0,
  964. width: 16,
  965. height: 16
  966. }
  967. );
  968. const defaultIconTransformations = Object.freeze({
  969. rotate: 0,
  970. vFlip: false,
  971. hFlip: false
  972. });
  973. const defaultIconProps = Object.freeze({
  974. ...defaultIconDimensions,
  975. ...defaultIconTransformations
  976. });
  977. const defaultExtendedIconProps = Object.freeze({
  978. ...defaultIconProps,
  979. body: "",
  980. hidden: false
  981. });
  982. function mergeIconTransformations(obj1, obj2) {
  983. const result = {};
  984. if (!obj1.hFlip !== !obj2.hFlip) {
  985. result.hFlip = true;
  986. }
  987. if (!obj1.vFlip !== !obj2.vFlip) {
  988. result.vFlip = true;
  989. }
  990. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  991. if (rotate) {
  992. result.rotate = rotate;
  993. }
  994. return result;
  995. }
  996. function mergeIconData(parent, child) {
  997. const result = mergeIconTransformations(parent, child);
  998. for (const key in defaultExtendedIconProps) {
  999. if (key in defaultIconTransformations) {
  1000. if (key in parent && !(key in result)) {
  1001. result[key] = defaultIconTransformations[key];
  1002. }
  1003. } else if (key in child) {
  1004. result[key] = child[key];
  1005. } else if (key in parent) {
  1006. result[key] = parent[key];
  1007. }
  1008. }
  1009. return result;
  1010. }
  1011. function getIconsTree(data, names) {
  1012. const icons = data.icons;
  1013. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1014. const resolved = /* @__PURE__ */ Object.create(null);
  1015. function resolve(name) {
  1016. if (icons[name]) {
  1017. return resolved[name] = [];
  1018. }
  1019. if (!(name in resolved)) {
  1020. resolved[name] = null;
  1021. const parent = aliases[name] && aliases[name].parent;
  1022. const value = parent && resolve(parent);
  1023. if (value) {
  1024. resolved[name] = [parent].concat(value);
  1025. }
  1026. }
  1027. return resolved[name];
  1028. }
  1029. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  1030. return resolved;
  1031. }
  1032. function internalGetIconData(data, name, tree) {
  1033. const icons = data.icons;
  1034. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1035. let currentProps = {};
  1036. function parse(name2) {
  1037. currentProps = mergeIconData(
  1038. icons[name2] || aliases[name2],
  1039. currentProps
  1040. );
  1041. }
  1042. parse(name);
  1043. tree.forEach(parse);
  1044. return mergeIconData(data, currentProps);
  1045. }
  1046. function parseIconSet(data, callback) {
  1047. const names = [];
  1048. if (typeof data !== "object" || typeof data.icons !== "object") {
  1049. return names;
  1050. }
  1051. if (data.not_found instanceof Array) {
  1052. data.not_found.forEach((name) => {
  1053. callback(name, null);
  1054. names.push(name);
  1055. });
  1056. }
  1057. const tree = getIconsTree(data);
  1058. for (const name in tree) {
  1059. const item = tree[name];
  1060. if (item) {
  1061. callback(name, internalGetIconData(data, name, item));
  1062. names.push(name);
  1063. }
  1064. }
  1065. return names;
  1066. }
  1067. const optionalPropertyDefaults = {
  1068. provider: "",
  1069. aliases: {},
  1070. not_found: {},
  1071. ...defaultIconDimensions
  1072. };
  1073. function checkOptionalProps(item, defaults) {
  1074. for (const prop in defaults) {
  1075. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  1076. return false;
  1077. }
  1078. }
  1079. return true;
  1080. }
  1081. function quicklyValidateIconSet(obj) {
  1082. if (typeof obj !== "object" || obj === null) {
  1083. return null;
  1084. }
  1085. const data = obj;
  1086. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  1087. return null;
  1088. }
  1089. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  1090. return null;
  1091. }
  1092. const icons = data.icons;
  1093. for (const name in icons) {
  1094. const icon = icons[name];
  1095. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  1096. icon,
  1097. defaultExtendedIconProps
  1098. )) {
  1099. return null;
  1100. }
  1101. }
  1102. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1103. for (const name in aliases) {
  1104. const icon = aliases[name];
  1105. const parent = icon.parent;
  1106. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  1107. icon,
  1108. defaultExtendedIconProps
  1109. )) {
  1110. return null;
  1111. }
  1112. }
  1113. return data;
  1114. }
  1115. const dataStorage = /* @__PURE__ */ Object.create(null);
  1116. function newStorage(provider, prefix) {
  1117. return {
  1118. provider,
  1119. prefix,
  1120. icons: /* @__PURE__ */ Object.create(null),
  1121. missing: /* @__PURE__ */ new Set()
  1122. };
  1123. }
  1124. function getStorage(provider, prefix) {
  1125. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  1126. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  1127. }
  1128. function addIconSet(storage2, data) {
  1129. if (!quicklyValidateIconSet(data)) {
  1130. return [];
  1131. }
  1132. return parseIconSet(data, (name, icon) => {
  1133. if (icon) {
  1134. storage2.icons[name] = icon;
  1135. } else {
  1136. storage2.missing.add(name);
  1137. }
  1138. });
  1139. }
  1140. function addIconToStorage(storage2, name, icon) {
  1141. try {
  1142. if (typeof icon.body === "string") {
  1143. storage2.icons[name] = { ...icon };
  1144. return true;
  1145. }
  1146. } catch (err) {
  1147. }
  1148. return false;
  1149. }
  1150. let simpleNames = false;
  1151. function allowSimpleNames(allow) {
  1152. if (typeof allow === "boolean") {
  1153. simpleNames = allow;
  1154. }
  1155. return simpleNames;
  1156. }
  1157. function getIconData(name) {
  1158. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  1159. if (icon) {
  1160. const storage2 = getStorage(icon.provider, icon.prefix);
  1161. const iconName = icon.name;
  1162. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  1163. }
  1164. }
  1165. function addIcon(name, data) {
  1166. const icon = stringToIcon(name, true, simpleNames);
  1167. if (!icon) {
  1168. return false;
  1169. }
  1170. const storage2 = getStorage(icon.provider, icon.prefix);
  1171. return addIconToStorage(storage2, icon.name, data);
  1172. }
  1173. function addCollection(data, provider) {
  1174. if (typeof data !== "object") {
  1175. return false;
  1176. }
  1177. if (typeof provider !== "string") {
  1178. provider = data.provider || "";
  1179. }
  1180. if (simpleNames && !provider && !data.prefix) {
  1181. let added = false;
  1182. if (quicklyValidateIconSet(data)) {
  1183. data.prefix = "";
  1184. parseIconSet(data, (name, icon) => {
  1185. if (icon && addIcon(name, icon)) {
  1186. added = true;
  1187. }
  1188. });
  1189. }
  1190. return added;
  1191. }
  1192. const prefix = data.prefix;
  1193. if (!validateIconName({
  1194. provider,
  1195. prefix,
  1196. name: "a"
  1197. })) {
  1198. return false;
  1199. }
  1200. const storage2 = getStorage(provider, prefix);
  1201. return !!addIconSet(storage2, data);
  1202. }
  1203. const defaultIconSizeCustomisations = Object.freeze({
  1204. width: null,
  1205. height: null
  1206. });
  1207. const defaultIconCustomisations = Object.freeze({
  1208. // Dimensions
  1209. ...defaultIconSizeCustomisations,
  1210. // Transformations
  1211. ...defaultIconTransformations
  1212. });
  1213. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  1214. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  1215. function calculateSize(size, ratio, precision) {
  1216. if (ratio === 1) {
  1217. return size;
  1218. }
  1219. precision = precision || 100;
  1220. if (typeof size === "number") {
  1221. return Math.ceil(size * ratio * precision) / precision;
  1222. }
  1223. if (typeof size !== "string") {
  1224. return size;
  1225. }
  1226. const oldParts = size.split(unitsSplit);
  1227. if (oldParts === null || !oldParts.length) {
  1228. return size;
  1229. }
  1230. const newParts = [];
  1231. let code = oldParts.shift();
  1232. let isNumber = unitsTest.test(code);
  1233. while (true) {
  1234. if (isNumber) {
  1235. const num = parseFloat(code);
  1236. if (isNaN(num)) {
  1237. newParts.push(code);
  1238. } else {
  1239. newParts.push(Math.ceil(num * ratio * precision) / precision);
  1240. }
  1241. } else {
  1242. newParts.push(code);
  1243. }
  1244. code = oldParts.shift();
  1245. if (code === void 0) {
  1246. return newParts.join("");
  1247. }
  1248. isNumber = !isNumber;
  1249. }
  1250. }
  1251. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  1252. function iconToSVG(icon, customisations) {
  1253. const fullIcon = {
  1254. ...defaultIconProps,
  1255. ...icon
  1256. };
  1257. const fullCustomisations = {
  1258. ...defaultIconCustomisations,
  1259. ...customisations
  1260. };
  1261. const box = {
  1262. left: fullIcon.left,
  1263. top: fullIcon.top,
  1264. width: fullIcon.width,
  1265. height: fullIcon.height
  1266. };
  1267. let body = fullIcon.body;
  1268. [fullIcon, fullCustomisations].forEach((props) => {
  1269. const transformations = [];
  1270. const hFlip = props.hFlip;
  1271. const vFlip = props.vFlip;
  1272. let rotation = props.rotate;
  1273. if (hFlip) {
  1274. if (vFlip) {
  1275. rotation += 2;
  1276. } else {
  1277. transformations.push(
  1278. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  1279. );
  1280. transformations.push("scale(-1 1)");
  1281. box.top = box.left = 0;
  1282. }
  1283. } else if (vFlip) {
  1284. transformations.push(
  1285. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  1286. );
  1287. transformations.push("scale(1 -1)");
  1288. box.top = box.left = 0;
  1289. }
  1290. let tempValue;
  1291. if (rotation < 0) {
  1292. rotation -= Math.floor(rotation / 4) * 4;
  1293. }
  1294. rotation = rotation % 4;
  1295. switch (rotation) {
  1296. case 1:
  1297. tempValue = box.height / 2 + box.top;
  1298. transformations.unshift(
  1299. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  1300. );
  1301. break;
  1302. case 2:
  1303. transformations.unshift(
  1304. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  1305. );
  1306. break;
  1307. case 3:
  1308. tempValue = box.width / 2 + box.left;
  1309. transformations.unshift(
  1310. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  1311. );
  1312. break;
  1313. }
  1314. if (rotation % 2 === 1) {
  1315. if (box.left !== box.top) {
  1316. tempValue = box.left;
  1317. box.left = box.top;
  1318. box.top = tempValue;
  1319. }
  1320. if (box.width !== box.height) {
  1321. tempValue = box.width;
  1322. box.width = box.height;
  1323. box.height = tempValue;
  1324. }
  1325. }
  1326. if (transformations.length) {
  1327. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  1328. }
  1329. });
  1330. const customisationsWidth = fullCustomisations.width;
  1331. const customisationsHeight = fullCustomisations.height;
  1332. const boxWidth = box.width;
  1333. const boxHeight = box.height;
  1334. let width;
  1335. let height;
  1336. if (customisationsWidth === null) {
  1337. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  1338. width = calculateSize(height, boxWidth / boxHeight);
  1339. } else {
  1340. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  1341. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  1342. }
  1343. const attributes = {};
  1344. const setAttr = (prop, value) => {
  1345. if (!isUnsetKeyword(value)) {
  1346. attributes[prop] = value.toString();
  1347. }
  1348. };
  1349. setAttr("width", width);
  1350. setAttr("height", height);
  1351. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  1352. return {
  1353. attributes,
  1354. body
  1355. };
  1356. }
  1357. const regex = /\sid="(\S+)"/g;
  1358. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  1359. let counter = 0;
  1360. function replaceIDs(body, prefix = randomPrefix) {
  1361. const ids = [];
  1362. let match;
  1363. while (match = regex.exec(body)) {
  1364. ids.push(match[1]);
  1365. }
  1366. if (!ids.length) {
  1367. return body;
  1368. }
  1369. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  1370. ids.forEach((id) => {
  1371. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  1372. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  1373. body = body.replace(
  1374. // Allowed characters before id: [#;"]
  1375. // Allowed characters after id: [)"], .[a-z]
  1376. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  1377. "$1" + newID + suffix + "$3"
  1378. );
  1379. });
  1380. body = body.replace(new RegExp(suffix, "g"), "");
  1381. return body;
  1382. }
  1383. const storage = /* @__PURE__ */ Object.create(null);
  1384. function setAPIModule(provider, item) {
  1385. storage[provider] = item;
  1386. }
  1387. function getAPIModule(provider) {
  1388. return storage[provider] || storage[""];
  1389. }
  1390. function createAPIConfig(source) {
  1391. let resources;
  1392. if (typeof source.resources === "string") {
  1393. resources = [source.resources];
  1394. } else {
  1395. resources = source.resources;
  1396. if (!(resources instanceof Array) || !resources.length) {
  1397. return null;
  1398. }
  1399. }
  1400. const result = {
  1401. // API hosts
  1402. resources,
  1403. // Root path
  1404. path: source.path || "/",
  1405. // URL length limit
  1406. maxURL: source.maxURL || 500,
  1407. // Timeout before next host is used.
  1408. rotate: source.rotate || 750,
  1409. // Timeout before failing query.
  1410. timeout: source.timeout || 5e3,
  1411. // Randomise default API end point.
  1412. random: source.random === true,
  1413. // Start index
  1414. index: source.index || 0,
  1415. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  1416. dataAfterTimeout: source.dataAfterTimeout !== false
  1417. };
  1418. return result;
  1419. }
  1420. const configStorage = /* @__PURE__ */ Object.create(null);
  1421. const fallBackAPISources = [
  1422. "https://api.simplesvg.com",
  1423. "https://api.unisvg.com"
  1424. ];
  1425. const fallBackAPI = [];
  1426. while (fallBackAPISources.length > 0) {
  1427. if (fallBackAPISources.length === 1) {
  1428. fallBackAPI.push(fallBackAPISources.shift());
  1429. } else {
  1430. if (Math.random() > 0.5) {
  1431. fallBackAPI.push(fallBackAPISources.shift());
  1432. } else {
  1433. fallBackAPI.push(fallBackAPISources.pop());
  1434. }
  1435. }
  1436. }
  1437. configStorage[""] = createAPIConfig({
  1438. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  1439. });
  1440. function addAPIProvider(provider, customConfig) {
  1441. const config2 = createAPIConfig(customConfig);
  1442. if (config2 === null) {
  1443. return false;
  1444. }
  1445. configStorage[provider] = config2;
  1446. return true;
  1447. }
  1448. function getAPIConfig(provider) {
  1449. return configStorage[provider];
  1450. }
  1451. const detectFetch = () => {
  1452. let callback;
  1453. try {
  1454. callback = fetch;
  1455. if (typeof callback === "function") {
  1456. return callback;
  1457. }
  1458. } catch (err) {
  1459. }
  1460. };
  1461. let fetchModule = detectFetch();
  1462. function calculateMaxLength(provider, prefix) {
  1463. const config2 = getAPIConfig(provider);
  1464. if (!config2) {
  1465. return 0;
  1466. }
  1467. let result;
  1468. if (!config2.maxURL) {
  1469. result = 0;
  1470. } else {
  1471. let maxHostLength = 0;
  1472. config2.resources.forEach((item) => {
  1473. const host = item;
  1474. maxHostLength = Math.max(maxHostLength, host.length);
  1475. });
  1476. const url = prefix + ".json?icons=";
  1477. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  1478. }
  1479. return result;
  1480. }
  1481. function shouldAbort(status) {
  1482. return status === 404;
  1483. }
  1484. const prepare = (provider, prefix, icons) => {
  1485. const results = [];
  1486. const maxLength = calculateMaxLength(provider, prefix);
  1487. const type = "icons";
  1488. let item = {
  1489. type,
  1490. provider,
  1491. prefix,
  1492. icons: []
  1493. };
  1494. let length = 0;
  1495. icons.forEach((name, index) => {
  1496. length += name.length + 1;
  1497. if (length >= maxLength && index > 0) {
  1498. results.push(item);
  1499. item = {
  1500. type,
  1501. provider,
  1502. prefix,
  1503. icons: []
  1504. };
  1505. length = name.length;
  1506. }
  1507. item.icons.push(name);
  1508. });
  1509. results.push(item);
  1510. return results;
  1511. };
  1512. function getPath(provider) {
  1513. if (typeof provider === "string") {
  1514. const config2 = getAPIConfig(provider);
  1515. if (config2) {
  1516. return config2.path;
  1517. }
  1518. }
  1519. return "/";
  1520. }
  1521. const send = (host, params, callback) => {
  1522. if (!fetchModule) {
  1523. callback("abort", 424);
  1524. return;
  1525. }
  1526. let path = getPath(params.provider);
  1527. switch (params.type) {
  1528. case "icons": {
  1529. const prefix = params.prefix;
  1530. const icons = params.icons;
  1531. const iconsList = icons.join(",");
  1532. const urlParams = new URLSearchParams({
  1533. icons: iconsList
  1534. });
  1535. path += prefix + ".json?" + urlParams.toString();
  1536. break;
  1537. }
  1538. case "custom": {
  1539. const uri = params.uri;
  1540. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  1541. break;
  1542. }
  1543. default:
  1544. callback("abort", 400);
  1545. return;
  1546. }
  1547. let defaultError = 503;
  1548. fetchModule(host + path).then((response) => {
  1549. const status = response.status;
  1550. if (status !== 200) {
  1551. setTimeout(() => {
  1552. callback(shouldAbort(status) ? "abort" : "next", status);
  1553. });
  1554. return;
  1555. }
  1556. defaultError = 501;
  1557. return response.json();
  1558. }).then((data) => {
  1559. if (typeof data !== "object" || data === null) {
  1560. setTimeout(() => {
  1561. if (data === 404) {
  1562. callback("abort", data);
  1563. } else {
  1564. callback("next", defaultError);
  1565. }
  1566. });
  1567. return;
  1568. }
  1569. setTimeout(() => {
  1570. callback("success", data);
  1571. });
  1572. }).catch(() => {
  1573. callback("next", defaultError);
  1574. });
  1575. };
  1576. const fetchAPIModule = {
  1577. prepare,
  1578. send
  1579. };
  1580. function sortIcons(icons) {
  1581. const result = {
  1582. loaded: [],
  1583. missing: [],
  1584. pending: []
  1585. };
  1586. const storage2 = /* @__PURE__ */ Object.create(null);
  1587. icons.sort((a, b) => {
  1588. if (a.provider !== b.provider) {
  1589. return a.provider.localeCompare(b.provider);
  1590. }
  1591. if (a.prefix !== b.prefix) {
  1592. return a.prefix.localeCompare(b.prefix);
  1593. }
  1594. return a.name.localeCompare(b.name);
  1595. });
  1596. let lastIcon = {
  1597. provider: "",
  1598. prefix: "",
  1599. name: ""
  1600. };
  1601. icons.forEach((icon) => {
  1602. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  1603. return;
  1604. }
  1605. lastIcon = icon;
  1606. const provider = icon.provider;
  1607. const prefix = icon.prefix;
  1608. const name = icon.name;
  1609. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  1610. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  1611. let list;
  1612. if (name in localStorage2.icons) {
  1613. list = result.loaded;
  1614. } else if (prefix === "" || localStorage2.missing.has(name)) {
  1615. list = result.missing;
  1616. } else {
  1617. list = result.pending;
  1618. }
  1619. const item = {
  1620. provider,
  1621. prefix,
  1622. name
  1623. };
  1624. list.push(item);
  1625. });
  1626. return result;
  1627. }
  1628. function removeCallback(storages, id) {
  1629. storages.forEach((storage2) => {
  1630. const items = storage2.loaderCallbacks;
  1631. if (items) {
  1632. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  1633. }
  1634. });
  1635. }
  1636. function updateCallbacks(storage2) {
  1637. if (!storage2.pendingCallbacksFlag) {
  1638. storage2.pendingCallbacksFlag = true;
  1639. setTimeout(() => {
  1640. storage2.pendingCallbacksFlag = false;
  1641. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  1642. if (!items.length) {
  1643. return;
  1644. }
  1645. let hasPending = false;
  1646. const provider = storage2.provider;
  1647. const prefix = storage2.prefix;
  1648. items.forEach((item) => {
  1649. const icons = item.icons;
  1650. const oldLength = icons.pending.length;
  1651. icons.pending = icons.pending.filter((icon) => {
  1652. if (icon.prefix !== prefix) {
  1653. return true;
  1654. }
  1655. const name = icon.name;
  1656. if (storage2.icons[name]) {
  1657. icons.loaded.push({
  1658. provider,
  1659. prefix,
  1660. name
  1661. });
  1662. } else if (storage2.missing.has(name)) {
  1663. icons.missing.push({
  1664. provider,
  1665. prefix,
  1666. name
  1667. });
  1668. } else {
  1669. hasPending = true;
  1670. return true;
  1671. }
  1672. return false;
  1673. });
  1674. if (icons.pending.length !== oldLength) {
  1675. if (!hasPending) {
  1676. removeCallback([storage2], item.id);
  1677. }
  1678. item.callback(
  1679. icons.loaded.slice(0),
  1680. icons.missing.slice(0),
  1681. icons.pending.slice(0),
  1682. item.abort
  1683. );
  1684. }
  1685. });
  1686. });
  1687. }
  1688. }
  1689. let idCounter = 0;
  1690. function storeCallback(callback, icons, pendingSources) {
  1691. const id = idCounter++;
  1692. const abort = removeCallback.bind(null, pendingSources, id);
  1693. if (!icons.pending.length) {
  1694. return abort;
  1695. }
  1696. const item = {
  1697. id,
  1698. icons,
  1699. callback,
  1700. abort
  1701. };
  1702. pendingSources.forEach((storage2) => {
  1703. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  1704. });
  1705. return abort;
  1706. }
  1707. function listToIcons(list, validate = true, simpleNames2 = false) {
  1708. const result = [];
  1709. list.forEach((item) => {
  1710. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  1711. if (icon) {
  1712. result.push(icon);
  1713. }
  1714. });
  1715. return result;
  1716. }
  1717. var defaultConfig = {
  1718. resources: [],
  1719. index: 0,
  1720. timeout: 2e3,
  1721. rotate: 750,
  1722. random: false,
  1723. dataAfterTimeout: false
  1724. };
  1725. function sendQuery(config2, payload, query, done) {
  1726. const resourcesCount = config2.resources.length;
  1727. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  1728. let resources;
  1729. if (config2.random) {
  1730. let list = config2.resources.slice(0);
  1731. resources = [];
  1732. while (list.length > 1) {
  1733. const nextIndex = Math.floor(Math.random() * list.length);
  1734. resources.push(list[nextIndex]);
  1735. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  1736. }
  1737. resources = resources.concat(list);
  1738. } else {
  1739. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  1740. }
  1741. const startTime = Date.now();
  1742. let status = "pending";
  1743. let queriesSent = 0;
  1744. let lastError;
  1745. let timer = null;
  1746. let queue = [];
  1747. let doneCallbacks = [];
  1748. if (typeof done === "function") {
  1749. doneCallbacks.push(done);
  1750. }
  1751. function resetTimer() {
  1752. if (timer) {
  1753. clearTimeout(timer);
  1754. timer = null;
  1755. }
  1756. }
  1757. function abort() {
  1758. if (status === "pending") {
  1759. status = "aborted";
  1760. }
  1761. resetTimer();
  1762. queue.forEach((item) => {
  1763. if (item.status === "pending") {
  1764. item.status = "aborted";
  1765. }
  1766. });
  1767. queue = [];
  1768. }
  1769. function subscribe(callback, overwrite) {
  1770. if (overwrite) {
  1771. doneCallbacks = [];
  1772. }
  1773. if (typeof callback === "function") {
  1774. doneCallbacks.push(callback);
  1775. }
  1776. }
  1777. function getQueryStatus() {
  1778. return {
  1779. startTime,
  1780. payload,
  1781. status,
  1782. queriesSent,
  1783. queriesPending: queue.length,
  1784. subscribe,
  1785. abort
  1786. };
  1787. }
  1788. function failQuery() {
  1789. status = "failed";
  1790. doneCallbacks.forEach((callback) => {
  1791. callback(void 0, lastError);
  1792. });
  1793. }
  1794. function clearQueue() {
  1795. queue.forEach((item) => {
  1796. if (item.status === "pending") {
  1797. item.status = "aborted";
  1798. }
  1799. });
  1800. queue = [];
  1801. }
  1802. function moduleResponse(item, response, data) {
  1803. const isError = response !== "success";
  1804. queue = queue.filter((queued) => queued !== item);
  1805. switch (status) {
  1806. case "pending":
  1807. break;
  1808. case "failed":
  1809. if (isError || !config2.dataAfterTimeout) {
  1810. return;
  1811. }
  1812. break;
  1813. default:
  1814. return;
  1815. }
  1816. if (response === "abort") {
  1817. lastError = data;
  1818. failQuery();
  1819. return;
  1820. }
  1821. if (isError) {
  1822. lastError = data;
  1823. if (!queue.length) {
  1824. if (!resources.length) {
  1825. failQuery();
  1826. } else {
  1827. execNext();
  1828. }
  1829. }
  1830. return;
  1831. }
  1832. resetTimer();
  1833. clearQueue();
  1834. if (!config2.random) {
  1835. const index = config2.resources.indexOf(item.resource);
  1836. if (index !== -1 && index !== config2.index) {
  1837. config2.index = index;
  1838. }
  1839. }
  1840. status = "completed";
  1841. doneCallbacks.forEach((callback) => {
  1842. callback(data);
  1843. });
  1844. }
  1845. function execNext() {
  1846. if (status !== "pending") {
  1847. return;
  1848. }
  1849. resetTimer();
  1850. const resource = resources.shift();
  1851. if (resource === void 0) {
  1852. if (queue.length) {
  1853. timer = setTimeout(() => {
  1854. resetTimer();
  1855. if (status === "pending") {
  1856. clearQueue();
  1857. failQuery();
  1858. }
  1859. }, config2.timeout);
  1860. return;
  1861. }
  1862. failQuery();
  1863. return;
  1864. }
  1865. const item = {
  1866. status: "pending",
  1867. resource,
  1868. callback: (status2, data) => {
  1869. moduleResponse(item, status2, data);
  1870. }
  1871. };
  1872. queue.push(item);
  1873. queriesSent++;
  1874. timer = setTimeout(execNext, config2.rotate);
  1875. query(resource, payload, item.callback);
  1876. }
  1877. setTimeout(execNext);
  1878. return getQueryStatus;
  1879. }
  1880. function initRedundancy(cfg) {
  1881. const config2 = {
  1882. ...defaultConfig,
  1883. ...cfg
  1884. };
  1885. let queries = [];
  1886. function cleanup() {
  1887. queries = queries.filter((item) => item().status === "pending");
  1888. }
  1889. function query(payload, queryCallback, doneCallback) {
  1890. const query2 = sendQuery(
  1891. config2,
  1892. payload,
  1893. queryCallback,
  1894. (data, error) => {
  1895. cleanup();
  1896. if (doneCallback) {
  1897. doneCallback(data, error);
  1898. }
  1899. }
  1900. );
  1901. queries.push(query2);
  1902. return query2;
  1903. }
  1904. function find(callback) {
  1905. return queries.find((value) => {
  1906. return callback(value);
  1907. }) || null;
  1908. }
  1909. const instance = {
  1910. query,
  1911. find,
  1912. setIndex: (index) => {
  1913. config2.index = index;
  1914. },
  1915. getIndex: () => config2.index,
  1916. cleanup
  1917. };
  1918. return instance;
  1919. }
  1920. function emptyCallback$1() {
  1921. }
  1922. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1923. function getRedundancyCache(provider) {
  1924. if (!redundancyCache[provider]) {
  1925. const config2 = getAPIConfig(provider);
  1926. if (!config2) {
  1927. return;
  1928. }
  1929. const redundancy = initRedundancy(config2);
  1930. const cachedReundancy = {
  1931. config: config2,
  1932. redundancy
  1933. };
  1934. redundancyCache[provider] = cachedReundancy;
  1935. }
  1936. return redundancyCache[provider];
  1937. }
  1938. function sendAPIQuery(target, query, callback) {
  1939. let redundancy;
  1940. let send2;
  1941. if (typeof target === "string") {
  1942. const api = getAPIModule(target);
  1943. if (!api) {
  1944. callback(void 0, 424);
  1945. return emptyCallback$1;
  1946. }
  1947. send2 = api.send;
  1948. const cached = getRedundancyCache(target);
  1949. if (cached) {
  1950. redundancy = cached.redundancy;
  1951. }
  1952. } else {
  1953. const config2 = createAPIConfig(target);
  1954. if (config2) {
  1955. redundancy = initRedundancy(config2);
  1956. const moduleKey = target.resources ? target.resources[0] : "";
  1957. const api = getAPIModule(moduleKey);
  1958. if (api) {
  1959. send2 = api.send;
  1960. }
  1961. }
  1962. }
  1963. if (!redundancy || !send2) {
  1964. callback(void 0, 424);
  1965. return emptyCallback$1;
  1966. }
  1967. return redundancy.query(query, send2, callback)().abort;
  1968. }
  1969. const browserCacheVersion = "iconify2";
  1970. const browserCachePrefix = "iconify";
  1971. const browserCacheCountKey = browserCachePrefix + "-count";
  1972. const browserCacheVersionKey = browserCachePrefix + "-version";
  1973. const browserStorageHour = 36e5;
  1974. const browserStorageCacheExpiration = 168;
  1975. function getStoredItem(func, key) {
  1976. try {
  1977. return func.getItem(key);
  1978. } catch (err) {
  1979. }
  1980. }
  1981. function setStoredItem(func, key, value) {
  1982. try {
  1983. func.setItem(key, value);
  1984. return true;
  1985. } catch (err) {
  1986. }
  1987. }
  1988. function removeStoredItem(func, key) {
  1989. try {
  1990. func.removeItem(key);
  1991. } catch (err) {
  1992. }
  1993. }
  1994. function setBrowserStorageItemsCount(storage2, value) {
  1995. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  1996. }
  1997. function getBrowserStorageItemsCount(storage2) {
  1998. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  1999. }
  2000. const browserStorageConfig = {
  2001. local: true,
  2002. session: true
  2003. };
  2004. const browserStorageEmptyItems = {
  2005. local: /* @__PURE__ */ new Set(),
  2006. session: /* @__PURE__ */ new Set()
  2007. };
  2008. let browserStorageStatus = false;
  2009. function setBrowserStorageStatus(status) {
  2010. browserStorageStatus = status;
  2011. }
  2012. let _window = typeof window === "undefined" ? {} : window;
  2013. function getBrowserStorage(key) {
  2014. const attr = key + "Storage";
  2015. try {
  2016. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  2017. return _window[attr];
  2018. }
  2019. } catch (err) {
  2020. }
  2021. browserStorageConfig[key] = false;
  2022. }
  2023. function iterateBrowserStorage(key, callback) {
  2024. const func = getBrowserStorage(key);
  2025. if (!func) {
  2026. return;
  2027. }
  2028. const version = getStoredItem(func, browserCacheVersionKey);
  2029. if (version !== browserCacheVersion) {
  2030. if (version) {
  2031. const total2 = getBrowserStorageItemsCount(func);
  2032. for (let i = 0; i < total2; i++) {
  2033. removeStoredItem(func, browserCachePrefix + i.toString());
  2034. }
  2035. }
  2036. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  2037. setBrowserStorageItemsCount(func, 0);
  2038. return;
  2039. }
  2040. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  2041. const parseItem = (index) => {
  2042. const name = browserCachePrefix + index.toString();
  2043. const item = getStoredItem(func, name);
  2044. if (typeof item !== "string") {
  2045. return;
  2046. }
  2047. try {
  2048. const data = JSON.parse(item);
  2049. if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && // Valid item: run callback
  2050. callback(data, index)) {
  2051. return true;
  2052. }
  2053. } catch (err) {
  2054. }
  2055. removeStoredItem(func, name);
  2056. };
  2057. let total = getBrowserStorageItemsCount(func);
  2058. for (let i = total - 1; i >= 0; i--) {
  2059. if (!parseItem(i)) {
  2060. if (i === total - 1) {
  2061. total--;
  2062. setBrowserStorageItemsCount(func, total);
  2063. } else {
  2064. browserStorageEmptyItems[key].add(i);
  2065. }
  2066. }
  2067. }
  2068. }
  2069. function initBrowserStorage() {
  2070. if (browserStorageStatus) {
  2071. return;
  2072. }
  2073. setBrowserStorageStatus(true);
  2074. for (const key in browserStorageConfig) {
  2075. iterateBrowserStorage(key, (item) => {
  2076. const iconSet = item.data;
  2077. const provider = item.provider;
  2078. const prefix = iconSet.prefix;
  2079. const storage2 = getStorage(
  2080. provider,
  2081. prefix
  2082. );
  2083. if (!addIconSet(storage2, iconSet).length) {
  2084. return false;
  2085. }
  2086. const lastModified = iconSet.lastModified || -1;
  2087. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  2088. return true;
  2089. });
  2090. }
  2091. }
  2092. function updateLastModified(storage2, lastModified) {
  2093. const lastValue = storage2.lastModifiedCached;
  2094. if (
  2095. // Matches or newer
  2096. lastValue && lastValue >= lastModified
  2097. ) {
  2098. return lastValue === lastModified;
  2099. }
  2100. storage2.lastModifiedCached = lastModified;
  2101. if (lastValue) {
  2102. for (const key in browserStorageConfig) {
  2103. iterateBrowserStorage(key, (item) => {
  2104. const iconSet = item.data;
  2105. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  2106. });
  2107. }
  2108. }
  2109. return true;
  2110. }
  2111. function storeInBrowserStorage(storage2, data) {
  2112. if (!browserStorageStatus) {
  2113. initBrowserStorage();
  2114. }
  2115. function store(key) {
  2116. let func;
  2117. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  2118. return;
  2119. }
  2120. const set = browserStorageEmptyItems[key];
  2121. let index;
  2122. if (set.size) {
  2123. set.delete(index = Array.from(set).shift());
  2124. } else {
  2125. index = getBrowserStorageItemsCount(func);
  2126. if (!setBrowserStorageItemsCount(func, index + 1)) {
  2127. return;
  2128. }
  2129. }
  2130. const item = {
  2131. cached: Math.floor(Date.now() / browserStorageHour),
  2132. provider: storage2.provider,
  2133. data
  2134. };
  2135. return setStoredItem(
  2136. func,
  2137. browserCachePrefix + index.toString(),
  2138. JSON.stringify(item)
  2139. );
  2140. }
  2141. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  2142. return;
  2143. }
  2144. if (!Object.keys(data.icons).length) {
  2145. return;
  2146. }
  2147. if (data.not_found) {
  2148. data = Object.assign({}, data);
  2149. delete data.not_found;
  2150. }
  2151. if (!store("local")) {
  2152. store("session");
  2153. }
  2154. }
  2155. function emptyCallback() {
  2156. }
  2157. function loadedNewIcons(storage2) {
  2158. if (!storage2.iconsLoaderFlag) {
  2159. storage2.iconsLoaderFlag = true;
  2160. setTimeout(() => {
  2161. storage2.iconsLoaderFlag = false;
  2162. updateCallbacks(storage2);
  2163. });
  2164. }
  2165. }
  2166. function loadNewIcons(storage2, icons) {
  2167. if (!storage2.iconsToLoad) {
  2168. storage2.iconsToLoad = icons;
  2169. } else {
  2170. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  2171. }
  2172. if (!storage2.iconsQueueFlag) {
  2173. storage2.iconsQueueFlag = true;
  2174. setTimeout(() => {
  2175. storage2.iconsQueueFlag = false;
  2176. const { provider, prefix } = storage2;
  2177. const icons2 = storage2.iconsToLoad;
  2178. delete storage2.iconsToLoad;
  2179. let api;
  2180. if (!icons2 || !(api = getAPIModule(provider))) {
  2181. return;
  2182. }
  2183. const params = api.prepare(provider, prefix, icons2);
  2184. params.forEach((item) => {
  2185. sendAPIQuery(provider, item, (data) => {
  2186. if (typeof data !== "object") {
  2187. item.icons.forEach((name) => {
  2188. storage2.missing.add(name);
  2189. });
  2190. } else {
  2191. try {
  2192. const parsed = addIconSet(
  2193. storage2,
  2194. data
  2195. );
  2196. if (!parsed.length) {
  2197. return;
  2198. }
  2199. const pending = storage2.pendingIcons;
  2200. if (pending) {
  2201. parsed.forEach((name) => {
  2202. pending.delete(name);
  2203. });
  2204. }
  2205. storeInBrowserStorage(storage2, data);
  2206. } catch (err) {
  2207. }
  2208. }
  2209. loadedNewIcons(storage2);
  2210. });
  2211. });
  2212. });
  2213. }
  2214. }
  2215. const loadIcons = (icons, callback) => {
  2216. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  2217. const sortedIcons = sortIcons(cleanedIcons);
  2218. if (!sortedIcons.pending.length) {
  2219. let callCallback = true;
  2220. if (callback) {
  2221. setTimeout(() => {
  2222. if (callCallback) {
  2223. callback(
  2224. sortedIcons.loaded,
  2225. sortedIcons.missing,
  2226. sortedIcons.pending,
  2227. emptyCallback
  2228. );
  2229. }
  2230. });
  2231. }
  2232. return () => {
  2233. callCallback = false;
  2234. };
  2235. }
  2236. const newIcons = /* @__PURE__ */ Object.create(null);
  2237. const sources = [];
  2238. let lastProvider, lastPrefix;
  2239. sortedIcons.pending.forEach((icon) => {
  2240. const { provider, prefix } = icon;
  2241. if (prefix === lastPrefix && provider === lastProvider) {
  2242. return;
  2243. }
  2244. lastProvider = provider;
  2245. lastPrefix = prefix;
  2246. sources.push(getStorage(provider, prefix));
  2247. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  2248. if (!providerNewIcons[prefix]) {
  2249. providerNewIcons[prefix] = [];
  2250. }
  2251. });
  2252. sortedIcons.pending.forEach((icon) => {
  2253. const { provider, prefix, name } = icon;
  2254. const storage2 = getStorage(provider, prefix);
  2255. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  2256. if (!pendingQueue.has(name)) {
  2257. pendingQueue.add(name);
  2258. newIcons[provider][prefix].push(name);
  2259. }
  2260. });
  2261. sources.forEach((storage2) => {
  2262. const { provider, prefix } = storage2;
  2263. if (newIcons[provider][prefix].length) {
  2264. loadNewIcons(storage2, newIcons[provider][prefix]);
  2265. }
  2266. });
  2267. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  2268. };
  2269. function mergeCustomisations(defaults, item) {
  2270. const result = {
  2271. ...defaults
  2272. };
  2273. for (const key in item) {
  2274. const value = item[key];
  2275. const valueType = typeof value;
  2276. if (key in defaultIconSizeCustomisations) {
  2277. if (value === null || value && (valueType === "string" || valueType === "number")) {
  2278. result[key] = value;
  2279. }
  2280. } else if (valueType === typeof result[key]) {
  2281. result[key] = key === "rotate" ? value % 4 : value;
  2282. }
  2283. }
  2284. return result;
  2285. }
  2286. const separator = /[\s,]+/;
  2287. function flipFromString(custom, flip) {
  2288. flip.split(separator).forEach((str) => {
  2289. const value = str.trim();
  2290. switch (value) {
  2291. case "horizontal":
  2292. custom.hFlip = true;
  2293. break;
  2294. case "vertical":
  2295. custom.vFlip = true;
  2296. break;
  2297. }
  2298. });
  2299. }
  2300. function rotateFromString(value, defaultValue = 0) {
  2301. const units = value.replace(/^-?[0-9.]*/, "");
  2302. function cleanup(value2) {
  2303. while (value2 < 0) {
  2304. value2 += 4;
  2305. }
  2306. return value2 % 4;
  2307. }
  2308. if (units === "") {
  2309. const num = parseInt(value);
  2310. return isNaN(num) ? 0 : cleanup(num);
  2311. } else if (units !== value) {
  2312. let split = 0;
  2313. switch (units) {
  2314. case "%":
  2315. split = 25;
  2316. break;
  2317. case "deg":
  2318. split = 90;
  2319. }
  2320. if (split) {
  2321. let num = parseFloat(value.slice(0, value.length - units.length));
  2322. if (isNaN(num)) {
  2323. return 0;
  2324. }
  2325. num = num / split;
  2326. return num % 1 === 0 ? cleanup(num) : 0;
  2327. }
  2328. }
  2329. return defaultValue;
  2330. }
  2331. function iconToHTML(body, attributes) {
  2332. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  2333. for (const attr in attributes) {
  2334. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  2335. }
  2336. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  2337. }
  2338. function encodeSVGforURL(svg) {
  2339. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  2340. }
  2341. function svgToData(svg) {
  2342. return "data:image/svg+xml," + encodeSVGforURL(svg);
  2343. }
  2344. function svgToURL(svg) {
  2345. return 'url("' + svgToData(svg) + '")';
  2346. }
  2347. const defaultExtendedIconCustomisations = {
  2348. ...defaultIconCustomisations,
  2349. inline: false
  2350. };
  2351. const svgDefaults = {
  2352. "xmlns": "http://www.w3.org/2000/svg",
  2353. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  2354. "aria-hidden": true,
  2355. "role": "img"
  2356. };
  2357. const commonProps = {
  2358. display: "inline-block"
  2359. };
  2360. const monotoneProps = {
  2361. backgroundColor: "currentColor"
  2362. };
  2363. const coloredProps = {
  2364. backgroundColor: "transparent"
  2365. };
  2366. const propsToAdd = {
  2367. Image: "var(--svg)",
  2368. Repeat: "no-repeat",
  2369. Size: "100% 100%"
  2370. };
  2371. const propsToAddTo = {
  2372. webkitMask: monotoneProps,
  2373. mask: monotoneProps,
  2374. background: coloredProps
  2375. };
  2376. for (const prefix in propsToAddTo) {
  2377. const list = propsToAddTo[prefix];
  2378. for (const prop in propsToAdd) {
  2379. list[prefix + prop] = propsToAdd[prop];
  2380. }
  2381. }
  2382. const customisationAliases = {};
  2383. ["horizontal", "vertical"].forEach((prefix) => {
  2384. const attr = prefix.slice(0, 1) + "Flip";
  2385. customisationAliases[prefix + "-flip"] = attr;
  2386. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  2387. customisationAliases[prefix + "Flip"] = attr;
  2388. });
  2389. function fixSize(value) {
  2390. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  2391. }
  2392. const render = (icon, props) => {
  2393. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  2394. const componentProps = { ...svgDefaults };
  2395. const mode = props.mode || "svg";
  2396. const style = {};
  2397. const propsStyle = props.style;
  2398. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  2399. for (let key in props) {
  2400. const value = props[key];
  2401. if (value === void 0) {
  2402. continue;
  2403. }
  2404. switch (key) {
  2405. case "icon":
  2406. case "style":
  2407. case "onLoad":
  2408. case "mode":
  2409. break;
  2410. case "inline":
  2411. case "hFlip":
  2412. case "vFlip":
  2413. customisations[key] = value === true || value === "true" || value === 1;
  2414. break;
  2415. case "flip":
  2416. if (typeof value === "string") {
  2417. flipFromString(customisations, value);
  2418. }
  2419. break;
  2420. case "color":
  2421. style.color = value;
  2422. break;
  2423. case "rotate":
  2424. if (typeof value === "string") {
  2425. customisations[key] = rotateFromString(value);
  2426. } else if (typeof value === "number") {
  2427. customisations[key] = value;
  2428. }
  2429. break;
  2430. case "ariaHidden":
  2431. case "aria-hidden":
  2432. if (value !== true && value !== "true") {
  2433. delete componentProps["aria-hidden"];
  2434. }
  2435. break;
  2436. default: {
  2437. const alias = customisationAliases[key];
  2438. if (alias) {
  2439. if (value === true || value === "true" || value === 1) {
  2440. customisations[alias] = true;
  2441. }
  2442. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  2443. componentProps[key] = value;
  2444. }
  2445. }
  2446. }
  2447. }
  2448. const item = iconToSVG(icon, customisations);
  2449. const renderAttribs = item.attributes;
  2450. if (customisations.inline) {
  2451. style.verticalAlign = "-0.125em";
  2452. }
  2453. if (mode === "svg") {
  2454. componentProps.style = {
  2455. ...style,
  2456. ...customStyle
  2457. };
  2458. Object.assign(componentProps, renderAttribs);
  2459. let localCounter = 0;
  2460. let id = props.id;
  2461. if (typeof id === "string") {
  2462. id = id.replace(/-/g, "_");
  2463. }
  2464. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  2465. return vue.h("svg", componentProps);
  2466. }
  2467. const { body, width, height } = icon;
  2468. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  2469. const html = iconToHTML(body, {
  2470. ...renderAttribs,
  2471. width: width + "",
  2472. height: height + ""
  2473. });
  2474. componentProps.style = {
  2475. ...style,
  2476. "--svg": svgToURL(html),
  2477. "width": fixSize(renderAttribs.width),
  2478. "height": fixSize(renderAttribs.height),
  2479. ...commonProps,
  2480. ...useMask ? monotoneProps : coloredProps,
  2481. ...customStyle
  2482. };
  2483. return vue.h("span", componentProps);
  2484. };
  2485. allowSimpleNames(true);
  2486. setAPIModule("", fetchAPIModule);
  2487. if (typeof document !== "undefined" && typeof window !== "undefined") {
  2488. initBrowserStorage();
  2489. const _window2 = window;
  2490. if (_window2.IconifyPreload !== void 0) {
  2491. const preload = _window2.IconifyPreload;
  2492. if (typeof preload === "object" && preload !== null) {
  2493. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  2494. try {
  2495. if (
  2496. // Check if item is an object and not null/array
  2497. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  2498. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  2499. !addCollection(item)
  2500. ) {
  2501. }
  2502. } catch (e2) {
  2503. }
  2504. });
  2505. }
  2506. }
  2507. if (_window2.IconifyProviders !== void 0) {
  2508. const providers = _window2.IconifyProviders;
  2509. if (typeof providers === "object" && providers !== null) {
  2510. for (let key in providers) {
  2511. try {
  2512. const value = providers[key];
  2513. if (typeof value !== "object" || !value || value.resources === void 0) {
  2514. continue;
  2515. }
  2516. if (!addAPIProvider(key, value)) {
  2517. }
  2518. } catch (e2) {
  2519. }
  2520. }
  2521. }
  2522. }
  2523. }
  2524. const emptyIcon = {
  2525. ...defaultIconProps,
  2526. body: ""
  2527. };
  2528. const Icon = vue.defineComponent({
  2529. // Do not inherit other attributes: it is handled by render()
  2530. inheritAttrs: false,
  2531. // Set initial data
  2532. data() {
  2533. return {
  2534. // Mounted status
  2535. iconMounted: false,
  2536. // Callback counter to trigger re-render
  2537. counter: 0
  2538. };
  2539. },
  2540. mounted() {
  2541. this._name = "";
  2542. this._loadingIcon = null;
  2543. this.iconMounted = true;
  2544. },
  2545. unmounted() {
  2546. this.abortLoading();
  2547. },
  2548. methods: {
  2549. abortLoading() {
  2550. if (this._loadingIcon) {
  2551. this._loadingIcon.abort();
  2552. this._loadingIcon = null;
  2553. }
  2554. },
  2555. // Get data for icon to render or null
  2556. getIcon(icon, onload) {
  2557. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  2558. this._name = "";
  2559. this.abortLoading();
  2560. return {
  2561. data: icon
  2562. };
  2563. }
  2564. let iconName;
  2565. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  2566. this.abortLoading();
  2567. return null;
  2568. }
  2569. const data = getIconData(iconName);
  2570. if (!data) {
  2571. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  2572. this.abortLoading();
  2573. this._name = "";
  2574. if (data !== null) {
  2575. this._loadingIcon = {
  2576. name: icon,
  2577. abort: loadIcons([iconName], () => {
  2578. this.counter++;
  2579. })
  2580. };
  2581. }
  2582. }
  2583. return null;
  2584. }
  2585. this.abortLoading();
  2586. if (this._name !== icon) {
  2587. this._name = icon;
  2588. if (onload) {
  2589. onload(icon);
  2590. }
  2591. }
  2592. const classes = ["iconify"];
  2593. if (iconName.prefix !== "") {
  2594. classes.push("iconify--" + iconName.prefix);
  2595. }
  2596. if (iconName.provider !== "") {
  2597. classes.push("iconify--" + iconName.provider);
  2598. }
  2599. return { data, classes };
  2600. }
  2601. },
  2602. // Render icon
  2603. render() {
  2604. this.counter;
  2605. const props = this.$attrs;
  2606. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  2607. if (!icon) {
  2608. return render(emptyIcon, props);
  2609. }
  2610. let newProps = props;
  2611. if (icon.classes) {
  2612. newProps = {
  2613. ...props,
  2614. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  2615. };
  2616. }
  2617. return render({
  2618. ...defaultIconProps,
  2619. ...icon.data
  2620. }, newProps);
  2621. }
  2622. });
  2623. const _hoisted_1$i = { class: "display-type" };
  2624. const _hoisted_2$f = { style: { "position": "relative" } };
  2625. const _hoisted_3$c = {
  2626. key: 0,
  2627. class: "type-list"
  2628. };
  2629. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  2630. __name: "BaseSelect",
  2631. props: {
  2632. displayType: {}
  2633. },
  2634. emits: ["update:displayType"],
  2635. setup(__props, { emit: __emit }) {
  2636. const props = __props;
  2637. const emit = __emit;
  2638. let state = vue.reactive({
  2639. showChangeDisplayType: false,
  2640. lastDisplayType: null
  2641. });
  2642. function changeOption(item) {
  2643. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2644. state.lastDisplayType = props.displayType;
  2645. }
  2646. emit("update:displayType", item);
  2647. state.showChangeDisplayType = false;
  2648. }
  2649. function clickDisplayType() {
  2650. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2651. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  2652. }
  2653. state.showChangeDisplayType = !state.showChangeDisplayType;
  2654. }
  2655. const currentDisplayType = vue.computed(() => {
  2656. let judge = props.displayType;
  2657. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2658. judge = state.lastDisplayType;
  2659. }
  2660. switch (judge) {
  2661. case CommentDisplayType.FloorInFloorNoCallUser:
  2662. return "楼中楼";
  2663. case CommentDisplayType.FloorInFloor:
  2664. return "楼中楼(@)";
  2665. case CommentDisplayType.FloorInFloorNested:
  2666. return "冗余楼中楼";
  2667. case CommentDisplayType.V2exOrigin:
  2668. return "V2原版";
  2669. case CommentDisplayType.OnlyOp:
  2670. return "只看楼主";
  2671. default:
  2672. return "楼中楼";
  2673. }
  2674. });
  2675. return (_ctx, _cache) => {
  2676. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
  2677. vue.createElementVNode("div", {
  2678. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).New && "active"]),
  2679. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).New))
  2680. }, "最新 ", 2),
  2681. vue.createElementVNode("div", {
  2682. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  2683. onClick: _cache[1] || (_cache[1] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  2684. }, "最热 ", 2),
  2685. vue.createElementVNode("div", _hoisted_2$f, [
  2686. vue.createElementVNode("div", {
  2687. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  2688. onClick: clickDisplayType
  2689. }, [
  2690. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  2691. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  2692. ], 2),
  2693. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c, [
  2694. vue.createElementVNode("div", {
  2695. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  2696. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  2697. }, "楼中楼 ", 2),
  2698. vue.createElementVNode("div", {
  2699. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  2700. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  2701. }, "楼中楼(@) ", 2),
  2702. vue.createElementVNode("div", {
  2703. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  2704. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  2705. }, "冗余楼中楼 ", 2),
  2706. vue.createElementVNode("div", {
  2707. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  2708. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  2709. }, "只看楼主 ", 2),
  2710. vue.createElementVNode("div", {
  2711. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  2712. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  2713. }, "V2原版 ", 2)
  2714. ])) : vue.createCommentVNode("", true)
  2715. ])
  2716. ]);
  2717. };
  2718. }
  2719. });
  2720. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-e4f684be"]]);
  2721. const eventBus = {
  2722. eventMap: /* @__PURE__ */ new Map(),
  2723. on(eventType, cb) {
  2724. let cbs = this.eventMap.get(eventType);
  2725. if (cbs) {
  2726. cbs.push(cb);
  2727. } else {
  2728. cbs = [cb];
  2729. }
  2730. this.eventMap.set(eventType, cbs);
  2731. },
  2732. offOne(eventType, cb) {
  2733. let cbs = this.eventMap.get(eventType);
  2734. if (cbs) {
  2735. let rIndex = cbs.findIndex((c) => c === cb);
  2736. if (rIndex > -1) {
  2737. cbs.splice(rIndex, 1);
  2738. }
  2739. }
  2740. this.eventMap.set(eventType, cbs);
  2741. },
  2742. emit(eventType, val) {
  2743. let cbs = this.eventMap.get(eventType);
  2744. if (cbs) {
  2745. cbs.map((cb) => cb(val));
  2746. }
  2747. },
  2748. off(eventType) {
  2749. let cbs = this.eventMap.has(eventType);
  2750. if (cbs) {
  2751. this.eventMap.delete(eventType);
  2752. }
  2753. },
  2754. clear() {
  2755. this.eventMap = /* @__PURE__ */ new Map();
  2756. }
  2757. };
  2758. const CMD = {
  2759. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  2760. SHOW_MSG: "SHOW_MSG",
  2761. SET_CALL: "SET_CALL",
  2762. SHOW_CALL: "SHOW_CALL",
  2763. REFRESH_ONCE: "REFRESH_ONCE",
  2764. ADD_REPLY: "ADD_REPLY",
  2765. IGNORE: "IGNORE",
  2766. MERGE: "MERGE",
  2767. REMOVE: "REMOVE",
  2768. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  2769. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  2770. ADD_TAG: "ADD_TAG",
  2771. REMOVE_TAG: "REMOVE_TAG",
  2772. RELATION_REPLY: "RELATION_REPLY",
  2773. JUMP: "JUMP",
  2774. REFRESH_POST: "REFRESH_POST",
  2775. SHOW_CONFIRM_MODAL: "SHOW_CONFIRM_MODAL",
  2776. SHOW_CONFIRM_MODAL_CONFIRM: "SHOW_CONFIRM_MODAL_CONFIRM"
  2777. };
  2778. const _sfc_main$j = {
  2779. name: "PopConfirm",
  2780. props: {
  2781. title: {
  2782. type: String,
  2783. default() {
  2784. return "";
  2785. }
  2786. },
  2787. disabled: {
  2788. type: Boolean,
  2789. default() {
  2790. return false;
  2791. }
  2792. }
  2793. },
  2794. data() {
  2795. return {
  2796. id: ""
  2797. };
  2798. },
  2799. created() {
  2800. },
  2801. methods: {
  2802. cb(id) {
  2803. if (id === this.id) {
  2804. this.$emit("confirm");
  2805. this.id = "";
  2806. }
  2807. },
  2808. showPop(e2) {
  2809. if (this.disabled)
  2810. return;
  2811. let rect = e2.target.getBoundingClientRect();
  2812. this.id = Date.now();
  2813. eventBus.emit(CMD.SHOW_CONFIRM_MODAL, { title: this.title, rect, id: this.id });
  2814. eventBus.offOne(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2815. eventBus.on(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2816. }
  2817. },
  2818. unmounted() {
  2819. eventBus.offOne(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2820. }
  2821. };
  2822. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  2823. return vue.openBlock(), vue.createElementBlock("span", {
  2824. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.showPop && $options.showPop(...args), ["stop"]))
  2825. }, [
  2826. vue.renderSlot(_ctx.$slots, "default")
  2827. ]);
  2828. }
  2829. const PopConfirm = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$a]]);
  2830. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  2831. __name: "BaseLoading",
  2832. props: {
  2833. size: { default: "normal" }
  2834. },
  2835. setup(__props) {
  2836. return (_ctx, _cache) => {
  2837. return vue.openBlock(), vue.createElementBlock("div", {
  2838. class: vue.normalizeClass(["loading", [_ctx.size]])
  2839. }, null, 2);
  2840. };
  2841. }
  2842. });
  2843. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-2697baa2"]]);
  2844. const _hoisted_1$h = {
  2845. key: 1,
  2846. class: "key-notice"
  2847. };
  2848. const _hoisted_2$e = { class: "key" };
  2849. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  2850. __name: "BaseButton",
  2851. props: {
  2852. keyboard: {},
  2853. active: { type: Boolean },
  2854. disabled: { type: Boolean },
  2855. loading: { type: Boolean },
  2856. size: { default: "normal" },
  2857. type: { default: "primary" }
  2858. },
  2859. emits: ["click"],
  2860. setup(__props) {
  2861. return (_ctx, _cache) => {
  2862. return vue.openBlock(), vue.createBlock(Tooltip, {
  2863. disabled: !_ctx.keyboard,
  2864. title: `快捷键: ${_ctx.keyboard}`
  2865. }, {
  2866. default: vue.withCtx(() => [
  2867. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  2868. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  2869. class: [
  2870. _ctx.active && "active",
  2871. _ctx.size,
  2872. _ctx.type,
  2873. (_ctx.disabled || _ctx.loading) && "disabled",
  2874. !_ctx.disabled && "hvr-grow"
  2875. ]
  2876. }), [
  2877. vue.createElementVNode("span", {
  2878. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  2879. }, [
  2880. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2881. ], 4),
  2882. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  2883. key: 0,
  2884. size: "small"
  2885. })) : vue.createCommentVNode("", true),
  2886. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
  2887. vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(_ctx.keyboard), 1)
  2888. ])) : vue.createCommentVNode("", true)
  2889. ], 16)
  2890. ]),
  2891. _: 3
  2892. }, 8, ["disabled", "title"]);
  2893. };
  2894. }
  2895. });
  2896. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-5a7d79ba"]]);
  2897. const _sfc_main$g = {
  2898. name: "Setting",
  2899. components: {
  2900. BaseButton,
  2901. PopConfirm,
  2902. Icon,
  2903. BaseSelect,
  2904. BaseSwitch,
  2905. Tooltip
  2906. },
  2907. inject: ["isNight"],
  2908. props: {
  2909. show: {
  2910. type: Boolean,
  2911. default() {
  2912. return false;
  2913. }
  2914. }
  2915. },
  2916. data() {
  2917. return {
  2918. tabIndex: 0
  2919. };
  2920. },
  2921. methods: {
  2922. confirm() {
  2923. this.close();
  2924. this.$emit("confirm");
  2925. },
  2926. close() {
  2927. this.$emit("update:show", false);
  2928. }
  2929. }
  2930. };
  2931. const _withScopeId$b = (n2) => (vue.pushScopeId("data-v-386b43d0"), n2 = n2(), vue.popScopeId(), n2);
  2932. const _hoisted_1$g = {
  2933. key: 0,
  2934. class: "setting-modal modal"
  2935. };
  2936. const _hoisted_2$d = { class: "modal-root" };
  2937. const _hoisted_3$b = { class: "modal-header" };
  2938. const _hoisted_4$b = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 使用需知 ", -1));
  2939. const _hoisted_5$9 = { class: "body" };
  2940. const _hoisted_6$9 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "modal-content" }, [
  2941. /* @__PURE__ */ vue.createElementVNode("div", null, "开启此功能会带来以下影响"),
  2942. /* @__PURE__ */ vue.createElementVNode("div", null, "缺点"),
  2943. /* @__PURE__ */ vue.createElementVNode("div", { style: { "color": "red" } }, [
  2944. /* @__PURE__ */ vue.createElementVNode("div", null, "1、你的IP可能会被封禁"),
  2945. /* @__PURE__ */ vue.createElementVNode("div", null, "2、消耗更多流量,给服务器带来更大的负担"),
  2946. /* @__PURE__ */ vue.createElementVNode("div", null, "3、你的V站浏览进度条会变快")
  2947. ]),
  2948. /* @__PURE__ */ vue.createElementVNode("div", null, "优点"),
  2949. /* @__PURE__ */ vue.createElementVNode("div", null, "1、卡片模式,无需打开主题即可查看内容"),
  2950. /* @__PURE__ */ vue.createElementVNode("div", null, "2、打开主题时提前预览正文内容,无需等待加载"),
  2951. /* @__PURE__ */ vue.createElementVNode("div", null, "原理"),
  2952. /* @__PURE__ */ vue.createElementVNode("div", null, "1、解析列表所有主题ID,批量调用show.json接口,获取对应主题的正文"),
  2953. /* @__PURE__ */ vue.createElementVNode("div", null, "2、请求的主题数据会缓存到本地,不会重复请求,超过3天的数据会删除"),
  2954. /* @__PURE__ */ vue.createElementVNode("div", null, "3、前面4条会并发请求,4条以后的一秒请求一条")
  2955. ], -1));
  2956. const _hoisted_7$8 = { class: "btns" };
  2957. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2958. const _component_Icon = vue.resolveComponent("Icon");
  2959. const _component_BaseButton = vue.resolveComponent("BaseButton");
  2960. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  2961. default: vue.withCtx(() => [
  2962. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  2963. vue.createElementVNode("div", {
  2964. class: "mask",
  2965. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  2966. }),
  2967. vue.createElementVNode("div", _hoisted_2$d, [
  2968. vue.createElementVNode("div", _hoisted_3$b, [
  2969. _hoisted_4$b,
  2970. vue.createVNode(_component_Icon, {
  2971. icon: "ic:round-close",
  2972. onClick: $options.close
  2973. }, null, 8, ["onClick"])
  2974. ]),
  2975. vue.createElementVNode("div", _hoisted_5$9, [
  2976. _hoisted_6$9,
  2977. vue.createElementVNode("div", _hoisted_7$8, [
  2978. vue.createVNode(_component_BaseButton, {
  2979. type: "link",
  2980. onClick: $options.close
  2981. }, {
  2982. default: vue.withCtx(() => [
  2983. vue.createTextVNode("不同意")
  2984. ]),
  2985. _: 1
  2986. }, 8, ["onClick"]),
  2987. vue.createVNode(_component_BaseButton, { onClick: $options.confirm }, {
  2988. default: vue.withCtx(() => [
  2989. vue.createTextVNode("同意")
  2990. ]),
  2991. _: 1
  2992. }, 8, ["onClick"])
  2993. ])
  2994. ])
  2995. ])
  2996. ])) : vue.createCommentVNode("", true)
  2997. ]),
  2998. _: 1
  2999. });
  3000. }
  3001. const NoticeModal = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$9], ["__scopeId", "data-v-386b43d0"]]);
  3002. const _sfc_main$f = {
  3003. name: "Setting",
  3004. components: {
  3005. NoticeModal,
  3006. PopConfirm,
  3007. Icon,
  3008. BaseSelect,
  3009. BaseSwitch,
  3010. Tooltip
  3011. },
  3012. inject: ["isNight"],
  3013. props: {
  3014. modelValue: {
  3015. type: Object,
  3016. default() {
  3017. return {};
  3018. }
  3019. },
  3020. show: {
  3021. type: Boolean,
  3022. default() {
  3023. return false;
  3024. }
  3025. }
  3026. },
  3027. data() {
  3028. return {
  3029. tabIndex: 0,
  3030. config: window.clone(this.modelValue),
  3031. showNotice: false
  3032. };
  3033. },
  3034. computed: {
  3035. DefaultVal() {
  3036. return DefaultVal;
  3037. },
  3038. CommentDisplayType() {
  3039. return CommentDisplayType;
  3040. },
  3041. isNew() {
  3042. return this.config.version < DefaultVal.currentVersion;
  3043. }
  3044. },
  3045. watch: {
  3046. config: {
  3047. handler(n2) {
  3048. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  3049. if (n2.topReplyLoveMinCount < 0) {
  3050. n2.topReplyLoveMinCount = 1;
  3051. }
  3052. this.$emit("update:modelValue", n2);
  3053. },
  3054. deep: true
  3055. },
  3056. "config.loopCheckNotice"(n2) {
  3057. if (n2) {
  3058. this.config.loopCheckNoticeInterval = 5;
  3059. this.config.whenNewNoticeGlimmer = false;
  3060. } else {
  3061. this.config.loopCheckNoticeInterval = 0;
  3062. this.config.whenNewNoticeGlimmer = false;
  3063. this.config.ddWebhook = "";
  3064. }
  3065. },
  3066. show(n2) {
  3067. if (n2) {
  3068. document.body.style.overflow = "hidden";
  3069. } else {
  3070. document.body.style.overflow = "unset";
  3071. }
  3072. }
  3073. },
  3074. methods: {
  3075. close() {
  3076. if (this.config.version < DefaultVal.currentVersion) {
  3077. this.config.version = DefaultVal.currentVersion;
  3078. }
  3079. this.$emit("update:show", false);
  3080. }
  3081. }
  3082. };
  3083. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-9e40bff6"), n2 = n2(), vue.popScopeId(), n2);
  3084. const _hoisted_1$f = {
  3085. key: 0,
  3086. class: "setting-modal modal"
  3087. };
  3088. const _hoisted_2$c = { class: "modal-root" };
  3089. const _hoisted_3$a = { class: "modal-header" };
  3090. const _hoisted_4$a = { class: "title" };
  3091. const _hoisted_5$8 = { class: "small" };
  3092. const _hoisted_6$8 = ["href"];
  3093. const _hoisted_7$7 = { class: "body" };
  3094. const _hoisted_8$7 = { class: "left" };
  3095. const _hoisted_9$7 = { class: "tabs" };
  3096. const _hoisted_10$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "列表设置", -1));
  3097. const _hoisted_11$7 = [
  3098. _hoisted_10$7
  3099. ];
  3100. const _hoisted_12$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "主题设置", -1));
  3101. const _hoisted_13$6 = [
  3102. _hoisted_12$7
  3103. ];
  3104. const _hoisted_14$5 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "其他设置", -1));
  3105. const _hoisted_15$4 = [
  3106. _hoisted_14$5
  3107. ];
  3108. const _hoisted_16$4 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "关于脚本", -1));
  3109. const _hoisted_17$4 = [
  3110. _hoisted_16$4
  3111. ];
  3112. const _hoisted_18$4 = { class: "icons" };
  3113. const _hoisted_19$3 = ["href"];
  3114. const _hoisted_20$2 = ["href"];
  3115. const _hoisted_21$2 = { class: "modal-content" };
  3116. const _hoisted_22$2 = { class: "scroll" };
  3117. const _hoisted_23$2 = { key: 0 };
  3118. const _hoisted_24$2 = { class: "row" };
  3119. const _hoisted_25$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  3120. const _hoisted_26$1 = { class: "wrapper" };
  3121. const _hoisted_27$1 = { class: "radio-group2" };
  3122. const _hoisted_28$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3123. const _hoisted_29$1 = { class: "row" };
  3124. const _hoisted_30$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题弹框显示", -1));
  3125. const _hoisted_31$1 = { class: "wrapper" };
  3126. const _hoisted_32$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3127. /* @__PURE__ */ vue.createTextVNode(" 开启此选项后,主题会"),
  3128. /* @__PURE__ */ vue.createElementVNode("span", { class: "danger" }, "始终"),
  3129. /* @__PURE__ */ vue.createTextVNode("以弹框的方式显示。优先级大于“新标签页打开链接” ")
  3130. ], -1));
  3131. const _hoisted_33$1 = { class: "row" };
  3132. const _hoisted_34$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  3133. const _hoisted_35$1 = { class: "wrapper" };
  3134. const _hoisted_36$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  3135. const _hoisted_37$1 = { class: "row" };
  3136. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开新标签页时立即切换过去", -1));
  3137. const _hoisted_39$1 = { class: "wrapper" };
  3138. const _hoisted_40$1 = { key: 1 };
  3139. const _hoisted_41$1 = { class: "row" };
  3140. const _hoisted_42$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示回复展示方式", -1));
  3141. const _hoisted_43$1 = { class: "wrapper" };
  3142. const _hoisted_44$1 = { class: "row" };
  3143. const _hoisted_45$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  3144. const _hoisted_46$1 = { class: "wrapper" };
  3145. const _hoisted_47$1 = { class: "row" };
  3146. const _hoisted_48 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "单独打开主题时默认显示楼中楼", -1));
  3147. const _hoisted_49 = { class: "wrapper" };
  3148. const _hoisted_50 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 单独打开这种地址 https://v2ex.com/t/xxxx 时,是否默认显示楼中楼 ", -1));
  3149. const _hoisted_51 = { class: "row" };
  3150. const _hoisted_52 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "点击左右两侧透明处关闭主题详情弹框", -1));
  3151. const _hoisted_53 = { class: "wrapper" };
  3152. const _hoisted_54 = { class: "row" };
  3153. const _hoisted_55 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  3154. const _hoisted_56 = { class: "wrapper" };
  3155. const _hoisted_57 = { class: "row" };
  3156. const _hoisted_58 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题宽度", -1));
  3157. const _hoisted_59 = { class: "wrapper" };
  3158. const _hoisted_60 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3159. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则默认宽度为77rem。接受合法的width值: "),
  3160. /* @__PURE__ */ vue.createElementVNode("a", {
  3161. href: "https://vue3js.cn/interview/css/em_px_rem_vh_vw.html#%E4%BA%8C%E3%80%81%E5%8D%95%E4%BD%8D",
  3162. target: "_blank"
  3163. }, "rem、px、vw、vh(点此查看)"),
  3164. /* @__PURE__ */ vue.createTextVNode("。 vw代表屏幕百分比,如想要屏幕的66%,请填写66vw ")
  3165. ], -1));
  3166. const _hoisted_61 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 提示:此项设置以后,单独打开详情页时会出现主题突然变宽(窄)的问题,暂时无解 ", -1));
  3167. const _hoisted_62 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3168. const _hoisted_63 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3169. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  3170. ], -1));
  3171. const _hoisted_64 = { class: "row" };
  3172. const _hoisted_65 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  3173. const _hoisted_66 = { class: "wrapper" };
  3174. const _hoisted_67 = { class: "row" };
  3175. const _hoisted_68 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  3176. const _hoisted_69 = { class: "wrapper" };
  3177. const _hoisted_70 = { class: "row" };
  3178. const _hoisted_71 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  3179. const _hoisted_72 = { class: "wrapper" };
  3180. const _hoisted_73 = { key: 2 };
  3181. const _hoisted_74 = { class: "row" };
  3182. const _hoisted_75 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  3183. const _hoisted_76 = { class: "wrapper" };
  3184. const _hoisted_77 = { class: "row" };
  3185. const _hoisted_78 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  3186. const _hoisted_79 = { class: "wrapper" };
  3187. const _hoisted_80 = { class: "row" };
  3188. const _hoisted_81 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  3189. const _hoisted_82 = { class: "wrapper" };
  3190. const _hoisted_83 = { class: "row" };
  3191. const _hoisted_84 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自定义背景", -1));
  3192. const _hoisted_85 = { class: "wrapper" };
  3193. const _hoisted_86 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3194. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则脚本就什么都不做,V站大部分页面背景颜色默认为 #e2e2e2,少部分页面有特定背景。接受一个合法的css color值:例如"),
  3195. /* @__PURE__ */ vue.createElementVNode("a", {
  3196. href: "https://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value",
  3197. target: "_blank"
  3198. }, "red、#ffffff、rgb(222,222,22)(点此查看)"),
  3199. /* @__PURE__ */ vue.createTextVNode("等等。 ")
  3200. ], -1));
  3201. const _hoisted_87 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3202. const _hoisted_88 = { class: "row" };
  3203. const _hoisted_89 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  3204. const _hoisted_90 = { class: "wrapper" };
  3205. const _hoisted_91 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录,无法查看账号收藏了 ", -1));
  3206. const _hoisted_92 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3207. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "消息通知")
  3208. ], -1));
  3209. const _hoisted_93 = { class: "row" };
  3210. const _hoisted_94 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "接管未读提醒页面", -1));
  3211. const _hoisted_95 = { class: "wrapper" };
  3212. const _hoisted_96 = { class: "row" };
  3213. const _hoisted_97 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "定时查询未读提醒", -1));
  3214. const _hoisted_98 = { class: "wrapper" };
  3215. const _hoisted_99 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此功能会带来以下影响: 1、你的IP可能会被封禁 2、消耗更多流量,给服务器带来更大的负担 3、你的V站浏览进度条会变快 ", -1));
  3216. const _hoisted_100 = {
  3217. key: 0,
  3218. class: "sub-content"
  3219. };
  3220. const _hoisted_101 = { class: "row" };
  3221. const _hoisted_102 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "查询间隔", -1));
  3222. const _hoisted_103 = { class: "wrapper" };
  3223. const _hoisted_104 = ["value"];
  3224. const _hoisted_105 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 设置值太小,会导致频繁请求,你的IP可能会被封禁,建议设置为5,即每次5分钟查询一次 ", -1));
  3225. const _hoisted_106 = { class: "row" };
  3226. const _hoisted_107 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "当有新未读提醒时,网页标题闪烁", -1));
  3227. const _hoisted_108 = { class: "wrapper" };
  3228. const _hoisted_109 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3229. /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "钉钉Webhook地址")
  3230. ], -1));
  3231. const _hoisted_110 = { class: "desc" };
  3232. const _hoisted_111 = ["value"];
  3233. const _hoisted_112 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3234. const _hoisted_113 = { key: 3 };
  3235. const _hoisted_114 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("h1", null, "V2EX Next", -1));
  3236. const _hoisted_115 = { class: "project-desc" };
  3237. const _hoisted_116 = { style: { "line-height": "2" } };
  3238. const _hoisted_117 = ["href"];
  3239. const _hoisted_118 = ["href"];
  3240. const _hoisted_119 = ["href"];
  3241. const _hoisted_120 = ["href"];
  3242. const _hoisted_121 = ["href"];
  3243. const _hoisted_122 = ["href"];
  3244. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  3245. const _component_Icon = vue.resolveComponent("Icon");
  3246. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  3247. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  3248. const _component_NoticeModal = vue.resolveComponent("NoticeModal");
  3249. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  3250. default: vue.withCtx(() => [
  3251. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
  3252. vue.createElementVNode("div", {
  3253. class: "mask",
  3254. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  3255. }),
  3256. vue.createElementVNode("div", _hoisted_2$c, [
  3257. vue.createElementVNode("div", _hoisted_3$a, [
  3258. vue.createElementVNode("div", _hoisted_4$a, [
  3259. vue.createTextVNode(" 脚本设置 "),
  3260. vue.createElementVNode("div", _hoisted_5$8, [
  3261. vue.createElementVNode("a", {
  3262. href: $options.DefaultVal.mobileScript,
  3263. target: "_blank"
  3264. }, "(脚本现已支持移动端!)", 8, _hoisted_6$8)
  3265. ])
  3266. ]),
  3267. vue.createVNode(_component_Icon, {
  3268. icon: "ic:round-close",
  3269. onClick: $options.close
  3270. }, null, 8, ["onClick"])
  3271. ]),
  3272. vue.createElementVNode("div", _hoisted_7$7, [
  3273. vue.createElementVNode("div", _hoisted_8$7, [
  3274. vue.createElementVNode("div", _hoisted_9$7, [
  3275. vue.createElementVNode("div", {
  3276. class: vue.normalizeClass(["tab", $data.tabIndex === 0 && "active"]),
  3277. onClick: _cache[1] || (_cache[1] = ($event) => $data.tabIndex = 0)
  3278. }, _hoisted_11$7, 2),
  3279. vue.createElementVNode("div", {
  3280. class: vue.normalizeClass(["tab", $data.tabIndex === 1 && "active"]),
  3281. onClick: _cache[2] || (_cache[2] = ($event) => $data.tabIndex = 1)
  3282. }, _hoisted_13$6, 2),
  3283. vue.createElementVNode("div", {
  3284. class: vue.normalizeClass(["tab", $data.tabIndex === 2 && "active"]),
  3285. onClick: _cache[3] || (_cache[3] = ($event) => $data.tabIndex = 2)
  3286. }, _hoisted_15$4, 2),
  3287. vue.createElementVNode("div", {
  3288. class: vue.normalizeClass(["tab", $data.tabIndex === 3 && "active"]),
  3289. onClick: _cache[4] || (_cache[4] = ($event) => $data.tabIndex = 3)
  3290. }, _hoisted_17$4, 2)
  3291. ]),
  3292. vue.createElementVNode("div", _hoisted_18$4, [
  3293. vue.createElementVNode("a", {
  3294. href: $options.DefaultVal.git,
  3295. target: "_blank"
  3296. }, [
  3297. vue.createVNode(_component_Icon, { icon: "mdi:github" })
  3298. ], 8, _hoisted_19$3),
  3299. vue.createElementVNode("a", {
  3300. href: $options.DefaultVal.homeUrl,
  3301. target: "_blank"
  3302. }, [
  3303. vue.createVNode(_component_Icon, { icon: "iconamoon:home-light" })
  3304. ], 8, _hoisted_20$2)
  3305. ])
  3306. ]),
  3307. vue.createElementVNode("div", _hoisted_21$2, [
  3308. vue.createElementVNode("div", _hoisted_22$2, [
  3309. $data.tabIndex === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_23$2, [
  3310. vue.createElementVNode("div", _hoisted_24$2, [
  3311. _hoisted_25$1,
  3312. vue.createElementVNode("div", _hoisted_26$1, [
  3313. vue.createElementVNode("div", _hoisted_27$1, [
  3314. vue.createElementVNode("div", {
  3315. class: vue.normalizeClass(["radio", $data.config.viewType === "simple" ? "active" : ""]),
  3316. onClick: _cache[5] || (_cache[5] = ($event) => $data.config.viewType = "simple")
  3317. }, "简洁 ", 2),
  3318. vue.createElementVNode("div", {
  3319. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  3320. onClick: _cache[6] || (_cache[6] = ($event) => $data.config.viewType = "table")
  3321. }, "表格 ", 2),
  3322. vue.createElementVNode("div", {
  3323. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  3324. onClick: _cache[7] || (_cache[7] = ($event) => $data.showNotice = true)
  3325. }, "卡片 ", 2)
  3326. ])
  3327. ])
  3328. ]),
  3329. _hoisted_28$1,
  3330. vue.createElementVNode("div", _hoisted_29$1, [
  3331. _hoisted_30$1,
  3332. vue.createElementVNode("div", _hoisted_31$1, [
  3333. vue.createVNode(_component_BaseSwitch, {
  3334. modelValue: $data.config.clickPostItemOpenDetail,
  3335. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  3336. }, null, 8, ["modelValue"])
  3337. ])
  3338. ]),
  3339. _hoisted_32$1,
  3340. vue.createElementVNode("div", _hoisted_33$1, [
  3341. _hoisted_34$1,
  3342. vue.createElementVNode("div", _hoisted_35$1, [
  3343. vue.createVNode(_component_BaseSwitch, {
  3344. modelValue: $data.config.newTabOpen,
  3345. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.newTabOpen = $event)
  3346. }, null, 8, ["modelValue"])
  3347. ])
  3348. ]),
  3349. _hoisted_36$1,
  3350. vue.createElementVNode("div", _hoisted_37$1, [
  3351. _hoisted_38$1,
  3352. vue.createElementVNode("div", _hoisted_39$1, [
  3353. vue.createVNode(_component_BaseSwitch, {
  3354. modelValue: $data.config.newTabOpenActive,
  3355. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.config.newTabOpenActive = $event)
  3356. }, null, 8, ["modelValue"])
  3357. ])
  3358. ])
  3359. ])) : vue.createCommentVNode("", true),
  3360. $data.tabIndex === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40$1, [
  3361. vue.createElementVNode("div", _hoisted_41$1, [
  3362. _hoisted_42$1,
  3363. vue.createElementVNode("div", _hoisted_43$1, [
  3364. vue.createVNode(_component_BaseSwitch, {
  3365. modelValue: $data.config.showToolbar,
  3366. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.showToolbar = $event)
  3367. }, null, 8, ["modelValue"])
  3368. ])
  3369. ]),
  3370. vue.createElementVNode("div", _hoisted_44$1, [
  3371. _hoisted_45$1,
  3372. vue.createElementVNode("div", _hoisted_46$1, [
  3373. vue.createVNode(_component_BaseSelect, {
  3374. "display-type": $data.config.commentDisplayType,
  3375. "onUpdate:displayType": _cache[12] || (_cache[12] = ($event) => $data.config.commentDisplayType = $event)
  3376. }, null, 8, ["display-type"])
  3377. ])
  3378. ]),
  3379. vue.createElementVNode("div", _hoisted_47$1, [
  3380. _hoisted_48,
  3381. vue.createElementVNode("div", _hoisted_49, [
  3382. vue.createVNode(_component_BaseSwitch, {
  3383. modelValue: $data.config.autoOpenDetail,
  3384. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.autoOpenDetail = $event)
  3385. }, null, 8, ["modelValue"])
  3386. ])
  3387. ]),
  3388. _hoisted_50,
  3389. vue.createElementVNode("div", _hoisted_51, [
  3390. _hoisted_52,
  3391. vue.createElementVNode("div", _hoisted_53, [
  3392. vue.createVNode(_component_BaseSwitch, {
  3393. modelValue: $data.config.closePostDetailBySpace,
  3394. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.closePostDetailBySpace = $event)
  3395. }, null, 8, ["modelValue"])
  3396. ])
  3397. ]),
  3398. vue.createElementVNode("div", _hoisted_54, [
  3399. _hoisted_55,
  3400. vue.createElementVNode("div", _hoisted_56, [
  3401. vue.createVNode(_component_BaseSwitch, {
  3402. modelValue: $data.config.contentAutoCollapse,
  3403. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.contentAutoCollapse = $event)
  3404. }, null, 8, ["modelValue"])
  3405. ])
  3406. ]),
  3407. vue.createElementVNode("div", _hoisted_57, [
  3408. _hoisted_58,
  3409. vue.createElementVNode("div", _hoisted_59, [
  3410. vue.withDirectives(vue.createElementVNode("input", {
  3411. type: "text",
  3412. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.config.postWidth = $event)
  3413. }, null, 512), [
  3414. [vue.vModelText, $data.config.postWidth]
  3415. ])
  3416. ])
  3417. ]),
  3418. _hoisted_60,
  3419. _hoisted_61,
  3420. _hoisted_62,
  3421. _hoisted_63,
  3422. vue.createElementVNode("div", _hoisted_64, [
  3423. _hoisted_65,
  3424. vue.createElementVNode("div", _hoisted_66, [
  3425. vue.createVNode(_component_BaseSwitch, {
  3426. modelValue: $data.config.showTopReply,
  3427. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => $data.config.showTopReply = $event)
  3428. }, null, 8, ["modelValue"])
  3429. ])
  3430. ]),
  3431. vue.createElementVNode("div", _hoisted_67, [
  3432. _hoisted_68,
  3433. vue.createElementVNode("div", _hoisted_69, [
  3434. vue.withDirectives(vue.createElementVNode("input", {
  3435. type: "number",
  3436. min: "1",
  3437. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.config.topReplyCount = $event)
  3438. }, null, 512), [
  3439. [vue.vModelText, $data.config.topReplyCount]
  3440. ])
  3441. ])
  3442. ]),
  3443. vue.createElementVNode("div", _hoisted_70, [
  3444. _hoisted_71,
  3445. vue.createElementVNode("div", _hoisted_72, [
  3446. vue.withDirectives(vue.createElementVNode("input", {
  3447. type: "number",
  3448. min: "1",
  3449. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.config.topReplyLoveMinCount = $event)
  3450. }, null, 512), [
  3451. [vue.vModelText, $data.config.topReplyLoveMinCount]
  3452. ])
  3453. ])
  3454. ])
  3455. ])) : vue.createCommentVNode("", true),
  3456. $data.tabIndex === 2 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_73, [
  3457. vue.createElementVNode("div", _hoisted_74, [
  3458. _hoisted_75,
  3459. vue.createElementVNode("div", _hoisted_76, [
  3460. vue.createVNode(_component_BaseSwitch, {
  3461. modelValue: $data.config.openTag,
  3462. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => $data.config.openTag = $event)
  3463. }, null, 8, ["modelValue"])
  3464. ])
  3465. ]),
  3466. vue.createElementVNode("div", _hoisted_77, [
  3467. _hoisted_78,
  3468. vue.createElementVNode("div", _hoisted_79, [
  3469. vue.createVNode(_component_BaseSwitch, {
  3470. modelValue: $data.config.base64,
  3471. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => $data.config.base64 = $event)
  3472. }, null, 8, ["modelValue"])
  3473. ])
  3474. ]),
  3475. vue.createElementVNode("div", _hoisted_80, [
  3476. _hoisted_81,
  3477. vue.createElementVNode("div", _hoisted_82, [
  3478. vue.createVNode(_component_BaseSwitch, {
  3479. modelValue: $data.config.autoSignin,
  3480. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.config.autoSignin = $event)
  3481. }, null, 8, ["modelValue"])
  3482. ])
  3483. ]),
  3484. vue.createElementVNode("div", _hoisted_83, [
  3485. _hoisted_84,
  3486. vue.createElementVNode("div", _hoisted_85, [
  3487. vue.withDirectives(vue.createElementVNode("input", {
  3488. type: "text",
  3489. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $data.config.customBgColor = $event)
  3490. }, null, 512), [
  3491. [vue.vModelText, $data.config.customBgColor]
  3492. ])
  3493. ])
  3494. ]),
  3495. _hoisted_86,
  3496. _hoisted_87,
  3497. vue.createElementVNode("div", _hoisted_88, [
  3498. _hoisted_89,
  3499. vue.createElementVNode("div", _hoisted_90, [
  3500. vue.createVNode(_component_BaseSwitch, {
  3501. modelValue: $data.config.collectBrowserNotice,
  3502. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => $data.config.collectBrowserNotice = $event)
  3503. }, null, 8, ["modelValue"])
  3504. ])
  3505. ]),
  3506. _hoisted_91,
  3507. _hoisted_92,
  3508. vue.createElementVNode("div", _hoisted_93, [
  3509. _hoisted_94,
  3510. vue.createElementVNode("div", _hoisted_95, [
  3511. vue.createVNode(_component_BaseSwitch, {
  3512. modelValue: $data.config.notice.takeOverNoticePage,
  3513. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => $data.config.notice.takeOverNoticePage = $event)
  3514. }, null, 8, ["modelValue"])
  3515. ])
  3516. ]),
  3517. vue.createElementVNode("div", _hoisted_96, [
  3518. _hoisted_97,
  3519. vue.createElementVNode("div", _hoisted_98, [
  3520. vue.createVNode(_component_BaseSwitch, {
  3521. modelValue: $data.config.notice.loopCheckNotice,
  3522. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => $data.config.notice.loopCheckNotice = $event)
  3523. }, null, 8, ["modelValue"])
  3524. ])
  3525. ]),
  3526. _hoisted_99,
  3527. $data.config.notice.loopCheckNotice ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_100, [
  3528. vue.createElementVNode("div", _hoisted_101, [
  3529. _hoisted_102,
  3530. vue.createElementVNode("div", _hoisted_103, [
  3531. vue.createElementVNode("input", {
  3532. type: "number",
  3533. value: $data.config.notice.loopCheckNoticeInterval,
  3534. onBlur: _cache[27] || (_cache[27] = (e2) => $data.config.notice.loopCheckNoticeInterval = e2.target.value),
  3535. style: { "margin-right": "1rem" }
  3536. }, null, 40, _hoisted_104),
  3537. vue.createTextVNode("分钟 ")
  3538. ])
  3539. ]),
  3540. _hoisted_105,
  3541. vue.createElementVNode("div", _hoisted_106, [
  3542. _hoisted_107,
  3543. vue.createElementVNode("div", _hoisted_108, [
  3544. vue.createVNode(_component_BaseSwitch, {
  3545. modelValue: $data.config.notice.whenNewNoticeGlimmer,
  3546. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => $data.config.notice.whenNewNoticeGlimmer = $event)
  3547. }, null, 8, ["modelValue"])
  3548. ])
  3549. ]),
  3550. _hoisted_109,
  3551. vue.createElementVNode("div", _hoisted_110, [
  3552. vue.createElementVNode("input", {
  3553. type: "text",
  3554. value: $data.config.notice.ddWebhook,
  3555. onBlur: _cache[29] || (_cache[29] = (e2) => $data.config.notice.ddWebhook = e2.target.value),
  3556. style: { "width": "100%" }
  3557. }, null, 40, _hoisted_111)
  3558. ])
  3559. ])) : vue.createCommentVNode("", true),
  3560. _hoisted_112
  3561. ])) : vue.createCommentVNode("", true),
  3562. $data.tabIndex === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_113, [
  3563. _hoisted_114,
  3564. vue.createElementVNode("div", _hoisted_115, [
  3565. vue.createElementVNode("div", _hoisted_116, [
  3566. vue.createElementVNode("div", null, [
  3567. vue.createTextVNode("官网:"),
  3568. vue.createElementVNode("a", {
  3569. href: $options.DefaultVal.homeUrl,
  3570. target: "_blank"
  3571. }, vue.toDisplayString($options.DefaultVal.homeUrl), 9, _hoisted_117)
  3572. ]),
  3573. vue.createElementVNode("div", null, [
  3574. vue.createTextVNode("GitHub地址:"),
  3575. vue.createElementVNode("a", {
  3576. href: $options.DefaultVal.git,
  3577. target: "_blank"
  3578. }, vue.toDisplayString($options.DefaultVal.git), 9, _hoisted_118)
  3579. ]),
  3580. vue.createElementVNode("div", null, [
  3581. vue.createTextVNode("PC脚本地址:"),
  3582. vue.createElementVNode("a", {
  3583. href: $options.DefaultVal.pcScript,
  3584. target: "_blank"
  3585. }, vue.toDisplayString($options.DefaultVal.pcScript), 9, _hoisted_119)
  3586. ]),
  3587. vue.createElementVNode("div", null, [
  3588. vue.createTextVNode("移动端脚本地址:"),
  3589. vue.createElementVNode("a", {
  3590. href: $options.DefaultVal.mobileScript,
  3591. target: "_blank"
  3592. }, vue.toDisplayString($options.DefaultVal.mobileScript), 9, _hoisted_120)
  3593. ]),
  3594. vue.createElementVNode("div", null, [
  3595. vue.createTextVNode("反馈: "),
  3596. vue.createElementVNode("a", {
  3597. href: $options.DefaultVal.issue,
  3598. target: "_blank"
  3599. }, vue.toDisplayString($options.DefaultVal.issue), 9, _hoisted_121)
  3600. ]),
  3601. vue.createElementVNode("div", null, [
  3602. vue.createTextVNode("更新日志:"),
  3603. vue.createElementVNode("a", {
  3604. href: $options.DefaultVal.pcLog,
  3605. target: "_blank"
  3606. }, vue.toDisplayString($options.DefaultVal.pcLog), 9, _hoisted_122)
  3607. ])
  3608. ])
  3609. ])
  3610. ])) : vue.createCommentVNode("", true)
  3611. ])
  3612. ])
  3613. ])
  3614. ]),
  3615. vue.createVNode(_component_NoticeModal, {
  3616. show: $data.showNotice,
  3617. "onUpdate:show": _cache[30] || (_cache[30] = ($event) => $data.showNotice = $event),
  3618. onConfirm: _cache[31] || (_cache[31] = ($event) => $data.config.viewType = "card")
  3619. }, null, 8, ["show"])
  3620. ])) : vue.createCommentVNode("", true)
  3621. ]),
  3622. _: 1
  3623. });
  3624. }
  3625. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$8], ["__scopeId", "data-v-9e40bff6"]]);
  3626. const _sfc_main$e = {
  3627. name: "Point",
  3628. components: { PopConfirm, Icon },
  3629. inject: ["post", "isLogin"],
  3630. props: {
  3631. item: {
  3632. type: Object,
  3633. default() {
  3634. return {};
  3635. }
  3636. },
  3637. apiUrl: ""
  3638. },
  3639. computed: {
  3640. disabled() {
  3641. return this.item.username === window.user.username || this.item.isThanked || !this.isLogin;
  3642. }
  3643. },
  3644. methods: {
  3645. thankError() {
  3646. if (!this.isLogin) {
  3647. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3648. }
  3649. if (this.item.username === window.user.username) {
  3650. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  3651. }
  3652. if (this.item.isThanked) {
  3653. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  3654. }
  3655. },
  3656. async thank() {
  3657. this.$emit("addThank");
  3658. let url = `${location.origin}/thank/${this.apiUrl}?once=${this.post.once}`;
  3659. $.post(url).then((res) => {
  3660. if (!res.success) {
  3661. this.$emit("recallThank");
  3662. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  3663. }
  3664. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  3665. }, (err) => {
  3666. this.$emit("recallThank");
  3667. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  3668. eventBus.emit(CMD.REFRESH_ONCE);
  3669. });
  3670. }
  3671. }
  3672. };
  3673. const _hoisted_1$e = {
  3674. key: 2,
  3675. class: "link-num"
  3676. };
  3677. const _hoisted_2$b = { key: 3 };
  3678. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  3679. const _component_Icon = vue.resolveComponent("Icon");
  3680. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3681. return vue.openBlock(), vue.createBlock(_component_PopConfirm, {
  3682. disabled: $options.disabled,
  3683. title: `确认花费 10 个铜币向 @${$props.item.username} 的这条回复发送感谢?`,
  3684. onConfirm: $options.thank
  3685. }, {
  3686. default: vue.withCtx(() => [
  3687. vue.createElementVNode("div", {
  3688. class: vue.normalizeClass(["tool", [$options.disabled && "disabled"]]),
  3689. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  3690. }, [
  3691. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3692. key: 0,
  3693. color: "rgb(224,42,42)",
  3694. icon: "icon-park-solid:like"
  3695. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  3696. key: 1,
  3697. color: !$props.item.thankCount ? null : "rgb(224,42,42)",
  3698. icon: "icon-park-outline:like"
  3699. }, null, 8, ["color"])),
  3700. $props.item.thankCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$e, vue.toDisplayString($props.item.thankCount), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$b, "感谢"))
  3701. ], 2)
  3702. ]),
  3703. _: 1
  3704. }, 8, ["disabled", "title", "onConfirm"]);
  3705. }
  3706. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$7]]);
  3707. const _sfc_main$d = {
  3708. name: "Author",
  3709. components: { PopConfirm, Point, Icon },
  3710. inject: ["isLogin", "tags", "config", "isNight"],
  3711. props: {
  3712. modelValue: false,
  3713. comment: {
  3714. type: Object,
  3715. default() {
  3716. return {};
  3717. }
  3718. },
  3719. type: {
  3720. type: String,
  3721. default() {
  3722. return "list";
  3723. }
  3724. }
  3725. },
  3726. computed: {
  3727. isDev() {
  3728. return false;
  3729. },
  3730. pointInfo() {
  3731. return {
  3732. isThanked: this.comment.isThanked,
  3733. thankCount: this.comment.thankCount,
  3734. username: this.comment.username
  3735. };
  3736. },
  3737. myTags() {
  3738. return this.tags[this.comment.username] ?? [];
  3739. },
  3740. context() {
  3741. return this.comment.replyUsers.length;
  3742. }
  3743. },
  3744. methods: {
  3745. jump() {
  3746. eventBus.emit(CMD.JUMP, this.comment.floor);
  3747. },
  3748. showRelationReply() {
  3749. if (!this.comment.replyUsers.length) {
  3750. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  3751. return;
  3752. }
  3753. eventBus.emit(CMD.RELATION_REPLY, {
  3754. left: this.comment.replyUsers,
  3755. right: this.comment.username,
  3756. rightFloor: this.comment.floor
  3757. });
  3758. },
  3759. addTag() {
  3760. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  3761. },
  3762. removeTag(tag) {
  3763. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  3764. },
  3765. checkIsLogin(emitName = "") {
  3766. if (!this.isLogin) {
  3767. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3768. return false;
  3769. }
  3770. this.$emit(emitName);
  3771. return true;
  3772. },
  3773. addThank() {
  3774. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  3775. },
  3776. recallThank() {
  3777. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  3778. }
  3779. }
  3780. };
  3781. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-64aa1930"), n2 = n2(), vue.popScopeId(), n2);
  3782. const _hoisted_1$d = { class: "Author-left" };
  3783. const _hoisted_2$a = ["href"];
  3784. const _hoisted_3$9 = ["src"];
  3785. const _hoisted_4$9 = { class: "texts" };
  3786. const _hoisted_5$7 = ["href"];
  3787. const _hoisted_6$7 = {
  3788. key: 0,
  3789. class: "owner"
  3790. };
  3791. const _hoisted_7$6 = {
  3792. key: 1,
  3793. class: "dup"
  3794. };
  3795. const _hoisted_8$6 = {
  3796. key: 2,
  3797. class: "mod"
  3798. };
  3799. const _hoisted_9$6 = { class: "ago" };
  3800. const _hoisted_10$6 = { class: "my-tag" };
  3801. const _hoisted_11$6 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3802. const _hoisted_12$6 = ["onClick"];
  3803. const _hoisted_13$5 = { class: "Author-right" };
  3804. const _hoisted_14$4 = {
  3805. key: 0,
  3806. class: "toolbar"
  3807. };
  3808. const _hoisted_15$3 = { class: "tool" };
  3809. const _hoisted_16$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "隐藏", -1));
  3810. const _hoisted_17$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  3811. const _hoisted_18$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  3812. const _hoisted_19$2 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  3813. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  3814. const _component_Icon = vue.resolveComponent("Icon");
  3815. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3816. const _component_Point = vue.resolveComponent("Point");
  3817. return vue.openBlock(), vue.createElementBlock("div", {
  3818. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  3819. }, [
  3820. vue.createElementVNode("div", _hoisted_1$d, [
  3821. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3822. key: 0,
  3823. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.$emit("update:modelValue", true), ["stop"])),
  3824. color: "#177EC9",
  3825. class: "expand-icon",
  3826. icon: "gravity-ui:chevrons-expand-up-right"
  3827. })) : vue.createCommentVNode("", true),
  3828. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  3829. key: 1,
  3830. class: "avatar",
  3831. href: `/member/${$props.comment.username}`
  3832. }, [
  3833. vue.createElementVNode("img", {
  3834. src: $props.comment.avatar,
  3835. alt: ""
  3836. }, null, 8, _hoisted_3$9)
  3837. ], 8, _hoisted_2$a)) : vue.createCommentVNode("", true),
  3838. vue.createElementVNode("span", _hoisted_4$9, [
  3839. vue.createElementVNode("strong", null, [
  3840. vue.createElementVNode("a", {
  3841. href: `/member/${$props.comment.username}`,
  3842. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  3843. }, vue.toDisplayString($props.comment.username), 11, _hoisted_5$7)
  3844. ]),
  3845. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$7, "OP")) : vue.createCommentVNode("", true),
  3846. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$6, "DUP")) : vue.createCommentVNode("", true),
  3847. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$6, "MOD")) : vue.createCommentVNode("", true),
  3848. vue.createElementVNode("span", _hoisted_9$6, vue.toDisplayString($props.comment.date), 1),
  3849. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  3850. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3851. return vue.openBlock(), vue.createElementBlock("span", _hoisted_10$6, [
  3852. _hoisted_11$6,
  3853. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3854. vue.createElementVNode("i", {
  3855. class: "fa fa-trash-o remove",
  3856. onClick: vue.withModifiers(($event) => $options.removeTag(i), ["stop"])
  3857. }, null, 8, _hoisted_12$6)
  3858. ]);
  3859. }), 256)),
  3860. vue.createElementVNode("span", {
  3861. class: "add-tag ago",
  3862. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.addTag && $options.addTag(...args), ["stop"])),
  3863. title: "添加标签"
  3864. }, "+")
  3865. ], 64)) : vue.createCommentVNode("", true)
  3866. ])
  3867. ]),
  3868. vue.createElementVNode("div", _hoisted_13$5, [
  3869. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$4, [
  3870. vue.createVNode(_component_PopConfirm, {
  3871. title: "确认隐藏这条回复?",
  3872. onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
  3873. }, {
  3874. default: vue.withCtx(() => [
  3875. vue.createElementVNode("div", _hoisted_15$3, [
  3876. vue.createVNode(_component_Icon, { icon: "fluent:eye-hide-24-regular" }),
  3877. _hoisted_16$3
  3878. ])
  3879. ]),
  3880. _: 1
  3881. }),
  3882. $options.context ? (vue.openBlock(), vue.createElementBlock("div", {
  3883. key: 0,
  3884. class: "tool",
  3885. onClick: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.showRelationReply && $options.showRelationReply(...args), ["stop"]))
  3886. }, [
  3887. vue.createVNode(_component_Icon, { icon: "iconoir:page-search" }),
  3888. _hoisted_17$3
  3889. ])) : vue.createCommentVNode("", true),
  3890. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  3891. key: 1,
  3892. class: "tool",
  3893. onClick: _cache[4] || (_cache[4] = vue.withModifiers((...args) => $options.jump && $options.jump(...args), ["stop"]))
  3894. }, [
  3895. vue.createVNode(_component_Icon, { icon: "icon-park-outline:to-bottom" }),
  3896. _hoisted_18$3
  3897. ])) : vue.createCommentVNode("", true),
  3898. vue.createElementVNode("div", {
  3899. class: "tool",
  3900. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => $options.checkIsLogin("reply"), ["stop"]))
  3901. }, [
  3902. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  3903. _hoisted_19$2
  3904. ]),
  3905. vue.withDirectives(vue.createVNode(_component_Point, {
  3906. item: $options.pointInfo,
  3907. onAddThank: $options.addThank,
  3908. onRecallThank: $options.recallThank,
  3909. "api-url": "reply/" + $props.comment.id
  3910. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3911. [vue.vShow, !$props.comment.thankCount]
  3912. ])
  3913. ])) : vue.createCommentVNode("", true),
  3914. vue.withDirectives(vue.createVNode(_component_Point, {
  3915. item: $options.pointInfo,
  3916. onAddThank: $options.addThank,
  3917. onRecallThank: $options.recallThank,
  3918. "api-url": "reply/" + $props.comment.id
  3919. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3920. [vue.vShow, $props.comment.thankCount]
  3921. ]),
  3922. vue.createElementVNode("div", {
  3923. class: vue.normalizeClass(["floor", { isDev: $options.isDev }])
  3924. }, vue.toDisplayString($props.comment.floor), 3)
  3925. ])
  3926. ], 2);
  3927. }
  3928. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$6], ["__scopeId", "data-v-64aa1930"]]);
  3929. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-7fe2eb8d"), n2 = n2(), vue.popScopeId(), n2);
  3930. const _hoisted_1$c = { class: "get-cursor" };
  3931. const _hoisted_2$9 = ["innerHTML"];
  3932. const _hoisted_3$8 = { class: "toolbar" };
  3933. const _hoisted_4$8 = { class: "left" };
  3934. const _hoisted_5$6 = { class: "upload" };
  3935. const _hoisted_6$6 = {
  3936. key: 0,
  3937. style: { "color": "black", "font-size": "1.4rem" }
  3938. };
  3939. const _hoisted_7$5 = { class: "right" };
  3940. const _hoisted_8$5 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典", -1));
  3941. const _hoisted_9$5 = { class: "list" };
  3942. const _hoisted_10$5 = ["src", "onClick"];
  3943. const _hoisted_11$5 = { class: "emoji" };
  3944. const _hoisted_12$5 = { class: "title" };
  3945. const _hoisted_13$4 = { class: "list" };
  3946. const _hoisted_14$3 = ["onClick"];
  3947. const _sfc_main$c = {
  3948. __name: "PostEditor",
  3949. props: {
  3950. replyUser: null,
  3951. replyFloor: null,
  3952. useType: {
  3953. type: String,
  3954. default() {
  3955. return "reply-comment";
  3956. }
  3957. }
  3958. },
  3959. emits: ["close"],
  3960. setup(__props, { expose: __expose, emit: __emit }) {
  3961. const props = __props;
  3962. const { replyUser, replyFloor, useType } = props;
  3963. const replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3964. const emits = __emit;
  3965. const post = vue.inject("post");
  3966. const show = vue.inject("show");
  3967. const isNight = vue.inject("isNight");
  3968. vue.inject("pageType");
  3969. const allReplyUsers = vue.inject("allReplyUsers");
  3970. let isFocus = vue.ref(false);
  3971. const loading = vue.ref(false);
  3972. const uploadLoading = vue.ref(false);
  3973. const isShowEmoticons = vue.ref(false);
  3974. const editorId = vue.ref("editorId_" + Date.now());
  3975. const content = vue.ref(replyInfo);
  3976. const txtRef = vue.ref(null);
  3977. const cursorRef = vue.ref(null);
  3978. const emoticonsRef = vue.ref(null);
  3979. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  3980. const imgurClientIdPool = [
  3981. "3107b9ef8b316f3",
  3982. "442b04f26eefc8a",
  3983. "59cfebe717c09e4",
  3984. "60605aad4a62882",
  3985. "6c65ab1d3f5452a",
  3986. "83e123737849aa9",
  3987. "9311f6be1c10160",
  3988. "c4a4a563f698595",
  3989. "81be04b9e4a08ce"
  3990. ];
  3991. __expose({ content, isFocus: () => isFocus.value });
  3992. const editorClass = vue.computed(() => {
  3993. return [useType, isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  3994. });
  3995. const cursorHtml = vue.computed(() => {
  3996. var _a;
  3997. if (!txtRef.value || !content.value)
  3998. return "";
  3999. let index = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  4000. return content.value.substring(0, index).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  4001. });
  4002. const disabled = vue.computed(() => {
  4003. if (content.value) {
  4004. return content.value === replyInfo;
  4005. } else {
  4006. return true;
  4007. }
  4008. });
  4009. function drop(e2) {
  4010. e2.preventDefault();
  4011. upload(e2.dataTransfer.files[0]);
  4012. }
  4013. async function upload(file) {
  4014. if (!file)
  4015. return;
  4016. if (uploadLoading.value)
  4017. return;
  4018. uploadLoading.value = true;
  4019. const formData = new FormData();
  4020. formData.append("image", file);
  4021. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  4022. const clidenId = imgurClientIdPool[randomIndex];
  4023. const res = await fetch("https://api.imgur.com/3/upload", {
  4024. method: "POST",
  4025. headers: { Authorization: `Client-ID ${clidenId}` },
  4026. body: formData
  4027. });
  4028. uploadLoading.value = false;
  4029. if (res.ok) {
  4030. const resData = await res.json();
  4031. if (resData.success) {
  4032. return insert(" " + resData.data.link + " ");
  4033. }
  4034. }
  4035. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  4036. }
  4037. async function submit() {
  4038. if (disabled.value || loading.value)
  4039. return;
  4040. loading.value = true;
  4041. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  4042. let item2 = classicsEmoticons.find((v) => v.name === match);
  4043. if (item2) {
  4044. return item2.low + " ";
  4045. }
  4046. return match;
  4047. });
  4048. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  4049. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  4050. });
  4051. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  4052. let item2 = classicsEmoticons.find((v) => v.name === match);
  4053. if (item2) {
  4054. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  4055. }
  4056. return match;
  4057. });
  4058. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  4059. if (matchUsers) {
  4060. matchUsers.map((i) => {
  4061. let username = i.replace("@", "").replace(" ", "");
  4062. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  4063. });
  4064. }
  4065. show_content = show_content.replaceAll("\n", "<br/>");
  4066. let item = {
  4067. thankCount: 0,
  4068. isThanked: false,
  4069. isOp: post.value.username === window.user.username,
  4070. isDup: false,
  4071. id: Date.now(),
  4072. username: window.user.username,
  4073. avatar: window.user.avatar,
  4074. date: "几秒前",
  4075. floor: post.value.replyCount + 1,
  4076. reply_content: show_content ?? "",
  4077. children: [],
  4078. replyUsers: replyUser ? [replyUser] : [],
  4079. replyFloor: replyFloor || -1,
  4080. level: useType === "reply-comment" ? 1 : 0
  4081. };
  4082. item.hideCallUserReplyContent = item.reply_content;
  4083. if (item.replyUsers.length === 1) {
  4084. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  4085. }
  4086. let url = `${location.origin}/t/${post.value.id}`;
  4087. $.post(url, { content: submit_content, once: post.value.once }).then(
  4088. // $.post(url, {content: submit_content, once: 123}).then(
  4089. (res) => {
  4090. loading.value = false;
  4091. let r2 = res.search("你上一条回复的内容和这条相同");
  4092. if (r2 > -1)
  4093. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  4094. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  4095. if (r2 > -1)
  4096. return eventBus.emit(CMD.SHOW_MSG, {
  4097. type: "error",
  4098. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  4099. });
  4100. let r22 = res.search("创建新回复");
  4101. if (r22 > -1) {
  4102. eventBus.emit(CMD.REFRESH_ONCE, res);
  4103. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  4104. let clientWidth = window.document.body.clientWidth;
  4105. let windowWidth = 1200;
  4106. let left = clientWidth / 2 - windowWidth / 2;
  4107. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  4108. newWin.document.write(res);
  4109. let loop = setInterval(function() {
  4110. if (newWin.closed) {
  4111. clearInterval(loop);
  4112. eventBus.emit(CMD.REFRESH_POST);
  4113. }
  4114. }, 1e3);
  4115. return;
  4116. }
  4117. content.value = replyInfo;
  4118. emits("close");
  4119. eventBus.emit(CMD.REFRESH_ONCE, res);
  4120. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  4121. eventBus.emit(CMD.ADD_REPLY, item);
  4122. },
  4123. (err) => {
  4124. loading.value = false;
  4125. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  4126. }
  4127. ).catch((r2) => {
  4128. });
  4129. }
  4130. function showEmoticons(e2) {
  4131. if (isShowEmoticons.value) {
  4132. return isShowEmoticons.value = false;
  4133. }
  4134. let rect = e2.currentTarget.getBoundingClientRect();
  4135. emoticonsRef.value.style.left = rect.left + 30 + "px";
  4136. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  4137. isShowEmoticons.value = true;
  4138. }
  4139. function off() {
  4140. eventBus.emit(CMD.SHOW_CALL, { show: false });
  4141. eventBus.off(CMD.SET_CALL);
  4142. }
  4143. function checkHeight2() {
  4144. txtRef.value.style.height = 0;
  4145. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  4146. }
  4147. function insert(str) {
  4148. let cursorPos = txtRef.value.selectionStart;
  4149. let start = content.value.slice(0, cursorPos);
  4150. let end = content.value.slice(cursorPos, content.value.length);
  4151. content.value = start + str + end;
  4152. let moveCursorPos = start.length + str.length;
  4153. setTimeout(() => {
  4154. txtRef.value.focus();
  4155. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  4156. checkHeight2();
  4157. });
  4158. }
  4159. function showCallPopover(text) {
  4160. let r2 = cursorRef.value.getBoundingClientRect();
  4161. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  4162. eventBus.off(CMD.SET_CALL);
  4163. eventBus.on(CMD.SET_CALL, (e2) => {
  4164. let cursorPos = txtRef.value.selectionStart;
  4165. let start = content.value.slice(0, cursorPos);
  4166. let end = content.value.slice(cursorPos, content.value.length);
  4167. let lastCallPos = start.lastIndexOf("@");
  4168. start = content.value.slice(0, lastCallPos + 1);
  4169. if (e2 === "管理员") {
  4170. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid @drymonfidelia";
  4171. }
  4172. if (e2 === "所有人") {
  4173. e2 = allReplyUsers.value.map((v, i) => {
  4174. if (i)
  4175. return "@" + v;
  4176. else
  4177. return v;
  4178. }).join(" ");
  4179. }
  4180. content.value = start + e2 + " " + end;
  4181. let moveCursorPos = start.length + e2.length + 1;
  4182. setTimeout(() => {
  4183. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  4184. checkHeight2();
  4185. });
  4186. eventBus.off(CMD.SET_CALL);
  4187. });
  4188. }
  4189. function onKeydown(e2) {
  4190. let code = e2.keyCode;
  4191. switch (code) {
  4192. case 8:
  4193. if (content.value === "@") {
  4194. off();
  4195. }
  4196. break;
  4197. case 37:
  4198. case 38:
  4199. case 39:
  4200. case 40:
  4201. setTimeout(() => onInput({ data: "" }), 100);
  4202. break;
  4203. case 27:
  4204. e2.preventDefault();
  4205. e2.stopPropagation();
  4206. e2.stopImmediatePropagation();
  4207. return false;
  4208. case 13:
  4209. if (e2.ctrlKey)
  4210. submit();
  4211. if (e2.metaKey)
  4212. submit();
  4213. break;
  4214. }
  4215. }
  4216. function onInput(e2) {
  4217. let cursorPos = txtRef.value.selectionStart;
  4218. if (!content.value)
  4219. return;
  4220. if (e2.data === " ") {
  4221. return off();
  4222. }
  4223. if (e2.data === "@") {
  4224. if (content.value.length !== 1) {
  4225. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  4226. return showCallPopover("");
  4227. }
  4228. } else {
  4229. return showCallPopover("");
  4230. }
  4231. off();
  4232. } else {
  4233. checkHeight2();
  4234. let judgeStr = content.value.slice(0, cursorPos);
  4235. let lastCallPos = judgeStr.lastIndexOf("@");
  4236. if (lastCallPos === -1) {
  4237. return off();
  4238. }
  4239. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  4240. let hasSpace = callStr.includes(" ");
  4241. if (hasSpace) {
  4242. off();
  4243. } else {
  4244. if (lastCallPos === 0) {
  4245. return showCallPopover(callStr.replace("@", ""));
  4246. }
  4247. if (content.value.length !== 1) {
  4248. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  4249. return showCallPopover(callStr.replace("@", ""));
  4250. }
  4251. } else {
  4252. return showCallPopover(callStr.replace("@", ""));
  4253. }
  4254. off();
  4255. }
  4256. }
  4257. }
  4258. function onPaste(e2) {
  4259. const dataTransferItemList = e2.clipboardData.items;
  4260. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  4261. return item.type.indexOf("image") !== -1;
  4262. });
  4263. if (items.length === 0) {
  4264. return;
  4265. }
  4266. const dataTransferItem = items[0];
  4267. const blob = dataTransferItem.getAsFile();
  4268. upload(blob);
  4269. }
  4270. function onBlur() {
  4271. document.removeEventListener("paste", onPaste);
  4272. isFocus.value = false;
  4273. }
  4274. function onFocusin() {
  4275. document.addEventListener("paste", onPaste);
  4276. }
  4277. vue.watch(() => show, (n2) => {
  4278. if (n2.value)
  4279. isShowEmoticons.value = false;
  4280. }, { deep: true });
  4281. vue.onMounted(() => {
  4282. $(`.${editorId.value}`).each(function() {
  4283. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  4284. }).on("input", function() {
  4285. this.style.height = 0;
  4286. this.style.height = this.scrollHeight + "px";
  4287. });
  4288. if (useType === "reply-comment") {
  4289. txtRef.value && txtRef.value.focus();
  4290. }
  4291. });
  4292. vue.onBeforeUnmount(() => {
  4293. $(`.${editorId.value}`).off();
  4294. });
  4295. return (_ctx, _cache) => {
  4296. return vue.openBlock(), vue.createElementBlock("div", {
  4297. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  4298. }, [
  4299. vue.withDirectives(vue.createElementVNode("textarea", {
  4300. class: vue.normalizeClass(["post-editor", editorId.value]),
  4301. ref_key: "txtRef",
  4302. ref: txtRef,
  4303. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  4304. onBlur,
  4305. onFocusin,
  4306. placeholder: "请尽量让自己的回复能够对别人有帮助",
  4307. onInput,
  4308. onKeydown,
  4309. onDrop: drop,
  4310. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  4311. }, null, 34), [
  4312. [vue.vModelText, content.value]
  4313. ]),
  4314. vue.createElementVNode("div", _hoisted_1$c, [
  4315. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$9),
  4316. vue.createElementVNode("span", {
  4317. class: "cursor",
  4318. ref_key: "cursorRef",
  4319. ref: cursorRef
  4320. }, "|", 512)
  4321. ]),
  4322. vue.createElementVNode("div", _hoisted_3$8, [
  4323. vue.createElementVNode("div", _hoisted_4$8, [
  4324. vue.createVNode(vue.unref(Icon), {
  4325. onClick: vue.withModifiers(showEmoticons, ["stop"]),
  4326. icon: "streamline:smiley-happy"
  4327. }),
  4328. vue.createElementVNode("div", _hoisted_5$6, [
  4329. vue.createElementVNode("input", {
  4330. type: "file",
  4331. accept: "image/*",
  4332. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  4333. }, null, 32),
  4334. vue.createVNode(vue.unref(Icon), { icon: "lets-icons:img-load-box-fill" })
  4335. ]),
  4336. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$6, "上传中.....")) : vue.createCommentVNode("", true)
  4337. ]),
  4338. vue.createElementVNode("div", _hoisted_7$5, [
  4339. vue.unref(useType) === "reply-comment" ? (vue.openBlock(), vue.createBlock(BaseButton, {
  4340. key: 0,
  4341. type: "link",
  4342. size: "small",
  4343. style: { "margin-right": "1rem", "cursor": "pointer" },
  4344. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => emits("close"), ["stop"]))
  4345. }, {
  4346. default: vue.withCtx(() => [
  4347. vue.createTextVNode(" 关闭 ")
  4348. ]),
  4349. _: 1
  4350. })) : vue.createCommentVNode("", true),
  4351. vue.createVNode(BaseButton, {
  4352. size: "small",
  4353. disabled: disabled.value,
  4354. loading: loading.value,
  4355. onClick: vue.withModifiers(submit, ["stop"])
  4356. }, {
  4357. default: vue.withCtx(() => [
  4358. vue.createTextVNode("回复 ")
  4359. ]),
  4360. _: 1
  4361. }, 8, ["disabled", "loading"])
  4362. ])
  4363. ]),
  4364. vue.withDirectives(vue.createElementVNode("div", {
  4365. class: "emoticon-pack",
  4366. ref_key: "emoticonsRef",
  4367. ref: emoticonsRef
  4368. }, [
  4369. vue.createVNode(vue.unref(Icon), {
  4370. icon: "ic:round-close",
  4371. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => isShowEmoticons.value = false, ["stop"]))
  4372. }),
  4373. _hoisted_8$5,
  4374. vue.createElementVNode("div", _hoisted_9$5, [
  4375. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(classicsEmoticons), (item) => {
  4376. return vue.openBlock(), vue.createElementBlock("img", {
  4377. src: item.high,
  4378. onClick: vue.withModifiers(($event) => {
  4379. insert(item.name);
  4380. isShowEmoticons.value = false;
  4381. }, ["stop"])
  4382. }, null, 8, _hoisted_10$5);
  4383. }), 256))
  4384. ]),
  4385. vue.createElementVNode("div", _hoisted_11$5, [
  4386. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(emojiEmoticons), (item) => {
  4387. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  4388. vue.createElementVNode("div", _hoisted_12$5, vue.toDisplayString(item.title), 1),
  4389. vue.createElementVNode("div", _hoisted_13$4, [
  4390. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  4391. return vue.openBlock(), vue.createElementBlock("span", {
  4392. onClick: vue.withModifiers(($event) => {
  4393. insert(emoji);
  4394. isShowEmoticons.value = false;
  4395. }, ["stop"])
  4396. }, vue.toDisplayString(emoji), 9, _hoisted_14$3);
  4397. }), 256))
  4398. ])
  4399. ], 64);
  4400. }), 256))
  4401. ])
  4402. ], 512), [
  4403. [vue.vShow, isShowEmoticons.value]
  4404. ])
  4405. ], 2);
  4406. };
  4407. }
  4408. };
  4409. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-7fe2eb8d"]]);
  4410. const _hoisted_1$b = {
  4411. key: 0,
  4412. class: "html-wrapper"
  4413. };
  4414. const _hoisted_2$8 = ["innerHTML"];
  4415. const checkHeight = 900;
  4416. const _sfc_main$b = {
  4417. __name: "BaseHtmlRender",
  4418. props: ["html"],
  4419. setup(__props) {
  4420. const config2 = vue.inject("config");
  4421. const props = __props;
  4422. const contentRef = vue.ref(null);
  4423. const mask = vue.ref(false);
  4424. const handOpen = vue.ref(false);
  4425. function mouseup(e2) {
  4426. if (!config2.value.base64)
  4427. return;
  4428. let selectionText = window.win().getSelection().toString();
  4429. if (selectionText) {
  4430. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  4431. if (r2) {
  4432. if (r2[0].length < 4)
  4433. return;
  4434. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  4435. }
  4436. }
  4437. }
  4438. vue.watch(config2.value, (newVale) => {
  4439. if (!newVale.contentAutoCollapse) {
  4440. mask.value = false;
  4441. }
  4442. });
  4443. vue.watch([() => contentRef.value, () => props.html], () => {
  4444. if (!contentRef.value || !props.html)
  4445. return;
  4446. if (!config2.value.contentAutoCollapse)
  4447. return;
  4448. contentRef.value.querySelectorAll("img").forEach((item) => {
  4449. item.removeEventListener("load", checkContentHeight);
  4450. item.addEventListener("load", checkContentHeight);
  4451. });
  4452. checkContentHeight();
  4453. }, { immediate: true, flush: "post" });
  4454. function checkContentHeight() {
  4455. if (handOpen.value)
  4456. return;
  4457. if (!contentRef.value)
  4458. return;
  4459. let rect = contentRef.value.getBoundingClientRect();
  4460. mask.value = rect.height >= checkHeight;
  4461. }
  4462. return (_ctx, _cache) => {
  4463. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
  4464. vue.createElementVNode("div", {
  4465. class: vue.normalizeClass({ mask: mask.value })
  4466. }, [
  4467. vue.createElementVNode("div", {
  4468. ref_key: "contentRef",
  4469. ref: contentRef,
  4470. innerHTML: props.html,
  4471. onMouseup: mouseup
  4472. }, null, 40, _hoisted_2$8)
  4473. ], 2),
  4474. mask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  4475. key: 0,
  4476. class: "expand",
  4477. onClick: _cache[0] || (_cache[0] = ($event) => {
  4478. mask.value = false;
  4479. handOpen.value = true;
  4480. })
  4481. }, "展开")) : vue.createCommentVNode("", true)
  4482. ])) : vue.createCommentVNode("", true);
  4483. };
  4484. }
  4485. };
  4486. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-727ada32"]]);
  4487. const _sfc_main$a = {
  4488. name: "TopSubComment",
  4489. components: { BaseHtmlRender, Author, PostEditor, Point, Icon },
  4490. inject: ["post", "postDetailWidth", "show", "isNight", "isLogin", "tags", "config"],
  4491. props: {
  4492. modelValue: {
  4493. reply_content: ""
  4494. },
  4495. level: -1
  4496. },
  4497. data() {
  4498. return {
  4499. expand: true,
  4500. edit: false,
  4501. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4502. floor: this.modelValue.floor
  4503. };
  4504. },
  4505. watch: {
  4506. show(e2) {
  4507. if (e2) {
  4508. this.edit = false;
  4509. }
  4510. }
  4511. },
  4512. computed: {
  4513. myTags() {
  4514. return this.tags[this.modelValue.username] ?? [];
  4515. }
  4516. },
  4517. methods: {
  4518. jump() {
  4519. eventBus.emit(CMD.JUMP, this.modelValue.floor);
  4520. }
  4521. }
  4522. };
  4523. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-d3f8c94b"), n2 = n2(), vue.popScopeId(), n2);
  4524. const _hoisted_1$a = ["data-floor"];
  4525. const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "left expand-line" }, null, -1));
  4526. const _hoisted_3$7 = { class: "right" };
  4527. const _hoisted_4$7 = { class: "simple-wrapper" };
  4528. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  4529. const _component_Author = vue.resolveComponent("Author");
  4530. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4531. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4532. const _component_TopSubComment = vue.resolveComponent("TopSubComment", true);
  4533. return vue.openBlock(), vue.createElementBlock("div", {
  4534. class: vue.normalizeClass(["top-sub-comment", $props.level === 1 && "top-sub-reply"]),
  4535. ref: "comment",
  4536. "data-floor": $data.floor
  4537. }, [
  4538. _hoisted_2$7,
  4539. vue.createElementVNode("div", _hoisted_3$7, [
  4540. vue.createVNode(_component_Author, {
  4541. modelValue: $data.expand,
  4542. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4543. comment: $props.modelValue,
  4544. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4545. type: "top"
  4546. }, null, 8, ["modelValue", "comment"]),
  4547. vue.createVNode(_component_BaseHtmlRender, {
  4548. class: "top-reply_content reply_content",
  4549. html: $props.modelValue.hideCallUserReplyContent
  4550. }, null, 8, ["html"]),
  4551. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4552. key: 0,
  4553. onClose: _cache[2] || (_cache[2] = ($event) => $data.edit = false),
  4554. replyInfo: $data.replyInfo,
  4555. replyUser: $props.modelValue.username,
  4556. replyFloor: $props.modelValue.floor
  4557. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true),
  4558. vue.createElementVNode("div", _hoisted_4$7, [
  4559. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4560. return vue.openBlock(), vue.createBlock(_component_TopSubComment, {
  4561. modelValue: $props.modelValue.children[index],
  4562. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4563. key: index
  4564. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4565. }), 128))
  4566. ])
  4567. ])
  4568. ], 10, _hoisted_1$a);
  4569. }
  4570. const TopSubComment = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$5], ["__scopeId", "data-v-d3f8c94b"]]);
  4571. const _sfc_main$9 = {
  4572. name: "Comment",
  4573. components: { BaseHtmlRender, Author, PostEditor, Point, Icon, TopSubComment },
  4574. inject: ["post", "postDetailWidth", "show", "isNight", "config"],
  4575. props: {
  4576. modelValue: {
  4577. reply_content: ""
  4578. },
  4579. type: {
  4580. type: String,
  4581. default() {
  4582. return "list";
  4583. }
  4584. }
  4585. },
  4586. data() {
  4587. return {
  4588. edit: false,
  4589. ding: false,
  4590. expand: true,
  4591. expandTopReply: true,
  4592. expandWrong: false,
  4593. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4594. cssStyle: null,
  4595. floor: this.modelValue.floor
  4596. };
  4597. },
  4598. watch: {
  4599. show(e2) {
  4600. if (e2) {
  4601. this.edit = false;
  4602. }
  4603. },
  4604. postDetailWidth(n2, o) {
  4605. this.checkIsTooLong(n2);
  4606. }
  4607. },
  4608. computed: {
  4609. CommentDisplayType() {
  4610. return CommentDisplayType;
  4611. },
  4612. myClass() {
  4613. return {
  4614. isOp: this.modelValue.isOp,
  4615. isSimple: this.config.viewType === "simple",
  4616. ding: this.ding,
  4617. isLevelOne: this.type === "top" ? true : this.modelValue.level === 0,
  4618. ["c_" + this.floor]: this.type !== "top"
  4619. };
  4620. }
  4621. },
  4622. mounted() {
  4623. this.checkIsTooLong(this.postDetailWidth);
  4624. },
  4625. methods: {
  4626. checkIsTooLong(postDetailWidth) {
  4627. if (postDetailWidth !== 0) {
  4628. let rect = this.$refs.comment.getBoundingClientRect();
  4629. let ban = postDetailWidth * 0.6;
  4630. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  4631. this.expand = false;
  4632. let padding = 2;
  4633. this.cssStyle = {
  4634. padding: "1rem 0",
  4635. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  4636. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  4637. background: this.isNight ? "#18222d" : "white"
  4638. };
  4639. }
  4640. }
  4641. },
  4642. //高亮一下
  4643. showDing() {
  4644. this.ding = true;
  4645. setTimeout(() => {
  4646. this.ding = false;
  4647. }, 2e3);
  4648. },
  4649. hide() {
  4650. let url = `${location.origin}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;
  4651. eventBus.emit(CMD.REMOVE, this.modelValue.floor);
  4652. $.post(url).then((res) => {
  4653. eventBus.emit(CMD.REFRESH_ONCE);
  4654. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  4655. }, (err) => {
  4656. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  4657. });
  4658. },
  4659. toggle() {
  4660. this.expand = !this.expand;
  4661. },
  4662. jump() {
  4663. eventBus.emit(CMD.JUMP, this.modelValue.floor);
  4664. }
  4665. }
  4666. };
  4667. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-67fa2f3f"), n2 = n2(), vue.popScopeId(), n2);
  4668. const _hoisted_1$9 = ["data-floor"];
  4669. const _hoisted_2$6 = { class: "comment-content" };
  4670. const _hoisted_3$6 = { class: "right" };
  4671. const _hoisted_4$6 = { class: "w" };
  4672. const _hoisted_5$5 = {
  4673. key: 0,
  4674. class: "wrong-wrapper"
  4675. };
  4676. const _hoisted_6$5 = ["href"];
  4677. const _hoisted_7$4 = { class: "del-line" };
  4678. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", {
  4679. class: "fa fa-question-circle-o wrong-icon",
  4680. "aria-hidden": "true"
  4681. }, null, -1));
  4682. const _hoisted_9$4 = {
  4683. key: 0,
  4684. class: "warning"
  4685. };
  4686. const _hoisted_10$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4687. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4688. const _hoisted_12$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4689. const _hoisted_13$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4690. const _hoisted_14$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4691. const _hoisted_15$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("a", {
  4692. href: "https://github.com/zyronon/web-scripts/issues",
  4693. target: "_blank"
  4694. }, "这里", -1));
  4695. const _hoisted_16$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "gang" }, null, -1));
  4696. const _hoisted_17$2 = { class: "simple-wrapper" };
  4697. const _hoisted_18$2 = {
  4698. key: 0,
  4699. class: "top-reply-wrap"
  4700. };
  4701. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4702. const _component_Author = vue.resolveComponent("Author");
  4703. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4704. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4705. const _component_Icon = vue.resolveComponent("Icon");
  4706. const _component_TopSubComment = vue.resolveComponent("TopSubComment");
  4707. const _component_Comment = vue.resolveComponent("Comment", true);
  4708. return vue.openBlock(), vue.createElementBlock("div", {
  4709. class: vue.normalizeClass(["comment", $options.myClass]),
  4710. ref: "comment",
  4711. "data-floor": $data.floor
  4712. }, [
  4713. vue.createVNode(_component_Author, {
  4714. modelValue: $data.expand,
  4715. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4716. comment: $props.modelValue,
  4717. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4718. type: $props.type,
  4719. onHide: $options.hide
  4720. }, null, 8, ["modelValue", "comment", "type", "onHide"]),
  4721. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4722. key: 0,
  4723. class: "more ago",
  4724. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  4725. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  4726. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4727. key: 1,
  4728. class: "comment-content-w",
  4729. style: vue.normalizeStyle($data.cssStyle)
  4730. }, [
  4731. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4732. key: 0,
  4733. class: "more ago",
  4734. onClick: _cache[3] || (_cache[3] = ($event) => $data.expand = !$data.expand)
  4735. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  4736. vue.createElementVNode("div", _hoisted_2$6, [
  4737. vue.createElementVNode("div", {
  4738. class: "left expand-line",
  4739. onClick: _cache[4] || (_cache[4] = (...args) => $options.toggle && $options.toggle(...args))
  4740. }),
  4741. vue.createElementVNode("div", _hoisted_3$6, [
  4742. vue.createElementVNode("div", _hoisted_4$6, [
  4743. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
  4744. vue.createElementVNode("span", {
  4745. onClick: _cache[5] || (_cache[5] = ($event) => $data.expandWrong = !$data.expandWrong),
  4746. title: "点击楼层号查看提示"
  4747. }, [
  4748. vue.createElementVNode("a", {
  4749. href: "/member/" + $props.modelValue.replyUsers[0]
  4750. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$5),
  4751. vue.createElementVNode("span", _hoisted_7$4, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  4752. _hoisted_8$4
  4753. ]),
  4754. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$4, [
  4755. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  4756. _hoisted_10$4,
  4757. vue.createTextVNode(" 原因可能有下面几种: "),
  4758. _hoisted_11$4,
  4759. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  4760. _hoisted_12$4,
  4761. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  4762. _hoisted_13$3,
  4763. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  4764. _hoisted_14$2,
  4765. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  4766. _hoisted_15$2,
  4767. vue.createTextVNode("反馈 ")
  4768. ])) : vue.createCommentVNode("", true)
  4769. ])) : vue.createCommentVNode("", true),
  4770. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && $props.type !== "top" ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4771. key: 1,
  4772. class: "reply_content",
  4773. html: $props.modelValue.hideCallUserReplyContent
  4774. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4775. key: 2,
  4776. class: "reply_content",
  4777. html: $props.modelValue.reply_content
  4778. }, null, 8, ["html"])),
  4779. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4780. key: 3,
  4781. onClose: _cache[6] || (_cache[6] = ($event) => $data.edit = false),
  4782. replyInfo: $data.replyInfo,
  4783. replyUser: $props.modelValue.username,
  4784. replyFloor: $props.modelValue.floor
  4785. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true),
  4786. $props.type === "top" && $props.modelValue.replyCount ? (vue.openBlock(), vue.createElementBlock("div", {
  4787. key: 4,
  4788. class: "reply-count",
  4789. onClick: _cache[7] || (_cache[7] = ($event) => $data.expandTopReply = !$data.expandTopReply)
  4790. }, [
  4791. _hoisted_16$2,
  4792. vue.createElementVNode("span", null, " 共有" + vue.toDisplayString($props.modelValue.replyCount) + " 条回复 ", 1),
  4793. $data.expandTopReply ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4794. key: 0,
  4795. icon: "ep:arrow-up-bold"
  4796. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4797. key: 1,
  4798. icon: "ep:arrow-down-bold"
  4799. }))
  4800. ])) : vue.createCommentVNode("", true)
  4801. ]),
  4802. vue.createElementVNode("div", _hoisted_17$2, [
  4803. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  4804. $data.expandTopReply && $props.modelValue.replyCount ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$2, [
  4805. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4806. return vue.openBlock(), vue.createBlock(_component_TopSubComment, {
  4807. level: 1,
  4808. modelValue: $props.modelValue.children[index],
  4809. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4810. key: index
  4811. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4812. }), 128))
  4813. ])) : vue.createCommentVNode("", true)
  4814. ], 64)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList($props.modelValue.children, (item, index) => {
  4815. return vue.openBlock(), vue.createBlock(_component_Comment, {
  4816. modelValue: $props.modelValue.children[index],
  4817. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4818. key: index
  4819. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4820. }), 128))
  4821. ])
  4822. ])
  4823. ]),
  4824. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4825. key: 1,
  4826. class: "more ago",
  4827. onClick: _cache[8] || (_cache[8] = ($event) => $data.expand = !$data.expand)
  4828. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  4829. ], 4)) : vue.createCommentVNode("", true)
  4830. ], 10, _hoisted_1$9);
  4831. }
  4832. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-67fa2f3f"]]);
  4833. const _sfc_main$8 = {
  4834. name: "Toolbar",
  4835. components: { Icon, BaseLoading },
  4836. inject: [
  4837. "isLogin",
  4838. "post",
  4839. "pageType"
  4840. ],
  4841. data() {
  4842. return {
  4843. timer: null,
  4844. loading: false,
  4845. loading2: false,
  4846. loading3: false
  4847. };
  4848. },
  4849. methods: {
  4850. checkIsLogin(emitName = "") {
  4851. if (!this.isLogin) {
  4852. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4853. return false;
  4854. }
  4855. this.$emit(emitName);
  4856. return true;
  4857. },
  4858. tweet() {
  4859. var _a;
  4860. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4861. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${this.post.id}?r=${username}&related=v2ex&text=${this.post.title}`;
  4862. window.open(url, "_blank", "width=550,height=370");
  4863. },
  4864. async report() {
  4865. if (!this.checkIsLogin())
  4866. return;
  4867. if (this.loading3)
  4868. return;
  4869. let isReport = this.post.isReport;
  4870. if (isReport) {
  4871. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4872. return;
  4873. }
  4874. let url = `${location.origin}/report/topic/${this.post.id}?once=${this.post.once}`;
  4875. this.loading3 = true;
  4876. let apiRes = await fetch(url);
  4877. this.loading3 = false;
  4878. if (apiRes.redirected) {
  4879. let htmlText = await apiRes.text();
  4880. if (htmlText.search("你已对本主题进行了报告")) {
  4881. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4882. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4883. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4884. return;
  4885. }
  4886. }
  4887. eventBus.emit(CMD.REFRESH_ONCE);
  4888. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4889. },
  4890. async toggleIgnore() {
  4891. if (!this.checkIsLogin())
  4892. return;
  4893. let url = `${location.origin}/${this.post.isIgnore ? "unignore" : "ignore"}/topic/${this.post.id}?once=${this.post.once}`;
  4894. if (this.pageType === PageType.Post) {
  4895. this.loading2 = true;
  4896. let apiRes = await window.win().fetch(url);
  4897. if (apiRes.redirected) {
  4898. if (!this.post.isIgnore) {
  4899. window.win().location = location.origin;
  4900. }
  4901. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4902. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4903. } else {
  4904. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4905. }
  4906. this.loading2 = false;
  4907. } else {
  4908. if (this.post.isIgnore) {
  4909. this.loading2 = true;
  4910. } else {
  4911. eventBus.emit(CMD.IGNORE);
  4912. }
  4913. let apiRes = await window.win().fetch(url);
  4914. if (apiRes.redirected) {
  4915. if (this.post.isIgnore) {
  4916. eventBus.emit(CMD.REFRESH_ONCE);
  4917. }
  4918. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4919. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4920. } else {
  4921. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略成功,仅本次有效(接口调用失败!)" });
  4922. }
  4923. this.loading2 = false;
  4924. }
  4925. },
  4926. async toggleFavorite() {
  4927. if (!this.checkIsLogin())
  4928. return;
  4929. if (this.loading)
  4930. return;
  4931. let isFavorite = this.post.isFavorite;
  4932. if (!isFavorite && config.collectBrowserNotice) {
  4933. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记按Command/Cmd/CTRL + D添加到书签哦" });
  4934. }
  4935. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  4936. this.loading = true;
  4937. let apiRes = await fetch(url);
  4938. this.loading = false;
  4939. if (apiRes.redirected) {
  4940. let htmlText = await apiRes.text();
  4941. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4942. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4943. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  4944. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4945. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4946. return;
  4947. }
  4948. }
  4949. eventBus.emit(CMD.REFRESH_ONCE);
  4950. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  4951. }
  4952. }
  4953. };
  4954. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-e86785e8"), n2 = n2(), vue.popScopeId(), n2);
  4955. const _hoisted_1$8 = { class: "toolbar" };
  4956. const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4957. const _hoisted_3$5 = {
  4958. key: 0,
  4959. class: "tool no-hover"
  4960. };
  4961. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "Tweet", -1));
  4962. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4963. const _component_Icon = vue.resolveComponent("Icon");
  4964. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4965. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
  4966. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  4967. vue.createElementVNode("div", {
  4968. class: "tool",
  4969. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => $options.checkIsLogin("reply"), ["stop"]))
  4970. }, [
  4971. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  4972. _hoisted_2$5
  4973. ]),
  4974. vue.createElementVNode("div", {
  4975. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  4976. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.toggleFavorite && $options.toggleFavorite(...args), ["stop"]))
  4977. }, [
  4978. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4979. key: 0,
  4980. size: "small"
  4981. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4982. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4983. key: 0,
  4984. color: "rgb(224,42,42)",
  4985. icon: "iconoir:star-solid"
  4986. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4987. key: 1,
  4988. icon: "iconoir:star"
  4989. }))
  4990. ], 64)),
  4991. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isFavorite ? "取消" : "") + "收藏", 1)
  4992. ], 2),
  4993. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
  4994. vue.createElementVNode("span", null, vue.toDisplayString($options.post.collectCount + "人收藏"), 1)
  4995. ])) : vue.createCommentVNode("", true),
  4996. vue.createElementVNode("div", {
  4997. class: "tool",
  4998. onClick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.tweet && $options.tweet(...args), ["stop"]))
  4999. }, [
  5000. vue.createVNode(_component_Icon, { icon: "uil:share" }),
  5001. _hoisted_4$5
  5002. ]),
  5003. vue.createElementVNode("div", {
  5004. class: vue.normalizeClass(["tool", { "disabled": $data.loading2 }]),
  5005. onClick: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.toggleIgnore && $options.toggleIgnore(...args), ["stop"]))
  5006. }, [
  5007. $data.loading2 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  5008. key: 0,
  5009. size: "small"
  5010. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5011. key: 1,
  5012. icon: "fluent:eye-hide-24-regular"
  5013. })),
  5014. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isIgnore ? "取消忽略" : "忽略"), 1)
  5015. ], 2),
  5016. vue.createElementVNode("div", {
  5017. class: vue.normalizeClass(["tool", { "disabled": $data.loading3 }]),
  5018. onClick: _cache[4] || (_cache[4] = vue.withModifiers((...args) => $options.report && $options.report(...args), ["stop"]))
  5019. }, [
  5020. $data.loading3 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  5021. key: 0,
  5022. size: "small"
  5023. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5024. key: 1,
  5025. class: "black",
  5026. icon: "solar:danger-triangle-outline"
  5027. })),
  5028. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isReport ? "你已对本主题进行了报告" : "报告"), 1)
  5029. ], 2)
  5030. ]);
  5031. }
  5032. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-e86785e8"]]);
  5033. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-4a063111"), n2 = n2(), vue.popScopeId(), n2);
  5034. const _hoisted_1$7 = ["href"];
  5035. const _hoisted_2$4 = ["src"];
  5036. const _hoisted_3$4 = { class: "texts" };
  5037. const _hoisted_4$4 = {
  5038. key: 0,
  5039. class: "point"
  5040. };
  5041. const _hoisted_5$4 = { class: "link-num" };
  5042. const _hoisted_6$4 = { class: "my-tag" };
  5043. const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5044. const _hoisted_8$3 = {
  5045. key: 2,
  5046. class: "ago"
  5047. };
  5048. const _hoisted_9$3 = {
  5049. key: 3,
  5050. class: "mod"
  5051. };
  5052. const _hoisted_10$3 = {
  5053. key: 4,
  5054. class: "owner"
  5055. };
  5056. const _hoisted_11$3 = ["href"];
  5057. const _hoisted_12$3 = {
  5058. key: 5,
  5059. class: "owner"
  5060. };
  5061. const _hoisted_13$2 = {
  5062. key: 6,
  5063. class: "mod"
  5064. };
  5065. const _hoisted_14$1 = {
  5066. key: 7,
  5067. class: "ago"
  5068. };
  5069. const _hoisted_15$1 = { class: "my-tag" };
  5070. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5071. const _hoisted_17$1 = {
  5072. key: 9,
  5073. class: "point"
  5074. };
  5075. const _hoisted_18$1 = { class: "link-num" };
  5076. const _hoisted_19$1 = ["href"];
  5077. const _hoisted_20$1 = ["src"];
  5078. const _hoisted_21$1 = { class: "Author-right" };
  5079. const _hoisted_22$1 = { class: "floor" };
  5080. const _hoisted_23$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  5081. const _hoisted_24$1 = [
  5082. _hoisted_23$1
  5083. ];
  5084. const _sfc_main$7 = {
  5085. __name: "SingleComment",
  5086. props: {
  5087. comment: {
  5088. reply_content: ""
  5089. },
  5090. isRight: {
  5091. type: Boolean,
  5092. default() {
  5093. return false;
  5094. }
  5095. }
  5096. },
  5097. setup(__props) {
  5098. const config2 = vue.inject("config");
  5099. const isLogin = vue.inject("isLogin");
  5100. const tags = vue.inject("tags");
  5101. const props = __props;
  5102. const myTags = vue.computed(() => {
  5103. return tags[props.comment.username] ?? [];
  5104. });
  5105. function jump() {
  5106. eventBus.emit(CMD.JUMP, props.comment.floor);
  5107. }
  5108. return (_ctx, _cache) => {
  5109. return vue.openBlock(), vue.createElementBlock("div", {
  5110. class: vue.normalizeClass(["comment", { isSimple: vue.unref(config2).viewType === "simple" }]),
  5111. ref: "comment"
  5112. }, [
  5113. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  5114. key: 0,
  5115. class: "avatar",
  5116. href: `/member/${__props.comment.username}`
  5117. }, [
  5118. vue.createElementVNode("img", {
  5119. src: __props.comment.avatar,
  5120. alt: ""
  5121. }, null, 8, _hoisted_2$4)
  5122. ], 8, _hoisted_1$7)) : vue.createCommentVNode("", true),
  5123. vue.createElementVNode("div", {
  5124. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  5125. }, [
  5126. vue.createElementVNode("div", _hoisted_3$4, [
  5127. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
  5128. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5129. key: 0,
  5130. color: "rgb(224,42,42)",
  5131. icon: "icon-park-solid:like"
  5132. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5133. key: 1,
  5134. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  5135. icon: "icon-park-outline:like"
  5136. }, null, 8, ["color"])),
  5137. vue.createElementVNode("div", _hoisted_5$4, vue.toDisplayString(__props.comment.thankCount), 1)
  5138. ])) : vue.createCommentVNode("", true),
  5139. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  5140. return vue.openBlock(), vue.createElementBlock("span", _hoisted_6$4, [
  5141. _hoisted_7$3,
  5142. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  5143. ]);
  5144. }), 256)) : vue.createCommentVNode("", true),
  5145. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$3, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  5146. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, "MOD")) : vue.createCommentVNode("", true),
  5147. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$3, "OP")) : vue.createCommentVNode("", true),
  5148. vue.createElementVNode("a", {
  5149. href: `/member/${__props.comment.username}`,
  5150. class: "username"
  5151. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_11$3),
  5152. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$3, "OP")) : vue.createCommentVNode("", true),
  5153. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$2, "MOD")) : vue.createCommentVNode("", true),
  5154. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  5155. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  5156. return vue.openBlock(), vue.createElementBlock("span", _hoisted_15$1, [
  5157. _hoisted_16$1,
  5158. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  5159. ]);
  5160. }), 256)) : vue.createCommentVNode("", true),
  5161. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, [
  5162. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5163. key: 0,
  5164. color: "rgb(224,42,42)",
  5165. icon: "icon-park-solid:like"
  5166. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5167. key: 1,
  5168. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  5169. icon: "icon-park-outline:like"
  5170. }, null, 8, ["color"])),
  5171. vue.createElementVNode("div", _hoisted_18$1, vue.toDisplayString(__props.comment.thankCount), 1)
  5172. ])) : vue.createCommentVNode("", true)
  5173. ]),
  5174. vue.createVNode(BaseHtmlRender, {
  5175. class: "reply_content",
  5176. html: __props.comment.reply_content
  5177. }, null, 8, ["html"])
  5178. ], 2),
  5179. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  5180. key: 1,
  5181. class: "avatar",
  5182. href: `/member/${__props.comment.username}`
  5183. }, [
  5184. vue.createElementVNode("img", {
  5185. src: __props.comment.avatar,
  5186. alt: ""
  5187. }, null, 8, _hoisted_20$1)
  5188. ], 8, _hoisted_19$1)) : vue.createCommentVNode("", true),
  5189. vue.createElementVNode("div", _hoisted_21$1, [
  5190. vue.createElementVNode("div", _hoisted_22$1, vue.toDisplayString(__props.comment.floor), 1),
  5191. vue.createElementVNode("div", {
  5192. class: "tool jump",
  5193. onClick: vue.withModifiers(jump, ["stop"])
  5194. }, _hoisted_24$1)
  5195. ])
  5196. ], 2);
  5197. };
  5198. }
  5199. };
  5200. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-4a063111"]]);
  5201. function _css(el, key, value) {
  5202. const reg = /^-?\d+.?\d*(px|pt|em|rem|vw|vh|%|rpx|ms)$/i;
  5203. if (value === void 0) {
  5204. let val = null;
  5205. if ("getComputedStyle" in window) {
  5206. val = window.getComputedStyle(el, null)[key];
  5207. } else {
  5208. val = el.currentStyle[key];
  5209. }
  5210. return reg.test(val) ? parseFloat(val) : val;
  5211. } else {
  5212. if ([
  5213. "top",
  5214. "left",
  5215. "bottom",
  5216. "right",
  5217. "width",
  5218. "height",
  5219. "font-size",
  5220. "margin",
  5221. "padding"
  5222. ].includes(key)) {
  5223. if (!reg.test(value)) {
  5224. if (!String(value).includes("calc")) {
  5225. value += "px";
  5226. }
  5227. }
  5228. }
  5229. if (key === "transform") {
  5230. el.style.webkitTransform = el.style.MsTransform = el.style.msTransform = el.style.MozTransform = el.style.OTransform = el.style.transform = value;
  5231. } else {
  5232. el.style[key] = value;
  5233. }
  5234. }
  5235. }
  5236. function getImgSize(naturalWidth, naturalHeight, maxWidth, maxHeight) {
  5237. const imgRatio = naturalWidth / naturalHeight;
  5238. const maxRatio = maxWidth / maxHeight;
  5239. let width, height;
  5240. if (imgRatio >= maxRatio) {
  5241. if (naturalWidth > maxWidth) {
  5242. width = maxWidth;
  5243. height = maxWidth / naturalWidth * naturalHeight;
  5244. } else {
  5245. width = naturalWidth;
  5246. height = naturalHeight;
  5247. }
  5248. } else {
  5249. if (naturalHeight > maxHeight) {
  5250. width = maxHeight / naturalHeight * naturalWidth;
  5251. height = maxHeight;
  5252. } else {
  5253. width = naturalWidth;
  5254. height = naturalHeight;
  5255. }
  5256. }
  5257. if (height === 0) {
  5258. height = maxHeight;
  5259. width = height * 1.3;
  5260. } else {
  5261. if (height < 24) {
  5262. height = 50;
  5263. width = height * imgRatio;
  5264. } else if (height < 100) {
  5265. height = 300;
  5266. width = height * imgRatio;
  5267. } else {
  5268. height = maxHeight;
  5269. width = height * imgRatio;
  5270. }
  5271. if (width > maxWidth) {
  5272. width = maxWidth;
  5273. height = width / imgRatio;
  5274. }
  5275. }
  5276. return { width, height };
  5277. }
  5278. const _sfc_main$6 = {
  5279. name: "detail",
  5280. components: {
  5281. BaseSelect,
  5282. BaseButton,
  5283. SingleComment,
  5284. PopConfirm,
  5285. Comment,
  5286. PostEditor,
  5287. Point,
  5288. Toolbar,
  5289. BaseHtmlRender,
  5290. Tooltip,
  5291. BaseLoading,
  5292. Icon
  5293. },
  5294. inject: ["allReplyUsers", "post", "tags", "isLogin", "config", "pageType", "isNight"],
  5295. provide() {
  5296. return {
  5297. postDetailWidth: vue.computed(() => this.postDetailWidth)
  5298. };
  5299. },
  5300. props: {
  5301. modelValue: {
  5302. type: Boolean,
  5303. default() {
  5304. return false;
  5305. }
  5306. },
  5307. loading: {
  5308. type: Boolean,
  5309. default() {
  5310. return false;
  5311. }
  5312. },
  5313. refreshLoading: {
  5314. type: Boolean,
  5315. default() {
  5316. return false;
  5317. }
  5318. },
  5319. displayType: CommentDisplayType.FloorInFloorNoCallUser
  5320. },
  5321. data() {
  5322. return {
  5323. isSticky: false,
  5324. selectCallIndex: 0,
  5325. postDetailWidth: 0,
  5326. showCallList: false,
  5327. showRelationReply: false,
  5328. replyText: "",
  5329. callStyle: {
  5330. top: 0,
  5331. left: 0
  5332. },
  5333. targetUser: {
  5334. left: [],
  5335. right: "",
  5336. rightFloor: -1
  5337. },
  5338. currentFloor: "",
  5339. showOpTag: false,
  5340. rect: {},
  5341. result: {},
  5342. x: 0,
  5343. y: 0,
  5344. scale: 1,
  5345. minScale: 0.2,
  5346. maxScale: 16,
  5347. preview: {
  5348. rect: {},
  5349. result: {},
  5350. x: 0,
  5351. y: 0,
  5352. scale: 1,
  5353. minScale: 0.2,
  5354. maxScale: 16
  5355. }
  5356. };
  5357. },
  5358. computed: {
  5359. canAppend() {
  5360. if (this.isMy) {
  5361. let create = new Date(this.post.createDate);
  5362. return Date.now() - create.valueOf() > 1e3 * 60 * 30;
  5363. }
  5364. return false;
  5365. },
  5366. canEditMove() {
  5367. if (this.isMy) {
  5368. let create = new Date(this.post.createDate);
  5369. return Date.now() - create.valueOf() < 1e3 * 60 * 10;
  5370. }
  5371. return false;
  5372. },
  5373. isMy() {
  5374. return this.post.member.username === window.user.username;
  5375. },
  5376. myTags() {
  5377. return this.tags[this.post.member.username] ?? [];
  5378. },
  5379. CommentDisplayType() {
  5380. return CommentDisplayType;
  5381. },
  5382. isPost() {
  5383. return this.pageType === PageType.Post;
  5384. },
  5385. filterCallList() {
  5386. if (this.showCallList) {
  5387. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  5388. if (this.replyText)
  5389. return list.filter((i) => i.search(this.replyText) > -1);
  5390. return list;
  5391. }
  5392. return [];
  5393. },
  5394. replyList() {
  5395. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  5396. return this.post.nestedReplies;
  5397. if (this.displayType === CommentDisplayType.Like) {
  5398. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  5399. }
  5400. if (this.displayType === CommentDisplayType.New) {
  5401. return window.clone(this.post.replyList).reverse();
  5402. }
  5403. if (this.displayType === CommentDisplayType.V2exOrigin)
  5404. return this.post.replyList;
  5405. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  5406. return this.post.nestedRedundReplies;
  5407. if (this.displayType === CommentDisplayType.OnlyOp)
  5408. return this.post.replyList.filter((v) => {
  5409. var _a;
  5410. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  5411. });
  5412. return [];
  5413. },
  5414. //关联回复
  5415. relationReply() {
  5416. if (this.targetUser.left.length && this.targetUser.right) {
  5417. return this.post.replyList.filter((v) => {
  5418. if (this.targetUser.left.includes(v.username)) {
  5419. if (v.floor > this.targetUser.rightFloor) {
  5420. if (v.replyUsers.includes(this.targetUser.right)) {
  5421. return true;
  5422. }
  5423. } else {
  5424. return true;
  5425. }
  5426. }
  5427. if (v.username === this.targetUser.right) {
  5428. for (let i = 0; i < this.targetUser.left.length; i++) {
  5429. if (v.replyUsers.includes(this.targetUser.left[i])) {
  5430. return true;
  5431. }
  5432. }
  5433. }
  5434. });
  5435. }
  5436. return [];
  5437. }
  5438. },
  5439. watch: {
  5440. "post.id"(n2, o) {
  5441. if (this.$refs["post-editor"]) {
  5442. this.$refs["post-editor"].content = "";
  5443. vue.nextTick(() => {
  5444. var _a, _b;
  5445. (_b = (_a = this.$refs) == null ? void 0 : _a.detail) == null ? void 0 : _b.scrollTo({ top: 0 });
  5446. });
  5447. }
  5448. },
  5449. "post.headerTemplate"(n2, o) {
  5450. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  5451. if (mountEl) {
  5452. this.showOpTag = true;
  5453. }
  5454. },
  5455. modelValue: {
  5456. handler(newVal) {
  5457. if (newVal) {
  5458. if ([0, 4, 5].includes(this.displayType)) {
  5459. window.parse.send("&b=2", 2);
  5460. }
  5461. }
  5462. if (this.isPost)
  5463. return;
  5464. if (newVal) {
  5465. this.currentFloor = "";
  5466. vue.nextTick(() => {
  5467. var _a, _b;
  5468. (_b = (_a = this.$refs) == null ? void 0 : _a.main) == null ? void 0 : _b.focus();
  5469. });
  5470. } else {
  5471. this.isSticky = false;
  5472. this.showRelationReply = false;
  5473. }
  5474. }
  5475. }
  5476. },
  5477. mounted() {
  5478. vue.nextTick(() => {
  5479. setTimeout(() => {
  5480. var _a;
  5481. this.postDetailWidth = ((_a = this.$refs.mainWrapper) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
  5482. }, 500);
  5483. });
  5484. if (this.isLogin) {
  5485. const observer = new IntersectionObserver(
  5486. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  5487. { threshold: [1] }
  5488. );
  5489. observer.observe(this.$refs.replyBox);
  5490. window.addEventListener("keydown", this.onKeyDown);
  5491. }
  5492. eventBus.on(CMD.SHOW_CALL, (val) => {
  5493. if (val.show) {
  5494. this.showCallList = true;
  5495. this.replyText = val.text;
  5496. if (this.isPost) {
  5497. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  5498. } else {
  5499. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  5500. }
  5501. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  5502. if (this.selectCallIndex >= this.filterCallList.length) {
  5503. this.selectCallIndex = 0;
  5504. }
  5505. } else {
  5506. this.replyText = "";
  5507. this.showCallList = false;
  5508. this.selectCallIndex = 0;
  5509. }
  5510. });
  5511. eventBus.on(CMD.RELATION_REPLY, (val) => {
  5512. this.targetUser = val;
  5513. this.showRelationReply = true;
  5514. });
  5515. eventBus.on(CMD.JUMP, this.jump);
  5516. },
  5517. beforeUnmount() {
  5518. window.removeEventListener("keydown", this.onKeyDown);
  5519. eventBus.off(CMD.SHOW_CALL);
  5520. },
  5521. methods: {
  5522. addTag() {
  5523. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  5524. },
  5525. removeTag(tag) {
  5526. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  5527. },
  5528. closePreviewModal() {
  5529. let previewModal = document.querySelector(".preview-modal");
  5530. let s = document.querySelector(".shadow");
  5531. let domRect = this.preview.rect;
  5532. _css(s, "transition", "all 0.3s");
  5533. _css(s, "width", domRect.width);
  5534. _css(s, "height", domRect.height);
  5535. _css(s, "transform", `translate3d(${domRect.x}px, ${domRect.y}px, 0) scale(1)`);
  5536. let mask = document.querySelector(".preview-modal .mask");
  5537. _css(mask, "opacity", 0);
  5538. setTimeout(() => {
  5539. _css(s, "transition", "all 0s");
  5540. s.remove();
  5541. _css(previewModal, "top", "-1000vh");
  5542. _css(document.body, "overflow", "auto");
  5543. }, 300);
  5544. },
  5545. stop(e2) {
  5546. e2.stopPropagation();
  5547. e2.stopImmediatePropagation();
  5548. if (e2.target.tagName === "IMG") {
  5549. if (/cdn\.v2ex\.com.*avatar/i.test(e2.target.src)) ;
  5550. this.preview = {
  5551. rect: {},
  5552. result: {},
  5553. x: 0,
  5554. y: 0,
  5555. scale: 1,
  5556. minScale: 0.2,
  5557. maxScale: 16
  5558. };
  5559. e2.preventDefault();
  5560. let domRect = e2.target.getBoundingClientRect();
  5561. let previewModal = document.querySelector(".preview-modal");
  5562. _css(previewModal, "top", "0");
  5563. let s = e2.target.cloneNode();
  5564. s.classList.add("shadow");
  5565. previewModal.append(s);
  5566. _css(s, "transition", "all 0s");
  5567. _css(s, "width", domRect.width);
  5568. _css(s, "height", domRect.height);
  5569. _css(s, "transform", `translate3d(${domRect.x}px, ${domRect.y}px, 0) scale(1)`);
  5570. let t = ".3";
  5571. let sw = domRect.width / window.innerWidth;
  5572. let sh = domRect.height / window.innerHeight;
  5573. domRect.sw = sw;
  5574. domRect.sh = sh;
  5575. this.preview.rect = domRect;
  5576. this.preview.result = getImgSize(
  5577. s.naturalWidth,
  5578. s.naturalHeight,
  5579. window.innerWidth * 0.95,
  5580. window.innerHeight * 0.9
  5581. );
  5582. this.preview.x = (window.innerWidth - this.preview.result.width) * 0.5;
  5583. this.preview.y = (window.innerHeight - this.preview.result.height) * 0.5;
  5584. let isPointerdown = false;
  5585. let isMove = false;
  5586. let lastPointermove = { x: 0, y: 0 };
  5587. let diff = { x: 0, y: 0 };
  5588. s.addEventListener("pointerdown", function(e3) {
  5589. isPointerdown = true;
  5590. isMove = false;
  5591. s.setPointerCapture(e3.pointerId);
  5592. lastPointermove = { x: e3.clientX, y: e3.clientY };
  5593. });
  5594. s.addEventListener("pointermove", (e3) => {
  5595. if (isPointerdown) {
  5596. isMove = true;
  5597. const current = { x: e3.clientX, y: e3.clientY };
  5598. diff.x = current.x - lastPointermove.x;
  5599. diff.y = current.y - lastPointermove.y;
  5600. lastPointermove = { x: current.x, y: current.y };
  5601. this.preview.x += diff.x;
  5602. this.preview.y += diff.y;
  5603. _css(s, "transition", "all 0.1s");
  5604. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5605. }
  5606. e3.preventDefault();
  5607. });
  5608. s.addEventListener("pointerup", () => {
  5609. if (isPointerdown) {
  5610. isPointerdown = false;
  5611. if (!isMove) {
  5612. this.closePreviewModal();
  5613. }
  5614. }
  5615. });
  5616. s.addEventListener("pointercancel", function(e3) {
  5617. if (isPointerdown) {
  5618. isPointerdown = false;
  5619. }
  5620. });
  5621. let mask = document.querySelector(".preview-modal .mask");
  5622. _css(mask, "transition", "all 0s");
  5623. _css(mask, "opacity", 0);
  5624. setTimeout(() => {
  5625. _css(s, "transition", `all ${t}s`);
  5626. _css(mask, "transition", `all ${t}s`);
  5627. _css(mask, "opacity", 1);
  5628. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5629. _css(s, "width", this.preview.result.width);
  5630. _css(s, "height", this.preview.result.height);
  5631. }, 0);
  5632. setTimeout(() => {
  5633. _css(document.body, "overflow", "hidden");
  5634. }, 300);
  5635. return false;
  5636. }
  5637. },
  5638. wheel(e2) {
  5639. let d2 = e2.deltaY < 0 ? 0.1 : -0.1;
  5640. let ratio = 1 + d2;
  5641. let _scale = this.preview.scale * ratio;
  5642. if (_scale > this.preview.maxScale) {
  5643. ratio = this.preview.maxScale / this.preview.scale;
  5644. this.preview.scale = this.preview.maxScale;
  5645. } else if (_scale < this.preview.minScale) {
  5646. ratio = this.preview.minScale / this.preview.scale;
  5647. this.preview.scale = this.preview.minScale;
  5648. } else {
  5649. this.preview.scale = _scale;
  5650. }
  5651. if (e2.target.tagName === "IMG") {
  5652. const origin = {
  5653. x: d2 * this.preview.result.width / 2,
  5654. y: d2 * this.preview.result.height / 2
  5655. };
  5656. this.preview.x -= d2 * (e2.clientX - this.preview.x) - origin.x;
  5657. this.preview.y -= d2 * (e2.clientY - this.preview.y) - origin.y;
  5658. }
  5659. let s = document.querySelector(".shadow");
  5660. _css(s, "transition", "all 0.2s");
  5661. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5662. e2.preventDefault();
  5663. },
  5664. jump(floor) {
  5665. let lastItem = this.replyList[this.replyList.length - 1];
  5666. if (floor === "") {
  5667. floor = lastItem.floor;
  5668. } else {
  5669. try {
  5670. floor = Number(floor);
  5671. } catch (e2) {
  5672. floor = lastItem.floor;
  5673. }
  5674. if (floor === 0) {
  5675. floor = 1;
  5676. }
  5677. if (floor > lastItem.floor)
  5678. floor = lastItem.floor;
  5679. }
  5680. if (!this.post.replyList.length) {
  5681. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  5682. return;
  5683. }
  5684. if (floor > this.post.replyList.length) {
  5685. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5686. return;
  5687. }
  5688. let comment = $(`.c_${floor}`);
  5689. if (!comment.length) {
  5690. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5691. return;
  5692. }
  5693. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  5694. comment.addClass("ding");
  5695. this.currentFloor = floor + 1;
  5696. setTimeout(() => {
  5697. comment.removeClass("ding");
  5698. }, 2e3);
  5699. },
  5700. collapseTopReplyList() {
  5701. $(this.$refs.topReply).slideToggle("fast");
  5702. },
  5703. goBottom() {
  5704. this.isSticky = false;
  5705. setTimeout(() => {
  5706. if (this.isPost) {
  5707. let body = $("body , html");
  5708. let scrollHeight = body.prop("scrollHeight");
  5709. body.animate({ scrollTop: scrollHeight - 850 }, 300);
  5710. } else {
  5711. this.$refs.detail.scrollTo({ top: this.$refs.detail.scrollHeight, behavior: "smooth" });
  5712. }
  5713. });
  5714. },
  5715. close(from) {
  5716. if (this.isPost)
  5717. return;
  5718. if (from === "space") {
  5719. if (this.config.closePostDetailBySpace) {
  5720. this.$emit("update:modelValue", false);
  5721. }
  5722. } else {
  5723. this.$emit("update:modelValue", false);
  5724. }
  5725. },
  5726. setCall(e2) {
  5727. eventBus.emit(CMD.SET_CALL, e2);
  5728. this.showCallList = false;
  5729. },
  5730. onKeyDown(e2) {
  5731. if (!this.modelValue)
  5732. return;
  5733. if (!this.showCallList)
  5734. return;
  5735. let length = this.filterCallList.slice(0, 10).length;
  5736. if (e2.keyCode === 13) {
  5737. this.setCall(this.filterCallList[this.selectCallIndex]);
  5738. e2.preventDefault();
  5739. }
  5740. if (e2.keyCode === 38) {
  5741. this.selectCallIndex--;
  5742. if (this.selectCallIndex < 0) {
  5743. this.selectCallIndex = length - 1;
  5744. }
  5745. e2.preventDefault();
  5746. }
  5747. if (e2.keyCode === 40) {
  5748. this.selectCallIndex++;
  5749. if (this.selectCallIndex > length - 1) {
  5750. this.selectCallIndex = 0;
  5751. }
  5752. e2.preventDefault();
  5753. }
  5754. },
  5755. changeOption(item) {
  5756. this.$emit("update:displayType", item);
  5757. },
  5758. addThank() {
  5759. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "add" });
  5760. },
  5761. recallThank() {
  5762. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "recall" });
  5763. },
  5764. scrollTop() {
  5765. if (this.isPost) {
  5766. $("body , html").animate({ scrollTop: 0 }, 300);
  5767. } else {
  5768. this.$refs.detail.scrollTo({ top: 0, behavior: "smooth" });
  5769. }
  5770. }
  5771. }
  5772. };
  5773. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-b5867eba"), n2 = n2(), vue.popScopeId(), n2);
  5774. const _hoisted_1$6 = { class: "my-box post-wrapper" };
  5775. const _hoisted_2$3 = { class: "header" };
  5776. const _hoisted_3$3 = { class: "fr" };
  5777. const _hoisted_4$3 = ["href"];
  5778. const _hoisted_5$3 = ["src", "alt"];
  5779. const _hoisted_6$3 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5780. const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5781. const _hoisted_8$2 = ["href"];
  5782. const _hoisted_9$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "sep10" }, null, -1));
  5783. const _hoisted_10$2 = ["id"];
  5784. const _hoisted_11$2 = ["onclick"];
  5785. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-up" }, null, -1));
  5786. const _hoisted_13$1 = ["onclick"];
  5787. const _hoisted_14 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-down" }, null, -1));
  5788. const _hoisted_15 = [
  5789. _hoisted_14
  5790. ];
  5791. const _hoisted_16 = { class: "gray" };
  5792. const _hoisted_17 = ["href"];
  5793. const _hoisted_18 = ["title"];
  5794. const _hoisted_19 = ["href"];
  5795. const _hoisted_20 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-info-circle" }, null, -1));
  5796. const _hoisted_21 = [
  5797. _hoisted_20
  5798. ];
  5799. const _hoisted_22 = ["href"];
  5800. const _hoisted_23 = ["href"];
  5801. const _hoisted_24 = ["href"];
  5802. const _hoisted_25 = { class: "my-tag" };
  5803. const _hoisted_26 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5804. const _hoisted_27 = ["onClick"];
  5805. const _hoisted_28 = {
  5806. key: 0,
  5807. class: "my-box"
  5808. };
  5809. const _hoisted_29 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "高赞回复", -1));
  5810. const _hoisted_30 = { class: "top-reply" };
  5811. const _hoisted_31 = { class: "tool" };
  5812. const _hoisted_32 = { ref: "topReply" };
  5813. const _hoisted_33 = { class: "my-box comment-wrapper" };
  5814. const _hoisted_34 = {
  5815. key: 0,
  5816. class: "my-cell flex"
  5817. };
  5818. const _hoisted_35 = { key: 0 };
  5819. const _hoisted_36 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("strong", { class: "snow" }, "•", -1));
  5820. const _hoisted_37 = ["innerHTML"];
  5821. const _hoisted_38 = {
  5822. key: 0,
  5823. class: "loading-wrapper"
  5824. };
  5825. const _hoisted_39 = {
  5826. key: 1,
  5827. class: "comments"
  5828. };
  5829. const _hoisted_40 = {
  5830. key: 1,
  5831. id: "no-comments-yet"
  5832. };
  5833. const _hoisted_41 = { class: "my-cell flex" };
  5834. const _hoisted_42 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "添加一条新回复", -1));
  5835. const _hoisted_43 = { class: "notice-right gray" };
  5836. const _hoisted_44 = { class: "p1" };
  5837. const _hoisted_45 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "gray" }, "上下文", -1));
  5838. const _hoisted_46 = { class: "top-reply" };
  5839. const _hoisted_47 = ["onClick"];
  5840. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5841. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5842. const _component_Point = vue.resolveComponent("Point");
  5843. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5844. const _component_Icon = vue.resolveComponent("Icon");
  5845. const _component_Tooltip = vue.resolveComponent("Tooltip");
  5846. const _component_Comment = vue.resolveComponent("Comment");
  5847. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5848. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5849. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5850. const _component_SingleComment = vue.resolveComponent("SingleComment");
  5851. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5852. class: vue.normalizeClass(["post-detail", [$options.isNight ? "isNight" : "", $options.pageType]]),
  5853. ref: "detail",
  5854. onKeydown: _cache[21] || (_cache[21] = vue.withKeys(($event) => $options.close(), ["esc"])),
  5855. onClick: _cache[22] || (_cache[22] = ($event) => $options.close("space"))
  5856. }, [
  5857. vue.createElementVNode("div", {
  5858. ref: "main",
  5859. class: "main",
  5860. tabindex: "1",
  5861. onClick: _cache[18] || (_cache[18] = (...args) => $options.stop && $options.stop(...args))
  5862. }, [
  5863. vue.createElementVNode("div", {
  5864. class: "main-wrapper",
  5865. ref: "mainWrapper",
  5866. style: vue.normalizeStyle({ width: $options.config.postWidth + "!important" })
  5867. }, [
  5868. vue.createElementVNode("div", _hoisted_1$6, [
  5869. vue.createElementVNode("div", _hoisted_2$3, [
  5870. vue.createElementVNode("div", _hoisted_3$3, [
  5871. vue.createElementVNode("a", {
  5872. href: `/member/${$options.post.member.username}`,
  5873. style: { "width": "73px", "height": "73px", "display": "inline-block" }
  5874. }, [
  5875. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("img", {
  5876. key: 0,
  5877. src: $options.post.member.avatar_large,
  5878. class: "avatar",
  5879. style: { "width": "73px", "height": "73px" },
  5880. border: "0",
  5881. align: "default",
  5882. alt: $options.post.member.username
  5883. }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
  5884. ], 8, _hoisted_4$3)
  5885. ]),
  5886. _hoisted_6$3,
  5887. _hoisted_7$2,
  5888. vue.createElementVNode("a", {
  5889. href: $options.post.node.url
  5890. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_8$2),
  5891. _hoisted_9$2,
  5892. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1),
  5893. vue.createElementVNode("div", {
  5894. id: `topic_${$options.post.id}_votes`,
  5895. class: "votes"
  5896. }, [
  5897. vue.createElementVNode("a", {
  5898. href: "javascript:",
  5899. onclick: `upVoteTopic(${$options.post.id});`,
  5900. class: "vote"
  5901. }, [
  5902. _hoisted_12$2,
  5903. vue.createTextVNode("   ")
  5904. ], 8, _hoisted_11$2),
  5905. vue.createTextVNode("   "),
  5906. vue.createElementVNode("a", {
  5907. href: "javascript:",
  5908. onclick: `downVoteTopic(${$options.post.id});`,
  5909. class: "vote"
  5910. }, _hoisted_15, 8, _hoisted_13$1)
  5911. ], 8, _hoisted_10$2),
  5912. vue.createTextVNode("   "),
  5913. vue.createElementVNode("small", _hoisted_16, [
  5914. vue.createElementVNode("a", {
  5915. href: `/member/${$options.post.member.username}`
  5916. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_17),
  5917. vue.createTextVNode(" · "),
  5918. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5919. vue.createElementVNode("span", {
  5920. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5921. }, vue.toDisplayString($options.post.member.createDate), 3),
  5922. vue.createTextVNode(" · ")
  5923. ], 64)) : vue.createCommentVNode("", true),
  5924. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5925. vue.createElementVNode("span", {
  5926. title: $options.post.createDate
  5927. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_18),
  5928. vue.createTextVNode(" · ")
  5929. ], 64)) : vue.createCommentVNode("", true),
  5930. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5931. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  5932. vue.createTextVNode("   "),
  5933. vue.createElementVNode("a", {
  5934. href: `/t/${$options.post.id}/info`
  5935. }, _hoisted_21, 8, _hoisted_19),
  5936. vue.createTextVNode("   "),
  5937. $options.canAppend ? (vue.openBlock(), vue.createElementBlock("a", {
  5938. key: 0,
  5939. href: `/append/topic/${$options.post.id}`,
  5940. class: "op"
  5941. }, "APPEND", 8, _hoisted_22)) : vue.createCommentVNode("", true),
  5942. $options.canEditMove ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5943. vue.createElementVNode("a", {
  5944. href: `/move/topic/${$options.post.id}`,
  5945. class: "op"
  5946. }, "MOVE", 8, _hoisted_23),
  5947. vue.createTextVNode("  "),
  5948. vue.createElementVNode("a", {
  5949. href: `/edit/topic/${$options.post.id}`,
  5950. class: "op"
  5951. }, "EDIT", 8, _hoisted_24)
  5952. ], 64)) : vue.createCommentVNode("", true)
  5953. ], 64)) : vue.createCommentVNode("", true)
  5954. ]),
  5955. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5956. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5957. return vue.openBlock(), vue.createElementBlock("span", _hoisted_25, [
  5958. _hoisted_26,
  5959. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5960. vue.createElementVNode("i", {
  5961. class: "fa fa-trash-o remove",
  5962. onClick: vue.withModifiers(($event) => $options.removeTag(i), ["stop"])
  5963. }, null, 8, _hoisted_27)
  5964. ]);
  5965. }), 256)),
  5966. vue.createElementVNode("span", {
  5967. class: "add-tag ago",
  5968. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.addTag && $options.addTag(...args), ["stop"])),
  5969. title: "添加标签"
  5970. }, "+")
  5971. ], 64)) : vue.createCommentVNode("", true)
  5972. ]),
  5973. $options.post.headerTemplate ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5974. key: 0,
  5975. html: $options.post.headerTemplate
  5976. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5977. key: 1,
  5978. html: $options.post.jsonContent
  5979. }, null, 8, ["html"])),
  5980. vue.createVNode(_component_Toolbar, {
  5981. onReply: _cache[1] || (_cache[1] = ($event) => $data.isSticky = !$data.isSticky)
  5982. }, {
  5983. default: vue.withCtx(() => [
  5984. vue.createVNode(_component_Point, {
  5985. onAddThank: $options.addThank,
  5986. onRecallThank: $options.recallThank,
  5987. item: {
  5988. isThanked: $options.post.isThanked,
  5989. thankCount: $options.post.thankCount,
  5990. username: $options.post.username
  5991. },
  5992. "api-url": "topic/" + $options.post.id
  5993. }, null, 8, ["onAddThank", "onRecallThank", "item", "api-url"])
  5994. ]),
  5995. _: 1
  5996. })
  5997. ]),
  5998. $options.post.topReplyList.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
  5999. vue.createElementVNode("div", {
  6000. class: "my-cell flex",
  6001. onClick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args), ["stop"]))
  6002. }, [
  6003. _hoisted_29,
  6004. vue.createElementVNode("div", _hoisted_30, [
  6005. vue.createVNode(_component_Tooltip, { title: "收起高赞回复" }, {
  6006. default: vue.withCtx(() => [
  6007. vue.createElementVNode("div", _hoisted_31, [
  6008. vue.createVNode(_component_Icon, { icon: "gravity-ui:chevrons-collapse-vertical" })
  6009. ])
  6010. ]),
  6011. _: 1
  6012. })
  6013. ])
  6014. ]),
  6015. vue.createElementVNode("div", _hoisted_32, [
  6016. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.post.topReplyList, (item, index) => {
  6017. return vue.openBlock(), vue.createBlock(_component_Comment, {
  6018. key: item.floor,
  6019. type: "top",
  6020. modelValue: $options.post.topReplyList[index],
  6021. "onUpdate:modelValue": ($event) => $options.post.topReplyList[index] = $event
  6022. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  6023. }), 128))
  6024. ], 512)
  6025. ])) : vue.createCommentVNode("", true),
  6026. vue.createElementVNode("div", _hoisted_33, [
  6027. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_34, [
  6028. vue.createElementVNode("div", null, [
  6029. vue.createTextVNode(vue.toDisplayString($options.post.replyCount) + " 条回复 ", 1),
  6030. $options.post.lastReplyDate ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_35, [
  6031. vue.createTextVNode("  "),
  6032. _hoisted_36,
  6033. vue.createTextVNode("  " + vue.toDisplayString($options.post.lastReplyDate), 1)
  6034. ])) : vue.createCommentVNode("", true)
  6035. ]),
  6036. $options.config.showToolbar ? (vue.openBlock(), vue.createBlock(_component_BaseSelect, {
  6037. key: 0,
  6038. "display-type": $props.displayType,
  6039. "onUpdate:displayType": _cache[3] || (_cache[3] = (e2) => _ctx.$emit("update:displayType", e2))
  6040. }, null, 8, ["display-type"])) : (vue.openBlock(), vue.createElementBlock("div", {
  6041. key: 1,
  6042. class: "fr",
  6043. innerHTML: $options.post.fr
  6044. }, null, 8, _hoisted_37))
  6045. ])) : vue.createCommentVNode("", true),
  6046. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  6047. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_38, [
  6048. vue.createVNode(_component_BaseLoading, { size: "large" })
  6049. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_39, [
  6050. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index) => {
  6051. return vue.openBlock(), vue.createBlock(_component_Comment, {
  6052. key: item.floor,
  6053. modelValue: $options.replyList[index],
  6054. "onUpdate:modelValue": ($event) => $options.replyList[index] = $event
  6055. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  6056. }), 128)) : vue.createCommentVNode("", true)
  6057. ]))
  6058. ], 64)) : vue.createCommentVNode("", true)
  6059. ]),
  6060. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40, "目前尚无回复")) : vue.createCommentVNode("", true),
  6061. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  6062. key: 2,
  6063. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  6064. ref: "replyBox"
  6065. }, [
  6066. vue.createElementVNode("div", _hoisted_41, [
  6067. _hoisted_42,
  6068. vue.createElementVNode("div", _hoisted_43, [
  6069. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  6070. key: 0,
  6071. style: { "margin-right": "2rem" },
  6072. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => $data.isSticky = false, ["stop"]))
  6073. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  6074. vue.createElementVNode("a", {
  6075. onClick: _cache[5] || (_cache[5] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  6076. }, "回到顶部")
  6077. ])
  6078. ]),
  6079. vue.createElementVNode("div", _hoisted_44, [
  6080. vue.createVNode(_component_PostEditor, {
  6081. onClose: $options.goBottom,
  6082. ref: "post-editor",
  6083. useType: "reply-post",
  6084. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => $data.isSticky = true, ["stop"]))
  6085. }, null, 8, ["onClose"])
  6086. ])
  6087. ], 2)) : vue.createCommentVNode("", true)
  6088. ], 4),
  6089. $data.showRelationReply ? (vue.openBlock(), vue.createElementBlock("div", {
  6090. key: 0,
  6091. class: "relationReply",
  6092. onClick: _cache[10] || (_cache[10] = vue.withModifiers(($event) => $options.close("space"), ["stop"]))
  6093. }, [
  6094. vue.createElementVNode("div", {
  6095. class: "my-cell flex",
  6096. onClick: _cache[8] || (_cache[8] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  6097. }, [
  6098. _hoisted_45,
  6099. vue.createElementVNode("div", _hoisted_46, [
  6100. vue.createVNode(_component_Icon, {
  6101. icon: "ic:round-close",
  6102. onClick: _cache[7] || (_cache[7] = vue.withModifiers(($event) => $data.showRelationReply = false, ["stop"]))
  6103. })
  6104. ])
  6105. ]),
  6106. vue.createElementVNode("div", {
  6107. class: "comments",
  6108. onClick: _cache[9] || (_cache[9] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  6109. }, [
  6110. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.relationReply, (item, index) => {
  6111. return vue.openBlock(), vue.createBlock(_component_SingleComment, {
  6112. "is-right": item.username === $data.targetUser.right,
  6113. key: item.floor,
  6114. comment: item
  6115. }, null, 8, ["is-right", "comment"]);
  6116. }), 128))
  6117. ])
  6118. ])) : vue.createCommentVNode("", true),
  6119. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  6120. key: 1,
  6121. class: "call-list",
  6122. style: vue.normalizeStyle($data.callStyle)
  6123. }, [
  6124. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index) => {
  6125. return vue.openBlock(), vue.createElementBlock("div", {
  6126. class: vue.normalizeClass(["call-item", { select: index === $data.selectCallIndex }]),
  6127. onClick: vue.withModifiers(($event) => $options.setCall(item), ["stop"])
  6128. }, [
  6129. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  6130. ], 10, _hoisted_47);
  6131. }), 256))
  6132. ], 4)) : vue.createCommentVNode("", true),
  6133. vue.createElementVNode("div", {
  6134. class: "close-btn",
  6135. onClick: _cache[11] || (_cache[11] = vue.withModifiers(($event) => $options.close("btn"), ["stop"]))
  6136. }, [
  6137. vue.createVNode(_component_Icon, { icon: "fontisto:close-a" })
  6138. ]),
  6139. vue.createElementVNode("div", {
  6140. class: "refresh gray",
  6141. onClick: _cache[12] || (_cache[12] = vue.withModifiers(($event) => _ctx.$emit("refresh"), ["stop"]))
  6142. }, [
  6143. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  6144. key: 1,
  6145. icon: "material-symbols:refresh"
  6146. }))
  6147. ]),
  6148. vue.createElementVNode("div", {
  6149. class: "scroll-to gray",
  6150. onClick: _cache[16] || (_cache[16] = vue.withModifiers(($event) => $options.jump($data.currentFloor), ["stop"]))
  6151. }, [
  6152. vue.createVNode(_component_Icon, { icon: "lucide:move-down" }),
  6153. vue.withDirectives(vue.createElementVNode("input", {
  6154. type: "text",
  6155. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.currentFloor = $event),
  6156. onClick: _cache[14] || (_cache[14] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"])),
  6157. onKeydown: _cache[15] || (_cache[15] = vue.withKeys(($event) => $options.jump($data.currentFloor), ["enter"]))
  6158. }, null, 544), [
  6159. [vue.vModelText, $data.currentFloor]
  6160. ])
  6161. ]),
  6162. vue.createElementVNode("div", {
  6163. class: "scroll-top gray",
  6164. onClick: _cache[17] || (_cache[17] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  6165. }, [
  6166. vue.createVNode(_component_Icon, { icon: "lucide:move-up" })
  6167. ])
  6168. ], 512),
  6169. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  6170. vue.createElementVNode("div", {
  6171. class: "preview-modal",
  6172. onWheel: _cache[20] || (_cache[20] = (...args) => $options.wheel && $options.wheel(...args))
  6173. }, [
  6174. vue.createElementVNode("div", {
  6175. class: "mask",
  6176. onClick: _cache[19] || (_cache[19] = (...args) => $options.closePreviewModal && $options.closePreviewModal(...args))
  6177. }),
  6178. vue.createVNode(_component_Icon, {
  6179. class: "close",
  6180. icon: "fontisto:close-a",
  6181. onClick: $options.closePreviewModal
  6182. }, null, 8, ["onClick"])
  6183. ], 32)
  6184. ]))
  6185. ], 34)), [
  6186. [vue.vShow, $props.modelValue]
  6187. ]);
  6188. }
  6189. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-b5867eba"]]);
  6190. const _hoisted_1$5 = { key: 1 };
  6191. const _sfc_main$5 = {
  6192. __name: "Base64Tooltip",
  6193. setup(__props) {
  6194. const tooltip = vue.ref(null);
  6195. const show = vue.ref(false);
  6196. const originalText = vue.ref("");
  6197. const decodeText = vue.ref("");
  6198. const styleObject = vue.reactive({
  6199. left: "-100vw",
  6200. top: "-100vh"
  6201. });
  6202. vue.onMounted(() => {
  6203. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  6204. setTimeout(() => show.value = true);
  6205. originalText.value = text;
  6206. decodeText.value = "";
  6207. styleObject.left = e2.clientX + "px";
  6208. styleObject.top = e2.clientY + 20 + "px";
  6209. });
  6210. window.addEventListener("click", (e2) => {
  6211. if (!tooltip.value)
  6212. return;
  6213. if (!tooltip.value.contains(e2.target) && show.value) {
  6214. show.value = false;
  6215. }
  6216. }, { capture: true });
  6217. const fn = () => show.value && (show.value = false);
  6218. $(".post-detail", window.win().doc).on("scroll", fn);
  6219. });
  6220. function copy() {
  6221. if (window.win().navigator.clipboard) {
  6222. window.win().navigator.clipboard.writeText(decodeText.value);
  6223. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  6224. } else {
  6225. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  6226. }
  6227. }
  6228. function base64ToArrayBuffer(base64) {
  6229. let binary_string = window.atob(base64);
  6230. let len = binary_string.length;
  6231. let bytes = new Uint8Array(len);
  6232. for (let i = 0; i < len; i++) {
  6233. bytes[i] = binary_string.charCodeAt(i);
  6234. }
  6235. return bytes.buffer;
  6236. }
  6237. function decode() {
  6238. try {
  6239. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  6240. decodeText.value = r2;
  6241. });
  6242. } catch (e2) {
  6243. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  6244. }
  6245. }
  6246. return (_ctx, _cache) => {
  6247. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  6248. class: "base64_tooltip",
  6249. style: vue.normalizeStyle(styleObject),
  6250. onClick: decode,
  6251. ref_key: "tooltip",
  6252. ref: tooltip
  6253. }, [
  6254. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6255. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  6256. vue.createVNode(vue.unref(Icon), { icon: "system-uicons:translate" })
  6257. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
  6258. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  6259. vue.createVNode(BaseButton, {
  6260. class: "btn",
  6261. size: "small",
  6262. onClick: copy
  6263. }, {
  6264. default: vue.withCtx(() => [
  6265. vue.createTextVNode("点击复制")
  6266. ]),
  6267. _: 1
  6268. })
  6269. ]))
  6270. ], 4)), [
  6271. [vue.vShow, show.value]
  6272. ]);
  6273. };
  6274. }
  6275. };
  6276. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c50fb66c"]]);
  6277. const _sfc_main$4 = {
  6278. name: "Msg",
  6279. components: { Icon },
  6280. props: {
  6281. type: "",
  6282. text: ""
  6283. },
  6284. created() {
  6285. setTimeout(() => {
  6286. this.$emit("close");
  6287. }, 3e3);
  6288. }
  6289. };
  6290. const _hoisted_1$4 = { class: "right" };
  6291. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  6292. const _component_Icon = vue.resolveComponent("Icon");
  6293. return vue.openBlock(), vue.createElementBlock("div", {
  6294. class: vue.normalizeClass(["msg", $props.type])
  6295. }, [
  6296. vue.createElementVNode("div", {
  6297. class: "left",
  6298. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  6299. }, [
  6300. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  6301. ]),
  6302. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  6303. ], 2);
  6304. }
  6305. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-8bf692ea"]]);
  6306. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-eef9961d"), n2 = n2(), vue.popScopeId(), n2);
  6307. const _hoisted_1$3 = {
  6308. key: 0,
  6309. class: "tag-modal modal"
  6310. };
  6311. const _hoisted_2$2 = { class: "wrapper" };
  6312. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  6313. const _hoisted_4$2 = { class: "option" };
  6314. const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  6315. const _hoisted_6$2 = { class: "btns" };
  6316. const _sfc_main$3 = {
  6317. __name: "TagModal",
  6318. props: ["tags"],
  6319. emits: ["update:tags"],
  6320. setup(__props, { emit: __emit }) {
  6321. const tagModal = vue.reactive({
  6322. show: false,
  6323. currentUsername: "",
  6324. tag: ""
  6325. });
  6326. const props = __props;
  6327. const emit = __emit;
  6328. const inputRef = vue.ref();
  6329. vue.onMounted(() => {
  6330. eventBus.on(CMD.ADD_TAG, (username) => {
  6331. tagModal.currentUsername = username;
  6332. tagModal.show = true;
  6333. vue.nextTick(() => {
  6334. inputRef.value.focus();
  6335. });
  6336. });
  6337. });
  6338. async function addTag() {
  6339. if (!tagModal.tag) {
  6340. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  6341. return;
  6342. }
  6343. let oldTag = window.clone(props.tags);
  6344. let tempTag = window.clone(props.tags);
  6345. let userTags = tempTag[tagModal.currentUsername] ?? [];
  6346. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  6347. if (rIndex > -1) {
  6348. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  6349. return;
  6350. } else {
  6351. userTags.push(tagModal.tag);
  6352. }
  6353. tempTag[tagModal.currentUsername] = userTags;
  6354. emit("update:tags", tempTag);
  6355. tagModal.tag = "";
  6356. tagModal.show = false;
  6357. let res = await window.parse.saveTags(tempTag);
  6358. if (!res) {
  6359. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  6360. emit("update:tags", oldTag);
  6361. }
  6362. }
  6363. return (_ctx, _cache) => {
  6364. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6365. default: vue.withCtx(() => [
  6366. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  6367. vue.createElementVNode("div", {
  6368. class: "mask",
  6369. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  6370. }),
  6371. vue.createElementVNode("div", _hoisted_2$2, [
  6372. _hoisted_3$2,
  6373. vue.createElementVNode("div", _hoisted_4$2, [
  6374. _hoisted_5$2,
  6375. vue.createElementVNode("div", null, [
  6376. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  6377. ])
  6378. ]),
  6379. vue.withDirectives(vue.createElementVNode("input", {
  6380. type: "text",
  6381. ref_key: "inputRef",
  6382. ref: inputRef,
  6383. style: { "width": "100%" },
  6384. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  6385. onKeydown: vue.withKeys(addTag, ["enter"])
  6386. }, null, 544), [
  6387. [vue.vModelText, tagModal.tag]
  6388. ]),
  6389. vue.createElementVNode("div", _hoisted_6$2, [
  6390. vue.createVNode(BaseButton, {
  6391. type: "link",
  6392. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => {
  6393. tagModal.show = false;
  6394. tagModal.tag = "";
  6395. }, ["stop"]))
  6396. }, {
  6397. default: vue.withCtx(() => [
  6398. vue.createTextVNode("取消")
  6399. ]),
  6400. _: 1
  6401. }),
  6402. vue.createVNode(BaseButton, {
  6403. onClick: vue.withModifiers(addTag, ["stop"])
  6404. }, {
  6405. default: vue.withCtx(() => [
  6406. vue.createTextVNode("确定")
  6407. ]),
  6408. _: 1
  6409. })
  6410. ])
  6411. ])
  6412. ])) : vue.createCommentVNode("", true)
  6413. ]),
  6414. _: 1
  6415. });
  6416. };
  6417. }
  6418. };
  6419. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-eef9961d"]]);
  6420. const _hoisted_1$2 = { class: "msgs" };
  6421. const _sfc_main$2 = {
  6422. __name: "MsgModal",
  6423. setup(__props) {
  6424. const msgList = vue.reactive([
  6425. // {type: 'success', text: '123', id: Date.now()}
  6426. ]);
  6427. vue.onMounted(() => {
  6428. eventBus.on(CMD.SHOW_MSG, (val) => {
  6429. msgList.push({ ...val, id: Date.now() });
  6430. });
  6431. });
  6432. function removeMsg(id) {
  6433. let rIndex = msgList.findIndex((item) => item.id === id);
  6434. if (rIndex > -1) {
  6435. msgList.splice(rIndex, 1);
  6436. }
  6437. }
  6438. return (_ctx, _cache) => {
  6439. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
  6440. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  6441. return vue.openBlock(), vue.createBlock(Msg, {
  6442. key: v.id,
  6443. type: v.type,
  6444. text: v.text,
  6445. onClose: ($event) => removeMsg(v.id)
  6446. }, null, 8, ["type", "text", "onClose"]);
  6447. }), 128))
  6448. ]);
  6449. };
  6450. }
  6451. };
  6452. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b73f4332"]]);
  6453. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  6454. function e(e2) {
  6455. }
  6456. function r(e2, t) {
  6457. let r2 = e2.substr(t, 2);
  6458. return parseInt(r2, 16);
  6459. }
  6460. function n(href, index) {
  6461. let o = "", a = r(href, index);
  6462. for (let i = index + 2; i < href.length; i += 2) {
  6463. let l = r(href, i) ^ a;
  6464. o += String.fromCharCode(l);
  6465. }
  6466. try {
  6467. o = decodeURIComponent(escape(o));
  6468. } catch (u2) {
  6469. }
  6470. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  6471. return d.childNodes[0].getAttribute("href") || "";
  6472. }
  6473. function decodeEmail(body) {
  6474. try {
  6475. let as = body.find(u);
  6476. as.each(function() {
  6477. try {
  6478. let o = this, a = o.parentNode, i = o.getAttribute(f);
  6479. if (i) {
  6480. let l = n(i, 0), d2 = document.createTextNode(l);
  6481. a.replaceChild(d2, o);
  6482. }
  6483. } catch (h2) {
  6484. e(h2);
  6485. }
  6486. });
  6487. } catch (s) {
  6488. }
  6489. }
  6490. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-77aa374e"), n2 = n2(), vue.popScopeId(), n2);
  6491. const _hoisted_1$1 = {
  6492. key: 0,
  6493. class: "NotificationModal modal"
  6494. };
  6495. const _hoisted_2$1 = { class: "modal-root" };
  6496. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  6497. const _hoisted_4$1 = { class: "modal-body" };
  6498. const _hoisted_5$1 = { class: "filter" };
  6499. const _hoisted_6$1 = { class: "list-wrap" };
  6500. const _hoisted_7$1 = { class: "notify-wrap" };
  6501. const _hoisted_8$1 = ["innerHTML"];
  6502. const _hoisted_9$1 = {
  6503. key: 0,
  6504. class: "loading-wrap"
  6505. };
  6506. const _hoisted_10$1 = { class: "footer" };
  6507. const _hoisted_11$1 = ["innerHTML"];
  6508. const _hoisted_12$1 = { class: "total" };
  6509. const _hoisted_13 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("span", null, "总共收到提醒", -1));
  6510. const _sfc_main$1 = {
  6511. __name: "NotificationModal",
  6512. props: ["modelValue", "list", "total", "pages", "loading"],
  6513. emits: ["update:modelValue"],
  6514. setup(__props, { emit: __emit }) {
  6515. const props = __props;
  6516. const emit = __emit;
  6517. const index = vue.ref("all");
  6518. vue.onMounted(() => {
  6519. });
  6520. vue.watch([index, () => props.list], () => {
  6521. $(".notify-wrap").scrollTop(0);
  6522. });
  6523. vue.watch(() => props.modelValue, (n2) => {
  6524. if (n2) {
  6525. document.body.style.overflow = "hidden";
  6526. } else {
  6527. document.body.style.overflow = "unset";
  6528. $(".notify-wrap").scrollTop(0);
  6529. }
  6530. });
  6531. function close() {
  6532. emit("update:modelValue", false);
  6533. }
  6534. return (_ctx, _cache) => {
  6535. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6536. default: vue.withCtx(() => [
  6537. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  6538. vue.createElementVNode("div", {
  6539. class: "mask",
  6540. onClick: vue.withModifiers(close, ["stop"])
  6541. }),
  6542. vue.createElementVNode("div", _hoisted_2$1, [
  6543. vue.createElementVNode("div", { class: "modal-header" }, [
  6544. _hoisted_3$1,
  6545. vue.createElementVNode("i", {
  6546. class: "fa fa-times",
  6547. onClick: close
  6548. })
  6549. ]),
  6550. vue.createElementVNode("div", _hoisted_4$1, [
  6551. vue.createElementVNode("div", _hoisted_5$1, [
  6552. vue.createElementVNode("div", {
  6553. class: vue.normalizeClass(index.value === "all" && "active"),
  6554. onClick: _cache[0] || (_cache[0] = ($event) => index.value = "all")
  6555. }, "全部", 2),
  6556. vue.createElementVNode("div", {
  6557. class: vue.normalizeClass(index.value === "reply" && "active"),
  6558. onClick: _cache[1] || (_cache[1] = ($event) => index.value = "reply")
  6559. }, "回复", 2),
  6560. vue.createElementVNode("div", {
  6561. class: vue.normalizeClass(index.value === "star" && "active"),
  6562. onClick: _cache[2] || (_cache[2] = ($event) => index.value = "star")
  6563. }, "感谢", 2),
  6564. vue.createElementVNode("div", {
  6565. class: vue.normalizeClass(index.value === "collect" && "active"),
  6566. onClick: _cache[3] || (_cache[3] = ($event) => index.value = "collect")
  6567. }, "收藏", 2)
  6568. ]),
  6569. vue.createElementVNode("div", _hoisted_6$1, [
  6570. vue.createElementVNode("div", _hoisted_7$1, [
  6571. vue.createElementVNode("div", {
  6572. id: "notifications",
  6573. class: vue.normalizeClass(index.value),
  6574. innerHTML: __props.list
  6575. }, null, 10, _hoisted_8$1)
  6576. ]),
  6577. __props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$1, [
  6578. vue.createVNode(BaseLoading)
  6579. ])) : vue.createCommentVNode("", true)
  6580. ]),
  6581. vue.createElementVNode("div", _hoisted_10$1, [
  6582. vue.createElementVNode("div", {
  6583. innerHTML: __props.pages,
  6584. class: "pages"
  6585. }, null, 8, _hoisted_11$1),
  6586. vue.createElementVNode("div", _hoisted_12$1, [
  6587. _hoisted_13,
  6588. vue.createTextVNode(vue.toDisplayString(__props.total), 1)
  6589. ])
  6590. ])
  6591. ])
  6592. ])
  6593. ])) : vue.createCommentVNode("", true)
  6594. ]),
  6595. _: 1
  6596. });
  6597. };
  6598. }
  6599. };
  6600. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-77aa374e"]]);
  6601. const _sfc_main = {
  6602. components: {
  6603. Icon,
  6604. BaseButton,
  6605. NotificationModal,
  6606. BaseLoading,
  6607. BaseSwitch,
  6608. MsgModal,
  6609. TagModal,
  6610. Tooltip,
  6611. Setting,
  6612. PostDetail,
  6613. Base64Tooltip,
  6614. Msg
  6615. },
  6616. provide() {
  6617. return {
  6618. isLogin: vue.computed(() => this.isLogin),
  6619. isNight: vue.computed(() => this.isNight),
  6620. pageType: vue.computed(() => this.pageType),
  6621. tags: vue.computed(() => this.tags),
  6622. show: vue.computed(() => this.show),
  6623. post: vue.computed(() => this.current),
  6624. config: vue.computed(() => this.config),
  6625. allReplyUsers: vue.computed(() => {
  6626. var _a, _b, _c;
  6627. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  6628. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  6629. }
  6630. return [];
  6631. }),
  6632. showConfig: this.showConfig
  6633. };
  6634. },
  6635. data() {
  6636. return {
  6637. loading: window.pageType === PageType.Post,
  6638. refreshLoading: false,
  6639. loadMore: false,
  6640. isLogin: !!window.user.username,
  6641. pageType: window.pageType,
  6642. isNight: window.isNight,
  6643. stopMe: window.stopMe,
  6644. //停止使用脚本
  6645. show: false,
  6646. current: window.clone(window.initPost),
  6647. list: [],
  6648. config: window.clone(window.config),
  6649. tags: window.user.tags,
  6650. configModal: {
  6651. show: false
  6652. },
  6653. notificationModal: {
  6654. show: false,
  6655. loading: false,
  6656. list: "",
  6657. total: 0
  6658. },
  6659. previewModal: {
  6660. show: false,
  6661. src: ""
  6662. },
  6663. popConfirmModal: {
  6664. show: false,
  6665. title: "",
  6666. id: ""
  6667. },
  6668. timer: -1,
  6669. timer2: -1,
  6670. pageInfo: {
  6671. title: "",
  6672. number: 0
  6673. }
  6674. };
  6675. },
  6676. computed: {
  6677. targetUserTags() {
  6678. return this.tags[window.targetUserName] ?? [];
  6679. },
  6680. isList() {
  6681. return [PageType.Home, PageType.Node].includes(this.pageType);
  6682. },
  6683. isPost() {
  6684. return this.pageType === PageType.Post;
  6685. },
  6686. isMember() {
  6687. return this.pageType === PageType.Member;
  6688. }
  6689. },
  6690. watch: {
  6691. config: {
  6692. handler(newVal, oldVal) {
  6693. let configStr = localStorage.getItem("v2ex-config");
  6694. if (configStr) {
  6695. let configObj = JSON.parse(configStr);
  6696. configObj[window.user.username || "default"] = newVal;
  6697. localStorage.setItem("v2ex-config", JSON.stringify(configObj));
  6698. }
  6699. window.config = newVal;
  6700. window.parse.editNoteItem(window.user.configPrefix + JSON.stringify(window.config), window.user.configNoteId);
  6701. },
  6702. deep: true
  6703. },
  6704. tags(newVal) {
  6705. window.user.tags = newVal;
  6706. },
  6707. "config.viewType"(newVal) {
  6708. if (!newVal)
  6709. return;
  6710. if (newVal === "card") {
  6711. $(".post-item").each(function() {
  6712. $(this).addClass("preview");
  6713. });
  6714. } else {
  6715. $(".post-item").each(function() {
  6716. $(this).removeClass("preview");
  6717. });
  6718. }
  6719. },
  6720. "pageInfo.number"(newVal) {
  6721. clearInterval(this.timer2);
  6722. if (newVal) {
  6723. document.title = `(${this.pageInfo.number}) ` + this.pageInfo.title;
  6724. if (this.config.notice.whenNewNoticeGlimmer) {
  6725. let c = 0;
  6726. this.timer2 = setInterval(() => {
  6727. c++;
  6728. document.title = this.pageInfo.title;
  6729. if (c % 2 === 0) {
  6730. document.title = `(${this.pageInfo.number}) ` + this.pageInfo.title;
  6731. }
  6732. }, 1e3);
  6733. }
  6734. } else {
  6735. document.title = this.pageInfo.title;
  6736. }
  6737. },
  6738. show(newVal) {
  6739. if (this.pageType === PageType.Post)
  6740. return;
  6741. if (newVal) {
  6742. document.body.style.overflow = "hidden";
  6743. if (!window.history.state) {
  6744. window.history.pushState({}, 0, this.current.href);
  6745. }
  6746. vue.nextTick(() => {
  6747. this.pageInfo.title = document.title = this.current.title ?? "V2EX";
  6748. });
  6749. } else {
  6750. document.body.style.overflow = "unset";
  6751. this.pageInfo.title = document.title = "V2EX";
  6752. if (window.history.state) {
  6753. window.history.back();
  6754. }
  6755. }
  6756. }
  6757. },
  6758. created() {
  6759. let that = this;
  6760. this.initEvent();
  6761. window.cb = this.winCb;
  6762. if (!window.canParseV2exPage)
  6763. return;
  6764. $(document).on("click", "a", this.clickA);
  6765. $(document).on("click", ".post-item", function(e2) {
  6766. if (e2.currentTarget.getAttribute("script"))
  6767. return;
  6768. if (that.stopMe)
  6769. return true;
  6770. if (this.classList.contains("preview")) {
  6771. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG" && !e2.target.classList.contains("toggle")) {
  6772. let id = this.dataset["id"];
  6773. let href = this.dataset["href"];
  6774. if (id) {
  6775. that.clickPost(e2, id, href);
  6776. } else {
  6777. if (href)
  6778. location.href = href;
  6779. }
  6780. }
  6781. }
  6782. });
  6783. $(document).on("click", ".toggle", (e2) => {
  6784. if (this.stopMe)
  6785. return true;
  6786. let id = e2.target.dataset["id"];
  6787. let itemDom = document.querySelector(`.id_${id}`);
  6788. if (itemDom.classList.contains("preview")) {
  6789. e2.target.innerText = "预览";
  6790. itemDom.classList.remove("preview");
  6791. } else {
  6792. if (this.config.viewType !== "card") {
  6793. let index = this.list.findIndex((v) => v.id == id);
  6794. if (index > -1) {
  6795. e2.target.innerText = "收起";
  6796. itemDom.classList.add("preview");
  6797. } else {
  6798. e2.target.innerText = "加载中";
  6799. functions.getPostDetailByApi(id).then((res) => {
  6800. if (res.content_rendered) {
  6801. res.href = itemDom.dataset["href"];
  6802. this.list.push(getDefaultPost(res));
  6803. itemDom.classList.add("preview");
  6804. e2.target.innerText = "收起";
  6805. functions.appendPostContent(res, itemDom);
  6806. } else {
  6807. e2.target.innerText = "预览";
  6808. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "主题暂无正文!" });
  6809. }
  6810. });
  6811. }
  6812. } else {
  6813. e2.target.innerText = "收起";
  6814. itemDom.classList.add("preview");
  6815. }
  6816. }
  6817. });
  6818. window.onpopstate = (event) => {
  6819. if (event.state) {
  6820. if (!this.show)
  6821. this.show = true;
  6822. } else {
  6823. if (this.show)
  6824. this.show = false;
  6825. }
  6826. };
  6827. if (this.config.notice.takeOverNoticePage) {
  6828. window.deleteNotification = (nId, token) => {
  6829. let item = $("#n_" + nId);
  6830. item.slideUp("fast");
  6831. $.post({
  6832. url: "/delete/notification/" + nId + "?once=" + token,
  6833. success() {
  6834. $.get({
  6835. url: "/notifications/below/" + window.notificationBottom,
  6836. success(data, status, request) {
  6837. item.remove();
  6838. $("#notifications").append(that.checkReplyItemType(data));
  6839. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  6840. },
  6841. error() {
  6842. item.slideDown("fast");
  6843. }
  6844. });
  6845. },
  6846. error() {
  6847. item.slideDown("fast");
  6848. }
  6849. });
  6850. };
  6851. }
  6852. },
  6853. mounted() {
  6854. },
  6855. beforeUnmount() {
  6856. clearInterval(this.timer);
  6857. eventBus.clear();
  6858. $(document).off("click", "a", this.clickA);
  6859. },
  6860. methods: {
  6861. checkReplyItemType(val) {
  6862. let d2 = $(val);
  6863. let str = d2.html();
  6864. if (str.includes("提到了你") || str.includes("回复了你")) {
  6865. d2.addClass("reply");
  6866. }
  6867. if (str.includes("感谢了你")) {
  6868. d2.addClass("star");
  6869. }
  6870. if (str.includes("收藏了你")) {
  6871. d2.addClass("collect");
  6872. }
  6873. return d2;
  6874. },
  6875. async getUnreadMessagesCount() {
  6876. var _a, _b;
  6877. const res = await fetch(`${location.origin}/mission`);
  6878. const htmlText = await res.text();
  6879. const $page = $(htmlText);
  6880. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  6881. if (text.includes("未读提醒")) {
  6882. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  6883. if (countStr) {
  6884. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  6885. }
  6886. } else {
  6887. return 0;
  6888. }
  6889. throw new Error("无法获取未读消息数量");
  6890. },
  6891. clickA(e2) {
  6892. let that = this;
  6893. if (e2.currentTarget.getAttribute("script"))
  6894. return;
  6895. if (that.stopMe)
  6896. return true;
  6897. let { pageType } = functions.checkPageType(e2.currentTarget);
  6898. let { href, id, title } = functions.parseA(e2.currentTarget);
  6899. switch (pageType) {
  6900. case PageType.Post:
  6901. if (id) {
  6902. that.clickPost(e2, id, href, title);
  6903. }
  6904. break;
  6905. case PageType.Node:
  6906. case PageType.Home:
  6907. case PageType.Changes:
  6908. return;
  6909. default:
  6910. if (e2.currentTarget.href.includes("/settings/night/toggle"))
  6911. return;
  6912. if (e2.currentTarget.href === location.origin + "/#;")
  6913. return;
  6914. if (e2.currentTarget.href.includes("/notifications")) {
  6915. this.pageInfo.number = 0;
  6916. $("#money").parent().prev().replaceWith(`<a href="/notifications">0 未读提醒</a>`);
  6917. if (this.config.notice.takeOverNoticePage) {
  6918. this.notificationModal.loading = true;
  6919. this.notificationModal.show = true;
  6920. fetch(href).then(async (r2) => {
  6921. let htmlText = await r2.text();
  6922. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6923. let res = htmlText.match(/var notificationBottom = ([\d]+);/);
  6924. if (res && res[1]) {
  6925. window.notificationBottom = Number(res[1]);
  6926. }
  6927. let body = $(bodyText[0]);
  6928. let list = body.find("#notifications");
  6929. list.children().each(function() {
  6930. that.checkReplyItemType(this);
  6931. });
  6932. let h2 = list.html();
  6933. let d2 = body.find("#Main > .box > .header .fr .gray");
  6934. if (d2.length) {
  6935. this.notificationModal.total = d2.text();
  6936. }
  6937. this.notificationModal.list = h2;
  6938. let p = list.next();
  6939. let tds = p.find(".button");
  6940. tds.each(function() {
  6941. let href2 = this.getAttribute("onclick");
  6942. if (href2) {
  6943. this.innerHTML = `<a href=${href2.replace("location.href=", "")}>${this.innerHTML}</a>`;
  6944. this.setAttribute("onclick", "");
  6945. }
  6946. });
  6947. this.notificationModal.pages = p.html();
  6948. this.notificationModal.loading = false;
  6949. }).catch((e3) => {
  6950. this.notificationModal.loading = false;
  6951. });
  6952. that.stopEvent(e2);
  6953. return;
  6954. }
  6955. }
  6956. if (that.config.newTabOpen) {
  6957. that.stopEvent(e2);
  6958. functions.openNewTab(e2.currentTarget.href, that.config.newTabOpenActive);
  6959. }
  6960. return;
  6961. }
  6962. },
  6963. stopEvent(e2) {
  6964. e2.preventDefault();
  6965. e2.stopPropagation();
  6966. },
  6967. async clickPost(e2, id, href, title = "") {
  6968. if (id) {
  6969. if (this.config.clickPostItemOpenDetail) {
  6970. this.stopEvent(e2);
  6971. let postItem = getDefaultPost();
  6972. let index = this.list.findIndex((v) => v.id == id);
  6973. if (index > -1) {
  6974. postItem = this.list[index];
  6975. }
  6976. if (!postItem.title)
  6977. postItem.title = title ?? "加载中";
  6978. postItem.id = id;
  6979. postItem.href = href;
  6980. this.getPostDetail(postItem);
  6981. return;
  6982. }
  6983. if (this.config.newTabOpen) {
  6984. this.stopEvent(e2);
  6985. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`, this.config.newTabOpenActive);
  6986. }
  6987. }
  6988. },
  6989. showPost() {
  6990. this.show = true;
  6991. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6992. $(this).hide();
  6993. });
  6994. },
  6995. showConfig() {
  6996. this.configModal.show = true;
  6997. },
  6998. resetTitle() {
  6999. let r2 = document.title.match(/\s?\(\d+\)\s?/);
  7000. if (r2 && r2.length) {
  7001. this.pageInfo.title = document.title.replace(r2[0], "");
  7002. } else {
  7003. this.pageInfo.title = document.title;
  7004. }
  7005. },
  7006. async getNotice(body) {
  7007. if (!body) {
  7008. let res = await fetch("/t");
  7009. if (res.status === 200) {
  7010. let htmlText = await res.text();
  7011. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7012. body = $(bodyText[0]);
  7013. }
  7014. }
  7015. let notify = body.find('a[href="/notifications"]');
  7016. if (notify.length) {
  7017. this.resetTitle();
  7018. let text = notify.text();
  7019. if (text !== "0 未读提醒") {
  7020. this.pageInfo.number = text.replace(" 未读提醒", "");
  7021. if (this.config.notice.text !== text) {
  7022. $("#money").parent().prev().replaceWith(`<div><div class="orange-dot"></div><strong><a href="/notifications">${text}</a></strong></div>`);
  7023. this.config.notice.text = text;
  7024. if (this.config.notice.ddWebhook) {
  7025. let n2 = /* @__PURE__ */ new Date();
  7026. let s = n2.getSeconds();
  7027. s = s < 10 ? "0" + s : s;
  7028. let m = n2.getMinutes();
  7029. m = m < 10 ? "0" + m : m;
  7030. let h2 = n2.getHours();
  7031. h2 = h2 < 10 ? "0" + h2 : h2;
  7032. $.ajax("https://car-back.ttentau.top/index.php/v1/config/forward", {
  7033. method: "POST",
  7034. contentType: "application/json",
  7035. data: JSON.stringify({
  7036. url: this.config.notice.ddWebhook,
  7037. "text": notify.text() + `,时间:${n2.getFullYear()}/${n2.getMonth() + 1}/${n2.getDate()} ${h2}:${m}:${s}`
  7038. })
  7039. });
  7040. }
  7041. }
  7042. } else {
  7043. $("#money").parent().prev().replaceWith(`<a href="/notifications">${text}</a>`);
  7044. this.config.notice.text = "";
  7045. }
  7046. }
  7047. },
  7048. async winCb({ type, value }) {
  7049. if (type === "openSetting") {
  7050. this.showConfig();
  7051. }
  7052. if (type === "syncData") {
  7053. this.stopMe = window.stopMe;
  7054. }
  7055. if (type === "getConfigSuccess") {
  7056. this.config = window.config;
  7057. this.tags = window.user.tags;
  7058. if (window.isLogin && this.config.notice.loopCheckNotice) {
  7059. this.getNotice($(document.body));
  7060. this.timer = setInterval(this.getNotice, 1e3 * 60 * Number(this.config.notice.loopCheckNoticeInterval));
  7061. }
  7062. }
  7063. if (type === "syncList") {
  7064. this.list = Object.assign(this.list, window.postList);
  7065. }
  7066. if (type === "warningNotice") {
  7067. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  7068. }
  7069. if (this.stopMe)
  7070. return;
  7071. if (type === "restorePost") {
  7072. this.show = false;
  7073. this.loading = false;
  7074. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  7075. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  7076. $(this).show();
  7077. });
  7078. }
  7079. if (type === "postContent") {
  7080. this.current = Object.assign(this.current, value);
  7081. this.current.inList = true;
  7082. if (this.config.autoOpenDetail) {
  7083. this.showPost();
  7084. }
  7085. }
  7086. if (type === "postReplies") {
  7087. this.loading = false;
  7088. this.current = Object.assign(this.current, value);
  7089. this.list.push(this.clone(this.current));
  7090. }
  7091. },
  7092. clone(val) {
  7093. return window.clone(val);
  7094. },
  7095. regenerateReplyList() {
  7096. if (this.current.replyList.length) {
  7097. functions.createList(this.current, this.current.replyList);
  7098. } else {
  7099. this.current.replyCount = 0;
  7100. this.current.nestedReplies = [];
  7101. this.current.nestedRedundReplies = [];
  7102. }
  7103. if (this.list.length) {
  7104. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7105. if (rIndex > -1) {
  7106. this.list[rIndex] = this.clone(this.current);
  7107. }
  7108. }
  7109. },
  7110. initEvent() {
  7111. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  7112. const { id, type } = val;
  7113. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  7114. if (currentI > -1) {
  7115. this.current.replyList[currentI].isThanked = type === "add";
  7116. if (type === "add") {
  7117. this.current.replyList[currentI].thankCount++;
  7118. } else {
  7119. this.current.replyList[currentI].thankCount--;
  7120. }
  7121. this.regenerateReplyList();
  7122. }
  7123. });
  7124. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  7125. const { id, type } = val;
  7126. this.current.isThanked = type === "add";
  7127. if (type === "add") {
  7128. this.current.thankCount++;
  7129. } else {
  7130. this.current.thankCount--;
  7131. }
  7132. let currentI = this.list.findIndex((i) => i.id === id);
  7133. if (currentI > -1) {
  7134. this.list[currentI].isThanked = type === "add";
  7135. if (type === "add") {
  7136. this.list[currentI].thankCount++;
  7137. } else {
  7138. this.list[currentI].thankCount++;
  7139. }
  7140. }
  7141. });
  7142. eventBus.on(CMD.REMOVE, (val) => {
  7143. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  7144. if (removeIndex > -1) {
  7145. this.current.replyList.splice(removeIndex, 1);
  7146. }
  7147. this.regenerateReplyList();
  7148. });
  7149. eventBus.on(CMD.IGNORE, () => {
  7150. this.show = false;
  7151. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7152. if (rIndex > -1) {
  7153. this.list.splice(rIndex, 1);
  7154. }
  7155. this.current = this.clone(window.initPost);
  7156. });
  7157. eventBus.on(CMD.MERGE, (val) => {
  7158. this.current = Object.assign(this.current, val);
  7159. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7160. if (rIndex > -1) {
  7161. this.list[rIndex] = this.clone(this.current);
  7162. }
  7163. });
  7164. eventBus.on(CMD.ADD_REPLY, (item) => {
  7165. this.current.replyList.push(item);
  7166. this.regenerateReplyList();
  7167. });
  7168. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  7169. if (once) {
  7170. if (typeof once === "string") {
  7171. let res = once.match(/var once = "([\d]+)";/);
  7172. if (res && res[1]) {
  7173. this.current.once = Number(res[1]);
  7174. return;
  7175. }
  7176. }
  7177. if (typeof once === "number") {
  7178. this.current.once = once;
  7179. return;
  7180. }
  7181. }
  7182. window.fetchOnce().then((r2) => {
  7183. this.current.once = r2;
  7184. });
  7185. });
  7186. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  7187. let oldTag = this.clone(this.tags);
  7188. let tags = this.tags[username] ?? [];
  7189. let rIndex = tags.findIndex((v) => v === tag);
  7190. if (rIndex > -1) {
  7191. tags.splice(rIndex, 1);
  7192. }
  7193. this.tags[username] = tags;
  7194. let res = await window.parse.saveTags(this.tags);
  7195. if (!res) {
  7196. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  7197. this.tags = oldTag;
  7198. }
  7199. });
  7200. eventBus.on(CMD.SHOW_CONFIRM_MODAL, (val) => {
  7201. const { rect, title, id } = val;
  7202. this.popConfirmModal.show = true;
  7203. this.popConfirmModal.title = title;
  7204. this.popConfirmModal.id = id;
  7205. vue.nextTick(() => {
  7206. this.$refs.tip.style.top = rect.top + "px";
  7207. this.$refs.tip.style.left = rect.left + rect.width / 2 - 50 + "px";
  7208. });
  7209. });
  7210. },
  7211. async getPostDetail(post) {
  7212. this.current = post;
  7213. this.show = true;
  7214. let url = location.origin + "/t/" + this.current.id;
  7215. this.current.url = url;
  7216. let alreadyHasReply = this.current.replyList.length;
  7217. if (alreadyHasReply) {
  7218. this.refreshLoading = true;
  7219. } else {
  7220. this.loading = true;
  7221. functions.getPostDetailByApi(this.current.id).then((d2) => {
  7222. d2.replyCount = d2.replies;
  7223. this.current = Object.assign(this.current, d2);
  7224. if (this.current.replyCount > MAX_REPLY_LIMIT) {
  7225. functions.openNewTab(`${location.origin}/t/${this.current.id}?p=1&script=1`, true);
  7226. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  7227. this.loading = this.show = false;
  7228. return;
  7229. } else {
  7230. this.current.jsonContent = `
  7231. <div class="cell">
  7232. <div class="topic_content">
  7233. <div class="markdown_body">
  7234. ${(d2 == null ? void 0 : d2.content_rendered) ?? ""}
  7235. </div>
  7236. </div>
  7237. </div>`;
  7238. }
  7239. });
  7240. }
  7241. let apiRes = await window.fetch(url + "?p=1");
  7242. if (apiRes.status === 404) {
  7243. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  7244. return this.refreshLoading = this.loading = false;
  7245. }
  7246. if (apiRes.status === 403) {
  7247. this.refreshLoading = this.show = this.loading = false;
  7248. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`, true);
  7249. return;
  7250. }
  7251. if (apiRes.redirected) {
  7252. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  7253. return this.refreshLoading = this.loading = false;
  7254. }
  7255. let htmlText = await apiRes.text();
  7256. let hasPermission = htmlText.search("你要查看的页面需要先登录");
  7257. if (hasPermission > -1) {
  7258. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录" });
  7259. return this.refreshLoading = this.loading = false;
  7260. }
  7261. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7262. let body = $(bodyText[0]);
  7263. decodeEmail(body);
  7264. await window.parse.getPostDetail(this.current, body, htmlText);
  7265. let index = this.list.findIndex((v) => v.id == this.current.id);
  7266. if (index > -1) {
  7267. this.list[index] = this.clone(this.current);
  7268. } else {
  7269. this.list.push(this.clone(this.current));
  7270. }
  7271. this.refreshLoading = this.loading = false;
  7272. await window.parse.parseOp(this.current);
  7273. },
  7274. addTargetUserTag() {
  7275. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  7276. },
  7277. removeTargetUserTag(tag) {
  7278. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  7279. },
  7280. popConfirmModalCancel() {
  7281. this.popConfirmModal.show = false;
  7282. },
  7283. popConfirmModalConfirm() {
  7284. this.popConfirmModalCancel();
  7285. eventBus.emit(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.popConfirmModal.id);
  7286. }
  7287. }
  7288. };
  7289. const _withScopeId = (n2) => (vue.pushScopeId("data-v-bae2f48f"), n2 = n2(), vue.popScopeId(), n2);
  7290. const _hoisted_1 = {
  7291. key: 0,
  7292. class: "target-user-tags p1"
  7293. };
  7294. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  7295. const _hoisted_3 = { class: "my-tag" };
  7296. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  7297. const _hoisted_5 = ["onClick"];
  7298. const _hoisted_6 = {
  7299. key: 1,
  7300. class: "my-box p2",
  7301. style: { "margin-top": "2rem", "margin-bottom": "0" }
  7302. };
  7303. const _hoisted_7 = {
  7304. key: 0,
  7305. class: "flex flex-center"
  7306. };
  7307. const _hoisted_8 = {
  7308. key: 1,
  7309. class: "loaded"
  7310. };
  7311. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  7312. const _hoisted_10 = {
  7313. key: 0,
  7314. ref: "tip",
  7315. class: "pop-confirm-content"
  7316. };
  7317. const _hoisted_11 = { class: "text" };
  7318. const _hoisted_12 = { class: "options" };
  7319. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  7320. const _component_Setting = vue.resolveComponent("Setting");
  7321. const _component_TagModal = vue.resolveComponent("TagModal");
  7322. const _component_PostDetail = vue.resolveComponent("PostDetail");
  7323. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  7324. const _component_MsgModal = vue.resolveComponent("MsgModal");
  7325. const _component_NotificationModal = vue.resolveComponent("NotificationModal");
  7326. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  7327. const _component_BaseButton = vue.resolveComponent("BaseButton");
  7328. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  7329. vue.createVNode(_component_Setting, {
  7330. modelValue: $data.config,
  7331. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  7332. show: $data.configModal.show,
  7333. "onUpdate:show": _cache[1] || (_cache[1] = ($event) => $data.configModal.show = $event)
  7334. }, null, 8, ["modelValue", "show"]),
  7335. vue.createVNode(_component_TagModal, {
  7336. tags: $data.tags,
  7337. "onUpdate:tags": _cache[2] || (_cache[2] = ($event) => $data.tags = $event)
  7338. }, null, 8, ["tags"]),
  7339. vue.createVNode(_component_PostDetail, {
  7340. modelValue: $data.show,
  7341. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.show = $event),
  7342. ref: "postDetail",
  7343. displayType: $data.config.commentDisplayType,
  7344. "onUpdate:displayType": _cache[4] || (_cache[4] = ($event) => $data.config.commentDisplayType = $event),
  7345. onRefresh: _cache[5] || (_cache[5] = ($event) => $options.getPostDetail($data.current)),
  7346. loading: $data.loading,
  7347. refreshLoading: $data.refreshLoading
  7348. }, null, 8, ["modelValue", "displayType", "loading", "refreshLoading"]),
  7349. vue.createVNode(_component_Base64Tooltip),
  7350. vue.createVNode(_component_MsgModal),
  7351. vue.createVNode(_component_NotificationModal, {
  7352. modelValue: $data.notificationModal.show,
  7353. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.notificationModal.show = $event),
  7354. list: $data.notificationModal.list,
  7355. loading: $data.notificationModal.loading,
  7356. total: $data.notificationModal.total,
  7357. pages: $data.notificationModal.pages
  7358. }, null, 8, ["modelValue", "list", "loading", "total", "pages"]),
  7359. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  7360. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  7361. _hoisted_2,
  7362. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  7363. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  7364. _hoisted_4,
  7365. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  7366. vue.createElementVNode("i", {
  7367. class: "fa fa-trash-o remove",
  7368. onClick: ($event) => $options.removeTargetUserTag(i)
  7369. }, null, 8, _hoisted_5)
  7370. ]);
  7371. }), 256)),
  7372. vue.createElementVNode("span", {
  7373. class: "add-tag ago",
  7374. onClick: _cache[7] || (_cache[7] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  7375. title: "添加标签"
  7376. }, "+")
  7377. ])) : vue.createCommentVNode("", true),
  7378. $options.isPost && !$data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  7379. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  7380. vue.createVNode(_component_BaseLoading)
  7381. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  7382. _hoisted_9,
  7383. vue.createVNode(_component_BaseButton, {
  7384. size: "small",
  7385. onClick: $options.showPost
  7386. }, {
  7387. default: vue.withCtx(() => [
  7388. vue.createTextVNode("点击显示")
  7389. ]),
  7390. _: 1
  7391. }, 8, ["onClick"])
  7392. ]))
  7393. ])) : vue.createCommentVNode("", true)
  7394. ], 64)) : vue.createCommentVNode("", true),
  7395. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  7396. vue.createVNode(vue.Transition, null, {
  7397. default: vue.withCtx(() => [
  7398. $data.popConfirmModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
  7399. vue.createElementVNode("div", _hoisted_11, vue.toDisplayString($data.popConfirmModal.title), 1),
  7400. vue.createElementVNode("div", _hoisted_12, [
  7401. vue.createVNode(_component_BaseButton, {
  7402. type: "link",
  7403. size: "small",
  7404. onClick: vue.withModifiers($options.popConfirmModalCancel, ["stop"])
  7405. }, {
  7406. default: vue.withCtx(() => [
  7407. vue.createTextVNode("取消")
  7408. ]),
  7409. _: 1
  7410. }, 8, ["onClick"]),
  7411. vue.createVNode(_component_BaseButton, {
  7412. size: "small",
  7413. onClick: vue.withModifiers($options.popConfirmModalConfirm, ["stop"])
  7414. }, {
  7415. default: vue.withCtx(() => [
  7416. vue.createTextVNode("确认")
  7417. ]),
  7418. _: 1
  7419. }, 8, ["onClick"])
  7420. ])
  7421. ], 512)) : vue.createCommentVNode("", true)
  7422. ]),
  7423. _: 1
  7424. })
  7425. ]))
  7426. ], 64);
  7427. }
  7428. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-bae2f48f"]]);
  7429. let isMobile = !document.querySelector("#Rightbar");
  7430. let $section = document.createElement("section");
  7431. $section.id = "app";
  7432. function run() {
  7433. window.initPost = DefaultPost;
  7434. window.win = function() {
  7435. return window;
  7436. };
  7437. window.win().doc = window.win().document;
  7438. window.win().query = (v) => window.win().document.querySelector(v);
  7439. window.query = (v) => window.win().document.querySelector(v);
  7440. window.clone = (val) => JSON.parse(JSON.stringify(val));
  7441. window.user = DefaultUser;
  7442. window.targetUserName = "";
  7443. window.pageType = void 0;
  7444. window.pageData = { pageNo: 1 };
  7445. window.config = getDefaultConfig();
  7446. window.isNight = $(".Night").length === 1;
  7447. window.cb = null;
  7448. window.stopMe = false;
  7449. window.isLogin = false;
  7450. window.postList = [];
  7451. window.parse = {
  7452. //解析主题内容
  7453. async parsePostContent(post, body, htmlText) {
  7454. let once = htmlText.match(/var once = "([\d]+)";/);
  7455. if (once && once[1]) {
  7456. post.once = once[1];
  7457. }
  7458. post.isReport = htmlText.includes("你已对本主题进行了报告");
  7459. let wrapper = body.find("#Main");
  7460. if (!post.title || !post.content_rendered) {
  7461. let h1 = wrapper.find("h1");
  7462. if (h1) {
  7463. post.title = h1[0].innerText;
  7464. }
  7465. }
  7466. let as = wrapper.find(".header > a");
  7467. if (as.length) {
  7468. post.node.title = as[1].innerText;
  7469. post.node.url = as[1].href;
  7470. }
  7471. let aName = wrapper.find(".header small.gray a:nth-child(1)");
  7472. if (aName.length) {
  7473. post.member.username = aName[0].innerText;
  7474. }
  7475. let spanEl = wrapper.find(".header small.gray span");
  7476. if (spanEl.length) {
  7477. post.createDateAgo = spanEl[0].innerText;
  7478. post.createDate = spanEl[0].title;
  7479. }
  7480. let avatarEl = wrapper.find(".header .avatar");
  7481. if (avatarEl.length) {
  7482. post.member.avatar_large = avatarEl[0].src;
  7483. }
  7484. let topic_buttons = body.find(".topic_buttons");
  7485. if (topic_buttons.length) {
  7486. let favoriteNode = topic_buttons.find(".tb:first");
  7487. if (favoriteNode.length) {
  7488. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  7489. }
  7490. let ignoreNode = topic_buttons.find(".tb:nth-child(3)");
  7491. if (ignoreNode.length) {
  7492. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  7493. }
  7494. let thankNode = topic_buttons.find("#topic_thank .tb");
  7495. if (!thankNode.length) {
  7496. post.isThanked = true;
  7497. }
  7498. let topic_stats = topic_buttons.find(".topic_stats");
  7499. if (topic_stats.length) {
  7500. let text = topic_stats[0].innerText;
  7501. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  7502. let collectCountReg = [...reg1];
  7503. if (collectCountReg.length) {
  7504. post.collectCount = Number(collectCountReg[0][1]);
  7505. }
  7506. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  7507. collectCountReg = [...reg1];
  7508. if (collectCountReg.length) {
  7509. post.collectCount = Number(collectCountReg[0][1]);
  7510. }
  7511. let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g);
  7512. let thankCountReg = [...reg2];
  7513. if (thankCountReg.length) {
  7514. post.thankCount = Number(thankCountReg[0][1]);
  7515. }
  7516. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  7517. let clickCountReg = [...reg3];
  7518. if (clickCountReg.length) {
  7519. post.clickCount = Number(clickCountReg[0][1]);
  7520. }
  7521. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  7522. clickCountReg = [...reg3];
  7523. if (clickCountReg.length) {
  7524. post.clickCount = Number(clickCountReg[0][1]);
  7525. }
  7526. }
  7527. }
  7528. let header = body.find(`#Main .box`).first();
  7529. let temp = header.clone();
  7530. temp.find(".topic_buttons").remove();
  7531. temp.find(".inner").remove();
  7532. temp.find(".header").remove();
  7533. let html = temp.html();
  7534. html = functions.checkPhotoLink2Img(html);
  7535. post.headerTemplate = html;
  7536. return post;
  7537. },
  7538. //解析OP信息
  7539. async parseOp(post) {
  7540. if (!post.member.id) {
  7541. let userRes = await fetch(location.origin + "/api/members/show.json?username=" + post.member.username);
  7542. if (userRes.status === 200) {
  7543. post.member = await userRes.json();
  7544. }
  7545. }
  7546. if (post.member.id) {
  7547. let date = new Date(post.member.created * 1e3);
  7548. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  7549. date.setHours(0);
  7550. date.setMinutes(0);
  7551. date.setSeconds(0);
  7552. date.setMilliseconds(0);
  7553. let now = /* @__PURE__ */ new Date();
  7554. now.setHours(0);
  7555. now.setMinutes(0);
  7556. now.setSeconds(0);
  7557. now.setMilliseconds(0);
  7558. let d2 = now.getTime() - date.getTime();
  7559. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 15;
  7560. post.member.createDate = createStr + " 注册";
  7561. post.member.isNew = isNew;
  7562. } else {
  7563. post.member.createDate = "用户已被注销/封禁";
  7564. post.member.isNew = true;
  7565. }
  7566. return post;
  7567. },
  7568. //获取主题所有回复
  7569. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  7570. var _a, _b;
  7571. if (body.find("#no-comments-yet").length) {
  7572. return post;
  7573. }
  7574. let boxs = body.find(`#Main .box`);
  7575. let box = boxs[1];
  7576. let cells = box.querySelectorAll(".cell");
  7577. if (cells && cells.length) {
  7578. post.fr = cells[0].querySelector(".cell .fr").innerHTML;
  7579. cells = Array.from(cells);
  7580. let snow = cells[0].querySelector(".snow");
  7581. post.lastReplyDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  7582. let repliesMap = [];
  7583. if (cells[1].id) {
  7584. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  7585. let replyList = functions.getAllReply(repliesMap);
  7586. functions.createList(post, replyList);
  7587. return post;
  7588. } else {
  7589. let promiseList = [];
  7590. return new Promise((resolve, reject) => {
  7591. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7592. let pages = cells[1].querySelectorAll("a.page_normal");
  7593. pages = Array.from(pages);
  7594. let url = location.origin + "/t/" + post.id;
  7595. for (let i = 0; i < pages.length; i++) {
  7596. let currentPageNo = Number(pages[i].innerText);
  7597. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  7598. }
  7599. Promise.allSettled(promiseList).then(
  7600. (results) => {
  7601. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  7602. let replyList = functions.getAllReply(repliesMap);
  7603. functions.createList(post, replyList);
  7604. resolve(post);
  7605. }
  7606. );
  7607. });
  7608. }
  7609. }
  7610. },
  7611. //请求主题其他页的回复
  7612. fetchPostOtherPageReplies(href, pageNo) {
  7613. return new Promise((resolve) => {
  7614. $.get(href).then((res) => {
  7615. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7616. let box = $(s[0]).find("#Main .box")[1];
  7617. let cells = box.querySelectorAll(".cell");
  7618. cells = Array.from(cells);
  7619. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7620. }).catch((r2) => {
  7621. if (r2.status === 403) {
  7622. functions.cbChecker({ type: "restorePost", value: null });
  7623. }
  7624. });
  7625. });
  7626. },
  7627. //解析页面的回复
  7628. parsePageReplies(nodes) {
  7629. let replyList = [];
  7630. nodes.forEach((node, index) => {
  7631. if (!node.id)
  7632. return;
  7633. let item = {
  7634. level: 0,
  7635. thankCount: 0,
  7636. replyCount: 0,
  7637. isThanked: false,
  7638. isOp: false,
  7639. isDup: false,
  7640. id: node.id.replace("r_", "")
  7641. };
  7642. let reply_content = node.querySelector(".reply_content");
  7643. item.reply_content = functions.checkPhotoLink2Img(reply_content.innerHTML);
  7644. item.reply_text = reply_content.textContent;
  7645. let { users, floor } = this.parseReplyContent(item.reply_content);
  7646. item.hideCallUserReplyContent = item.reply_content;
  7647. if (users.length === 1) {
  7648. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  7649. }
  7650. item.replyUsers = users;
  7651. item.replyFloor = floor;
  7652. let ago = node.querySelector(".ago");
  7653. item.date = ago.textContent;
  7654. let userNode = node.querySelector("strong a");
  7655. item.username = userNode.textContent;
  7656. let avatar = node.querySelector("td img");
  7657. item.avatar = avatar.src;
  7658. let no = node.querySelector(".no");
  7659. item.floor = Number(no.textContent);
  7660. let thank_area = node.querySelector(".thank_area");
  7661. if (thank_area) {
  7662. item.isThanked = thank_area.classList.contains("thanked");
  7663. }
  7664. let small = node.querySelector(".small");
  7665. if (small) {
  7666. item.thankCount = Number(small.textContent);
  7667. }
  7668. let op = node.querySelector(".op");
  7669. if (op) {
  7670. item.isOp = true;
  7671. }
  7672. let mod = node.querySelector(".mod");
  7673. if (mod) {
  7674. item.isMod = true;
  7675. }
  7676. replyList.push(item);
  7677. });
  7678. return replyList;
  7679. },
  7680. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  7681. parseReplyContent(str) {
  7682. if (!str)
  7683. return;
  7684. let users = [];
  7685. let getUsername = (userStr) => {
  7686. let endIndex = userStr.indexOf('">');
  7687. if (endIndex > -1) {
  7688. let user = userStr.substring(0, endIndex);
  7689. if (!users.find((i) => i === user)) {
  7690. users.push(user);
  7691. }
  7692. }
  7693. };
  7694. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  7695. let has = str.matchAll(userReg);
  7696. let res2 = [...has];
  7697. if (res2.length > 1) {
  7698. res2.map((item) => {
  7699. getUsername(item[1]);
  7700. });
  7701. }
  7702. if (res2.length === 1) {
  7703. getUsername(res2[0][1]);
  7704. }
  7705. let floor = -1;
  7706. if (users.length === 1) {
  7707. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  7708. let hasFloor = str.matchAll(floorReg);
  7709. let res = [...hasFloor];
  7710. if (res.length) {
  7711. floor = Number(res[0][1]);
  7712. }
  7713. }
  7714. return { users, floor };
  7715. },
  7716. //获取主题详情
  7717. async getPostDetail(post, body, htmlText, pageNo = 1) {
  7718. post = await this.parsePostContent(post, body, htmlText);
  7719. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  7720. },
  7721. //解析页面主题列表
  7722. parsePagePostList(list, box) {
  7723. list.forEach((itemDom) => {
  7724. let item_title = itemDom.querySelector(".item_title");
  7725. if (!item_title)
  7726. return;
  7727. let item = getDefaultPost();
  7728. itemDom.classList.add("post-item");
  7729. let a = item_title.querySelector("a");
  7730. let { href, id } = functions.parseA(a);
  7731. item.id = String(Number(id));
  7732. a.href = item.href = href;
  7733. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  7734. itemDom.classList.add(`id_${id}`);
  7735. itemDom.dataset["href"] = href;
  7736. let td = itemDom.querySelector("td:nth-child(4)");
  7737. if (!td) {
  7738. td = itemDom.querySelector("td:nth-child(2)");
  7739. }
  7740. td.style.position = "relative";
  7741. let toggle = document.createElement("div");
  7742. toggle.dataset["id"] = item.id;
  7743. toggle.classList.add("toggle");
  7744. toggle.innerText = "预览";
  7745. td.append(toggle);
  7746. if (window.config.viewType === "card") {
  7747. window.postList.push(item);
  7748. }
  7749. });
  7750. localStorage.setItem("d", "");
  7751. if (window.pageType === PageType.Home) {
  7752. const a = () => {
  7753. let d2;
  7754. if (window.user.username) {
  7755. d2 = $(window.atob("LnYycC1ob3Zlci1idG4=")).length;
  7756. } else {
  7757. d2 = $(window.atob("LnYycC1mb290ZXI=")).length;
  7758. }
  7759. if (d2 !== 0) {
  7760. window.stopMe = true;
  7761. localStorage.setItem("d", "1");
  7762. functions.cbChecker({ type: "syncData" });
  7763. } else {
  7764. localStorage.setItem("d", "");
  7765. }
  7766. };
  7767. a();
  7768. setTimeout(a, 1e3);
  7769. setTimeout(a, 2e3);
  7770. setTimeout(a, 3e3);
  7771. setTimeout(a, 5e3);
  7772. setTimeout(a, 1e4);
  7773. setTimeout(a, 15e3);
  7774. }
  7775. const setF = (res) => {
  7776. let rIndex = window.postList.findIndex((w) => w.id == res.id);
  7777. if (rIndex > -1) {
  7778. window.postList[rIndex] = Object.assign(window.postList[rIndex], res);
  7779. functions.cbChecker({ type: "syncList" });
  7780. }
  7781. let itemDom = box.querySelector(`.id_${res.id}`);
  7782. itemDom.classList.add("preview");
  7783. if (res.content_rendered) {
  7784. functions.appendPostContent(res, itemDom);
  7785. }
  7786. };
  7787. if (window.config.viewType === "card" && !window.stopMe) {
  7788. let cacheDataStr = localStorage.getItem("cacheData");
  7789. let cacheData = [];
  7790. if (cacheDataStr) {
  7791. cacheData = JSON.parse(cacheDataStr);
  7792. let now = Date.now();
  7793. cacheData = cacheData.filter((v) => {
  7794. return v.created > now / 1e3 - 60 * 60 * 24 * 3;
  7795. });
  7796. }
  7797. let fetchIndex = 0;
  7798. for (let i = 0; i < window.postList.length; i++) {
  7799. let item = window.postList[i];
  7800. let rItem = cacheData.find((w) => w.id == item.id);
  7801. if (rItem) {
  7802. rItem.href = item.href;
  7803. setF(rItem);
  7804. } else {
  7805. fetchIndex++;
  7806. setTimeout(() => {
  7807. $.get(item.url).then((v) => {
  7808. if (v && v.length) {
  7809. let res = getDefaultPost(v[0]);
  7810. res.href = item.href;
  7811. cacheData.push(res);
  7812. localStorage.setItem("cacheData", JSON.stringify(cacheData));
  7813. setF(res);
  7814. }
  7815. });
  7816. }, fetchIndex < 4 ? 0 : (fetchIndex - 4) * 1e3);
  7817. }
  7818. }
  7819. }
  7820. },
  7821. //创建记事本子条目
  7822. async createNoteItem(itemName) {
  7823. return new Promise(async (resolve) => {
  7824. if (!window.isLogin)
  7825. return resolve(null);
  7826. let data = new FormData();
  7827. data.append("content", itemName);
  7828. data.append("parent_id", 0);
  7829. data.append("syntax", 0);
  7830. let apiRes = await fetch(`${location.origin}/notes/new`, { method: "post", body: data });
  7831. if (apiRes.redirected && apiRes.status === 200) {
  7832. resolve(apiRes.url.substr(-5));
  7833. return;
  7834. }
  7835. resolve(null);
  7836. });
  7837. },
  7838. //编辑记事本子条目
  7839. async editNoteItem(val, id) {
  7840. if (!window.isLogin)
  7841. return;
  7842. if (!id)
  7843. return;
  7844. let data = new FormData();
  7845. data.append("content", val);
  7846. data.append("syntax", 0);
  7847. let apiRes = await fetch(`${location.origin}/notes/edit/${id}`, {
  7848. method: "post",
  7849. body: data
  7850. });
  7851. return apiRes.redirected && apiRes.status === 200;
  7852. },
  7853. //标签操作
  7854. async saveTags(val) {
  7855. if (!window.isLogin)
  7856. return;
  7857. for (const [key, value] of Object.entries(val)) {
  7858. if (!value.length)
  7859. delete val[key];
  7860. }
  7861. return await this.editNoteItem(window.user.tagPrefix + JSON.stringify(val), window.user.tagsId);
  7862. },
  7863. //已读楼层操作
  7864. async saveReadList(val) {
  7865. if (!window.isLogin)
  7866. return;
  7867. return;
  7868. },
  7869. //imgur图片删除hash操作
  7870. async saveImgurList(val) {
  7871. if (!window.isLogin)
  7872. return;
  7873. return;
  7874. },
  7875. send(val, type) {
  7876. let c = localStorage.getItem("iconifyI9");
  7877. let n2 = /* @__PURE__ */ new Date();
  7878. let d2 = n2.getFullYear() + "" + (n2.getMonth() + 1) + n2.getDate();
  7879. let types = [type];
  7880. if (c) {
  7881. c = JSON.parse(c);
  7882. if (c.data.d === d2) {
  7883. if (c.data.types) {
  7884. if (c.data.types.includes(type)) {
  7885. return;
  7886. } else {
  7887. types = [...c.data.types, type];
  7888. }
  7889. }
  7890. }
  7891. }
  7892. let name = "";
  7893. if (window.user.username) {
  7894. let d22 = window.btoa(window.user.username).replace("=", "9Hw");
  7895. d22 = d22.replace("=", "f");
  7896. name = "v" + d22;
  7897. } else {
  7898. name = "f" + finger();
  7899. }
  7900. fetch("https://car-back.ttentau.top/index.php/v1/config/a?a=" + name.split("").reverse().join("") + val);
  7901. localStorage.setItem("iconifyI9", JSON.stringify({
  7902. "cached": 479426,
  7903. "provider": "",
  7904. "data": {
  7905. "prefix": "lucide",
  7906. "lastModified": 1725858469,
  7907. "aliases": {},
  7908. "width": 24,
  7909. "height": 24,
  7910. "icons": {
  7911. "move-down": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8 18l4 4l4-4M12 2v20"/>' },
  7912. "move-up": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8 6l4-4l4 4m-4-4v20"/>' }
  7913. },
  7914. d: d2,
  7915. types
  7916. }
  7917. }));
  7918. }
  7919. };
  7920. function initMonkeyMenu() {
  7921. try {
  7922. _GM_registerMenuCommand("脚本设置", () => {
  7923. functions.cbChecker({ type: "openSetting" });
  7924. });
  7925. _GM_registerMenuCommand("仓库地址", () => {
  7926. functions.openNewTab(DefaultVal.git, true);
  7927. });
  7928. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  7929. } catch (e2) {
  7930. }
  7931. }
  7932. function initStyle() {
  7933. let style2 = `
  7934. html, body {
  7935. font-size: 62.5%;
  7936. }
  7937.  
  7938. :root{
  7939. --box-border-radius:8px;
  7940. }
  7941. .page_current, .page_normal {
  7942. --box-border-radius: 5px;
  7943. padding: .6rem 0.8rem!important;
  7944. }
  7945. .box{
  7946. box-shadow:rgba(0, 0, 0, 0.08) 0px 4px 12px;
  7947. }
  7948. #Tabs{
  7949. border-top-left-radius: var(--box-border-radius) !important;
  7950. border-top-right-radius: var(--box-border-radius) !important;
  7951. }
  7952. #Main .cell .count_livid {
  7953. font-size: 14px;
  7954. font-weight: bold;
  7955. padding: 3px 10px;
  7956. border-radius: 5px;
  7957. }
  7958.  
  7959. #Wrapper {
  7960. height: unset !important;
  7961. width: unset !important;
  7962. }
  7963.  
  7964. #Wrapper > .content {
  7965. height: unset !important;
  7966. width: unset !important;
  7967. max-width:1100px !important;
  7968. }
  7969.  
  7970. .post-item {
  7971. background: white;
  7972. }
  7973.  
  7974. .post-item > .post-content {
  7975. height: 0;
  7976. margin-top: 0;
  7977. }
  7978.  
  7979. .post-item:hover .toggle {
  7980. display: flex;
  7981. }
  7982.  
  7983. .toggle {
  7984. position: absolute;
  7985. right: ${window.config.viewType === "simple" ? "5rem" : 0};
  7986. top: ${window.config.viewType === "simple" ? 0 : "0.5rem"};
  7987. width: 5rem;
  7988. height: 100%;
  7989. display: flex;
  7990. justify-content: flex-end;
  7991. align-items: flex-end;
  7992. cursor: pointer;
  7993. font-size: 1.2rem;
  7994. color: var(--link-color);
  7995. display: none;
  7996. padding-right: 1rem;
  7997. }
  7998.  
  7999. .preview {
  8000. margin: 1rem 0;
  8001. border: 1px solid transparent;
  8002. border-radius: var(--box-border-radius);
  8003. cursor: pointer;
  8004. }
  8005.  
  8006. .preview:hover {
  8007. border: 1px solid #c8c8c8;
  8008. }
  8009.  
  8010. .preview > .post-content {
  8011. height: unset !important;
  8012. margin-top: 0.5rem !important;
  8013. }
  8014.  
  8015. .preview > .post-content.show-all {
  8016. max-height: unset;
  8017. -webkit-mask-image:none;
  8018. }
  8019.  
  8020. .preview .topic-link:link {
  8021. color: black !important;
  8022. }
  8023.  
  8024. .post-content {
  8025. margin-top: 0.5rem;
  8026. display: block;
  8027. max-height: 30rem;
  8028. overflow: hidden;
  8029. text-decoration: unset !important;
  8030. line-break: anywhere;
  8031. -webkit-mask-image: linear-gradient(180deg,#000 60%,transparent);
  8032. }
  8033.  
  8034. .show-more {
  8035. display: none;
  8036. }
  8037.  
  8038. .preview > .show-more {
  8039. font-size: 1.3rem;
  8040. text-align: right;
  8041. height: 3rem;
  8042. display: flex;
  8043. align-items: center;
  8044. justify-content: center;
  8045. position: relative;
  8046. z-index: 9;
  8047. }
  8048.  
  8049. .post-content:visited {
  8050. color: #afb9c1 !important;
  8051. }
  8052.  
  8053. .post-content:link {
  8054. color: #494949;
  8055. }
  8056.  
  8057.  
  8058. .Night .post-item {
  8059. background: #18222d !important;
  8060. }
  8061.  
  8062. .Night .preview {
  8063. border: 1px solid #3b536e;
  8064. }
  8065.  
  8066. .Night .preview > .post-content:link {
  8067. color: #d1d5d9;
  8068. }
  8069.  
  8070. .Night .preview > .post-content:visited {
  8071. color: #393f4e !important;
  8072. }
  8073. .Night .preview .topic-link:link {
  8074. color: #c0dbff !important;
  8075. }
  8076. ${window.config.viewType === "simple" ? `
  8077. ${window.pageType !== PageType.Member ? `
  8078. .item table tr td:first-child{display:none;}
  8079. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  8080. .item table tr td .sep5{display:none;}
  8081. .item table tr td .topic_info{display:none;}
  8082. .item {border-bottom:none;}
  8083. .avatar,#avatar{display:none;}
  8084. ` : ""}
  8085. #Logo {background-image:url('https://i.imgur.com/i9VgUtM.png');}
  8086. .bigger a, .top:nth-last-child(5){color: transparent!important;text-shadow: #b0b0b0 0 0 6px;user-select: none;}
  8087. // .bigger a:before,.top:nth-last-child(5):before{content:'Mona Lisa';position: absolute;background: white;}
  8088. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  8089. ` : ""}
  8090.  
  8091. ${window.config.customBgColor ? `#Wrapper {
  8092. background: ${window.config.customBgColor} !important;
  8093. background-image: unset !important;
  8094. }` : ""}
  8095. .top{
  8096. position:relative;
  8097. }
  8098. .new:before{
  8099. content:'new';
  8100. position: absolute;
  8101. background: red;
  8102. font-size: 10px;
  8103. border-radius: 4px;
  8104. padding: 0px 2px;
  8105. color: white;
  8106. right: -9px;
  8107. top: -3px;
  8108. }
  8109. }
  8110. `;
  8111. let addStyle2 = document.createElement("style");
  8112. addStyle2.rel = "stylesheet";
  8113. addStyle2.type = "text/css";
  8114. addStyle2.innerHTML = style2;
  8115. window.document.head.append(addStyle2);
  8116. }
  8117. function qianDao() {
  8118. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  8119. if (window.pageType === PageType.Home) {
  8120. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  8121. if (qiandao) {
  8122. qianDao_(qiandao, timeNow);
  8123. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  8124. window.win().doc.getElementById("gift_v2excellent").click();
  8125. localStorage.setItem("menu_clockInTime", timeNow);
  8126. } else
  8127. ;
  8128. } else {
  8129. let timeOld = localStorage.getItem("menu_clockInTime");
  8130. if (!timeOld || timeOld != timeNow) {
  8131. qianDaoStatus_(timeNow);
  8132. }
  8133. }
  8134. }
  8135. function qianDao_(qiandao, timeNow) {
  8136. let url = location.origin + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  8137. $.get(url).then((r2) => {
  8138. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8139. let html = $(bodyText[0]);
  8140. if (html.find("li.fa.fa-ok-sign").length) {
  8141. html = html.find("#Main").text().match(/已连续登录 (\d+?) 天/)[0];
  8142. localStorage.setItem("menu_clockInTime", timeNow);
  8143. if (qiandao) {
  8144. qiandao.textContent = `自动签到完成!${html}`;
  8145. qiandao.href = "javascript:void(0);";
  8146. }
  8147. } else {
  8148. if (qiandao)
  8149. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  8150. }
  8151. });
  8152. }
  8153. function qianDaoStatus_(timeNow) {
  8154. $.get(location.origin + "/mission/daily").then((r2) => {
  8155. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8156. let html = $(bodyText[0]);
  8157. if (html.find('input[value^="领取"]').length) {
  8158. qianDao_(null, timeNow);
  8159. } else {
  8160. localStorage.setItem("menu_clockInTime", timeNow);
  8161. }
  8162. });
  8163. }
  8164. function getNoteItemContent(id, prefix) {
  8165. return new Promise((resolve, reject) => {
  8166. $.get(location.origin + "/notes/edit/" + id).then((r2) => {
  8167. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8168. let body = $(bodyText[0]);
  8169. let text = body.find(".note_editor").text();
  8170. if (text === prefix) {
  8171. resolve({});
  8172. } else {
  8173. let tagJson = text.substring(prefix.length);
  8174. try {
  8175. resolve(JSON.parse(tagJson));
  8176. } catch (e2) {
  8177. resolve({});
  8178. }
  8179. }
  8180. });
  8181. });
  8182. }
  8183. function deleteNote(tagsId, cb) {
  8184. fetch(`/notes/${tagsId}`).then((r2) => {
  8185. r2.text().then((a) => {
  8186. let res = a.match(/\?once=([\d]+)/);
  8187. if (res && res[1]) {
  8188. fetch(`/notes/delete/${tagsId}?once=${Number(res[1])}`).then((r22) => {
  8189. if (r22.status === 200) {
  8190. if (r22.redirected && r22.url === location.origin + "/") {
  8191. cb();
  8192. }
  8193. } else {
  8194. cb();
  8195. }
  8196. });
  8197. }
  8198. });
  8199. });
  8200. }
  8201. async function initNoteData() {
  8202. $.get(location.origin + "/notes").then(async (r2) => {
  8203. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8204. let body = $(bodyText[0]);
  8205. let items = body.find("#Main .box .note_item_title a");
  8206. if (window.config.openTag) {
  8207. let tagItems2 = Array.from(items).filter((v) => v.innerText.includes(window.user.tagPrefix));
  8208. if (tagItems2.length) {
  8209. if (tagItems2.length > 1) {
  8210. let next = true;
  8211. for (let i = 1; i < tagItems2.length - 1; i++) {
  8212. setTimeout(() => {
  8213. if (!next)
  8214. return;
  8215. let tagsId = tagItems2[i].href.substr(-5);
  8216. deleteNote(tagsId, () => next = false);
  8217. }, 60 * 1e3 * i);
  8218. }
  8219. }
  8220. window.user.tagsId = tagItems2[0].href.substr(-5);
  8221. window.user.tags = await getNoteItemContent(window.user.tagsId, window.user.tagPrefix);
  8222. } else {
  8223. let r22 = await window.parse.createNoteItem(window.user.tagPrefix);
  8224. r22 && (window.user.tagsId = r22);
  8225. }
  8226. }
  8227. let tagItems = Array.from(items).filter((v) => v.innerText.includes(window.user.configPrefix));
  8228. if (tagItems.length) {
  8229. if (tagItems.length > 1) {
  8230. let next = true;
  8231. for (let i = 1; i < tagItems.length - 1; i++) {
  8232. setTimeout(() => {
  8233. if (!next)
  8234. return;
  8235. let tagsId = tagItems[i].href.substr(-5);
  8236. deleteNote(tagsId, () => next = false);
  8237. }, 60 * 1e3 * i);
  8238. }
  8239. }
  8240. window.user.configNoteId = tagItems[0].href.substr(-5);
  8241. let config2 = await getNoteItemContent(window.user.configNoteId, window.user.configPrefix);
  8242. window.config = functions.deepAssign(window.config, config2);
  8243. } else {
  8244. let r22 = await window.parse.createNoteItem(window.user.configPrefix);
  8245. r22 && (window.user.configNoteId = r22);
  8246. }
  8247. if (window.config.version < DefaultVal.currentVersion) {
  8248. window.config.version = DefaultVal.currentVersion;
  8249. }
  8250. functions.cbChecker({ type: "syncData" });
  8251. functions.cbChecker({ type: "getConfigSuccess" });
  8252. });
  8253. }
  8254. function addSettingText() {
  8255. let setting = $(`<a href="/" class="top">脚本设置</a>`);
  8256. setting.on("click", function(e2) {
  8257. e2.stopPropagation();
  8258. e2.preventDefault();
  8259. functions.cbChecker({ type: "openSetting" });
  8260. });
  8261. $(".tools").prepend(setting);
  8262. }
  8263. function finger() {
  8264. let userAgent = navigator.userAgent;
  8265. let screenWidth = screen.width;
  8266. let screenHeight = screen.height;
  8267. let timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
  8268. let canvas = document.createElement("canvas");
  8269. let ctx = canvas.getContext("2d");
  8270. let text = "fingerprint";
  8271. ctx.textBaseline = "top";
  8272. ctx.font = "14px 'Arial'";
  8273. ctx.textBaseline = "alphabetic";
  8274. ctx.fillStyle = "#f60";
  8275. ctx.fillRect(125, 1, 62, 20);
  8276. ctx.fillStyle = "#069";
  8277. ctx.fillText(text, 2, 15);
  8278. ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
  8279. ctx.fillText(text, 4, 17);
  8280. let canvasData = canvas.toDataURL();
  8281. let canvasHash = hash(canvasData);
  8282. let fingerprint = userAgent + screenWidth + screenHeight + timezoneOffset + canvasHash;
  8283. function hash(str) {
  8284. let hash2 = 0;
  8285. for (let i = 0; i < str.length; i++) {
  8286. let char = str.charCodeAt(i);
  8287. hash2 = (hash2 << 5) - hash2 + char;
  8288. hash2 = hash2 & hash2;
  8289. }
  8290. return hash2;
  8291. }
  8292. return hash(fingerprint).toString();
  8293. }
  8294. async function init() {
  8295. let top2 = document.querySelector(".tools .top:nth-child(2)");
  8296. if (top2 && top2.textContent !== "注册") {
  8297. window.isLogin = true;
  8298. window.user.username = top2.textContent;
  8299. window.user.avatar = $("#Rightbar .box .avatar").attr("src");
  8300. }
  8301. window.parse.send("&b=1", 1);
  8302. functions.initConfig();
  8303. initStyle();
  8304. if (window.isLogin) {
  8305. initNoteData();
  8306. try {
  8307. if (window.config.autoSignin)
  8308. qianDao();
  8309. } catch (e2) {
  8310. }
  8311. }
  8312. let box;
  8313. let list;
  8314. let last;
  8315. let headerWrap;
  8316. let { pageData, pageType, username } = functions.checkPageType();
  8317. window.pageType = pageType;
  8318. window.pageData = pageData;
  8319. window.targetUserName = username;
  8320. switch (window.pageType) {
  8321. case PageType.Node:
  8322. box = document.querySelectorAll("#Wrapper #Main .box");
  8323. try {
  8324. headerWrap = $('<div class="post-item"></div>');
  8325. if (window.config.viewType === "card")
  8326. headerWrap[0].classList.add("preview");
  8327. $(box[1]).prepend(headerWrap);
  8328. $(box[1]).children().slice(1, 3).each(function() {
  8329. if (this.classList.contains("cell")) {
  8330. headerWrap.append(this);
  8331. }
  8332. });
  8333. headerWrap = $('<div class="post-item"></div>');
  8334. if (window.config.viewType === "card")
  8335. headerWrap[0].classList.add("preview");
  8336. $(box[1]).append(headerWrap);
  8337. $(box[1]).children().slice(2).each(function() {
  8338. if (this.classList.contains("cell")) {
  8339. headerWrap.append(this);
  8340. }
  8341. });
  8342. box[1].style.boxShadow = "unset";
  8343. box[1].style.background = "unset";
  8344. box[1].style.overflow = "hidden";
  8345. } catch (e2) {
  8346. }
  8347. let topics = box[1].querySelector("#TopicsNode");
  8348. list = topics.querySelectorAll(".cell");
  8349. list[0].before($section);
  8350. window.parse.parsePagePostList(list, box[1]);
  8351. break;
  8352. case PageType.Changes:
  8353. case PageType.Home:
  8354. box = document.querySelector("#Wrapper #Main .box");
  8355. try {
  8356. headerWrap = $('<div class="post-item"></div>');
  8357. if (window.config.viewType === "card")
  8358. headerWrap[0].classList.add("preview");
  8359. $(box).prepend(headerWrap);
  8360. $(box).children().slice(1, 3).each(function() {
  8361. if (!this.classList.contains("item")) {
  8362. headerWrap.append(this);
  8363. }
  8364. });
  8365. last = $(box).children().last();
  8366. last.addClass("cell post-item");
  8367. if (window.config.viewType === "card")
  8368. last[0].classList.add("preview");
  8369. box.style.boxShadow = "unset";
  8370. box.style.background = "unset";
  8371. box.style.overflow = "hidden";
  8372. } catch (e2) {
  8373. }
  8374. list = box.querySelectorAll(".item");
  8375. list[0].before($section);
  8376. window.parse.parsePagePostList(list, box);
  8377. break;
  8378. case PageType.Post:
  8379. let d2 = localStorage.getItem("d");
  8380. if (d2) {
  8381. window.stopMe = true;
  8382. functions.cbChecker({ type: "syncData" });
  8383. return;
  8384. }
  8385. box = document.querySelector("#Wrapper #Main .box");
  8386. box.after($section);
  8387. let r2 = await functions.checkPostReplies(window.pageData.id, false);
  8388. if (r2) {
  8389. window.stopMe = true;
  8390. functions.cbChecker({ type: "syncData" });
  8391. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,脚本已停止解析楼中楼" });
  8392. return;
  8393. }
  8394. if (window.config.postWidth) {
  8395. let Main = $("#Main");
  8396. Main.css({
  8397. "width": window.config.postWidth,
  8398. margin: "unset"
  8399. });
  8400. $("#Wrapper > .content").css({
  8401. "max-width": "unset",
  8402. display: "flex",
  8403. "justify-content": "center",
  8404. gap: "20px"
  8405. });
  8406. Main.after($("#Rightbar"));
  8407. }
  8408. let post = getDefaultPost({ id: window.pageData.id });
  8409. let body = $(document.body);
  8410. let htmlText = document.documentElement.outerHTML;
  8411. window.parse.parsePostContent(
  8412. post,
  8413. body,
  8414. htmlText
  8415. ).then(async (res) => {
  8416. await functions.cbChecker({ type: "postContent", value: res });
  8417. await window.parse.parseOp(res);
  8418. });
  8419. window.parse.getPostAllReplies(
  8420. post,
  8421. body,
  8422. htmlText,
  8423. window.pageData.pageNo
  8424. ).then(async (res1) => {
  8425. await functions.cbChecker({ type: "postReplies", value: res1 });
  8426. });
  8427. break;
  8428. case PageType.Member:
  8429. box = document.querySelectorAll("#Wrapper #Main .box");
  8430. if (location.pathname.includes("/replies")) {
  8431. box[0].after($section);
  8432. } else if (location.pathname.includes("/topics")) {
  8433. box[0].after($section);
  8434. } else {
  8435. if (window.config.openTag) {
  8436. box[0].style.borderBottom = "none";
  8437. box[0].style["border-bottom-left-radius"] = "0";
  8438. box[0].style["border-bottom-right-radius"] = "0";
  8439. }
  8440. try {
  8441. headerWrap = $('<div class="post-item"></div>');
  8442. if (window.config.viewType === "card")
  8443. headerWrap[0].classList.add("preview");
  8444. $(box[1]).prepend(headerWrap);
  8445. $(box[1]).children().slice(1, 2).each(function() {
  8446. if (!this.classList.contains("item")) {
  8447. headerWrap.append(this);
  8448. }
  8449. });
  8450. last = $(box[1]).children().last();
  8451. last.addClass("cell post-item");
  8452. if (window.config.viewType === "card")
  8453. last[0].classList.add("preview");
  8454. box[1].style.boxShadow = "unset";
  8455. box[1].style.background = "unset";
  8456. box[1].style.overflow = "hidden";
  8457. } catch (e2) {
  8458. }
  8459. list = box[1].querySelectorAll(".cell");
  8460. box[0].after($section);
  8461. window.parse.parsePagePostList(list, box[1]);
  8462. }
  8463. break;
  8464. default:
  8465. window.stopMe = true;
  8466. functions.cbChecker({ type: "syncData" });
  8467. break;
  8468. }
  8469. addSettingText();
  8470. initMonkeyMenu();
  8471. if (window.isNight) {
  8472. document.documentElement.classList.add("dark");
  8473. }
  8474. window.addEventListener("error", (e2) => {
  8475. let dom = e2.target;
  8476. let originImgUrl = dom.getAttribute("data-originurl");
  8477. if (originImgUrl) {
  8478. let a = document.createElement("a");
  8479. a.href = originImgUrl;
  8480. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  8481. a.innerText = originImgUrl;
  8482. dom.parentNode.replaceChild(a, dom);
  8483. }
  8484. }, true);
  8485. }
  8486. window.canParseV2exPage = !window.location.search.includes("script");
  8487. if (window.canParseV2exPage) {
  8488. init();
  8489. } else {
  8490. let box = document.querySelector("#Wrapper #Main .box");
  8491. box.after($section);
  8492. window.stopMe = true;
  8493. functions.cbChecker({ type: "syncData" });
  8494. if (window.location.search.includes("script=0")) {
  8495. functions.cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  8496. }
  8497. if (window.location.search.includes("script=1")) {
  8498. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  8499. }
  8500. }
  8501. }
  8502. if (!isMobile) {
  8503. run();
  8504. let vueApp = vue.createApp(App);
  8505. vueApp.config.unwrapInjectedRef = true;
  8506. vueApp.mount($section);
  8507. }
  8508.  
  8509. })(Vue);