V2EX Next V2Next

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

当前为 2024-11-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name V2EX Next V2Next
  3. // @namespace http://tampermonkey.net/
  4. // @version 10.15
  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. post.replyList = replyList;
  169. post.topReplyList = this.clone(replyList).filter((v) => v.thankCount >= window.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, window.config.topReplyCount);
  170. post.replyCount = replyList.length;
  171. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  172. post.nestedReplies = functions.createNestedList(this.clone(replyList), post.topReplyList);
  173. if (withRedundList) {
  174. post.nestedRedundReplies = functions.createNestedRedundantList(this.clone(replyList), post.topReplyList);
  175. }
  176. return post;
  177. },
  178. //获取所有回复
  179. getAllReply(repliesMap = []) {
  180. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  181. pre = pre.concat(i.replyList);
  182. return pre;
  183. }, []);
  184. },
  185. //查找子回复
  186. findChildren(item, endList, all, topReplyList) {
  187. var _a;
  188. const fn = (child, endList2, parent) => {
  189. child.level = parent.level + 1;
  190. let rIndex2 = all.findIndex((v) => v.floor === child.floor);
  191. if (rIndex2 > -1) {
  192. all[rIndex2].isUse = true;
  193. }
  194. parent.children.push(this.findChildren(child, endList2, all, topReplyList));
  195. };
  196. item.children = [];
  197. let floorReplyList = [];
  198. for (let i = 0; i < endList.length; i++) {
  199. let currentItem = endList[i];
  200. if (currentItem.isUse)
  201. continue;
  202. if (currentItem.replyFloor === item.floor) {
  203. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  204. currentItem.isUse = true;
  205. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  206. } else {
  207. currentItem.isWrong = true;
  208. }
  209. }
  210. }
  211. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  212. fn(currentItem, endList2, item);
  213. });
  214. let nextMeIndex = endList.findIndex((v) => {
  215. var _a2;
  216. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  217. });
  218. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  219. for (let i = 0; i < findList.length; i++) {
  220. let currentItem = findList[i];
  221. if (currentItem.isUse)
  222. continue;
  223. if (currentItem.replyUsers.length === 1) {
  224. if (currentItem.replyFloor !== -1) {
  225. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  226. continue;
  227. }
  228. }
  229. let endList2 = endList.slice(i + 1);
  230. if (currentItem.username === item.username) {
  231. if (currentItem.replyUsers[0] === item.username) {
  232. fn(currentItem, endList2, item);
  233. }
  234. break;
  235. } else {
  236. if (currentItem.replyUsers[0] === item.username) {
  237. fn(currentItem, endList2, item);
  238. }
  239. }
  240. } else {
  241. if (currentItem.username === item.username)
  242. break;
  243. }
  244. }
  245. item.children = item.children.sort((a, b) => a.floor - b.floor);
  246. item.replyCount = item.children.reduce((a, b) => {
  247. return a + (b.children.length ? b.replyCount + 1 : 1);
  248. }, 0);
  249. let rIndex = topReplyList.findIndex((v) => v.floor === item.floor);
  250. if (rIndex > -1) {
  251. topReplyList[rIndex].children = item.children;
  252. topReplyList[rIndex].replyCount = item.replyCount;
  253. }
  254. return item;
  255. },
  256. //生成嵌套回复
  257. createNestedList(allList = [], topReplyList = []) {
  258. if (!allList.length)
  259. return [];
  260. let list = allList;
  261. let nestedList = [];
  262. list.map((item, index) => {
  263. let startList = list.slice(0, index);
  264. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  265. let endList = list.slice(index + 1);
  266. if (index === 0) {
  267. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  268. } else {
  269. if (!item.isUse) {
  270. let isOneLevelReply = false;
  271. if (item.replyUsers.length) {
  272. if (item.replyUsers.length > 1) {
  273. isOneLevelReply = true;
  274. } else {
  275. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  276. }
  277. } else {
  278. isOneLevelReply = true;
  279. }
  280. if (isOneLevelReply) {
  281. item.level = 0;
  282. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  283. }
  284. }
  285. }
  286. });
  287. return nestedList;
  288. },
  289. //生成嵌套冗余回复
  290. createNestedRedundantList(allList = [], topReplyList) {
  291. if (!allList.length)
  292. return [];
  293. let list = allList;
  294. let nestedList = [];
  295. list.map((item, index) => {
  296. let startList = list.slice(0, index);
  297. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  298. let endList = list.slice(index + 1);
  299. if (index === 0) {
  300. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  301. } else {
  302. if (!item.isUse) {
  303. let isOneLevelReply = false;
  304. if (item.replyUsers.length) {
  305. if (item.replyUsers.length > 1) {
  306. isOneLevelReply = true;
  307. } else {
  308. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  309. }
  310. } else {
  311. isOneLevelReply = true;
  312. }
  313. if (isOneLevelReply) {
  314. item.level = 0;
  315. nestedList.push(this.findChildren(item, endList, list, topReplyList));
  316. }
  317. } else {
  318. let newItem = this.clone(item);
  319. newItem.children = [];
  320. newItem.level = 0;
  321. newItem.isDup = true;
  322. nestedList.push(newItem);
  323. }
  324. }
  325. });
  326. return nestedList;
  327. },
  328. //解析A标签
  329. parseA(a) {
  330. let href = a.href;
  331. let id;
  332. if (href.includes("/t/")) {
  333. id = a.pathname.substring("/t/".length);
  334. }
  335. return { href, id, title: a.innerText };
  336. },
  337. //图片链接转Img标签
  338. checkPhotoLink2Img(str) {
  339. if (!str)
  340. return;
  341. try {
  342. let imgWebs = [
  343. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  344. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  345. ];
  346. imgWebs.map((v, i) => {
  347. let has = str.matchAll(v);
  348. let res2 = [...has];
  349. res2.map((r2) => {
  350. let p = i === 0 ? r2[4] : r2[5];
  351. if (p) {
  352. let link = p.toLowerCase();
  353. let src = p;
  354. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  355. } else {
  356. src = p + ".png";
  357. }
  358. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  359. }
  360. });
  361. });
  362. } catch (e2) {
  363. }
  364. return str;
  365. },
  366. //检测帖子回复长度
  367. async checkPostReplies(id, needOpen = true) {
  368. return new Promise(async (resolve) => {
  369. let res = await functions.getPostDetailByApi(id);
  370. if ((res == null ? void 0 : res.replies) > MAX_REPLY_LIMIT) {
  371. if (needOpen) {
  372. functions.openNewTab(`https://${location.origin}/t/${id}?p=1&script=1`);
  373. }
  374. return resolve(true);
  375. }
  376. resolve(false);
  377. });
  378. },
  379. async sleep(time) {
  380. return new Promise((resolve) => {
  381. setTimeout(resolve, time);
  382. });
  383. },
  384. //打开新标签页
  385. openNewTab(href, active = false) {
  386. let isSafariBrowser = /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
  387. if (isSafariBrowser) {
  388. let tempId = "a_blank_" + Date.now();
  389. let a = document.createElement("a");
  390. a.setAttribute("href", href);
  391. a.setAttribute("target", "_blank");
  392. a.setAttribute("id", tempId);
  393. a.setAttribute("script", "1");
  394. if (!document.getElementById(tempId)) {
  395. document.body.appendChild(a);
  396. }
  397. a.click();
  398. } else {
  399. _GM_openInTab(href, { active });
  400. }
  401. },
  402. async cbChecker(val, count = 0) {
  403. if (window.cb) {
  404. window.cb(val);
  405. } else {
  406. while (!window.cb && count < 30) {
  407. await functions.sleep(500);
  408. count++;
  409. }
  410. window.cb && window.cb(val);
  411. }
  412. },
  413. //初始化脚本菜单
  414. initMonkeyMenu() {
  415. try {
  416. _GM_registerMenuCommand("脚本设置", () => {
  417. functions.cbChecker({ type: "openSetting" });
  418. });
  419. _GM_registerMenuCommand("仓库地址", () => {
  420. functions.openNewTab(window.const.git);
  421. });
  422. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  423. } catch (e2) {
  424. }
  425. },
  426. clone(val) {
  427. return JSON.parse(JSON.stringify(val));
  428. },
  429. feedback() {
  430. functions.openNewTab(DefaultVal.issue);
  431. },
  432. //检测页面类型
  433. checkPageType(a) {
  434. let l = a || window.location;
  435. let data = { pageType: null, pageData: { id: "", pageNo: null }, username: "" };
  436. if (l.pathname === "/") {
  437. data.pageType = PageType.Home;
  438. } else if (l.pathname === "/changes") {
  439. data.pageType = PageType.Changes;
  440. } else if (l.pathname === "/recent") {
  441. data.pageType = PageType.Changes;
  442. } else if (l.href.match(/.com\/?tab=/)) {
  443. data.pageType = PageType.Home;
  444. } else if (l.href.match(/.com\/go\//)) {
  445. if (!l.href.includes("/links")) {
  446. data.pageType = PageType.Node;
  447. }
  448. } else if (l.href.match(/.com\/member/)) {
  449. data.pageType = PageType.Member;
  450. data.username = l.pathname.replace("/member/", "").replace("/replies", "").replace("/topics", "");
  451. } else {
  452. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  453. if (r2 && !l.pathname.includes("review") && !l.pathname.includes("info")) {
  454. data.pageType = PageType.Post;
  455. data.pageData.id = r2[1];
  456. if (l.search) {
  457. let pr = l.href.match(/\?p=([\d]+)/);
  458. if (pr)
  459. data.pageData.pageNo = Number(pr[1]);
  460. }
  461. }
  462. }
  463. return data;
  464. },
  465. //通过api获取主题详情
  466. getPostDetailByApi(id) {
  467. return new Promise((resolve) => {
  468. fetch(`${location.origin}/api/topics/show.json?id=${id}`).then(async (r2) => {
  469. if (r2.status === 200) {
  470. let res = await r2.json();
  471. if (res) {
  472. let d2 = res[0];
  473. resolve(d2);
  474. }
  475. }
  476. });
  477. });
  478. },
  479. appendPostContent(res, el) {
  480. let a = document.createElement("a");
  481. a.href = res.href;
  482. a.classList.add("post-content");
  483. let div = document.createElement("div");
  484. div.innerHTML = res.content_rendered;
  485. a.append(div);
  486. el.append(a);
  487. const checkHeight2 = () => {
  488. var _a;
  489. if (div.clientHeight < 300) {
  490. a.classList.add("show-all");
  491. } else {
  492. let showMore = document.createElement("div");
  493. showMore.classList.add("show-more");
  494. showMore.innerHTML = "显示更多/收起";
  495. showMore.onclick = function(e2) {
  496. e2.stopPropagation();
  497. a.classList.toggle("show-all");
  498. };
  499. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  500. }
  501. };
  502. checkHeight2();
  503. },
  504. //从本地读取配置
  505. initConfig() {
  506. let configStr = localStorage.getItem("v2ex-config");
  507. let configMap = {};
  508. let configObj = {};
  509. let userName = window.user.username || "default";
  510. if (configStr) {
  511. configMap = JSON.parse(configStr);
  512. configObj = configMap[userName];
  513. if (configObj) {
  514. window.config = functions.deepAssign(window.config, configObj);
  515. }
  516. }
  517. configMap[userName] = window.config;
  518. localStorage.setItem("v2ex-config", JSON.stringify(configMap));
  519. },
  520. deepAssign(...arg) {
  521. let name, options, src, copy;
  522. let length = arguments.length;
  523. let i = 1;
  524. let target = arguments[0] || {};
  525. if (typeof target !== "object") {
  526. target = {};
  527. }
  528. for (; i < length; i++) {
  529. options = arguments[i];
  530. if (options != null) {
  531. for (name in options) {
  532. src = target[name];
  533. copy = options[name];
  534. if (copy && typeof copy == "object") {
  535. target[name] = this.deepAssign(src, copy);
  536. } else if (copy !== void 0) {
  537. target[name] = copy;
  538. }
  539. }
  540. }
  541. }
  542. return target;
  543. },
  544. //生成dom,从html字符串
  545. genDomFromHtmlString(htmlText) {
  546. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  547. let body = document.createElement("html");
  548. body.innerHTML = bodyText[0];
  549. return body;
  550. }
  551. };
  552. const DefaultPost = {
  553. allReplyUsers: [],
  554. content_rendered: "",
  555. createDate: "",
  556. createDateAgo: "",
  557. lastReplyDate: "",
  558. lastReplyUsername: "",
  559. fr: "",
  560. replyList: [],
  561. topReplyList: [],
  562. nestedReplies: [],
  563. nestedRedundReplies: [],
  564. username: "",
  565. url: "",
  566. href: "",
  567. member: {
  568. avatar: "",
  569. username: ""
  570. },
  571. node: {
  572. title: "",
  573. url: ""
  574. },
  575. headerTemplate: "",
  576. title: "",
  577. id: "",
  578. type: "post",
  579. once: "",
  580. replyCount: 0,
  581. clickCount: 0,
  582. thankCount: 0,
  583. collectCount: 0,
  584. lastReadFloor: 0,
  585. isFavorite: false,
  586. isIgnore: false,
  587. isThanked: false,
  588. isReport: false,
  589. inList: false
  590. };
  591. const getDefaultPost = (val = {}) => {
  592. return Object.assign(functions.clone(DefaultPost), val);
  593. };
  594. const DefaultUser = {
  595. tagPrefix: "--用户标签--",
  596. tags: {},
  597. tagsId: "",
  598. username: "",
  599. avatar: "",
  600. readPrefix: "--已读楼层--",
  601. readNoteItemId: "",
  602. readList: {},
  603. imgurPrefix: "--imgur图片删除hash--",
  604. imgurList: {},
  605. imgurNoteId: "",
  606. configPrefix: "--config--",
  607. configNoteId: ""
  608. };
  609. const DefaultVal = {
  610. pageType: void 0,
  611. pageData: { pageNo: 1 },
  612. targetUserName: "",
  613. currentVersion: 2,
  614. isNight: false,
  615. cb: null,
  616. stopMe: null,
  617. postList: [],
  618. git: "https://github.com/zyronon/web-scripts",
  619. shortGit: "zyronon/web-scripts",
  620. issue: "https://github.com/zyronon/web-scripts/issues",
  621. pcLog: "https://greasyfork.org/zh-CN/scripts/458024/versions",
  622. pcScript: "https://greasyfork.org/zh-CN/scripts/458024",
  623. mobileScript: "https://greasyfork.org/zh-CN/scripts/485356",
  624. homeUrl: "https://v2ex-script.vercel.app/"
  625. };
  626. const DefaultConfig = {
  627. showToolbar: true,
  628. autoOpenDetail: true,
  629. openTag: false,
  630. //给用户打标签
  631. clickPostItemOpenDetail: true,
  632. closePostDetailBySpace: true,
  633. //点击空白处关闭详情
  634. contentAutoCollapse: true,
  635. //正文超长自动折叠
  636. viewType: "table",
  637. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  638. newTabOpen: false,
  639. //新标签打开
  640. newTabOpenActive: false,
  641. base64: true,
  642. //base功能
  643. sov2ex: false,
  644. postWidth: "",
  645. showTopReply: true,
  646. topReplyLoveMinCount: 3,
  647. topReplyCount: 5,
  648. autoJumpLastReadFloor: false,
  649. rememberLastReadFloor: false,
  650. autoSignin: true,
  651. customBgColor: "",
  652. version: DefaultVal.currentVersion,
  653. collectBrowserNotice: false,
  654. fontSizeType: "normal",
  655. notice: {
  656. uid: "",
  657. text: "",
  658. ddWebhook: "",
  659. takeOverNoticePage: true,
  660. whenNewNoticeGlimmer: false,
  661. loopCheckNotice: false,
  662. loopCheckNoticeInterval: 5
  663. }
  664. };
  665. function getDefaultConfig() {
  666. return { ...DefaultConfig };
  667. }
  668. const emojiEmoticons = [
  669. {
  670. title: "常用",
  671. list: [
  672. "😅",
  673. "😭",
  674. "😂",
  675. "🥰",
  676. "😰",
  677. "🤡",
  678. "👀",
  679. "🐴",
  680. "🐶",
  681. "❓",
  682. "❤️",
  683. "💔",
  684. "⭐",
  685. "🔥",
  686. "💩",
  687. "🔞",
  688. "⚠️",
  689. "🎁",
  690. "🎉"
  691. ]
  692. },
  693. {
  694. title: "小黄脸",
  695. list: [
  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. "😭",
  731. "🤑",
  732. "🤮"
  733. ]
  734. },
  735. {
  736. title: "手势",
  737. list: [
  738. "🤏",
  739. "👉",
  740. "✌️",
  741. "👌",
  742. "👍",
  743. "👎",
  744. "🤝",
  745. "🙏",
  746. "👏"
  747. ]
  748. },
  749. {
  750. title: "其他",
  751. list: ["🔞", "👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶"]
  752. }
  753. ];
  754. const classicsEmoticons = [
  755. {
  756. name: "[狗头]",
  757. low: "https://i.imgur.com/io2SM1h.png",
  758. high: "https://i.imgur.com/0icl60r.png"
  759. },
  760. {
  761. name: "[doge]",
  762. low: "https://i.imgur.com/duWRpIu.png",
  763. high: "https://i.imgur.com/HyphI6d.png"
  764. },
  765. {
  766. name: "[受虐滑稽]",
  767. low: "https://i.imgur.com/Iy0taMy.png",
  768. high: "https://i.imgur.com/PS1pxd9.png"
  769. },
  770. {
  771. name: "[马]",
  772. low: "https://i.imgur.com/8EKZv7I.png",
  773. high: "https://i.imgur.com/ANFUX52.png"
  774. },
  775. {
  776. name: "[二哈]",
  777. low: "https://i.imgur.com/XKj1Tkx.png",
  778. high: "https://i.imgur.com/dOeP4XD.png"
  779. },
  780. {
  781. name: "[舔屏]",
  782. low: "https://i.imgur.com/Cvl7dyN.png",
  783. high: "https://i.imgur.com/LmETy9N.png"
  784. },
  785. {
  786. name: "[辣眼睛]",
  787. low: "https://i.imgur.com/cPNPYD5.png",
  788. high: "https://i.imgur.com/3fSUmi8.png"
  789. },
  790. {
  791. name: "[吃瓜]",
  792. low: "https://i.imgur.com/ee8Lq7H.png",
  793. high: "https://i.imgur.com/0L26og9.png"
  794. },
  795. {
  796. name: "[不高兴]",
  797. low: "https://i.imgur.com/huX6coX.png",
  798. high: "https://i.imgur.com/N7JEuvc.png"
  799. },
  800. // {
  801. // name: '[呵呵]',
  802. // low: 'https://i.imgur.com/RvoLAbX.png',
  803. // high: 'https://i.imgur.com/xSzIqrK.png'
  804. // },
  805. {
  806. name: "[真棒]",
  807. low: "https://i.imgur.com/xr1UOz1.png",
  808. high: "https://i.imgur.com/w8YEw9Q.png"
  809. },
  810. {
  811. name: "[鄙视]",
  812. low: "https://i.imgur.com/u6jlqVq.png",
  813. high: "https://i.imgur.com/8JFNANq.png"
  814. },
  815. {
  816. name: "[疑问]",
  817. low: "https://i.imgur.com/F29pmQ6.png",
  818. high: "https://i.imgur.com/EbbTQAR.png"
  819. },
  820. {
  821. name: "[吐舌]",
  822. low: "https://i.imgur.com/InmIzl9.png",
  823. high: "https://i.imgur.com/Ovj56Cd.png"
  824. },
  825. // {
  826. // name: '[嘲笑]',
  827. // low: 'https://i.imgur.com/BaWcsMR.png',
  828. // high: 'https://i.imgur.com/0OGfJw4.png'
  829. // },
  830. // {
  831. // name: '[滑稽]',
  832. // low: 'https://i.imgur.com/lmbN0yI.png',
  833. // high: 'https://i.imgur.com/Pc0wH85.png'
  834. // },
  835. {
  836. name: "[笑眼]",
  837. low: "https://i.imgur.com/ZveiiGy.png",
  838. high: "https://i.imgur.com/PI1CfEr.png"
  839. },
  840. // {
  841. // name: '[狂汗]',
  842. // low: 'https://i.imgur.com/veWihk6.png',
  843. // high: 'https://i.imgur.com/3LtHdQv.png'
  844. // },
  845. {
  846. name: "[大哭]",
  847. low: "https://i.imgur.com/hu4oR6C.png",
  848. high: "https://i.imgur.com/b4X9XLE.png"
  849. },
  850. {
  851. name: "[喷]",
  852. low: "https://i.imgur.com/bkw3VRr.png",
  853. high: "https://i.imgur.com/wnZL13L.png"
  854. },
  855. {
  856. name: "[苦笑]",
  857. low: "https://i.imgur.com/VUWFktU.png",
  858. high: "https://i.imgur.com/NAfspZ1.png"
  859. },
  860. {
  861. name: "[喝酒]",
  862. low: "https://i.imgur.com/2ZZSapE.png",
  863. high: "https://i.imgur.com/rVbSVak.png"
  864. },
  865. {
  866. name: "[捂脸]",
  867. low: "https://i.imgur.com/krir4IG.png",
  868. high: "https://i.imgur.com/qqBqgVm.png"
  869. },
  870. // {
  871. // name: '[呕]',
  872. // low: 'https://i.imgur.com/6CUiUxv.png',
  873. // high: 'https://i.imgur.com/kgdxRsG.png'
  874. // },
  875. {
  876. name: "[阴险]",
  877. low: "https://i.imgur.com/MA8YqTP.png",
  878. high: "https://i.imgur.com/e94jbaT.png"
  879. },
  880. {
  881. name: "[怒]",
  882. low: "https://i.imgur.com/n4kWfGB.png",
  883. high: "https://i.imgur.com/iMXxNxh.png"
  884. }
  885. // {
  886. // name: '[衰]',
  887. // low: 'https://i.imgur.com/voHFDyQ.png',
  888. // high: 'https://i.imgur.com/XffE6gu.png'
  889. // },
  890. // {
  891. // name: '[合十]',
  892. // low: 'https://i.imgur.com/I8x3ang.png',
  893. // high: 'https://i.imgur.com/T4rJVee.png'
  894. // },
  895. // {
  896. // name: '[赞]',
  897. // low: 'https://i.imgur.com/lG44yUl.png',
  898. // high: 'https://i.imgur.com/AoF5PLp.png'
  899. // },
  900. // {
  901. // name: '[踩]',
  902. // low: 'https://i.imgur.com/cJp0uKZ.png',
  903. // high: 'https://i.imgur.com/1XYGfXj.png'
  904. // },
  905. // {
  906. // name: '[爱心]',
  907. // low: 'https://i.imgur.com/sLENaF5.png',
  908. // high: 'https://i.imgur.com/dND56oX.png'
  909. // },
  910. //
  911. // {
  912. // name: '[心碎]',
  913. // low: 'https://i.imgur.com/AZxJzve.png',
  914. // high: 'https://i.imgur.com/RiUsPci.png'
  915. // },
  916. ];
  917. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  918. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  919. const colonSeparated = value.split(":");
  920. if (value.slice(0, 1) === "@") {
  921. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  922. return null;
  923. }
  924. provider = colonSeparated.shift().slice(1);
  925. }
  926. if (colonSeparated.length > 3 || !colonSeparated.length) {
  927. return null;
  928. }
  929. if (colonSeparated.length > 1) {
  930. const name2 = colonSeparated.pop();
  931. const prefix = colonSeparated.pop();
  932. const result = {
  933. // Allow provider without '@': "provider:prefix:name"
  934. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  935. prefix,
  936. name: name2
  937. };
  938. return validate && !validateIconName(result) ? null : result;
  939. }
  940. const name = colonSeparated[0];
  941. const dashSeparated = name.split("-");
  942. if (dashSeparated.length > 1) {
  943. const result = {
  944. provider,
  945. prefix: dashSeparated.shift(),
  946. name: dashSeparated.join("-")
  947. };
  948. return validate && !validateIconName(result) ? null : result;
  949. }
  950. if (allowSimpleName && provider === "") {
  951. const result = {
  952. provider,
  953. prefix: "",
  954. name
  955. };
  956. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  957. }
  958. return null;
  959. };
  960. const validateIconName = (icon, allowSimpleName) => {
  961. if (!icon) {
  962. return false;
  963. }
  964. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  965. };
  966. const defaultIconDimensions = Object.freeze(
  967. {
  968. left: 0,
  969. top: 0,
  970. width: 16,
  971. height: 16
  972. }
  973. );
  974. const defaultIconTransformations = Object.freeze({
  975. rotate: 0,
  976. vFlip: false,
  977. hFlip: false
  978. });
  979. const defaultIconProps = Object.freeze({
  980. ...defaultIconDimensions,
  981. ...defaultIconTransformations
  982. });
  983. const defaultExtendedIconProps = Object.freeze({
  984. ...defaultIconProps,
  985. body: "",
  986. hidden: false
  987. });
  988. function mergeIconTransformations(obj1, obj2) {
  989. const result = {};
  990. if (!obj1.hFlip !== !obj2.hFlip) {
  991. result.hFlip = true;
  992. }
  993. if (!obj1.vFlip !== !obj2.vFlip) {
  994. result.vFlip = true;
  995. }
  996. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  997. if (rotate) {
  998. result.rotate = rotate;
  999. }
  1000. return result;
  1001. }
  1002. function mergeIconData(parent, child) {
  1003. const result = mergeIconTransformations(parent, child);
  1004. for (const key in defaultExtendedIconProps) {
  1005. if (key in defaultIconTransformations) {
  1006. if (key in parent && !(key in result)) {
  1007. result[key] = defaultIconTransformations[key];
  1008. }
  1009. } else if (key in child) {
  1010. result[key] = child[key];
  1011. } else if (key in parent) {
  1012. result[key] = parent[key];
  1013. }
  1014. }
  1015. return result;
  1016. }
  1017. function getIconsTree(data, names) {
  1018. const icons = data.icons;
  1019. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1020. const resolved = /* @__PURE__ */ Object.create(null);
  1021. function resolve(name) {
  1022. if (icons[name]) {
  1023. return resolved[name] = [];
  1024. }
  1025. if (!(name in resolved)) {
  1026. resolved[name] = null;
  1027. const parent = aliases[name] && aliases[name].parent;
  1028. const value = parent && resolve(parent);
  1029. if (value) {
  1030. resolved[name] = [parent].concat(value);
  1031. }
  1032. }
  1033. return resolved[name];
  1034. }
  1035. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  1036. return resolved;
  1037. }
  1038. function internalGetIconData(data, name, tree) {
  1039. const icons = data.icons;
  1040. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1041. let currentProps = {};
  1042. function parse(name2) {
  1043. currentProps = mergeIconData(
  1044. icons[name2] || aliases[name2],
  1045. currentProps
  1046. );
  1047. }
  1048. parse(name);
  1049. tree.forEach(parse);
  1050. return mergeIconData(data, currentProps);
  1051. }
  1052. function parseIconSet(data, callback) {
  1053. const names = [];
  1054. if (typeof data !== "object" || typeof data.icons !== "object") {
  1055. return names;
  1056. }
  1057. if (data.not_found instanceof Array) {
  1058. data.not_found.forEach((name) => {
  1059. callback(name, null);
  1060. names.push(name);
  1061. });
  1062. }
  1063. const tree = getIconsTree(data);
  1064. for (const name in tree) {
  1065. const item = tree[name];
  1066. if (item) {
  1067. callback(name, internalGetIconData(data, name, item));
  1068. names.push(name);
  1069. }
  1070. }
  1071. return names;
  1072. }
  1073. const optionalPropertyDefaults = {
  1074. provider: "",
  1075. aliases: {},
  1076. not_found: {},
  1077. ...defaultIconDimensions
  1078. };
  1079. function checkOptionalProps(item, defaults) {
  1080. for (const prop in defaults) {
  1081. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  1082. return false;
  1083. }
  1084. }
  1085. return true;
  1086. }
  1087. function quicklyValidateIconSet(obj) {
  1088. if (typeof obj !== "object" || obj === null) {
  1089. return null;
  1090. }
  1091. const data = obj;
  1092. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  1093. return null;
  1094. }
  1095. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  1096. return null;
  1097. }
  1098. const icons = data.icons;
  1099. for (const name in icons) {
  1100. const icon = icons[name];
  1101. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  1102. icon,
  1103. defaultExtendedIconProps
  1104. )) {
  1105. return null;
  1106. }
  1107. }
  1108. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  1109. for (const name in aliases) {
  1110. const icon = aliases[name];
  1111. const parent = icon.parent;
  1112. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  1113. icon,
  1114. defaultExtendedIconProps
  1115. )) {
  1116. return null;
  1117. }
  1118. }
  1119. return data;
  1120. }
  1121. const dataStorage = /* @__PURE__ */ Object.create(null);
  1122. function newStorage(provider, prefix) {
  1123. return {
  1124. provider,
  1125. prefix,
  1126. icons: /* @__PURE__ */ Object.create(null),
  1127. missing: /* @__PURE__ */ new Set()
  1128. };
  1129. }
  1130. function getStorage(provider, prefix) {
  1131. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  1132. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  1133. }
  1134. function addIconSet(storage2, data) {
  1135. if (!quicklyValidateIconSet(data)) {
  1136. return [];
  1137. }
  1138. return parseIconSet(data, (name, icon) => {
  1139. if (icon) {
  1140. storage2.icons[name] = icon;
  1141. } else {
  1142. storage2.missing.add(name);
  1143. }
  1144. });
  1145. }
  1146. function addIconToStorage(storage2, name, icon) {
  1147. try {
  1148. if (typeof icon.body === "string") {
  1149. storage2.icons[name] = { ...icon };
  1150. return true;
  1151. }
  1152. } catch (err) {
  1153. }
  1154. return false;
  1155. }
  1156. let simpleNames = false;
  1157. function allowSimpleNames(allow) {
  1158. if (typeof allow === "boolean") {
  1159. simpleNames = allow;
  1160. }
  1161. return simpleNames;
  1162. }
  1163. function getIconData(name) {
  1164. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  1165. if (icon) {
  1166. const storage2 = getStorage(icon.provider, icon.prefix);
  1167. const iconName = icon.name;
  1168. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  1169. }
  1170. }
  1171. function addIcon(name, data) {
  1172. const icon = stringToIcon(name, true, simpleNames);
  1173. if (!icon) {
  1174. return false;
  1175. }
  1176. const storage2 = getStorage(icon.provider, icon.prefix);
  1177. return addIconToStorage(storage2, icon.name, data);
  1178. }
  1179. function addCollection(data, provider) {
  1180. if (typeof data !== "object") {
  1181. return false;
  1182. }
  1183. if (typeof provider !== "string") {
  1184. provider = data.provider || "";
  1185. }
  1186. if (simpleNames && !provider && !data.prefix) {
  1187. let added = false;
  1188. if (quicklyValidateIconSet(data)) {
  1189. data.prefix = "";
  1190. parseIconSet(data, (name, icon) => {
  1191. if (icon && addIcon(name, icon)) {
  1192. added = true;
  1193. }
  1194. });
  1195. }
  1196. return added;
  1197. }
  1198. const prefix = data.prefix;
  1199. if (!validateIconName({
  1200. provider,
  1201. prefix,
  1202. name: "a"
  1203. })) {
  1204. return false;
  1205. }
  1206. const storage2 = getStorage(provider, prefix);
  1207. return !!addIconSet(storage2, data);
  1208. }
  1209. const defaultIconSizeCustomisations = Object.freeze({
  1210. width: null,
  1211. height: null
  1212. });
  1213. const defaultIconCustomisations = Object.freeze({
  1214. // Dimensions
  1215. ...defaultIconSizeCustomisations,
  1216. // Transformations
  1217. ...defaultIconTransformations
  1218. });
  1219. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  1220. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  1221. function calculateSize(size, ratio, precision) {
  1222. if (ratio === 1) {
  1223. return size;
  1224. }
  1225. precision = precision || 100;
  1226. if (typeof size === "number") {
  1227. return Math.ceil(size * ratio * precision) / precision;
  1228. }
  1229. if (typeof size !== "string") {
  1230. return size;
  1231. }
  1232. const oldParts = size.split(unitsSplit);
  1233. if (oldParts === null || !oldParts.length) {
  1234. return size;
  1235. }
  1236. const newParts = [];
  1237. let code = oldParts.shift();
  1238. let isNumber = unitsTest.test(code);
  1239. while (true) {
  1240. if (isNumber) {
  1241. const num = parseFloat(code);
  1242. if (isNaN(num)) {
  1243. newParts.push(code);
  1244. } else {
  1245. newParts.push(Math.ceil(num * ratio * precision) / precision);
  1246. }
  1247. } else {
  1248. newParts.push(code);
  1249. }
  1250. code = oldParts.shift();
  1251. if (code === void 0) {
  1252. return newParts.join("");
  1253. }
  1254. isNumber = !isNumber;
  1255. }
  1256. }
  1257. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  1258. function iconToSVG(icon, customisations) {
  1259. const fullIcon = {
  1260. ...defaultIconProps,
  1261. ...icon
  1262. };
  1263. const fullCustomisations = {
  1264. ...defaultIconCustomisations,
  1265. ...customisations
  1266. };
  1267. const box = {
  1268. left: fullIcon.left,
  1269. top: fullIcon.top,
  1270. width: fullIcon.width,
  1271. height: fullIcon.height
  1272. };
  1273. let body = fullIcon.body;
  1274. [fullIcon, fullCustomisations].forEach((props) => {
  1275. const transformations = [];
  1276. const hFlip = props.hFlip;
  1277. const vFlip = props.vFlip;
  1278. let rotation = props.rotate;
  1279. if (hFlip) {
  1280. if (vFlip) {
  1281. rotation += 2;
  1282. } else {
  1283. transformations.push(
  1284. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  1285. );
  1286. transformations.push("scale(-1 1)");
  1287. box.top = box.left = 0;
  1288. }
  1289. } else if (vFlip) {
  1290. transformations.push(
  1291. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  1292. );
  1293. transformations.push("scale(1 -1)");
  1294. box.top = box.left = 0;
  1295. }
  1296. let tempValue;
  1297. if (rotation < 0) {
  1298. rotation -= Math.floor(rotation / 4) * 4;
  1299. }
  1300. rotation = rotation % 4;
  1301. switch (rotation) {
  1302. case 1:
  1303. tempValue = box.height / 2 + box.top;
  1304. transformations.unshift(
  1305. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  1306. );
  1307. break;
  1308. case 2:
  1309. transformations.unshift(
  1310. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  1311. );
  1312. break;
  1313. case 3:
  1314. tempValue = box.width / 2 + box.left;
  1315. transformations.unshift(
  1316. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  1317. );
  1318. break;
  1319. }
  1320. if (rotation % 2 === 1) {
  1321. if (box.left !== box.top) {
  1322. tempValue = box.left;
  1323. box.left = box.top;
  1324. box.top = tempValue;
  1325. }
  1326. if (box.width !== box.height) {
  1327. tempValue = box.width;
  1328. box.width = box.height;
  1329. box.height = tempValue;
  1330. }
  1331. }
  1332. if (transformations.length) {
  1333. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  1334. }
  1335. });
  1336. const customisationsWidth = fullCustomisations.width;
  1337. const customisationsHeight = fullCustomisations.height;
  1338. const boxWidth = box.width;
  1339. const boxHeight = box.height;
  1340. let width;
  1341. let height;
  1342. if (customisationsWidth === null) {
  1343. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  1344. width = calculateSize(height, boxWidth / boxHeight);
  1345. } else {
  1346. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  1347. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  1348. }
  1349. const attributes = {};
  1350. const setAttr = (prop, value) => {
  1351. if (!isUnsetKeyword(value)) {
  1352. attributes[prop] = value.toString();
  1353. }
  1354. };
  1355. setAttr("width", width);
  1356. setAttr("height", height);
  1357. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  1358. return {
  1359. attributes,
  1360. body
  1361. };
  1362. }
  1363. const regex = /\sid="(\S+)"/g;
  1364. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  1365. let counter = 0;
  1366. function replaceIDs(body, prefix = randomPrefix) {
  1367. const ids = [];
  1368. let match;
  1369. while (match = regex.exec(body)) {
  1370. ids.push(match[1]);
  1371. }
  1372. if (!ids.length) {
  1373. return body;
  1374. }
  1375. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  1376. ids.forEach((id) => {
  1377. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  1378. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  1379. body = body.replace(
  1380. // Allowed characters before id: [#;"]
  1381. // Allowed characters after id: [)"], .[a-z]
  1382. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  1383. "$1" + newID + suffix + "$3"
  1384. );
  1385. });
  1386. body = body.replace(new RegExp(suffix, "g"), "");
  1387. return body;
  1388. }
  1389. const storage = /* @__PURE__ */ Object.create(null);
  1390. function setAPIModule(provider, item) {
  1391. storage[provider] = item;
  1392. }
  1393. function getAPIModule(provider) {
  1394. return storage[provider] || storage[""];
  1395. }
  1396. function createAPIConfig(source) {
  1397. let resources;
  1398. if (typeof source.resources === "string") {
  1399. resources = [source.resources];
  1400. } else {
  1401. resources = source.resources;
  1402. if (!(resources instanceof Array) || !resources.length) {
  1403. return null;
  1404. }
  1405. }
  1406. const result = {
  1407. // API hosts
  1408. resources,
  1409. // Root path
  1410. path: source.path || "/",
  1411. // URL length limit
  1412. maxURL: source.maxURL || 500,
  1413. // Timeout before next host is used.
  1414. rotate: source.rotate || 750,
  1415. // Timeout before failing query.
  1416. timeout: source.timeout || 5e3,
  1417. // Randomise default API end point.
  1418. random: source.random === true,
  1419. // Start index
  1420. index: source.index || 0,
  1421. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  1422. dataAfterTimeout: source.dataAfterTimeout !== false
  1423. };
  1424. return result;
  1425. }
  1426. const configStorage = /* @__PURE__ */ Object.create(null);
  1427. const fallBackAPISources = [
  1428. "https://api.simplesvg.com",
  1429. "https://api.unisvg.com"
  1430. ];
  1431. const fallBackAPI = [];
  1432. while (fallBackAPISources.length > 0) {
  1433. if (fallBackAPISources.length === 1) {
  1434. fallBackAPI.push(fallBackAPISources.shift());
  1435. } else {
  1436. if (Math.random() > 0.5) {
  1437. fallBackAPI.push(fallBackAPISources.shift());
  1438. } else {
  1439. fallBackAPI.push(fallBackAPISources.pop());
  1440. }
  1441. }
  1442. }
  1443. configStorage[""] = createAPIConfig({
  1444. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  1445. });
  1446. function addAPIProvider(provider, customConfig) {
  1447. const config2 = createAPIConfig(customConfig);
  1448. if (config2 === null) {
  1449. return false;
  1450. }
  1451. configStorage[provider] = config2;
  1452. return true;
  1453. }
  1454. function getAPIConfig(provider) {
  1455. return configStorage[provider];
  1456. }
  1457. const detectFetch = () => {
  1458. let callback;
  1459. try {
  1460. callback = fetch;
  1461. if (typeof callback === "function") {
  1462. return callback;
  1463. }
  1464. } catch (err) {
  1465. }
  1466. };
  1467. let fetchModule = detectFetch();
  1468. function calculateMaxLength(provider, prefix) {
  1469. const config2 = getAPIConfig(provider);
  1470. if (!config2) {
  1471. return 0;
  1472. }
  1473. let result;
  1474. if (!config2.maxURL) {
  1475. result = 0;
  1476. } else {
  1477. let maxHostLength = 0;
  1478. config2.resources.forEach((item) => {
  1479. const host = item;
  1480. maxHostLength = Math.max(maxHostLength, host.length);
  1481. });
  1482. const url = prefix + ".json?icons=";
  1483. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  1484. }
  1485. return result;
  1486. }
  1487. function shouldAbort(status) {
  1488. return status === 404;
  1489. }
  1490. const prepare = (provider, prefix, icons) => {
  1491. const results = [];
  1492. const maxLength = calculateMaxLength(provider, prefix);
  1493. const type = "icons";
  1494. let item = {
  1495. type,
  1496. provider,
  1497. prefix,
  1498. icons: []
  1499. };
  1500. let length = 0;
  1501. icons.forEach((name, index) => {
  1502. length += name.length + 1;
  1503. if (length >= maxLength && index > 0) {
  1504. results.push(item);
  1505. item = {
  1506. type,
  1507. provider,
  1508. prefix,
  1509. icons: []
  1510. };
  1511. length = name.length;
  1512. }
  1513. item.icons.push(name);
  1514. });
  1515. results.push(item);
  1516. return results;
  1517. };
  1518. function getPath(provider) {
  1519. if (typeof provider === "string") {
  1520. const config2 = getAPIConfig(provider);
  1521. if (config2) {
  1522. return config2.path;
  1523. }
  1524. }
  1525. return "/";
  1526. }
  1527. const send = (host, params, callback) => {
  1528. if (!fetchModule) {
  1529. callback("abort", 424);
  1530. return;
  1531. }
  1532. let path = getPath(params.provider);
  1533. switch (params.type) {
  1534. case "icons": {
  1535. const prefix = params.prefix;
  1536. const icons = params.icons;
  1537. const iconsList = icons.join(",");
  1538. const urlParams = new URLSearchParams({
  1539. icons: iconsList
  1540. });
  1541. path += prefix + ".json?" + urlParams.toString();
  1542. break;
  1543. }
  1544. case "custom": {
  1545. const uri = params.uri;
  1546. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  1547. break;
  1548. }
  1549. default:
  1550. callback("abort", 400);
  1551. return;
  1552. }
  1553. let defaultError = 503;
  1554. fetchModule(host + path).then((response) => {
  1555. const status = response.status;
  1556. if (status !== 200) {
  1557. setTimeout(() => {
  1558. callback(shouldAbort(status) ? "abort" : "next", status);
  1559. });
  1560. return;
  1561. }
  1562. defaultError = 501;
  1563. return response.json();
  1564. }).then((data) => {
  1565. if (typeof data !== "object" || data === null) {
  1566. setTimeout(() => {
  1567. if (data === 404) {
  1568. callback("abort", data);
  1569. } else {
  1570. callback("next", defaultError);
  1571. }
  1572. });
  1573. return;
  1574. }
  1575. setTimeout(() => {
  1576. callback("success", data);
  1577. });
  1578. }).catch(() => {
  1579. callback("next", defaultError);
  1580. });
  1581. };
  1582. const fetchAPIModule = {
  1583. prepare,
  1584. send
  1585. };
  1586. function sortIcons(icons) {
  1587. const result = {
  1588. loaded: [],
  1589. missing: [],
  1590. pending: []
  1591. };
  1592. const storage2 = /* @__PURE__ */ Object.create(null);
  1593. icons.sort((a, b) => {
  1594. if (a.provider !== b.provider) {
  1595. return a.provider.localeCompare(b.provider);
  1596. }
  1597. if (a.prefix !== b.prefix) {
  1598. return a.prefix.localeCompare(b.prefix);
  1599. }
  1600. return a.name.localeCompare(b.name);
  1601. });
  1602. let lastIcon = {
  1603. provider: "",
  1604. prefix: "",
  1605. name: ""
  1606. };
  1607. icons.forEach((icon) => {
  1608. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  1609. return;
  1610. }
  1611. lastIcon = icon;
  1612. const provider = icon.provider;
  1613. const prefix = icon.prefix;
  1614. const name = icon.name;
  1615. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  1616. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  1617. let list;
  1618. if (name in localStorage2.icons) {
  1619. list = result.loaded;
  1620. } else if (prefix === "" || localStorage2.missing.has(name)) {
  1621. list = result.missing;
  1622. } else {
  1623. list = result.pending;
  1624. }
  1625. const item = {
  1626. provider,
  1627. prefix,
  1628. name
  1629. };
  1630. list.push(item);
  1631. });
  1632. return result;
  1633. }
  1634. function removeCallback(storages, id) {
  1635. storages.forEach((storage2) => {
  1636. const items = storage2.loaderCallbacks;
  1637. if (items) {
  1638. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  1639. }
  1640. });
  1641. }
  1642. function updateCallbacks(storage2) {
  1643. if (!storage2.pendingCallbacksFlag) {
  1644. storage2.pendingCallbacksFlag = true;
  1645. setTimeout(() => {
  1646. storage2.pendingCallbacksFlag = false;
  1647. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  1648. if (!items.length) {
  1649. return;
  1650. }
  1651. let hasPending = false;
  1652. const provider = storage2.provider;
  1653. const prefix = storage2.prefix;
  1654. items.forEach((item) => {
  1655. const icons = item.icons;
  1656. const oldLength = icons.pending.length;
  1657. icons.pending = icons.pending.filter((icon) => {
  1658. if (icon.prefix !== prefix) {
  1659. return true;
  1660. }
  1661. const name = icon.name;
  1662. if (storage2.icons[name]) {
  1663. icons.loaded.push({
  1664. provider,
  1665. prefix,
  1666. name
  1667. });
  1668. } else if (storage2.missing.has(name)) {
  1669. icons.missing.push({
  1670. provider,
  1671. prefix,
  1672. name
  1673. });
  1674. } else {
  1675. hasPending = true;
  1676. return true;
  1677. }
  1678. return false;
  1679. });
  1680. if (icons.pending.length !== oldLength) {
  1681. if (!hasPending) {
  1682. removeCallback([storage2], item.id);
  1683. }
  1684. item.callback(
  1685. icons.loaded.slice(0),
  1686. icons.missing.slice(0),
  1687. icons.pending.slice(0),
  1688. item.abort
  1689. );
  1690. }
  1691. });
  1692. });
  1693. }
  1694. }
  1695. let idCounter = 0;
  1696. function storeCallback(callback, icons, pendingSources) {
  1697. const id = idCounter++;
  1698. const abort = removeCallback.bind(null, pendingSources, id);
  1699. if (!icons.pending.length) {
  1700. return abort;
  1701. }
  1702. const item = {
  1703. id,
  1704. icons,
  1705. callback,
  1706. abort
  1707. };
  1708. pendingSources.forEach((storage2) => {
  1709. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  1710. });
  1711. return abort;
  1712. }
  1713. function listToIcons(list, validate = true, simpleNames2 = false) {
  1714. const result = [];
  1715. list.forEach((item) => {
  1716. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  1717. if (icon) {
  1718. result.push(icon);
  1719. }
  1720. });
  1721. return result;
  1722. }
  1723. var defaultConfig = {
  1724. resources: [],
  1725. index: 0,
  1726. timeout: 2e3,
  1727. rotate: 750,
  1728. random: false,
  1729. dataAfterTimeout: false
  1730. };
  1731. function sendQuery(config2, payload, query, done) {
  1732. const resourcesCount = config2.resources.length;
  1733. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  1734. let resources;
  1735. if (config2.random) {
  1736. let list = config2.resources.slice(0);
  1737. resources = [];
  1738. while (list.length > 1) {
  1739. const nextIndex = Math.floor(Math.random() * list.length);
  1740. resources.push(list[nextIndex]);
  1741. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  1742. }
  1743. resources = resources.concat(list);
  1744. } else {
  1745. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  1746. }
  1747. const startTime = Date.now();
  1748. let status = "pending";
  1749. let queriesSent = 0;
  1750. let lastError;
  1751. let timer = null;
  1752. let queue = [];
  1753. let doneCallbacks = [];
  1754. if (typeof done === "function") {
  1755. doneCallbacks.push(done);
  1756. }
  1757. function resetTimer() {
  1758. if (timer) {
  1759. clearTimeout(timer);
  1760. timer = null;
  1761. }
  1762. }
  1763. function abort() {
  1764. if (status === "pending") {
  1765. status = "aborted";
  1766. }
  1767. resetTimer();
  1768. queue.forEach((item) => {
  1769. if (item.status === "pending") {
  1770. item.status = "aborted";
  1771. }
  1772. });
  1773. queue = [];
  1774. }
  1775. function subscribe(callback, overwrite) {
  1776. if (overwrite) {
  1777. doneCallbacks = [];
  1778. }
  1779. if (typeof callback === "function") {
  1780. doneCallbacks.push(callback);
  1781. }
  1782. }
  1783. function getQueryStatus() {
  1784. return {
  1785. startTime,
  1786. payload,
  1787. status,
  1788. queriesSent,
  1789. queriesPending: queue.length,
  1790. subscribe,
  1791. abort
  1792. };
  1793. }
  1794. function failQuery() {
  1795. status = "failed";
  1796. doneCallbacks.forEach((callback) => {
  1797. callback(void 0, lastError);
  1798. });
  1799. }
  1800. function clearQueue() {
  1801. queue.forEach((item) => {
  1802. if (item.status === "pending") {
  1803. item.status = "aborted";
  1804. }
  1805. });
  1806. queue = [];
  1807. }
  1808. function moduleResponse(item, response, data) {
  1809. const isError = response !== "success";
  1810. queue = queue.filter((queued) => queued !== item);
  1811. switch (status) {
  1812. case "pending":
  1813. break;
  1814. case "failed":
  1815. if (isError || !config2.dataAfterTimeout) {
  1816. return;
  1817. }
  1818. break;
  1819. default:
  1820. return;
  1821. }
  1822. if (response === "abort") {
  1823. lastError = data;
  1824. failQuery();
  1825. return;
  1826. }
  1827. if (isError) {
  1828. lastError = data;
  1829. if (!queue.length) {
  1830. if (!resources.length) {
  1831. failQuery();
  1832. } else {
  1833. execNext();
  1834. }
  1835. }
  1836. return;
  1837. }
  1838. resetTimer();
  1839. clearQueue();
  1840. if (!config2.random) {
  1841. const index = config2.resources.indexOf(item.resource);
  1842. if (index !== -1 && index !== config2.index) {
  1843. config2.index = index;
  1844. }
  1845. }
  1846. status = "completed";
  1847. doneCallbacks.forEach((callback) => {
  1848. callback(data);
  1849. });
  1850. }
  1851. function execNext() {
  1852. if (status !== "pending") {
  1853. return;
  1854. }
  1855. resetTimer();
  1856. const resource = resources.shift();
  1857. if (resource === void 0) {
  1858. if (queue.length) {
  1859. timer = setTimeout(() => {
  1860. resetTimer();
  1861. if (status === "pending") {
  1862. clearQueue();
  1863. failQuery();
  1864. }
  1865. }, config2.timeout);
  1866. return;
  1867. }
  1868. failQuery();
  1869. return;
  1870. }
  1871. const item = {
  1872. status: "pending",
  1873. resource,
  1874. callback: (status2, data) => {
  1875. moduleResponse(item, status2, data);
  1876. }
  1877. };
  1878. queue.push(item);
  1879. queriesSent++;
  1880. timer = setTimeout(execNext, config2.rotate);
  1881. query(resource, payload, item.callback);
  1882. }
  1883. setTimeout(execNext);
  1884. return getQueryStatus;
  1885. }
  1886. function initRedundancy(cfg) {
  1887. const config2 = {
  1888. ...defaultConfig,
  1889. ...cfg
  1890. };
  1891. let queries = [];
  1892. function cleanup() {
  1893. queries = queries.filter((item) => item().status === "pending");
  1894. }
  1895. function query(payload, queryCallback, doneCallback) {
  1896. const query2 = sendQuery(
  1897. config2,
  1898. payload,
  1899. queryCallback,
  1900. (data, error) => {
  1901. cleanup();
  1902. if (doneCallback) {
  1903. doneCallback(data, error);
  1904. }
  1905. }
  1906. );
  1907. queries.push(query2);
  1908. return query2;
  1909. }
  1910. function find(callback) {
  1911. return queries.find((value) => {
  1912. return callback(value);
  1913. }) || null;
  1914. }
  1915. const instance = {
  1916. query,
  1917. find,
  1918. setIndex: (index) => {
  1919. config2.index = index;
  1920. },
  1921. getIndex: () => config2.index,
  1922. cleanup
  1923. };
  1924. return instance;
  1925. }
  1926. function emptyCallback$1() {
  1927. }
  1928. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1929. function getRedundancyCache(provider) {
  1930. if (!redundancyCache[provider]) {
  1931. const config2 = getAPIConfig(provider);
  1932. if (!config2) {
  1933. return;
  1934. }
  1935. const redundancy = initRedundancy(config2);
  1936. const cachedReundancy = {
  1937. config: config2,
  1938. redundancy
  1939. };
  1940. redundancyCache[provider] = cachedReundancy;
  1941. }
  1942. return redundancyCache[provider];
  1943. }
  1944. function sendAPIQuery(target, query, callback) {
  1945. let redundancy;
  1946. let send2;
  1947. if (typeof target === "string") {
  1948. const api = getAPIModule(target);
  1949. if (!api) {
  1950. callback(void 0, 424);
  1951. return emptyCallback$1;
  1952. }
  1953. send2 = api.send;
  1954. const cached = getRedundancyCache(target);
  1955. if (cached) {
  1956. redundancy = cached.redundancy;
  1957. }
  1958. } else {
  1959. const config2 = createAPIConfig(target);
  1960. if (config2) {
  1961. redundancy = initRedundancy(config2);
  1962. const moduleKey = target.resources ? target.resources[0] : "";
  1963. const api = getAPIModule(moduleKey);
  1964. if (api) {
  1965. send2 = api.send;
  1966. }
  1967. }
  1968. }
  1969. if (!redundancy || !send2) {
  1970. callback(void 0, 424);
  1971. return emptyCallback$1;
  1972. }
  1973. return redundancy.query(query, send2, callback)().abort;
  1974. }
  1975. const browserCacheVersion = "iconify2";
  1976. const browserCachePrefix = "iconify";
  1977. const browserCacheCountKey = browserCachePrefix + "-count";
  1978. const browserCacheVersionKey = browserCachePrefix + "-version";
  1979. const browserStorageHour = 36e5;
  1980. const browserStorageCacheExpiration = 168;
  1981. function getStoredItem(func, key) {
  1982. try {
  1983. return func.getItem(key);
  1984. } catch (err) {
  1985. }
  1986. }
  1987. function setStoredItem(func, key, value) {
  1988. try {
  1989. func.setItem(key, value);
  1990. return true;
  1991. } catch (err) {
  1992. }
  1993. }
  1994. function removeStoredItem(func, key) {
  1995. try {
  1996. func.removeItem(key);
  1997. } catch (err) {
  1998. }
  1999. }
  2000. function setBrowserStorageItemsCount(storage2, value) {
  2001. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  2002. }
  2003. function getBrowserStorageItemsCount(storage2) {
  2004. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  2005. }
  2006. const browserStorageConfig = {
  2007. local: true,
  2008. session: true
  2009. };
  2010. const browserStorageEmptyItems = {
  2011. local: /* @__PURE__ */ new Set(),
  2012. session: /* @__PURE__ */ new Set()
  2013. };
  2014. let browserStorageStatus = false;
  2015. function setBrowserStorageStatus(status) {
  2016. browserStorageStatus = status;
  2017. }
  2018. let _window = typeof window === "undefined" ? {} : window;
  2019. function getBrowserStorage(key) {
  2020. const attr = key + "Storage";
  2021. try {
  2022. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  2023. return _window[attr];
  2024. }
  2025. } catch (err) {
  2026. }
  2027. browserStorageConfig[key] = false;
  2028. }
  2029. function iterateBrowserStorage(key, callback) {
  2030. const func = getBrowserStorage(key);
  2031. if (!func) {
  2032. return;
  2033. }
  2034. const version = getStoredItem(func, browserCacheVersionKey);
  2035. if (version !== browserCacheVersion) {
  2036. if (version) {
  2037. const total2 = getBrowserStorageItemsCount(func);
  2038. for (let i = 0; i < total2; i++) {
  2039. removeStoredItem(func, browserCachePrefix + i.toString());
  2040. }
  2041. }
  2042. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  2043. setBrowserStorageItemsCount(func, 0);
  2044. return;
  2045. }
  2046. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  2047. const parseItem = (index) => {
  2048. const name = browserCachePrefix + index.toString();
  2049. const item = getStoredItem(func, name);
  2050. if (typeof item !== "string") {
  2051. return;
  2052. }
  2053. try {
  2054. const data = JSON.parse(item);
  2055. 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
  2056. callback(data, index)) {
  2057. return true;
  2058. }
  2059. } catch (err) {
  2060. }
  2061. removeStoredItem(func, name);
  2062. };
  2063. let total = getBrowserStorageItemsCount(func);
  2064. for (let i = total - 1; i >= 0; i--) {
  2065. if (!parseItem(i)) {
  2066. if (i === total - 1) {
  2067. total--;
  2068. setBrowserStorageItemsCount(func, total);
  2069. } else {
  2070. browserStorageEmptyItems[key].add(i);
  2071. }
  2072. }
  2073. }
  2074. }
  2075. function initBrowserStorage() {
  2076. if (browserStorageStatus) {
  2077. return;
  2078. }
  2079. setBrowserStorageStatus(true);
  2080. for (const key in browserStorageConfig) {
  2081. iterateBrowserStorage(key, (item) => {
  2082. const iconSet = item.data;
  2083. const provider = item.provider;
  2084. const prefix = iconSet.prefix;
  2085. const storage2 = getStorage(
  2086. provider,
  2087. prefix
  2088. );
  2089. if (!addIconSet(storage2, iconSet).length) {
  2090. return false;
  2091. }
  2092. const lastModified = iconSet.lastModified || -1;
  2093. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  2094. return true;
  2095. });
  2096. }
  2097. }
  2098. function updateLastModified(storage2, lastModified) {
  2099. const lastValue = storage2.lastModifiedCached;
  2100. if (
  2101. // Matches or newer
  2102. lastValue && lastValue >= lastModified
  2103. ) {
  2104. return lastValue === lastModified;
  2105. }
  2106. storage2.lastModifiedCached = lastModified;
  2107. if (lastValue) {
  2108. for (const key in browserStorageConfig) {
  2109. iterateBrowserStorage(key, (item) => {
  2110. const iconSet = item.data;
  2111. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  2112. });
  2113. }
  2114. }
  2115. return true;
  2116. }
  2117. function storeInBrowserStorage(storage2, data) {
  2118. if (!browserStorageStatus) {
  2119. initBrowserStorage();
  2120. }
  2121. function store(key) {
  2122. let func;
  2123. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  2124. return;
  2125. }
  2126. const set = browserStorageEmptyItems[key];
  2127. let index;
  2128. if (set.size) {
  2129. set.delete(index = Array.from(set).shift());
  2130. } else {
  2131. index = getBrowserStorageItemsCount(func);
  2132. if (!setBrowserStorageItemsCount(func, index + 1)) {
  2133. return;
  2134. }
  2135. }
  2136. const item = {
  2137. cached: Math.floor(Date.now() / browserStorageHour),
  2138. provider: storage2.provider,
  2139. data
  2140. };
  2141. return setStoredItem(
  2142. func,
  2143. browserCachePrefix + index.toString(),
  2144. JSON.stringify(item)
  2145. );
  2146. }
  2147. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  2148. return;
  2149. }
  2150. if (!Object.keys(data.icons).length) {
  2151. return;
  2152. }
  2153. if (data.not_found) {
  2154. data = Object.assign({}, data);
  2155. delete data.not_found;
  2156. }
  2157. if (!store("local")) {
  2158. store("session");
  2159. }
  2160. }
  2161. function emptyCallback() {
  2162. }
  2163. function loadedNewIcons(storage2) {
  2164. if (!storage2.iconsLoaderFlag) {
  2165. storage2.iconsLoaderFlag = true;
  2166. setTimeout(() => {
  2167. storage2.iconsLoaderFlag = false;
  2168. updateCallbacks(storage2);
  2169. });
  2170. }
  2171. }
  2172. function loadNewIcons(storage2, icons) {
  2173. if (!storage2.iconsToLoad) {
  2174. storage2.iconsToLoad = icons;
  2175. } else {
  2176. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  2177. }
  2178. if (!storage2.iconsQueueFlag) {
  2179. storage2.iconsQueueFlag = true;
  2180. setTimeout(() => {
  2181. storage2.iconsQueueFlag = false;
  2182. const { provider, prefix } = storage2;
  2183. const icons2 = storage2.iconsToLoad;
  2184. delete storage2.iconsToLoad;
  2185. let api;
  2186. if (!icons2 || !(api = getAPIModule(provider))) {
  2187. return;
  2188. }
  2189. const params = api.prepare(provider, prefix, icons2);
  2190. params.forEach((item) => {
  2191. sendAPIQuery(provider, item, (data) => {
  2192. if (typeof data !== "object") {
  2193. item.icons.forEach((name) => {
  2194. storage2.missing.add(name);
  2195. });
  2196. } else {
  2197. try {
  2198. const parsed = addIconSet(
  2199. storage2,
  2200. data
  2201. );
  2202. if (!parsed.length) {
  2203. return;
  2204. }
  2205. const pending = storage2.pendingIcons;
  2206. if (pending) {
  2207. parsed.forEach((name) => {
  2208. pending.delete(name);
  2209. });
  2210. }
  2211. storeInBrowserStorage(storage2, data);
  2212. } catch (err) {
  2213. }
  2214. }
  2215. loadedNewIcons(storage2);
  2216. });
  2217. });
  2218. });
  2219. }
  2220. }
  2221. const loadIcons = (icons, callback) => {
  2222. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  2223. const sortedIcons = sortIcons(cleanedIcons);
  2224. if (!sortedIcons.pending.length) {
  2225. let callCallback = true;
  2226. if (callback) {
  2227. setTimeout(() => {
  2228. if (callCallback) {
  2229. callback(
  2230. sortedIcons.loaded,
  2231. sortedIcons.missing,
  2232. sortedIcons.pending,
  2233. emptyCallback
  2234. );
  2235. }
  2236. });
  2237. }
  2238. return () => {
  2239. callCallback = false;
  2240. };
  2241. }
  2242. const newIcons = /* @__PURE__ */ Object.create(null);
  2243. const sources = [];
  2244. let lastProvider, lastPrefix;
  2245. sortedIcons.pending.forEach((icon) => {
  2246. const { provider, prefix } = icon;
  2247. if (prefix === lastPrefix && provider === lastProvider) {
  2248. return;
  2249. }
  2250. lastProvider = provider;
  2251. lastPrefix = prefix;
  2252. sources.push(getStorage(provider, prefix));
  2253. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  2254. if (!providerNewIcons[prefix]) {
  2255. providerNewIcons[prefix] = [];
  2256. }
  2257. });
  2258. sortedIcons.pending.forEach((icon) => {
  2259. const { provider, prefix, name } = icon;
  2260. const storage2 = getStorage(provider, prefix);
  2261. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  2262. if (!pendingQueue.has(name)) {
  2263. pendingQueue.add(name);
  2264. newIcons[provider][prefix].push(name);
  2265. }
  2266. });
  2267. sources.forEach((storage2) => {
  2268. const { provider, prefix } = storage2;
  2269. if (newIcons[provider][prefix].length) {
  2270. loadNewIcons(storage2, newIcons[provider][prefix]);
  2271. }
  2272. });
  2273. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  2274. };
  2275. function mergeCustomisations(defaults, item) {
  2276. const result = {
  2277. ...defaults
  2278. };
  2279. for (const key in item) {
  2280. const value = item[key];
  2281. const valueType = typeof value;
  2282. if (key in defaultIconSizeCustomisations) {
  2283. if (value === null || value && (valueType === "string" || valueType === "number")) {
  2284. result[key] = value;
  2285. }
  2286. } else if (valueType === typeof result[key]) {
  2287. result[key] = key === "rotate" ? value % 4 : value;
  2288. }
  2289. }
  2290. return result;
  2291. }
  2292. const separator = /[\s,]+/;
  2293. function flipFromString(custom, flip) {
  2294. flip.split(separator).forEach((str) => {
  2295. const value = str.trim();
  2296. switch (value) {
  2297. case "horizontal":
  2298. custom.hFlip = true;
  2299. break;
  2300. case "vertical":
  2301. custom.vFlip = true;
  2302. break;
  2303. }
  2304. });
  2305. }
  2306. function rotateFromString(value, defaultValue = 0) {
  2307. const units = value.replace(/^-?[0-9.]*/, "");
  2308. function cleanup(value2) {
  2309. while (value2 < 0) {
  2310. value2 += 4;
  2311. }
  2312. return value2 % 4;
  2313. }
  2314. if (units === "") {
  2315. const num = parseInt(value);
  2316. return isNaN(num) ? 0 : cleanup(num);
  2317. } else if (units !== value) {
  2318. let split = 0;
  2319. switch (units) {
  2320. case "%":
  2321. split = 25;
  2322. break;
  2323. case "deg":
  2324. split = 90;
  2325. }
  2326. if (split) {
  2327. let num = parseFloat(value.slice(0, value.length - units.length));
  2328. if (isNaN(num)) {
  2329. return 0;
  2330. }
  2331. num = num / split;
  2332. return num % 1 === 0 ? cleanup(num) : 0;
  2333. }
  2334. }
  2335. return defaultValue;
  2336. }
  2337. function iconToHTML(body, attributes) {
  2338. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  2339. for (const attr in attributes) {
  2340. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  2341. }
  2342. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  2343. }
  2344. function encodeSVGforURL(svg) {
  2345. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  2346. }
  2347. function svgToData(svg) {
  2348. return "data:image/svg+xml," + encodeSVGforURL(svg);
  2349. }
  2350. function svgToURL(svg) {
  2351. return 'url("' + svgToData(svg) + '")';
  2352. }
  2353. const defaultExtendedIconCustomisations = {
  2354. ...defaultIconCustomisations,
  2355. inline: false
  2356. };
  2357. const svgDefaults = {
  2358. "xmlns": "http://www.w3.org/2000/svg",
  2359. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  2360. "aria-hidden": true,
  2361. "role": "img"
  2362. };
  2363. const commonProps = {
  2364. display: "inline-block"
  2365. };
  2366. const monotoneProps = {
  2367. backgroundColor: "currentColor"
  2368. };
  2369. const coloredProps = {
  2370. backgroundColor: "transparent"
  2371. };
  2372. const propsToAdd = {
  2373. Image: "var(--svg)",
  2374. Repeat: "no-repeat",
  2375. Size: "100% 100%"
  2376. };
  2377. const propsToAddTo = {
  2378. webkitMask: monotoneProps,
  2379. mask: monotoneProps,
  2380. background: coloredProps
  2381. };
  2382. for (const prefix in propsToAddTo) {
  2383. const list = propsToAddTo[prefix];
  2384. for (const prop in propsToAdd) {
  2385. list[prefix + prop] = propsToAdd[prop];
  2386. }
  2387. }
  2388. const customisationAliases = {};
  2389. ["horizontal", "vertical"].forEach((prefix) => {
  2390. const attr = prefix.slice(0, 1) + "Flip";
  2391. customisationAliases[prefix + "-flip"] = attr;
  2392. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  2393. customisationAliases[prefix + "Flip"] = attr;
  2394. });
  2395. function fixSize(value) {
  2396. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  2397. }
  2398. const render = (icon, props) => {
  2399. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  2400. const componentProps = { ...svgDefaults };
  2401. const mode = props.mode || "svg";
  2402. const style = {};
  2403. const propsStyle = props.style;
  2404. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  2405. for (let key in props) {
  2406. const value = props[key];
  2407. if (value === void 0) {
  2408. continue;
  2409. }
  2410. switch (key) {
  2411. case "icon":
  2412. case "style":
  2413. case "onLoad":
  2414. case "mode":
  2415. break;
  2416. case "inline":
  2417. case "hFlip":
  2418. case "vFlip":
  2419. customisations[key] = value === true || value === "true" || value === 1;
  2420. break;
  2421. case "flip":
  2422. if (typeof value === "string") {
  2423. flipFromString(customisations, value);
  2424. }
  2425. break;
  2426. case "color":
  2427. style.color = value;
  2428. break;
  2429. case "rotate":
  2430. if (typeof value === "string") {
  2431. customisations[key] = rotateFromString(value);
  2432. } else if (typeof value === "number") {
  2433. customisations[key] = value;
  2434. }
  2435. break;
  2436. case "ariaHidden":
  2437. case "aria-hidden":
  2438. if (value !== true && value !== "true") {
  2439. delete componentProps["aria-hidden"];
  2440. }
  2441. break;
  2442. default: {
  2443. const alias = customisationAliases[key];
  2444. if (alias) {
  2445. if (value === true || value === "true" || value === 1) {
  2446. customisations[alias] = true;
  2447. }
  2448. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  2449. componentProps[key] = value;
  2450. }
  2451. }
  2452. }
  2453. }
  2454. const item = iconToSVG(icon, customisations);
  2455. const renderAttribs = item.attributes;
  2456. if (customisations.inline) {
  2457. style.verticalAlign = "-0.125em";
  2458. }
  2459. if (mode === "svg") {
  2460. componentProps.style = {
  2461. ...style,
  2462. ...customStyle
  2463. };
  2464. Object.assign(componentProps, renderAttribs);
  2465. let localCounter = 0;
  2466. let id = props.id;
  2467. if (typeof id === "string") {
  2468. id = id.replace(/-/g, "_");
  2469. }
  2470. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  2471. return vue.h("svg", componentProps);
  2472. }
  2473. const { body, width, height } = icon;
  2474. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  2475. const html = iconToHTML(body, {
  2476. ...renderAttribs,
  2477. width: width + "",
  2478. height: height + ""
  2479. });
  2480. componentProps.style = {
  2481. ...style,
  2482. "--svg": svgToURL(html),
  2483. "width": fixSize(renderAttribs.width),
  2484. "height": fixSize(renderAttribs.height),
  2485. ...commonProps,
  2486. ...useMask ? monotoneProps : coloredProps,
  2487. ...customStyle
  2488. };
  2489. return vue.h("span", componentProps);
  2490. };
  2491. allowSimpleNames(true);
  2492. setAPIModule("", fetchAPIModule);
  2493. if (typeof document !== "undefined" && typeof window !== "undefined") {
  2494. initBrowserStorage();
  2495. const _window2 = window;
  2496. if (_window2.IconifyPreload !== void 0) {
  2497. const preload = _window2.IconifyPreload;
  2498. if (typeof preload === "object" && preload !== null) {
  2499. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  2500. try {
  2501. if (
  2502. // Check if item is an object and not null/array
  2503. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  2504. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  2505. !addCollection(item)
  2506. ) {
  2507. }
  2508. } catch (e2) {
  2509. }
  2510. });
  2511. }
  2512. }
  2513. if (_window2.IconifyProviders !== void 0) {
  2514. const providers = _window2.IconifyProviders;
  2515. if (typeof providers === "object" && providers !== null) {
  2516. for (let key in providers) {
  2517. try {
  2518. const value = providers[key];
  2519. if (typeof value !== "object" || !value || value.resources === void 0) {
  2520. continue;
  2521. }
  2522. if (!addAPIProvider(key, value)) {
  2523. }
  2524. } catch (e2) {
  2525. }
  2526. }
  2527. }
  2528. }
  2529. }
  2530. const emptyIcon = {
  2531. ...defaultIconProps,
  2532. body: ""
  2533. };
  2534. const Icon = vue.defineComponent({
  2535. // Do not inherit other attributes: it is handled by render()
  2536. inheritAttrs: false,
  2537. // Set initial data
  2538. data() {
  2539. return {
  2540. // Mounted status
  2541. iconMounted: false,
  2542. // Callback counter to trigger re-render
  2543. counter: 0
  2544. };
  2545. },
  2546. mounted() {
  2547. this._name = "";
  2548. this._loadingIcon = null;
  2549. this.iconMounted = true;
  2550. },
  2551. unmounted() {
  2552. this.abortLoading();
  2553. },
  2554. methods: {
  2555. abortLoading() {
  2556. if (this._loadingIcon) {
  2557. this._loadingIcon.abort();
  2558. this._loadingIcon = null;
  2559. }
  2560. },
  2561. // Get data for icon to render or null
  2562. getIcon(icon, onload) {
  2563. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  2564. this._name = "";
  2565. this.abortLoading();
  2566. return {
  2567. data: icon
  2568. };
  2569. }
  2570. let iconName;
  2571. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  2572. this.abortLoading();
  2573. return null;
  2574. }
  2575. const data = getIconData(iconName);
  2576. if (!data) {
  2577. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  2578. this.abortLoading();
  2579. this._name = "";
  2580. if (data !== null) {
  2581. this._loadingIcon = {
  2582. name: icon,
  2583. abort: loadIcons([iconName], () => {
  2584. this.counter++;
  2585. })
  2586. };
  2587. }
  2588. }
  2589. return null;
  2590. }
  2591. this.abortLoading();
  2592. if (this._name !== icon) {
  2593. this._name = icon;
  2594. if (onload) {
  2595. onload(icon);
  2596. }
  2597. }
  2598. const classes = ["iconify"];
  2599. if (iconName.prefix !== "") {
  2600. classes.push("iconify--" + iconName.prefix);
  2601. }
  2602. if (iconName.provider !== "") {
  2603. classes.push("iconify--" + iconName.provider);
  2604. }
  2605. return { data, classes };
  2606. }
  2607. },
  2608. // Render icon
  2609. render() {
  2610. this.counter;
  2611. const props = this.$attrs;
  2612. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  2613. if (!icon) {
  2614. return render(emptyIcon, props);
  2615. }
  2616. let newProps = props;
  2617. if (icon.classes) {
  2618. newProps = {
  2619. ...props,
  2620. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  2621. };
  2622. }
  2623. return render({
  2624. ...defaultIconProps,
  2625. ...icon.data
  2626. }, newProps);
  2627. }
  2628. });
  2629. const _hoisted_1$i = { class: "display-type" };
  2630. const _hoisted_2$f = { style: { "position": "relative" } };
  2631. const _hoisted_3$c = {
  2632. key: 0,
  2633. class: "type-list"
  2634. };
  2635. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  2636. __name: "BaseSelect",
  2637. props: {
  2638. displayType: {}
  2639. },
  2640. emits: ["update:displayType"],
  2641. setup(__props, { emit: __emit }) {
  2642. const props = __props;
  2643. const emit = __emit;
  2644. let state = vue.reactive({
  2645. showChangeDisplayType: false,
  2646. lastDisplayType: null
  2647. });
  2648. function changeOption(item) {
  2649. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2650. state.lastDisplayType = props.displayType;
  2651. }
  2652. emit("update:displayType", item);
  2653. state.showChangeDisplayType = false;
  2654. }
  2655. function clickDisplayType() {
  2656. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2657. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  2658. }
  2659. state.showChangeDisplayType = !state.showChangeDisplayType;
  2660. }
  2661. const currentDisplayType = vue.computed(() => {
  2662. let judge = props.displayType;
  2663. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2664. judge = state.lastDisplayType;
  2665. }
  2666. switch (judge) {
  2667. case CommentDisplayType.FloorInFloorNoCallUser:
  2668. return "楼中楼";
  2669. case CommentDisplayType.FloorInFloor:
  2670. return "楼中楼(@)";
  2671. case CommentDisplayType.FloorInFloorNested:
  2672. return "冗余楼中楼";
  2673. case CommentDisplayType.V2exOrigin:
  2674. return "V2原版";
  2675. case CommentDisplayType.OnlyOp:
  2676. return "只看楼主";
  2677. default:
  2678. return "楼中楼";
  2679. }
  2680. });
  2681. return (_ctx, _cache) => {
  2682. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
  2683. vue.createElementVNode("div", {
  2684. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).New && "active"]),
  2685. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).New))
  2686. }, "最新 ", 2),
  2687. vue.createElementVNode("div", {
  2688. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  2689. onClick: _cache[1] || (_cache[1] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  2690. }, "最热 ", 2),
  2691. vue.createElementVNode("div", _hoisted_2$f, [
  2692. vue.createElementVNode("div", {
  2693. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  2694. onClick: clickDisplayType
  2695. }, [
  2696. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  2697. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  2698. ], 2),
  2699. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c, [
  2700. vue.createElementVNode("div", {
  2701. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  2702. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  2703. }, "楼中楼 ", 2),
  2704. vue.createElementVNode("div", {
  2705. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  2706. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  2707. }, "楼中楼(@) ", 2),
  2708. vue.createElementVNode("div", {
  2709. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  2710. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  2711. }, "冗余楼中楼 ", 2),
  2712. vue.createElementVNode("div", {
  2713. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  2714. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  2715. }, "只看楼主 ", 2),
  2716. vue.createElementVNode("div", {
  2717. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  2718. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  2719. }, "V2原版 ", 2)
  2720. ])) : vue.createCommentVNode("", true)
  2721. ])
  2722. ]);
  2723. };
  2724. }
  2725. });
  2726. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-e4f684be"]]);
  2727. const eventBus = {
  2728. eventMap: /* @__PURE__ */ new Map(),
  2729. on(eventType, cb) {
  2730. let cbs = this.eventMap.get(eventType);
  2731. if (cbs) {
  2732. cbs.push(cb);
  2733. } else {
  2734. cbs = [cb];
  2735. }
  2736. this.eventMap.set(eventType, cbs);
  2737. },
  2738. offOne(eventType, cb) {
  2739. let cbs = this.eventMap.get(eventType);
  2740. if (cbs) {
  2741. let rIndex = cbs.findIndex((c) => c === cb);
  2742. if (rIndex > -1) {
  2743. cbs.splice(rIndex, 1);
  2744. }
  2745. }
  2746. this.eventMap.set(eventType, cbs);
  2747. },
  2748. emit(eventType, val) {
  2749. let cbs = this.eventMap.get(eventType);
  2750. if (cbs) {
  2751. cbs.map((cb) => cb(val));
  2752. }
  2753. },
  2754. off(eventType) {
  2755. let cbs = this.eventMap.has(eventType);
  2756. if (cbs) {
  2757. this.eventMap.delete(eventType);
  2758. }
  2759. },
  2760. clear() {
  2761. this.eventMap = /* @__PURE__ */ new Map();
  2762. }
  2763. };
  2764. const CMD = {
  2765. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  2766. SHOW_MSG: "SHOW_MSG",
  2767. SET_CALL: "SET_CALL",
  2768. SHOW_CALL: "SHOW_CALL",
  2769. REFRESH_ONCE: "REFRESH_ONCE",
  2770. ADD_REPLY: "ADD_REPLY",
  2771. IGNORE: "IGNORE",
  2772. MERGE: "MERGE",
  2773. REMOVE: "REMOVE",
  2774. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  2775. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  2776. ADD_TAG: "ADD_TAG",
  2777. REMOVE_TAG: "REMOVE_TAG",
  2778. RELATION_REPLY: "RELATION_REPLY",
  2779. JUMP: "JUMP",
  2780. REFRESH_POST: "REFRESH_POST",
  2781. SHOW_CONFIRM_MODAL: "SHOW_CONFIRM_MODAL",
  2782. SHOW_CONFIRM_MODAL_CONFIRM: "SHOW_CONFIRM_MODAL_CONFIRM"
  2783. };
  2784. const _sfc_main$j = {
  2785. name: "PopConfirm",
  2786. props: {
  2787. title: {
  2788. type: String,
  2789. default() {
  2790. return "";
  2791. }
  2792. },
  2793. disabled: {
  2794. type: Boolean,
  2795. default() {
  2796. return false;
  2797. }
  2798. }
  2799. },
  2800. data() {
  2801. return {
  2802. id: ""
  2803. };
  2804. },
  2805. created() {
  2806. },
  2807. methods: {
  2808. cb(id) {
  2809. if (id === this.id) {
  2810. this.$emit("confirm");
  2811. this.id = "";
  2812. }
  2813. },
  2814. showPop(e2) {
  2815. if (this.disabled)
  2816. return;
  2817. let rect = e2.target.getBoundingClientRect();
  2818. this.id = Date.now();
  2819. eventBus.emit(CMD.SHOW_CONFIRM_MODAL, { title: this.title, rect, id: this.id });
  2820. eventBus.offOne(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2821. eventBus.on(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2822. }
  2823. },
  2824. unmounted() {
  2825. eventBus.offOne(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.cb);
  2826. }
  2827. };
  2828. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  2829. return vue.openBlock(), vue.createElementBlock("span", {
  2830. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.showPop && $options.showPop(...args), ["stop"]))
  2831. }, [
  2832. vue.renderSlot(_ctx.$slots, "default")
  2833. ]);
  2834. }
  2835. const PopConfirm = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$a]]);
  2836. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  2837. __name: "BaseLoading",
  2838. props: {
  2839. size: { default: "normal" }
  2840. },
  2841. setup(__props) {
  2842. return (_ctx, _cache) => {
  2843. return vue.openBlock(), vue.createElementBlock("div", {
  2844. class: vue.normalizeClass(["loading", [_ctx.size]])
  2845. }, null, 2);
  2846. };
  2847. }
  2848. });
  2849. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-2697baa2"]]);
  2850. const _hoisted_1$h = {
  2851. key: 1,
  2852. class: "key-notice"
  2853. };
  2854. const _hoisted_2$e = { class: "key" };
  2855. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  2856. __name: "BaseButton",
  2857. props: {
  2858. keyboard: {},
  2859. active: { type: Boolean },
  2860. disabled: { type: Boolean },
  2861. loading: { type: Boolean },
  2862. size: { default: "normal" },
  2863. type: { default: "primary" }
  2864. },
  2865. emits: ["click"],
  2866. setup(__props) {
  2867. return (_ctx, _cache) => {
  2868. return vue.openBlock(), vue.createBlock(Tooltip, {
  2869. disabled: !_ctx.keyboard,
  2870. title: `快捷键: ${_ctx.keyboard}`
  2871. }, {
  2872. default: vue.withCtx(() => [
  2873. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  2874. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  2875. class: [
  2876. _ctx.active && "active",
  2877. _ctx.size,
  2878. _ctx.type,
  2879. (_ctx.disabled || _ctx.loading) && "disabled",
  2880. !_ctx.disabled && "hvr-grow"
  2881. ]
  2882. }), [
  2883. vue.createElementVNode("span", {
  2884. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  2885. }, [
  2886. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2887. ], 4),
  2888. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  2889. key: 0,
  2890. size: "small"
  2891. })) : vue.createCommentVNode("", true),
  2892. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
  2893. vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(_ctx.keyboard), 1)
  2894. ])) : vue.createCommentVNode("", true)
  2895. ], 16)
  2896. ]),
  2897. _: 3
  2898. }, 8, ["disabled", "title"]);
  2899. };
  2900. }
  2901. });
  2902. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-5a7d79ba"]]);
  2903. const _sfc_main$g = {
  2904. name: "Setting",
  2905. components: {
  2906. BaseButton,
  2907. PopConfirm,
  2908. Icon,
  2909. BaseSelect,
  2910. BaseSwitch,
  2911. Tooltip
  2912. },
  2913. inject: ["isNight"],
  2914. props: {
  2915. show: {
  2916. type: Boolean,
  2917. default() {
  2918. return false;
  2919. }
  2920. }
  2921. },
  2922. data() {
  2923. return {
  2924. tabIndex: 0
  2925. };
  2926. },
  2927. methods: {
  2928. confirm() {
  2929. this.close();
  2930. this.$emit("confirm");
  2931. },
  2932. close() {
  2933. this.$emit("update:show", false);
  2934. }
  2935. }
  2936. };
  2937. const _withScopeId$b = (n2) => (vue.pushScopeId("data-v-386b43d0"), n2 = n2(), vue.popScopeId(), n2);
  2938. const _hoisted_1$g = {
  2939. key: 0,
  2940. class: "setting-modal modal"
  2941. };
  2942. const _hoisted_2$d = { class: "modal-root" };
  2943. const _hoisted_3$b = { class: "modal-header" };
  2944. const _hoisted_4$b = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 使用需知 ", -1));
  2945. const _hoisted_5$9 = { class: "body" };
  2946. const _hoisted_6$9 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "modal-content" }, [
  2947. /* @__PURE__ */ vue.createElementVNode("div", null, "开启此功能会带来以下影响"),
  2948. /* @__PURE__ */ vue.createElementVNode("div", null, "缺点"),
  2949. /* @__PURE__ */ vue.createElementVNode("div", { style: { "color": "red" } }, [
  2950. /* @__PURE__ */ vue.createElementVNode("div", null, "1、你的IP可能会被封禁"),
  2951. /* @__PURE__ */ vue.createElementVNode("div", null, "2、消耗更多流量,给服务器带来更大的负担"),
  2952. /* @__PURE__ */ vue.createElementVNode("div", null, "3、你的V站浏览进度条会变快")
  2953. ]),
  2954. /* @__PURE__ */ vue.createElementVNode("div", null, "优点"),
  2955. /* @__PURE__ */ vue.createElementVNode("div", null, "1、卡片模式,无需打开主题即可查看内容"),
  2956. /* @__PURE__ */ vue.createElementVNode("div", null, "2、打开主题时提前预览正文内容,无需等待加载"),
  2957. /* @__PURE__ */ vue.createElementVNode("div", null, "原理"),
  2958. /* @__PURE__ */ vue.createElementVNode("div", null, "1、解析列表所有主题ID,批量调用show.json接口,获取对应主题的正文"),
  2959. /* @__PURE__ */ vue.createElementVNode("div", null, "2、请求的主题数据会缓存到本地,不会重复请求,超过3天的数据会删除"),
  2960. /* @__PURE__ */ vue.createElementVNode("div", null, "3、前面4条会并发请求,4条以后的一秒请求一条")
  2961. ], -1));
  2962. const _hoisted_7$8 = { class: "btns" };
  2963. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2964. const _component_Icon = vue.resolveComponent("Icon");
  2965. const _component_BaseButton = vue.resolveComponent("BaseButton");
  2966. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  2967. default: vue.withCtx(() => [
  2968. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  2969. vue.createElementVNode("div", {
  2970. class: "mask",
  2971. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  2972. }),
  2973. vue.createElementVNode("div", _hoisted_2$d, [
  2974. vue.createElementVNode("div", _hoisted_3$b, [
  2975. _hoisted_4$b,
  2976. vue.createVNode(_component_Icon, {
  2977. icon: "ic:round-close",
  2978. onClick: $options.close
  2979. }, null, 8, ["onClick"])
  2980. ]),
  2981. vue.createElementVNode("div", _hoisted_5$9, [
  2982. _hoisted_6$9,
  2983. vue.createElementVNode("div", _hoisted_7$8, [
  2984. vue.createVNode(_component_BaseButton, {
  2985. type: "link",
  2986. onClick: $options.close
  2987. }, {
  2988. default: vue.withCtx(() => [
  2989. vue.createTextVNode("不同意")
  2990. ]),
  2991. _: 1
  2992. }, 8, ["onClick"]),
  2993. vue.createVNode(_component_BaseButton, { onClick: $options.confirm }, {
  2994. default: vue.withCtx(() => [
  2995. vue.createTextVNode("同意")
  2996. ]),
  2997. _: 1
  2998. }, 8, ["onClick"])
  2999. ])
  3000. ])
  3001. ])
  3002. ])) : vue.createCommentVNode("", true)
  3003. ]),
  3004. _: 1
  3005. });
  3006. }
  3007. const NoticeModal = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$9], ["__scopeId", "data-v-386b43d0"]]);
  3008. const _sfc_main$f = {
  3009. name: "Setting",
  3010. components: {
  3011. NoticeModal,
  3012. PopConfirm,
  3013. Icon,
  3014. BaseSelect,
  3015. BaseSwitch,
  3016. Tooltip
  3017. },
  3018. inject: ["isNight"],
  3019. props: {
  3020. modelValue: {
  3021. type: Object,
  3022. default() {
  3023. return {};
  3024. }
  3025. },
  3026. show: {
  3027. type: Boolean,
  3028. default() {
  3029. return false;
  3030. }
  3031. }
  3032. },
  3033. data() {
  3034. return {
  3035. tabIndex: 0,
  3036. config: window.clone(this.modelValue),
  3037. showNotice: false
  3038. };
  3039. },
  3040. computed: {
  3041. DefaultVal() {
  3042. return DefaultVal;
  3043. },
  3044. CommentDisplayType() {
  3045. return CommentDisplayType;
  3046. },
  3047. isNew() {
  3048. return this.config.version < DefaultVal.currentVersion;
  3049. }
  3050. },
  3051. watch: {
  3052. config: {
  3053. handler(n2) {
  3054. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  3055. if (n2.topReplyLoveMinCount < 0) {
  3056. n2.topReplyLoveMinCount = 1;
  3057. }
  3058. this.$emit("update:modelValue", n2);
  3059. },
  3060. deep: true
  3061. },
  3062. "config.loopCheckNotice"(n2) {
  3063. if (n2) {
  3064. this.config.loopCheckNoticeInterval = 5;
  3065. this.config.whenNewNoticeGlimmer = false;
  3066. } else {
  3067. this.config.loopCheckNoticeInterval = 0;
  3068. this.config.whenNewNoticeGlimmer = false;
  3069. this.config.ddWebhook = "";
  3070. }
  3071. },
  3072. show(n2) {
  3073. if (n2) {
  3074. document.body.style.overflow = "hidden";
  3075. } else {
  3076. document.body.style.overflow = "unset";
  3077. }
  3078. }
  3079. },
  3080. methods: {
  3081. close() {
  3082. if (this.config.version < DefaultVal.currentVersion) {
  3083. this.config.version = DefaultVal.currentVersion;
  3084. }
  3085. this.$emit("update:show", false);
  3086. }
  3087. }
  3088. };
  3089. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-9e40bff6"), n2 = n2(), vue.popScopeId(), n2);
  3090. const _hoisted_1$f = {
  3091. key: 0,
  3092. class: "setting-modal modal"
  3093. };
  3094. const _hoisted_2$c = { class: "modal-root" };
  3095. const _hoisted_3$a = { class: "modal-header" };
  3096. const _hoisted_4$a = { class: "title" };
  3097. const _hoisted_5$8 = { class: "small" };
  3098. const _hoisted_6$8 = ["href"];
  3099. const _hoisted_7$7 = { class: "body" };
  3100. const _hoisted_8$7 = { class: "left" };
  3101. const _hoisted_9$7 = { class: "tabs" };
  3102. const _hoisted_10$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "列表设置", -1));
  3103. const _hoisted_11$7 = [
  3104. _hoisted_10$7
  3105. ];
  3106. const _hoisted_12$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "主题设置", -1));
  3107. const _hoisted_13$6 = [
  3108. _hoisted_12$7
  3109. ];
  3110. const _hoisted_14$5 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "其他设置", -1));
  3111. const _hoisted_15$4 = [
  3112. _hoisted_14$5
  3113. ];
  3114. const _hoisted_16$4 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "关于脚本", -1));
  3115. const _hoisted_17$4 = [
  3116. _hoisted_16$4
  3117. ];
  3118. const _hoisted_18$4 = { class: "icons" };
  3119. const _hoisted_19$3 = ["href"];
  3120. const _hoisted_20$2 = ["href"];
  3121. const _hoisted_21$2 = { class: "modal-content" };
  3122. const _hoisted_22$2 = { class: "scroll" };
  3123. const _hoisted_23$2 = { key: 0 };
  3124. const _hoisted_24$2 = { class: "row" };
  3125. const _hoisted_25$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  3126. const _hoisted_26$1 = { class: "wrapper" };
  3127. const _hoisted_27$1 = { class: "radio-group2" };
  3128. const _hoisted_28$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3129. const _hoisted_29$1 = { class: "row" };
  3130. const _hoisted_30$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题弹框显示", -1));
  3131. const _hoisted_31$1 = { class: "wrapper" };
  3132. const _hoisted_32$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3133. /* @__PURE__ */ vue.createTextVNode(" 开启此选项后,主题会"),
  3134. /* @__PURE__ */ vue.createElementVNode("span", { class: "danger" }, "始终"),
  3135. /* @__PURE__ */ vue.createTextVNode("以弹框的方式显示。优先级大于“新标签页打开链接” ")
  3136. ], -1));
  3137. const _hoisted_33$1 = { class: "row" };
  3138. const _hoisted_34$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  3139. const _hoisted_35$1 = { class: "wrapper" };
  3140. const _hoisted_36$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  3141. const _hoisted_37$1 = { class: "row" };
  3142. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开新标签页时立即切换过去", -1));
  3143. const _hoisted_39$1 = { class: "wrapper" };
  3144. const _hoisted_40$1 = { key: 1 };
  3145. const _hoisted_41$1 = { class: "row" };
  3146. const _hoisted_42$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示回复展示方式", -1));
  3147. const _hoisted_43$1 = { class: "wrapper" };
  3148. const _hoisted_44$1 = { class: "row" };
  3149. const _hoisted_45$1 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  3150. const _hoisted_46$1 = { class: "wrapper" };
  3151. const _hoisted_47$1 = { class: "row" };
  3152. const _hoisted_48 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "单独打开主题时默认显示楼中楼", -1));
  3153. const _hoisted_49 = { class: "wrapper" };
  3154. const _hoisted_50 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 单独打开这种地址 https://v2ex.com/t/xxxx 时,是否默认显示楼中楼 ", -1));
  3155. const _hoisted_51 = { class: "row" };
  3156. const _hoisted_52 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "点击左右两侧透明处关闭主题详情弹框", -1));
  3157. const _hoisted_53 = { class: "wrapper" };
  3158. const _hoisted_54 = { class: "row" };
  3159. const _hoisted_55 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  3160. const _hoisted_56 = { class: "wrapper" };
  3161. const _hoisted_57 = { class: "row" };
  3162. const _hoisted_58 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题宽度", -1));
  3163. const _hoisted_59 = { class: "wrapper" };
  3164. const _hoisted_60 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3165. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则默认宽度为77rem。接受合法的width值: "),
  3166. /* @__PURE__ */ vue.createElementVNode("a", {
  3167. href: "https://vue3js.cn/interview/css/em_px_rem_vh_vw.html#%E4%BA%8C%E3%80%81%E5%8D%95%E4%BD%8D",
  3168. target: "_blank"
  3169. }, "rem、px、vw、vh(点此查看)"),
  3170. /* @__PURE__ */ vue.createTextVNode("。 vw代表屏幕百分比,如想要屏幕的66%,请填写66vw ")
  3171. ], -1));
  3172. const _hoisted_61 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 提示:此项设置以后,单独打开详情页时会出现主题突然变宽(窄)的问题,暂时无解 ", -1));
  3173. const _hoisted_62 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3174. const _hoisted_63 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3175. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  3176. ], -1));
  3177. const _hoisted_64 = { class: "row" };
  3178. const _hoisted_65 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  3179. const _hoisted_66 = { class: "wrapper" };
  3180. const _hoisted_67 = { class: "row" };
  3181. const _hoisted_68 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  3182. const _hoisted_69 = { class: "wrapper" };
  3183. const _hoisted_70 = { class: "row" };
  3184. const _hoisted_71 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  3185. const _hoisted_72 = { class: "wrapper" };
  3186. const _hoisted_73 = { key: 2 };
  3187. const _hoisted_74 = { class: "row" };
  3188. const _hoisted_75 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  3189. const _hoisted_76 = { class: "wrapper" };
  3190. const _hoisted_77 = { class: "row" };
  3191. const _hoisted_78 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  3192. const _hoisted_79 = { class: "wrapper" };
  3193. const _hoisted_80 = { class: "row" };
  3194. const _hoisted_81 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  3195. const _hoisted_82 = { class: "wrapper" };
  3196. const _hoisted_83 = { class: "row" };
  3197. const _hoisted_84 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自定义背景", -1));
  3198. const _hoisted_85 = { class: "wrapper" };
  3199. const _hoisted_86 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  3200. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则脚本就什么都不做,V站大部分页面背景颜色默认为 #e2e2e2,少部分页面有特定背景。接受一个合法的css color值:例如"),
  3201. /* @__PURE__ */ vue.createElementVNode("a", {
  3202. href: "https://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value",
  3203. target: "_blank"
  3204. }, "red、#ffffff、rgb(222,222,22)(点此查看)"),
  3205. /* @__PURE__ */ vue.createTextVNode("等等。 ")
  3206. ], -1));
  3207. const _hoisted_87 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3208. const _hoisted_88 = { class: "row" };
  3209. const _hoisted_89 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  3210. const _hoisted_90 = { class: "wrapper" };
  3211. const _hoisted_91 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录,无法查看账号收藏了 ", -1));
  3212. const _hoisted_92 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3213. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "消息通知")
  3214. ], -1));
  3215. const _hoisted_93 = { class: "row" };
  3216. const _hoisted_94 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "接管未读提醒页面", -1));
  3217. const _hoisted_95 = { class: "wrapper" };
  3218. const _hoisted_96 = { class: "row" };
  3219. const _hoisted_97 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "定时查询未读提醒", -1));
  3220. const _hoisted_98 = { class: "wrapper" };
  3221. const _hoisted_99 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此功能会带来以下影响: 1、你的IP可能会被封禁 2、消耗更多流量,给服务器带来更大的负担 3、你的V站浏览进度条会变快 ", -1));
  3222. const _hoisted_100 = {
  3223. key: 0,
  3224. class: "sub-content"
  3225. };
  3226. const _hoisted_101 = { class: "row" };
  3227. const _hoisted_102 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "查询间隔", -1));
  3228. const _hoisted_103 = { class: "wrapper" };
  3229. const _hoisted_104 = ["value"];
  3230. const _hoisted_105 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 设置值太小,会导致频繁请求,你的IP可能会被封禁,建议设置为5,即每次5分钟查询一次 ", -1));
  3231. const _hoisted_106 = { class: "row" };
  3232. const _hoisted_107 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "当有新未读提醒时,网页标题闪烁", -1));
  3233. const _hoisted_108 = { class: "wrapper" };
  3234. const _hoisted_109 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  3235. /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "钉钉Webhook地址")
  3236. ], -1));
  3237. const _hoisted_110 = { class: "desc" };
  3238. const _hoisted_111 = ["value"];
  3239. const _hoisted_112 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  3240. const _hoisted_113 = { key: 3 };
  3241. const _hoisted_114 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("h1", null, "V2EX Next", -1));
  3242. const _hoisted_115 = { class: "project-desc" };
  3243. const _hoisted_116 = { style: { "line-height": "2" } };
  3244. const _hoisted_117 = ["href"];
  3245. const _hoisted_118 = ["href"];
  3246. const _hoisted_119 = ["href"];
  3247. const _hoisted_120 = ["href"];
  3248. const _hoisted_121 = ["href"];
  3249. const _hoisted_122 = ["href"];
  3250. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  3251. const _component_Icon = vue.resolveComponent("Icon");
  3252. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  3253. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  3254. const _component_NoticeModal = vue.resolveComponent("NoticeModal");
  3255. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  3256. default: vue.withCtx(() => [
  3257. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
  3258. vue.createElementVNode("div", {
  3259. class: "mask",
  3260. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  3261. }),
  3262. vue.createElementVNode("div", _hoisted_2$c, [
  3263. vue.createElementVNode("div", _hoisted_3$a, [
  3264. vue.createElementVNode("div", _hoisted_4$a, [
  3265. vue.createTextVNode(" 脚本设置 "),
  3266. vue.createElementVNode("div", _hoisted_5$8, [
  3267. vue.createElementVNode("a", {
  3268. href: $options.DefaultVal.mobileScript,
  3269. target: "_blank"
  3270. }, "(脚本现已支持移动端!)", 8, _hoisted_6$8)
  3271. ])
  3272. ]),
  3273. vue.createVNode(_component_Icon, {
  3274. icon: "ic:round-close",
  3275. onClick: $options.close
  3276. }, null, 8, ["onClick"])
  3277. ]),
  3278. vue.createElementVNode("div", _hoisted_7$7, [
  3279. vue.createElementVNode("div", _hoisted_8$7, [
  3280. vue.createElementVNode("div", _hoisted_9$7, [
  3281. vue.createElementVNode("div", {
  3282. class: vue.normalizeClass(["tab", $data.tabIndex === 0 && "active"]),
  3283. onClick: _cache[1] || (_cache[1] = ($event) => $data.tabIndex = 0)
  3284. }, _hoisted_11$7, 2),
  3285. vue.createElementVNode("div", {
  3286. class: vue.normalizeClass(["tab", $data.tabIndex === 1 && "active"]),
  3287. onClick: _cache[2] || (_cache[2] = ($event) => $data.tabIndex = 1)
  3288. }, _hoisted_13$6, 2),
  3289. vue.createElementVNode("div", {
  3290. class: vue.normalizeClass(["tab", $data.tabIndex === 2 && "active"]),
  3291. onClick: _cache[3] || (_cache[3] = ($event) => $data.tabIndex = 2)
  3292. }, _hoisted_15$4, 2),
  3293. vue.createElementVNode("div", {
  3294. class: vue.normalizeClass(["tab", $data.tabIndex === 3 && "active"]),
  3295. onClick: _cache[4] || (_cache[4] = ($event) => $data.tabIndex = 3)
  3296. }, _hoisted_17$4, 2)
  3297. ]),
  3298. vue.createElementVNode("div", _hoisted_18$4, [
  3299. vue.createElementVNode("a", {
  3300. href: $options.DefaultVal.git,
  3301. target: "_blank"
  3302. }, [
  3303. vue.createVNode(_component_Icon, { icon: "mdi:github" })
  3304. ], 8, _hoisted_19$3),
  3305. vue.createElementVNode("a", {
  3306. href: $options.DefaultVal.homeUrl,
  3307. target: "_blank"
  3308. }, [
  3309. vue.createVNode(_component_Icon, { icon: "iconamoon:home-light" })
  3310. ], 8, _hoisted_20$2)
  3311. ])
  3312. ]),
  3313. vue.createElementVNode("div", _hoisted_21$2, [
  3314. vue.createElementVNode("div", _hoisted_22$2, [
  3315. $data.tabIndex === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_23$2, [
  3316. vue.createElementVNode("div", _hoisted_24$2, [
  3317. _hoisted_25$1,
  3318. vue.createElementVNode("div", _hoisted_26$1, [
  3319. vue.createElementVNode("div", _hoisted_27$1, [
  3320. vue.createElementVNode("div", {
  3321. class: vue.normalizeClass(["radio", $data.config.viewType === "simple" ? "active" : ""]),
  3322. onClick: _cache[5] || (_cache[5] = ($event) => $data.config.viewType = "simple")
  3323. }, "简洁 ", 2),
  3324. vue.createElementVNode("div", {
  3325. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  3326. onClick: _cache[6] || (_cache[6] = ($event) => $data.config.viewType = "table")
  3327. }, "表格 ", 2),
  3328. vue.createElementVNode("div", {
  3329. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  3330. onClick: _cache[7] || (_cache[7] = ($event) => $data.showNotice = true)
  3331. }, "卡片 ", 2)
  3332. ])
  3333. ])
  3334. ]),
  3335. _hoisted_28$1,
  3336. vue.createElementVNode("div", _hoisted_29$1, [
  3337. _hoisted_30$1,
  3338. vue.createElementVNode("div", _hoisted_31$1, [
  3339. vue.createVNode(_component_BaseSwitch, {
  3340. modelValue: $data.config.clickPostItemOpenDetail,
  3341. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  3342. }, null, 8, ["modelValue"])
  3343. ])
  3344. ]),
  3345. _hoisted_32$1,
  3346. vue.createElementVNode("div", _hoisted_33$1, [
  3347. _hoisted_34$1,
  3348. vue.createElementVNode("div", _hoisted_35$1, [
  3349. vue.createVNode(_component_BaseSwitch, {
  3350. modelValue: $data.config.newTabOpen,
  3351. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.newTabOpen = $event)
  3352. }, null, 8, ["modelValue"])
  3353. ])
  3354. ]),
  3355. _hoisted_36$1,
  3356. vue.createElementVNode("div", _hoisted_37$1, [
  3357. _hoisted_38$1,
  3358. vue.createElementVNode("div", _hoisted_39$1, [
  3359. vue.createVNode(_component_BaseSwitch, {
  3360. modelValue: $data.config.newTabOpenActive,
  3361. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.config.newTabOpenActive = $event)
  3362. }, null, 8, ["modelValue"])
  3363. ])
  3364. ])
  3365. ])) : vue.createCommentVNode("", true),
  3366. $data.tabIndex === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40$1, [
  3367. vue.createElementVNode("div", _hoisted_41$1, [
  3368. _hoisted_42$1,
  3369. vue.createElementVNode("div", _hoisted_43$1, [
  3370. vue.createVNode(_component_BaseSwitch, {
  3371. modelValue: $data.config.showToolbar,
  3372. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.showToolbar = $event)
  3373. }, null, 8, ["modelValue"])
  3374. ])
  3375. ]),
  3376. vue.createElementVNode("div", _hoisted_44$1, [
  3377. _hoisted_45$1,
  3378. vue.createElementVNode("div", _hoisted_46$1, [
  3379. vue.createVNode(_component_BaseSelect, {
  3380. "display-type": $data.config.commentDisplayType,
  3381. "onUpdate:displayType": _cache[12] || (_cache[12] = ($event) => $data.config.commentDisplayType = $event)
  3382. }, null, 8, ["display-type"])
  3383. ])
  3384. ]),
  3385. vue.createElementVNode("div", _hoisted_47$1, [
  3386. _hoisted_48,
  3387. vue.createElementVNode("div", _hoisted_49, [
  3388. vue.createVNode(_component_BaseSwitch, {
  3389. modelValue: $data.config.autoOpenDetail,
  3390. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.autoOpenDetail = $event)
  3391. }, null, 8, ["modelValue"])
  3392. ])
  3393. ]),
  3394. _hoisted_50,
  3395. vue.createElementVNode("div", _hoisted_51, [
  3396. _hoisted_52,
  3397. vue.createElementVNode("div", _hoisted_53, [
  3398. vue.createVNode(_component_BaseSwitch, {
  3399. modelValue: $data.config.closePostDetailBySpace,
  3400. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.closePostDetailBySpace = $event)
  3401. }, null, 8, ["modelValue"])
  3402. ])
  3403. ]),
  3404. vue.createElementVNode("div", _hoisted_54, [
  3405. _hoisted_55,
  3406. vue.createElementVNode("div", _hoisted_56, [
  3407. vue.createVNode(_component_BaseSwitch, {
  3408. modelValue: $data.config.contentAutoCollapse,
  3409. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.contentAutoCollapse = $event)
  3410. }, null, 8, ["modelValue"])
  3411. ])
  3412. ]),
  3413. vue.createElementVNode("div", _hoisted_57, [
  3414. _hoisted_58,
  3415. vue.createElementVNode("div", _hoisted_59, [
  3416. vue.withDirectives(vue.createElementVNode("input", {
  3417. type: "text",
  3418. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.config.postWidth = $event)
  3419. }, null, 512), [
  3420. [vue.vModelText, $data.config.postWidth]
  3421. ])
  3422. ])
  3423. ]),
  3424. _hoisted_60,
  3425. _hoisted_61,
  3426. _hoisted_62,
  3427. _hoisted_63,
  3428. vue.createElementVNode("div", _hoisted_64, [
  3429. _hoisted_65,
  3430. vue.createElementVNode("div", _hoisted_66, [
  3431. vue.createVNode(_component_BaseSwitch, {
  3432. modelValue: $data.config.showTopReply,
  3433. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => $data.config.showTopReply = $event)
  3434. }, null, 8, ["modelValue"])
  3435. ])
  3436. ]),
  3437. vue.createElementVNode("div", _hoisted_67, [
  3438. _hoisted_68,
  3439. vue.createElementVNode("div", _hoisted_69, [
  3440. vue.withDirectives(vue.createElementVNode("input", {
  3441. type: "number",
  3442. min: "1",
  3443. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.config.topReplyCount = $event)
  3444. }, null, 512), [
  3445. [vue.vModelText, $data.config.topReplyCount]
  3446. ])
  3447. ])
  3448. ]),
  3449. vue.createElementVNode("div", _hoisted_70, [
  3450. _hoisted_71,
  3451. vue.createElementVNode("div", _hoisted_72, [
  3452. vue.withDirectives(vue.createElementVNode("input", {
  3453. type: "number",
  3454. min: "1",
  3455. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.config.topReplyLoveMinCount = $event)
  3456. }, null, 512), [
  3457. [vue.vModelText, $data.config.topReplyLoveMinCount]
  3458. ])
  3459. ])
  3460. ])
  3461. ])) : vue.createCommentVNode("", true),
  3462. $data.tabIndex === 2 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_73, [
  3463. vue.createElementVNode("div", _hoisted_74, [
  3464. _hoisted_75,
  3465. vue.createElementVNode("div", _hoisted_76, [
  3466. vue.createVNode(_component_BaseSwitch, {
  3467. modelValue: $data.config.openTag,
  3468. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => $data.config.openTag = $event)
  3469. }, null, 8, ["modelValue"])
  3470. ])
  3471. ]),
  3472. vue.createElementVNode("div", _hoisted_77, [
  3473. _hoisted_78,
  3474. vue.createElementVNode("div", _hoisted_79, [
  3475. vue.createVNode(_component_BaseSwitch, {
  3476. modelValue: $data.config.base64,
  3477. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => $data.config.base64 = $event)
  3478. }, null, 8, ["modelValue"])
  3479. ])
  3480. ]),
  3481. vue.createElementVNode("div", _hoisted_80, [
  3482. _hoisted_81,
  3483. vue.createElementVNode("div", _hoisted_82, [
  3484. vue.createVNode(_component_BaseSwitch, {
  3485. modelValue: $data.config.autoSignin,
  3486. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.config.autoSignin = $event)
  3487. }, null, 8, ["modelValue"])
  3488. ])
  3489. ]),
  3490. vue.createElementVNode("div", _hoisted_83, [
  3491. _hoisted_84,
  3492. vue.createElementVNode("div", _hoisted_85, [
  3493. vue.withDirectives(vue.createElementVNode("input", {
  3494. type: "text",
  3495. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $data.config.customBgColor = $event)
  3496. }, null, 512), [
  3497. [vue.vModelText, $data.config.customBgColor]
  3498. ])
  3499. ])
  3500. ]),
  3501. _hoisted_86,
  3502. _hoisted_87,
  3503. vue.createElementVNode("div", _hoisted_88, [
  3504. _hoisted_89,
  3505. vue.createElementVNode("div", _hoisted_90, [
  3506. vue.createVNode(_component_BaseSwitch, {
  3507. modelValue: $data.config.collectBrowserNotice,
  3508. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => $data.config.collectBrowserNotice = $event)
  3509. }, null, 8, ["modelValue"])
  3510. ])
  3511. ]),
  3512. _hoisted_91,
  3513. _hoisted_92,
  3514. vue.createElementVNode("div", _hoisted_93, [
  3515. _hoisted_94,
  3516. vue.createElementVNode("div", _hoisted_95, [
  3517. vue.createVNode(_component_BaseSwitch, {
  3518. modelValue: $data.config.notice.takeOverNoticePage,
  3519. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => $data.config.notice.takeOverNoticePage = $event)
  3520. }, null, 8, ["modelValue"])
  3521. ])
  3522. ]),
  3523. vue.createElementVNode("div", _hoisted_96, [
  3524. _hoisted_97,
  3525. vue.createElementVNode("div", _hoisted_98, [
  3526. vue.createVNode(_component_BaseSwitch, {
  3527. modelValue: $data.config.notice.loopCheckNotice,
  3528. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => $data.config.notice.loopCheckNotice = $event)
  3529. }, null, 8, ["modelValue"])
  3530. ])
  3531. ]),
  3532. _hoisted_99,
  3533. $data.config.notice.loopCheckNotice ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_100, [
  3534. vue.createElementVNode("div", _hoisted_101, [
  3535. _hoisted_102,
  3536. vue.createElementVNode("div", _hoisted_103, [
  3537. vue.createElementVNode("input", {
  3538. type: "number",
  3539. value: $data.config.notice.loopCheckNoticeInterval,
  3540. onBlur: _cache[27] || (_cache[27] = (e2) => $data.config.notice.loopCheckNoticeInterval = e2.target.value),
  3541. style: { "margin-right": "1rem" }
  3542. }, null, 40, _hoisted_104),
  3543. vue.createTextVNode("分钟 ")
  3544. ])
  3545. ]),
  3546. _hoisted_105,
  3547. vue.createElementVNode("div", _hoisted_106, [
  3548. _hoisted_107,
  3549. vue.createElementVNode("div", _hoisted_108, [
  3550. vue.createVNode(_component_BaseSwitch, {
  3551. modelValue: $data.config.notice.whenNewNoticeGlimmer,
  3552. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => $data.config.notice.whenNewNoticeGlimmer = $event)
  3553. }, null, 8, ["modelValue"])
  3554. ])
  3555. ]),
  3556. _hoisted_109,
  3557. vue.createElementVNode("div", _hoisted_110, [
  3558. vue.createElementVNode("input", {
  3559. type: "text",
  3560. value: $data.config.notice.ddWebhook,
  3561. onBlur: _cache[29] || (_cache[29] = (e2) => $data.config.notice.ddWebhook = e2.target.value),
  3562. style: { "width": "100%" }
  3563. }, null, 40, _hoisted_111)
  3564. ])
  3565. ])) : vue.createCommentVNode("", true),
  3566. _hoisted_112
  3567. ])) : vue.createCommentVNode("", true),
  3568. $data.tabIndex === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_113, [
  3569. _hoisted_114,
  3570. vue.createElementVNode("div", _hoisted_115, [
  3571. vue.createElementVNode("div", _hoisted_116, [
  3572. vue.createElementVNode("div", null, [
  3573. vue.createTextVNode("官网:"),
  3574. vue.createElementVNode("a", {
  3575. href: $options.DefaultVal.homeUrl,
  3576. target: "_blank"
  3577. }, vue.toDisplayString($options.DefaultVal.homeUrl), 9, _hoisted_117)
  3578. ]),
  3579. vue.createElementVNode("div", null, [
  3580. vue.createTextVNode("GitHub地址:"),
  3581. vue.createElementVNode("a", {
  3582. href: $options.DefaultVal.git,
  3583. target: "_blank"
  3584. }, vue.toDisplayString($options.DefaultVal.git), 9, _hoisted_118)
  3585. ]),
  3586. vue.createElementVNode("div", null, [
  3587. vue.createTextVNode("PC脚本地址:"),
  3588. vue.createElementVNode("a", {
  3589. href: $options.DefaultVal.pcScript,
  3590. target: "_blank"
  3591. }, vue.toDisplayString($options.DefaultVal.pcScript), 9, _hoisted_119)
  3592. ]),
  3593. vue.createElementVNode("div", null, [
  3594. vue.createTextVNode("移动端脚本地址:"),
  3595. vue.createElementVNode("a", {
  3596. href: $options.DefaultVal.mobileScript,
  3597. target: "_blank"
  3598. }, vue.toDisplayString($options.DefaultVal.mobileScript), 9, _hoisted_120)
  3599. ]),
  3600. vue.createElementVNode("div", null, [
  3601. vue.createTextVNode("反馈: "),
  3602. vue.createElementVNode("a", {
  3603. href: $options.DefaultVal.issue,
  3604. target: "_blank"
  3605. }, vue.toDisplayString($options.DefaultVal.issue), 9, _hoisted_121)
  3606. ]),
  3607. vue.createElementVNode("div", null, [
  3608. vue.createTextVNode("更新日志:"),
  3609. vue.createElementVNode("a", {
  3610. href: $options.DefaultVal.pcLog,
  3611. target: "_blank"
  3612. }, vue.toDisplayString($options.DefaultVal.pcLog), 9, _hoisted_122)
  3613. ])
  3614. ])
  3615. ])
  3616. ])) : vue.createCommentVNode("", true)
  3617. ])
  3618. ])
  3619. ])
  3620. ]),
  3621. vue.createVNode(_component_NoticeModal, {
  3622. show: $data.showNotice,
  3623. "onUpdate:show": _cache[30] || (_cache[30] = ($event) => $data.showNotice = $event),
  3624. onConfirm: _cache[31] || (_cache[31] = ($event) => $data.config.viewType = "card")
  3625. }, null, 8, ["show"])
  3626. ])) : vue.createCommentVNode("", true)
  3627. ]),
  3628. _: 1
  3629. });
  3630. }
  3631. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$8], ["__scopeId", "data-v-9e40bff6"]]);
  3632. const _sfc_main$e = {
  3633. name: "Point",
  3634. components: { PopConfirm, Icon },
  3635. inject: ["post", "isLogin"],
  3636. props: {
  3637. item: {
  3638. type: Object,
  3639. default() {
  3640. return {};
  3641. }
  3642. },
  3643. apiUrl: ""
  3644. },
  3645. computed: {
  3646. disabled() {
  3647. return this.item.username === window.user.username || this.item.isThanked || !this.isLogin;
  3648. }
  3649. },
  3650. methods: {
  3651. thankError() {
  3652. if (!this.isLogin) {
  3653. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3654. }
  3655. if (this.item.username === window.user.username) {
  3656. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  3657. }
  3658. if (this.item.isThanked) {
  3659. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  3660. }
  3661. },
  3662. async thank() {
  3663. this.$emit("addThank");
  3664. let url = `${location.origin}/thank/${this.apiUrl}?once=${this.post.once}`;
  3665. $.post(url).then((res) => {
  3666. if (!res.success) {
  3667. this.$emit("recallThank");
  3668. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  3669. }
  3670. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  3671. }, (err) => {
  3672. this.$emit("recallThank");
  3673. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  3674. eventBus.emit(CMD.REFRESH_ONCE);
  3675. });
  3676. }
  3677. }
  3678. };
  3679. const _hoisted_1$e = {
  3680. key: 2,
  3681. class: "link-num"
  3682. };
  3683. const _hoisted_2$b = { key: 3 };
  3684. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  3685. const _component_Icon = vue.resolveComponent("Icon");
  3686. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3687. return vue.openBlock(), vue.createBlock(_component_PopConfirm, {
  3688. disabled: $options.disabled,
  3689. title: `确认花费 10 个铜币向 @${$props.item.username} 的这条回复发送感谢?`,
  3690. onConfirm: $options.thank
  3691. }, {
  3692. default: vue.withCtx(() => [
  3693. vue.createElementVNode("div", {
  3694. class: vue.normalizeClass(["tool", [$options.disabled && "disabled"]]),
  3695. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  3696. }, [
  3697. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3698. key: 0,
  3699. color: "rgb(224,42,42)",
  3700. icon: "icon-park-solid:like"
  3701. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  3702. key: 1,
  3703. color: !$props.item.thankCount ? null : "rgb(224,42,42)",
  3704. icon: "icon-park-outline:like"
  3705. }, null, 8, ["color"])),
  3706. $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, "感谢"))
  3707. ], 2)
  3708. ]),
  3709. _: 1
  3710. }, 8, ["disabled", "title", "onConfirm"]);
  3711. }
  3712. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$7]]);
  3713. const _sfc_main$d = {
  3714. name: "Author",
  3715. components: { PopConfirm, Point, Icon },
  3716. inject: ["isLogin", "tags", "config", "isNight"],
  3717. props: {
  3718. modelValue: false,
  3719. comment: {
  3720. type: Object,
  3721. default() {
  3722. return {};
  3723. }
  3724. },
  3725. type: {
  3726. type: String,
  3727. default() {
  3728. return "list";
  3729. }
  3730. }
  3731. },
  3732. computed: {
  3733. isDev() {
  3734. return false;
  3735. },
  3736. pointInfo() {
  3737. return {
  3738. isThanked: this.comment.isThanked,
  3739. thankCount: this.comment.thankCount,
  3740. username: this.comment.username
  3741. };
  3742. },
  3743. myTags() {
  3744. return this.tags[this.comment.username] ?? [];
  3745. },
  3746. context() {
  3747. return this.comment.replyUsers.length;
  3748. }
  3749. },
  3750. methods: {
  3751. jump() {
  3752. eventBus.emit(CMD.JUMP, this.comment.floor);
  3753. },
  3754. showRelationReply() {
  3755. if (!this.comment.replyUsers.length) {
  3756. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  3757. return;
  3758. }
  3759. eventBus.emit(CMD.RELATION_REPLY, {
  3760. left: this.comment.replyUsers,
  3761. right: this.comment.username,
  3762. rightFloor: this.comment.floor
  3763. });
  3764. },
  3765. addTag() {
  3766. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  3767. },
  3768. removeTag(tag) {
  3769. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  3770. },
  3771. checkIsLogin(emitName = "") {
  3772. if (!this.isLogin) {
  3773. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3774. return false;
  3775. }
  3776. this.$emit(emitName);
  3777. return true;
  3778. },
  3779. addThank() {
  3780. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  3781. },
  3782. recallThank() {
  3783. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  3784. }
  3785. }
  3786. };
  3787. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-64aa1930"), n2 = n2(), vue.popScopeId(), n2);
  3788. const _hoisted_1$d = { class: "Author-left" };
  3789. const _hoisted_2$a = ["href"];
  3790. const _hoisted_3$9 = ["src"];
  3791. const _hoisted_4$9 = { class: "texts" };
  3792. const _hoisted_5$7 = ["href"];
  3793. const _hoisted_6$7 = {
  3794. key: 0,
  3795. class: "owner"
  3796. };
  3797. const _hoisted_7$6 = {
  3798. key: 1,
  3799. class: "dup"
  3800. };
  3801. const _hoisted_8$6 = {
  3802. key: 2,
  3803. class: "mod"
  3804. };
  3805. const _hoisted_9$6 = { class: "ago" };
  3806. const _hoisted_10$6 = { class: "my-tag" };
  3807. const _hoisted_11$6 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3808. const _hoisted_12$6 = ["onClick"];
  3809. const _hoisted_13$5 = { class: "Author-right" };
  3810. const _hoisted_14$4 = {
  3811. key: 0,
  3812. class: "toolbar"
  3813. };
  3814. const _hoisted_15$3 = { class: "tool" };
  3815. const _hoisted_16$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "隐藏", -1));
  3816. const _hoisted_17$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  3817. const _hoisted_18$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  3818. const _hoisted_19$2 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  3819. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  3820. const _component_Icon = vue.resolveComponent("Icon");
  3821. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3822. const _component_Point = vue.resolveComponent("Point");
  3823. return vue.openBlock(), vue.createElementBlock("div", {
  3824. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  3825. }, [
  3826. vue.createElementVNode("div", _hoisted_1$d, [
  3827. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3828. key: 0,
  3829. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.$emit("update:modelValue", true), ["stop"])),
  3830. color: "#177EC9",
  3831. class: "expand-icon",
  3832. icon: "gravity-ui:chevrons-expand-up-right"
  3833. })) : vue.createCommentVNode("", true),
  3834. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  3835. key: 1,
  3836. class: "avatar",
  3837. href: `/member/${$props.comment.username}`
  3838. }, [
  3839. vue.createElementVNode("img", {
  3840. src: $props.comment.avatar,
  3841. alt: ""
  3842. }, null, 8, _hoisted_3$9)
  3843. ], 8, _hoisted_2$a)) : vue.createCommentVNode("", true),
  3844. vue.createElementVNode("span", _hoisted_4$9, [
  3845. vue.createElementVNode("strong", null, [
  3846. vue.createElementVNode("a", {
  3847. href: `/member/${$props.comment.username}`,
  3848. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  3849. }, vue.toDisplayString($props.comment.username), 11, _hoisted_5$7)
  3850. ]),
  3851. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$7, "OP")) : vue.createCommentVNode("", true),
  3852. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$6, "DUP")) : vue.createCommentVNode("", true),
  3853. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$6, "MOD")) : vue.createCommentVNode("", true),
  3854. vue.createElementVNode("span", _hoisted_9$6, vue.toDisplayString($props.comment.date), 1),
  3855. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  3856. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3857. return vue.openBlock(), vue.createElementBlock("span", _hoisted_10$6, [
  3858. _hoisted_11$6,
  3859. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3860. vue.createElementVNode("i", {
  3861. class: "fa fa-trash-o remove",
  3862. onClick: vue.withModifiers(($event) => $options.removeTag(i), ["stop"])
  3863. }, null, 8, _hoisted_12$6)
  3864. ]);
  3865. }), 256)),
  3866. vue.createElementVNode("span", {
  3867. class: "add-tag ago",
  3868. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.addTag && $options.addTag(...args), ["stop"])),
  3869. title: "添加标签"
  3870. }, "+")
  3871. ], 64)) : vue.createCommentVNode("", true)
  3872. ])
  3873. ]),
  3874. vue.createElementVNode("div", _hoisted_13$5, [
  3875. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$4, [
  3876. vue.createVNode(_component_PopConfirm, {
  3877. title: "确认隐藏这条回复?",
  3878. onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
  3879. }, {
  3880. default: vue.withCtx(() => [
  3881. vue.createElementVNode("div", _hoisted_15$3, [
  3882. vue.createVNode(_component_Icon, { icon: "fluent:eye-hide-24-regular" }),
  3883. _hoisted_16$3
  3884. ])
  3885. ]),
  3886. _: 1
  3887. }),
  3888. $options.context ? (vue.openBlock(), vue.createElementBlock("div", {
  3889. key: 0,
  3890. class: "tool",
  3891. onClick: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.showRelationReply && $options.showRelationReply(...args), ["stop"]))
  3892. }, [
  3893. vue.createVNode(_component_Icon, { icon: "iconoir:page-search" }),
  3894. _hoisted_17$3
  3895. ])) : vue.createCommentVNode("", true),
  3896. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  3897. key: 1,
  3898. class: "tool",
  3899. onClick: _cache[4] || (_cache[4] = vue.withModifiers((...args) => $options.jump && $options.jump(...args), ["stop"]))
  3900. }, [
  3901. vue.createVNode(_component_Icon, { icon: "icon-park-outline:to-bottom" }),
  3902. _hoisted_18$3
  3903. ])) : vue.createCommentVNode("", true),
  3904. vue.createElementVNode("div", {
  3905. class: "tool",
  3906. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => $options.checkIsLogin("reply"), ["stop"]))
  3907. }, [
  3908. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  3909. _hoisted_19$2
  3910. ]),
  3911. vue.withDirectives(vue.createVNode(_component_Point, {
  3912. item: $options.pointInfo,
  3913. onAddThank: $options.addThank,
  3914. onRecallThank: $options.recallThank,
  3915. "api-url": "reply/" + $props.comment.id
  3916. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3917. [vue.vShow, !$props.comment.thankCount]
  3918. ])
  3919. ])) : vue.createCommentVNode("", true),
  3920. vue.withDirectives(vue.createVNode(_component_Point, {
  3921. item: $options.pointInfo,
  3922. onAddThank: $options.addThank,
  3923. onRecallThank: $options.recallThank,
  3924. "api-url": "reply/" + $props.comment.id
  3925. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3926. [vue.vShow, $props.comment.thankCount]
  3927. ]),
  3928. vue.createElementVNode("div", {
  3929. class: vue.normalizeClass(["floor", { isDev: $options.isDev }])
  3930. }, vue.toDisplayString($props.comment.floor), 3)
  3931. ])
  3932. ], 2);
  3933. }
  3934. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$6], ["__scopeId", "data-v-64aa1930"]]);
  3935. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-7fe2eb8d"), n2 = n2(), vue.popScopeId(), n2);
  3936. const _hoisted_1$c = { class: "get-cursor" };
  3937. const _hoisted_2$9 = ["innerHTML"];
  3938. const _hoisted_3$8 = { class: "toolbar" };
  3939. const _hoisted_4$8 = { class: "left" };
  3940. const _hoisted_5$6 = { class: "upload" };
  3941. const _hoisted_6$6 = {
  3942. key: 0,
  3943. style: { "color": "black", "font-size": "1.4rem" }
  3944. };
  3945. const _hoisted_7$5 = { class: "right" };
  3946. const _hoisted_8$5 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典", -1));
  3947. const _hoisted_9$5 = { class: "list" };
  3948. const _hoisted_10$5 = ["src", "onClick"];
  3949. const _hoisted_11$5 = { class: "emoji" };
  3950. const _hoisted_12$5 = { class: "title" };
  3951. const _hoisted_13$4 = { class: "list" };
  3952. const _hoisted_14$3 = ["onClick"];
  3953. const _sfc_main$c = {
  3954. __name: "PostEditor",
  3955. props: {
  3956. replyUser: null,
  3957. replyFloor: null,
  3958. useType: {
  3959. type: String,
  3960. default() {
  3961. return "reply-comment";
  3962. }
  3963. }
  3964. },
  3965. emits: ["close"],
  3966. setup(__props, { expose: __expose, emit: __emit }) {
  3967. const props = __props;
  3968. const { replyUser, replyFloor, useType } = props;
  3969. const replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3970. const emits = __emit;
  3971. const post = vue.inject("post");
  3972. const show = vue.inject("show");
  3973. const isNight = vue.inject("isNight");
  3974. vue.inject("pageType");
  3975. const allReplyUsers = vue.inject("allReplyUsers");
  3976. let isFocus = vue.ref(false);
  3977. const loading = vue.ref(false);
  3978. const uploadLoading = vue.ref(false);
  3979. const isShowEmoticons = vue.ref(false);
  3980. const editorId = vue.ref("editorId_" + Date.now());
  3981. const content = vue.ref(replyInfo);
  3982. const txtRef = vue.ref(null);
  3983. const cursorRef = vue.ref(null);
  3984. const emoticonsRef = vue.ref(null);
  3985. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  3986. const imgurClientIdPool = [
  3987. "3107b9ef8b316f3",
  3988. "442b04f26eefc8a",
  3989. "59cfebe717c09e4",
  3990. "60605aad4a62882",
  3991. "6c65ab1d3f5452a",
  3992. "83e123737849aa9",
  3993. "9311f6be1c10160",
  3994. "c4a4a563f698595",
  3995. "81be04b9e4a08ce"
  3996. ];
  3997. __expose({ content, isFocus: () => isFocus.value });
  3998. const editorClass = vue.computed(() => {
  3999. return [useType, isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  4000. });
  4001. const cursorHtml = vue.computed(() => {
  4002. var _a;
  4003. if (!txtRef.value || !content.value)
  4004. return "";
  4005. let index = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  4006. return content.value.substring(0, index).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  4007. });
  4008. const disabled = vue.computed(() => {
  4009. if (content.value) {
  4010. return content.value === replyInfo;
  4011. } else {
  4012. return true;
  4013. }
  4014. });
  4015. function drop(e2) {
  4016. e2.preventDefault();
  4017. upload(e2.dataTransfer.files[0]);
  4018. }
  4019. async function upload(file) {
  4020. if (!file)
  4021. return;
  4022. if (uploadLoading.value)
  4023. return;
  4024. uploadLoading.value = true;
  4025. const formData = new FormData();
  4026. formData.append("image", file);
  4027. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  4028. const clidenId = imgurClientIdPool[randomIndex];
  4029. const res = await fetch("https://api.imgur.com/3/upload", {
  4030. method: "POST",
  4031. headers: { Authorization: `Client-ID ${clidenId}` },
  4032. body: formData
  4033. });
  4034. uploadLoading.value = false;
  4035. if (res.ok) {
  4036. const resData = await res.json();
  4037. if (resData.success) {
  4038. return insert(" " + resData.data.link + " ");
  4039. }
  4040. }
  4041. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  4042. }
  4043. async function submit() {
  4044. if (disabled.value || loading.value)
  4045. return;
  4046. loading.value = true;
  4047. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  4048. let item2 = classicsEmoticons.find((v) => v.name === match);
  4049. if (item2) {
  4050. return item2.low + " ";
  4051. }
  4052. return match;
  4053. });
  4054. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  4055. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  4056. });
  4057. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  4058. let item2 = classicsEmoticons.find((v) => v.name === match);
  4059. if (item2) {
  4060. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  4061. }
  4062. return match;
  4063. });
  4064. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  4065. if (matchUsers) {
  4066. matchUsers.map((i) => {
  4067. let username = i.replace("@", "").replace(" ", "");
  4068. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  4069. });
  4070. }
  4071. show_content = show_content.replaceAll("\n", "<br/>");
  4072. let item = {
  4073. thankCount: 0,
  4074. isThanked: false,
  4075. isOp: post.value.username === window.user.username,
  4076. isDup: false,
  4077. id: Date.now(),
  4078. username: window.user.username,
  4079. avatar: window.user.avatar,
  4080. date: "几秒前",
  4081. floor: post.value.replyCount + 1,
  4082. reply_content: show_content ?? "",
  4083. children: [],
  4084. replyUsers: replyUser ? [replyUser] : [],
  4085. replyFloor: replyFloor || -1,
  4086. level: useType === "reply-comment" ? 1 : 0
  4087. };
  4088. item.hideCallUserReplyContent = item.reply_content;
  4089. if (item.replyUsers.length === 1) {
  4090. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  4091. }
  4092. let url = `${location.origin}/t/${post.value.id}`;
  4093. $.post(url, { content: submit_content, once: post.value.once }).then(
  4094. // $.post(url, {content: submit_content, once: 123}).then(
  4095. (res) => {
  4096. loading.value = false;
  4097. let r2 = res.search("你上一条回复的内容和这条相同");
  4098. if (r2 > -1)
  4099. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  4100. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  4101. if (r2 > -1)
  4102. return eventBus.emit(CMD.SHOW_MSG, {
  4103. type: "error",
  4104. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  4105. });
  4106. let r22 = res.search("创建新回复");
  4107. if (r22 > -1) {
  4108. eventBus.emit(CMD.REFRESH_ONCE, res);
  4109. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  4110. let clientWidth = window.document.body.clientWidth;
  4111. let windowWidth = 1200;
  4112. let left = clientWidth / 2 - windowWidth / 2;
  4113. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  4114. newWin.document.write(res);
  4115. let loop = setInterval(function() {
  4116. if (newWin.closed) {
  4117. clearInterval(loop);
  4118. eventBus.emit(CMD.REFRESH_POST);
  4119. }
  4120. }, 1e3);
  4121. return;
  4122. }
  4123. content.value = replyInfo;
  4124. emits("close");
  4125. eventBus.emit(CMD.REFRESH_ONCE, res);
  4126. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  4127. eventBus.emit(CMD.ADD_REPLY, item);
  4128. },
  4129. (err) => {
  4130. loading.value = false;
  4131. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  4132. }
  4133. ).catch((r2) => {
  4134. });
  4135. }
  4136. function showEmoticons(e2) {
  4137. if (isShowEmoticons.value) {
  4138. return isShowEmoticons.value = false;
  4139. }
  4140. let rect = e2.currentTarget.getBoundingClientRect();
  4141. emoticonsRef.value.style.left = rect.left + 30 + "px";
  4142. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  4143. isShowEmoticons.value = true;
  4144. }
  4145. function off() {
  4146. eventBus.emit(CMD.SHOW_CALL, { show: false });
  4147. eventBus.off(CMD.SET_CALL);
  4148. }
  4149. function checkHeight2() {
  4150. txtRef.value.style.height = 0;
  4151. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  4152. }
  4153. function insert(str) {
  4154. let cursorPos = txtRef.value.selectionStart;
  4155. let start = content.value.slice(0, cursorPos);
  4156. let end = content.value.slice(cursorPos, content.value.length);
  4157. content.value = start + str + end;
  4158. let moveCursorPos = start.length + str.length;
  4159. setTimeout(() => {
  4160. txtRef.value.focus();
  4161. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  4162. checkHeight2();
  4163. });
  4164. }
  4165. function showCallPopover(text) {
  4166. let r2 = cursorRef.value.getBoundingClientRect();
  4167. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  4168. eventBus.off(CMD.SET_CALL);
  4169. eventBus.on(CMD.SET_CALL, (e2) => {
  4170. let cursorPos = txtRef.value.selectionStart;
  4171. let start = content.value.slice(0, cursorPos);
  4172. let end = content.value.slice(cursorPos, content.value.length);
  4173. let lastCallPos = start.lastIndexOf("@");
  4174. start = content.value.slice(0, lastCallPos + 1);
  4175. if (e2 === "管理员") {
  4176. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid @drymonfidelia";
  4177. }
  4178. if (e2 === "所有人") {
  4179. e2 = allReplyUsers.value.map((v, i) => {
  4180. if (i)
  4181. return "@" + v;
  4182. else
  4183. return v;
  4184. }).join(" ");
  4185. }
  4186. content.value = start + e2 + " " + end;
  4187. let moveCursorPos = start.length + e2.length + 1;
  4188. setTimeout(() => {
  4189. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  4190. checkHeight2();
  4191. });
  4192. eventBus.off(CMD.SET_CALL);
  4193. });
  4194. }
  4195. function onKeydown(e2) {
  4196. let code = e2.keyCode;
  4197. switch (code) {
  4198. case 8:
  4199. if (content.value === "@") {
  4200. off();
  4201. }
  4202. break;
  4203. case 37:
  4204. case 38:
  4205. case 39:
  4206. case 40:
  4207. setTimeout(() => onInput({ data: "" }), 100);
  4208. break;
  4209. case 27:
  4210. e2.preventDefault();
  4211. e2.stopPropagation();
  4212. e2.stopImmediatePropagation();
  4213. return false;
  4214. case 13:
  4215. if (e2.ctrlKey)
  4216. submit();
  4217. if (e2.metaKey)
  4218. submit();
  4219. break;
  4220. }
  4221. }
  4222. function onInput(e2) {
  4223. let cursorPos = txtRef.value.selectionStart;
  4224. if (!content.value)
  4225. return;
  4226. if (e2.data === " ") {
  4227. return off();
  4228. }
  4229. if (e2.data === "@") {
  4230. if (content.value.length !== 1) {
  4231. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  4232. return showCallPopover("");
  4233. }
  4234. } else {
  4235. return showCallPopover("");
  4236. }
  4237. off();
  4238. } else {
  4239. checkHeight2();
  4240. let judgeStr = content.value.slice(0, cursorPos);
  4241. let lastCallPos = judgeStr.lastIndexOf("@");
  4242. if (lastCallPos === -1) {
  4243. return off();
  4244. }
  4245. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  4246. let hasSpace = callStr.includes(" ");
  4247. if (hasSpace) {
  4248. off();
  4249. } else {
  4250. if (lastCallPos === 0) {
  4251. return showCallPopover(callStr.replace("@", ""));
  4252. }
  4253. if (content.value.length !== 1) {
  4254. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  4255. return showCallPopover(callStr.replace("@", ""));
  4256. }
  4257. } else {
  4258. return showCallPopover(callStr.replace("@", ""));
  4259. }
  4260. off();
  4261. }
  4262. }
  4263. }
  4264. function onPaste(e2) {
  4265. const dataTransferItemList = e2.clipboardData.items;
  4266. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  4267. return item.type.indexOf("image") !== -1;
  4268. });
  4269. if (items.length === 0) {
  4270. return;
  4271. }
  4272. const dataTransferItem = items[0];
  4273. const blob = dataTransferItem.getAsFile();
  4274. upload(blob);
  4275. }
  4276. function onBlur() {
  4277. document.removeEventListener("paste", onPaste);
  4278. isFocus.value = false;
  4279. }
  4280. function onFocusin() {
  4281. document.addEventListener("paste", onPaste);
  4282. }
  4283. vue.watch(() => show, (n2) => {
  4284. if (n2.value)
  4285. isShowEmoticons.value = false;
  4286. }, { deep: true });
  4287. vue.onMounted(() => {
  4288. $(`.${editorId.value}`).each(function() {
  4289. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  4290. }).on("input", function() {
  4291. this.style.height = 0;
  4292. this.style.height = this.scrollHeight + "px";
  4293. });
  4294. if (useType === "reply-comment") {
  4295. txtRef.value && txtRef.value.focus();
  4296. }
  4297. });
  4298. vue.onBeforeUnmount(() => {
  4299. $(`.${editorId.value}`).off();
  4300. });
  4301. return (_ctx, _cache) => {
  4302. return vue.openBlock(), vue.createElementBlock("div", {
  4303. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  4304. }, [
  4305. vue.withDirectives(vue.createElementVNode("textarea", {
  4306. class: vue.normalizeClass(["post-editor", editorId.value]),
  4307. ref_key: "txtRef",
  4308. ref: txtRef,
  4309. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  4310. onBlur,
  4311. onFocusin,
  4312. placeholder: "请尽量让自己的回复能够对别人有帮助",
  4313. onInput,
  4314. onKeydown,
  4315. onDrop: drop,
  4316. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  4317. }, null, 34), [
  4318. [vue.vModelText, content.value]
  4319. ]),
  4320. vue.createElementVNode("div", _hoisted_1$c, [
  4321. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$9),
  4322. vue.createElementVNode("span", {
  4323. class: "cursor",
  4324. ref_key: "cursorRef",
  4325. ref: cursorRef
  4326. }, "|", 512)
  4327. ]),
  4328. vue.createElementVNode("div", _hoisted_3$8, [
  4329. vue.createElementVNode("div", _hoisted_4$8, [
  4330. vue.createVNode(vue.unref(Icon), {
  4331. onClick: vue.withModifiers(showEmoticons, ["stop"]),
  4332. icon: "streamline:smiley-happy"
  4333. }),
  4334. vue.createElementVNode("div", _hoisted_5$6, [
  4335. vue.createElementVNode("input", {
  4336. type: "file",
  4337. accept: "image/*",
  4338. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  4339. }, null, 32),
  4340. vue.createVNode(vue.unref(Icon), { icon: "lets-icons:img-load-box-fill" })
  4341. ]),
  4342. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$6, "上传中.....")) : vue.createCommentVNode("", true)
  4343. ]),
  4344. vue.createElementVNode("div", _hoisted_7$5, [
  4345. vue.unref(useType) === "reply-comment" ? (vue.openBlock(), vue.createBlock(BaseButton, {
  4346. key: 0,
  4347. type: "link",
  4348. size: "small",
  4349. style: { "margin-right": "1rem", "cursor": "pointer" },
  4350. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => emits("close"), ["stop"]))
  4351. }, {
  4352. default: vue.withCtx(() => [
  4353. vue.createTextVNode(" 关闭 ")
  4354. ]),
  4355. _: 1
  4356. })) : vue.createCommentVNode("", true),
  4357. vue.createVNode(BaseButton, {
  4358. size: "small",
  4359. disabled: disabled.value,
  4360. loading: loading.value,
  4361. onClick: vue.withModifiers(submit, ["stop"])
  4362. }, {
  4363. default: vue.withCtx(() => [
  4364. vue.createTextVNode("回复 ")
  4365. ]),
  4366. _: 1
  4367. }, 8, ["disabled", "loading"])
  4368. ])
  4369. ]),
  4370. vue.withDirectives(vue.createElementVNode("div", {
  4371. class: "emoticon-pack",
  4372. ref_key: "emoticonsRef",
  4373. ref: emoticonsRef
  4374. }, [
  4375. vue.createVNode(vue.unref(Icon), {
  4376. icon: "ic:round-close",
  4377. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => isShowEmoticons.value = false, ["stop"]))
  4378. }),
  4379. _hoisted_8$5,
  4380. vue.createElementVNode("div", _hoisted_9$5, [
  4381. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(classicsEmoticons), (item) => {
  4382. return vue.openBlock(), vue.createElementBlock("img", {
  4383. src: item.high,
  4384. onClick: vue.withModifiers(($event) => {
  4385. insert(item.name);
  4386. isShowEmoticons.value = false;
  4387. }, ["stop"])
  4388. }, null, 8, _hoisted_10$5);
  4389. }), 256))
  4390. ]),
  4391. vue.createElementVNode("div", _hoisted_11$5, [
  4392. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(emojiEmoticons), (item) => {
  4393. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  4394. vue.createElementVNode("div", _hoisted_12$5, vue.toDisplayString(item.title), 1),
  4395. vue.createElementVNode("div", _hoisted_13$4, [
  4396. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  4397. return vue.openBlock(), vue.createElementBlock("span", {
  4398. onClick: vue.withModifiers(($event) => {
  4399. insert(emoji);
  4400. isShowEmoticons.value = false;
  4401. }, ["stop"])
  4402. }, vue.toDisplayString(emoji), 9, _hoisted_14$3);
  4403. }), 256))
  4404. ])
  4405. ], 64);
  4406. }), 256))
  4407. ])
  4408. ], 512), [
  4409. [vue.vShow, isShowEmoticons.value]
  4410. ])
  4411. ], 2);
  4412. };
  4413. }
  4414. };
  4415. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-7fe2eb8d"]]);
  4416. const _hoisted_1$b = {
  4417. key: 0,
  4418. class: "html-wrapper"
  4419. };
  4420. const _hoisted_2$8 = ["innerHTML"];
  4421. const checkHeight = 900;
  4422. const _sfc_main$b = {
  4423. __name: "BaseHtmlRender",
  4424. props: ["html"],
  4425. setup(__props) {
  4426. const config2 = vue.inject("config");
  4427. const props = __props;
  4428. const contentRef = vue.ref(null);
  4429. const mask = vue.ref(false);
  4430. const handOpen = vue.ref(false);
  4431. function mouseup(e2) {
  4432. if (!config2.value.base64)
  4433. return;
  4434. let selectionText = window.win().getSelection().toString();
  4435. if (selectionText) {
  4436. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  4437. if (r2) {
  4438. if (r2[0].length < 4)
  4439. return;
  4440. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  4441. }
  4442. }
  4443. }
  4444. vue.watch(config2.value, (newVale) => {
  4445. if (!newVale.contentAutoCollapse) {
  4446. mask.value = false;
  4447. }
  4448. });
  4449. vue.watch([() => contentRef.value, () => props.html], () => {
  4450. if (!contentRef.value || !props.html)
  4451. return;
  4452. if (!config2.value.contentAutoCollapse)
  4453. return;
  4454. contentRef.value.querySelectorAll("img").forEach((item) => {
  4455. item.removeEventListener("load", checkContentHeight);
  4456. item.addEventListener("load", checkContentHeight);
  4457. });
  4458. checkContentHeight();
  4459. }, { immediate: true, flush: "post" });
  4460. function checkContentHeight() {
  4461. if (handOpen.value)
  4462. return;
  4463. if (!contentRef.value)
  4464. return;
  4465. let rect = contentRef.value.getBoundingClientRect();
  4466. mask.value = rect.height >= checkHeight;
  4467. }
  4468. return (_ctx, _cache) => {
  4469. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
  4470. vue.createElementVNode("div", {
  4471. class: vue.normalizeClass({ mask: mask.value })
  4472. }, [
  4473. vue.createElementVNode("div", {
  4474. ref_key: "contentRef",
  4475. ref: contentRef,
  4476. innerHTML: props.html,
  4477. onMouseup: mouseup
  4478. }, null, 40, _hoisted_2$8)
  4479. ], 2),
  4480. mask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  4481. key: 0,
  4482. class: "expand",
  4483. onClick: _cache[0] || (_cache[0] = ($event) => {
  4484. mask.value = false;
  4485. handOpen.value = true;
  4486. })
  4487. }, "展开")) : vue.createCommentVNode("", true)
  4488. ])) : vue.createCommentVNode("", true);
  4489. };
  4490. }
  4491. };
  4492. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-727ada32"]]);
  4493. const _sfc_main$a = {
  4494. name: "TopSubComment",
  4495. components: { BaseHtmlRender, Author, PostEditor, Point, Icon },
  4496. inject: ["post", "postDetailWidth", "show", "isNight", "isLogin", "tags", "config"],
  4497. props: {
  4498. modelValue: {
  4499. reply_content: ""
  4500. },
  4501. level: -1
  4502. },
  4503. data() {
  4504. return {
  4505. expand: true,
  4506. edit: false,
  4507. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4508. floor: this.modelValue.floor
  4509. };
  4510. },
  4511. watch: {
  4512. show(e2) {
  4513. if (e2) {
  4514. this.edit = false;
  4515. }
  4516. }
  4517. },
  4518. computed: {
  4519. myTags() {
  4520. return this.tags[this.modelValue.username] ?? [];
  4521. }
  4522. },
  4523. methods: {
  4524. jump() {
  4525. eventBus.emit(CMD.JUMP, this.modelValue.floor);
  4526. }
  4527. }
  4528. };
  4529. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-d3f8c94b"), n2 = n2(), vue.popScopeId(), n2);
  4530. const _hoisted_1$a = ["data-floor"];
  4531. const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "left expand-line" }, null, -1));
  4532. const _hoisted_3$7 = { class: "right" };
  4533. const _hoisted_4$7 = { class: "simple-wrapper" };
  4534. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  4535. const _component_Author = vue.resolveComponent("Author");
  4536. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4537. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4538. const _component_TopSubComment = vue.resolveComponent("TopSubComment", true);
  4539. return vue.openBlock(), vue.createElementBlock("div", {
  4540. class: vue.normalizeClass(["top-sub-comment", $props.level === 1 && "top-sub-reply"]),
  4541. ref: "comment",
  4542. "data-floor": $data.floor
  4543. }, [
  4544. _hoisted_2$7,
  4545. vue.createElementVNode("div", _hoisted_3$7, [
  4546. vue.createVNode(_component_Author, {
  4547. modelValue: $data.expand,
  4548. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4549. comment: $props.modelValue,
  4550. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4551. type: "top"
  4552. }, null, 8, ["modelValue", "comment"]),
  4553. vue.createVNode(_component_BaseHtmlRender, {
  4554. class: "top-reply_content reply_content",
  4555. html: $props.modelValue.hideCallUserReplyContent
  4556. }, null, 8, ["html"]),
  4557. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4558. key: 0,
  4559. onClose: _cache[2] || (_cache[2] = ($event) => $data.edit = false),
  4560. replyInfo: $data.replyInfo,
  4561. replyUser: $props.modelValue.username,
  4562. replyFloor: $props.modelValue.floor
  4563. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true),
  4564. vue.createElementVNode("div", _hoisted_4$7, [
  4565. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4566. return vue.openBlock(), vue.createBlock(_component_TopSubComment, {
  4567. modelValue: $props.modelValue.children[index],
  4568. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4569. key: index
  4570. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4571. }), 128))
  4572. ])
  4573. ])
  4574. ], 10, _hoisted_1$a);
  4575. }
  4576. const TopSubComment = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$5], ["__scopeId", "data-v-d3f8c94b"]]);
  4577. const _sfc_main$9 = {
  4578. name: "Comment",
  4579. components: { BaseHtmlRender, Author, PostEditor, Point, Icon, TopSubComment },
  4580. inject: ["post", "postDetailWidth", "show", "isNight", "config"],
  4581. props: {
  4582. modelValue: {
  4583. reply_content: ""
  4584. },
  4585. type: {
  4586. type: String,
  4587. default() {
  4588. return "list";
  4589. }
  4590. }
  4591. },
  4592. data() {
  4593. return {
  4594. edit: false,
  4595. ding: false,
  4596. expand: true,
  4597. expandTopReply: true,
  4598. expandWrong: false,
  4599. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4600. cssStyle: null,
  4601. floor: this.modelValue.floor
  4602. };
  4603. },
  4604. watch: {
  4605. show(e2) {
  4606. if (e2) {
  4607. this.edit = false;
  4608. }
  4609. },
  4610. postDetailWidth(n2, o) {
  4611. this.checkIsTooLong(n2);
  4612. }
  4613. },
  4614. computed: {
  4615. CommentDisplayType() {
  4616. return CommentDisplayType;
  4617. },
  4618. myClass() {
  4619. return {
  4620. isOp: this.modelValue.isOp,
  4621. isSimple: this.config.viewType === "simple",
  4622. ding: this.ding,
  4623. isLevelOne: this.type === "top" ? true : this.modelValue.level === 0,
  4624. ["c_" + this.floor]: this.type !== "top"
  4625. };
  4626. }
  4627. },
  4628. mounted() {
  4629. this.checkIsTooLong(this.postDetailWidth);
  4630. },
  4631. methods: {
  4632. checkIsTooLong(postDetailWidth) {
  4633. if (postDetailWidth !== 0) {
  4634. let rect = this.$refs.comment.getBoundingClientRect();
  4635. let ban = postDetailWidth * 0.6;
  4636. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  4637. this.expand = false;
  4638. let padding = 2;
  4639. this.cssStyle = {
  4640. padding: "1rem 0",
  4641. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  4642. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  4643. background: this.isNight ? "#18222d" : "white"
  4644. };
  4645. }
  4646. }
  4647. },
  4648. //高亮一下
  4649. showDing() {
  4650. this.ding = true;
  4651. setTimeout(() => {
  4652. this.ding = false;
  4653. }, 2e3);
  4654. },
  4655. hide() {
  4656. let url = `${location.origin}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;
  4657. eventBus.emit(CMD.REMOVE, this.modelValue.floor);
  4658. $.post(url).then((res) => {
  4659. eventBus.emit(CMD.REFRESH_ONCE);
  4660. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  4661. }, (err) => {
  4662. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  4663. });
  4664. },
  4665. toggle() {
  4666. this.expand = !this.expand;
  4667. },
  4668. jump() {
  4669. eventBus.emit(CMD.JUMP, this.modelValue.floor);
  4670. }
  4671. }
  4672. };
  4673. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-67fa2f3f"), n2 = n2(), vue.popScopeId(), n2);
  4674. const _hoisted_1$9 = ["data-floor"];
  4675. const _hoisted_2$6 = { class: "comment-content" };
  4676. const _hoisted_3$6 = { class: "right" };
  4677. const _hoisted_4$6 = { class: "w" };
  4678. const _hoisted_5$5 = {
  4679. key: 0,
  4680. class: "wrong-wrapper"
  4681. };
  4682. const _hoisted_6$5 = ["href"];
  4683. const _hoisted_7$4 = { class: "del-line" };
  4684. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", {
  4685. class: "fa fa-question-circle-o wrong-icon",
  4686. "aria-hidden": "true"
  4687. }, null, -1));
  4688. const _hoisted_9$4 = {
  4689. key: 0,
  4690. class: "warning"
  4691. };
  4692. const _hoisted_10$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4693. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4694. const _hoisted_12$4 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4695. const _hoisted_13$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4696. const _hoisted_14$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4697. const _hoisted_15$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("a", {
  4698. href: "https://github.com/zyronon/web-scripts/issues",
  4699. target: "_blank"
  4700. }, "这里", -1));
  4701. const _hoisted_16$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "gang" }, null, -1));
  4702. const _hoisted_17$2 = { class: "simple-wrapper" };
  4703. const _hoisted_18$2 = {
  4704. key: 0,
  4705. class: "top-reply-wrap"
  4706. };
  4707. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4708. const _component_Author = vue.resolveComponent("Author");
  4709. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4710. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4711. const _component_Icon = vue.resolveComponent("Icon");
  4712. const _component_TopSubComment = vue.resolveComponent("TopSubComment");
  4713. const _component_Comment = vue.resolveComponent("Comment", true);
  4714. return vue.openBlock(), vue.createElementBlock("div", {
  4715. class: vue.normalizeClass(["comment", $options.myClass]),
  4716. ref: "comment",
  4717. "data-floor": $data.floor
  4718. }, [
  4719. vue.createVNode(_component_Author, {
  4720. modelValue: $data.expand,
  4721. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4722. comment: $props.modelValue,
  4723. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4724. type: $props.type,
  4725. onHide: $options.hide
  4726. }, null, 8, ["modelValue", "comment", "type", "onHide"]),
  4727. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4728. key: 0,
  4729. class: "more ago",
  4730. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  4731. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  4732. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4733. key: 1,
  4734. class: "comment-content-w",
  4735. style: vue.normalizeStyle($data.cssStyle)
  4736. }, [
  4737. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4738. key: 0,
  4739. class: "more ago",
  4740. onClick: _cache[3] || (_cache[3] = ($event) => $data.expand = !$data.expand)
  4741. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  4742. vue.createElementVNode("div", _hoisted_2$6, [
  4743. vue.createElementVNode("div", {
  4744. class: "left expand-line",
  4745. onClick: _cache[4] || (_cache[4] = (...args) => $options.toggle && $options.toggle(...args))
  4746. }),
  4747. vue.createElementVNode("div", _hoisted_3$6, [
  4748. vue.createElementVNode("div", _hoisted_4$6, [
  4749. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
  4750. vue.createElementVNode("span", {
  4751. onClick: _cache[5] || (_cache[5] = ($event) => $data.expandWrong = !$data.expandWrong),
  4752. title: "点击楼层号查看提示"
  4753. }, [
  4754. vue.createElementVNode("a", {
  4755. href: "/member/" + $props.modelValue.replyUsers[0]
  4756. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$5),
  4757. vue.createElementVNode("span", _hoisted_7$4, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  4758. _hoisted_8$4
  4759. ]),
  4760. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$4, [
  4761. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  4762. _hoisted_10$4,
  4763. vue.createTextVNode(" 原因可能有下面几种: "),
  4764. _hoisted_11$4,
  4765. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  4766. _hoisted_12$4,
  4767. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  4768. _hoisted_13$3,
  4769. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  4770. _hoisted_14$2,
  4771. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  4772. _hoisted_15$2,
  4773. vue.createTextVNode("反馈 ")
  4774. ])) : vue.createCommentVNode("", true)
  4775. ])) : vue.createCommentVNode("", true),
  4776. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && $props.type !== "top" ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4777. key: 1,
  4778. class: "reply_content",
  4779. html: $props.modelValue.hideCallUserReplyContent
  4780. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4781. key: 2,
  4782. class: "reply_content",
  4783. html: $props.modelValue.reply_content
  4784. }, null, 8, ["html"])),
  4785. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4786. key: 3,
  4787. onClose: _cache[6] || (_cache[6] = ($event) => $data.edit = false),
  4788. replyInfo: $data.replyInfo,
  4789. replyUser: $props.modelValue.username,
  4790. replyFloor: $props.modelValue.floor
  4791. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true),
  4792. $props.type === "top" && $props.modelValue.replyCount ? (vue.openBlock(), vue.createElementBlock("div", {
  4793. key: 4,
  4794. class: "reply-count",
  4795. onClick: _cache[7] || (_cache[7] = ($event) => $data.expandTopReply = !$data.expandTopReply)
  4796. }, [
  4797. _hoisted_16$2,
  4798. vue.createElementVNode("span", null, " 共有" + vue.toDisplayString($props.modelValue.replyCount) + " 条回复 ", 1),
  4799. $data.expandTopReply ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4800. key: 0,
  4801. icon: "ep:arrow-up-bold"
  4802. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4803. key: 1,
  4804. icon: "ep:arrow-down-bold"
  4805. }))
  4806. ])) : vue.createCommentVNode("", true)
  4807. ]),
  4808. vue.createElementVNode("div", _hoisted_17$2, [
  4809. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  4810. $data.expandTopReply && $props.modelValue.replyCount ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$2, [
  4811. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4812. return vue.openBlock(), vue.createBlock(_component_TopSubComment, {
  4813. level: 1,
  4814. modelValue: $props.modelValue.children[index],
  4815. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4816. key: index
  4817. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4818. }), 128))
  4819. ])) : vue.createCommentVNode("", true)
  4820. ], 64)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList($props.modelValue.children, (item, index) => {
  4821. return vue.openBlock(), vue.createBlock(_component_Comment, {
  4822. modelValue: $props.modelValue.children[index],
  4823. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4824. key: index
  4825. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4826. }), 128))
  4827. ])
  4828. ])
  4829. ]),
  4830. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4831. key: 1,
  4832. class: "more ago",
  4833. onClick: _cache[8] || (_cache[8] = ($event) => $data.expand = !$data.expand)
  4834. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  4835. ], 4)) : vue.createCommentVNode("", true)
  4836. ], 10, _hoisted_1$9);
  4837. }
  4838. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-67fa2f3f"]]);
  4839. const _sfc_main$8 = {
  4840. name: "Toolbar",
  4841. components: { Icon, BaseLoading },
  4842. inject: [
  4843. "isLogin",
  4844. "post",
  4845. "pageType"
  4846. ],
  4847. data() {
  4848. return {
  4849. timer: null,
  4850. loading: false,
  4851. loading2: false,
  4852. loading3: false
  4853. };
  4854. },
  4855. methods: {
  4856. checkIsLogin(emitName = "") {
  4857. if (!this.isLogin) {
  4858. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4859. return false;
  4860. }
  4861. this.$emit(emitName);
  4862. return true;
  4863. },
  4864. tweet() {
  4865. var _a;
  4866. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4867. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${this.post.id}?r=${username}&related=v2ex&text=${this.post.title}`;
  4868. window.open(url, "_blank", "width=550,height=370");
  4869. },
  4870. async report() {
  4871. if (!this.checkIsLogin())
  4872. return;
  4873. if (this.loading3)
  4874. return;
  4875. let isReport = this.post.isReport;
  4876. if (isReport) {
  4877. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4878. return;
  4879. }
  4880. let url = `${location.origin}/report/topic/${this.post.id}?once=${this.post.once}`;
  4881. this.loading3 = true;
  4882. let apiRes = await fetch(url);
  4883. this.loading3 = false;
  4884. if (apiRes.redirected) {
  4885. let htmlText = await apiRes.text();
  4886. if (htmlText.search("你已对本主题进行了报告")) {
  4887. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4888. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4889. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4890. return;
  4891. }
  4892. }
  4893. eventBus.emit(CMD.REFRESH_ONCE);
  4894. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4895. },
  4896. async toggleIgnore() {
  4897. if (!this.checkIsLogin())
  4898. return;
  4899. let url = `${location.origin}/${this.post.isIgnore ? "unignore" : "ignore"}/topic/${this.post.id}?once=${this.post.once}`;
  4900. if (this.pageType === PageType.Post) {
  4901. this.loading2 = true;
  4902. let apiRes = await window.win().fetch(url);
  4903. if (apiRes.redirected) {
  4904. if (!this.post.isIgnore) {
  4905. window.win().location = location.origin;
  4906. }
  4907. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4908. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4909. } else {
  4910. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4911. }
  4912. this.loading2 = false;
  4913. } else {
  4914. if (this.post.isIgnore) {
  4915. this.loading2 = true;
  4916. } else {
  4917. eventBus.emit(CMD.IGNORE);
  4918. }
  4919. let apiRes = await window.win().fetch(url);
  4920. if (apiRes.redirected) {
  4921. if (this.post.isIgnore) {
  4922. eventBus.emit(CMD.REFRESH_ONCE);
  4923. }
  4924. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4925. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4926. } else {
  4927. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略成功,仅本次有效(接口调用失败!)" });
  4928. }
  4929. this.loading2 = false;
  4930. }
  4931. },
  4932. async toggleFavorite() {
  4933. if (!this.checkIsLogin())
  4934. return;
  4935. if (this.loading)
  4936. return;
  4937. let isFavorite = this.post.isFavorite;
  4938. if (!isFavorite && config.collectBrowserNotice) {
  4939. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记按Command/Cmd/CTRL + D添加到书签哦" });
  4940. }
  4941. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  4942. this.loading = true;
  4943. let apiRes = await fetch(url);
  4944. this.loading = false;
  4945. if (apiRes.redirected) {
  4946. let htmlText = await apiRes.text();
  4947. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4948. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4949. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  4950. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4951. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4952. return;
  4953. }
  4954. }
  4955. eventBus.emit(CMD.REFRESH_ONCE);
  4956. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  4957. }
  4958. }
  4959. };
  4960. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-e86785e8"), n2 = n2(), vue.popScopeId(), n2);
  4961. const _hoisted_1$8 = { class: "toolbar" };
  4962. const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4963. const _hoisted_3$5 = {
  4964. key: 0,
  4965. class: "tool no-hover"
  4966. };
  4967. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "Tweet", -1));
  4968. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4969. const _component_Icon = vue.resolveComponent("Icon");
  4970. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4971. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
  4972. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  4973. vue.createElementVNode("div", {
  4974. class: "tool",
  4975. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => $options.checkIsLogin("reply"), ["stop"]))
  4976. }, [
  4977. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  4978. _hoisted_2$5
  4979. ]),
  4980. vue.createElementVNode("div", {
  4981. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  4982. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.toggleFavorite && $options.toggleFavorite(...args), ["stop"]))
  4983. }, [
  4984. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4985. key: 0,
  4986. size: "small"
  4987. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4988. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4989. key: 0,
  4990. color: "rgb(224,42,42)",
  4991. icon: "iconoir:star-solid"
  4992. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4993. key: 1,
  4994. icon: "iconoir:star"
  4995. }))
  4996. ], 64)),
  4997. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isFavorite ? "取消" : "") + "收藏", 1)
  4998. ], 2),
  4999. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
  5000. vue.createElementVNode("span", null, vue.toDisplayString($options.post.collectCount + "人收藏"), 1)
  5001. ])) : vue.createCommentVNode("", true),
  5002. vue.createElementVNode("div", {
  5003. class: "tool",
  5004. onClick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.tweet && $options.tweet(...args), ["stop"]))
  5005. }, [
  5006. vue.createVNode(_component_Icon, { icon: "uil:share" }),
  5007. _hoisted_4$5
  5008. ]),
  5009. vue.createElementVNode("div", {
  5010. class: vue.normalizeClass(["tool", { "disabled": $data.loading2 }]),
  5011. onClick: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.toggleIgnore && $options.toggleIgnore(...args), ["stop"]))
  5012. }, [
  5013. $data.loading2 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  5014. key: 0,
  5015. size: "small"
  5016. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5017. key: 1,
  5018. icon: "fluent:eye-hide-24-regular"
  5019. })),
  5020. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isIgnore ? "取消忽略" : "忽略"), 1)
  5021. ], 2),
  5022. vue.createElementVNode("div", {
  5023. class: vue.normalizeClass(["tool", { "disabled": $data.loading3 }]),
  5024. onClick: _cache[4] || (_cache[4] = vue.withModifiers((...args) => $options.report && $options.report(...args), ["stop"]))
  5025. }, [
  5026. $data.loading3 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  5027. key: 0,
  5028. size: "small"
  5029. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5030. key: 1,
  5031. class: "black",
  5032. icon: "solar:danger-triangle-outline"
  5033. })),
  5034. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isReport ? "你已对本主题进行了报告" : "报告"), 1)
  5035. ], 2)
  5036. ]);
  5037. }
  5038. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-e86785e8"]]);
  5039. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-4a063111"), n2 = n2(), vue.popScopeId(), n2);
  5040. const _hoisted_1$7 = ["href"];
  5041. const _hoisted_2$4 = ["src"];
  5042. const _hoisted_3$4 = { class: "texts" };
  5043. const _hoisted_4$4 = {
  5044. key: 0,
  5045. class: "point"
  5046. };
  5047. const _hoisted_5$4 = { class: "link-num" };
  5048. const _hoisted_6$4 = { class: "my-tag" };
  5049. const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5050. const _hoisted_8$3 = {
  5051. key: 2,
  5052. class: "ago"
  5053. };
  5054. const _hoisted_9$3 = {
  5055. key: 3,
  5056. class: "mod"
  5057. };
  5058. const _hoisted_10$3 = {
  5059. key: 4,
  5060. class: "owner"
  5061. };
  5062. const _hoisted_11$3 = ["href"];
  5063. const _hoisted_12$3 = {
  5064. key: 5,
  5065. class: "owner"
  5066. };
  5067. const _hoisted_13$2 = {
  5068. key: 6,
  5069. class: "mod"
  5070. };
  5071. const _hoisted_14$1 = {
  5072. key: 7,
  5073. class: "ago"
  5074. };
  5075. const _hoisted_15$1 = { class: "my-tag" };
  5076. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5077. const _hoisted_17$1 = {
  5078. key: 9,
  5079. class: "point"
  5080. };
  5081. const _hoisted_18$1 = { class: "link-num" };
  5082. const _hoisted_19$1 = ["href"];
  5083. const _hoisted_20$1 = ["src"];
  5084. const _hoisted_21$1 = { class: "Author-right" };
  5085. const _hoisted_22$1 = { class: "floor" };
  5086. const _hoisted_23$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  5087. const _hoisted_24$1 = [
  5088. _hoisted_23$1
  5089. ];
  5090. const _sfc_main$7 = {
  5091. __name: "SingleComment",
  5092. props: {
  5093. comment: {
  5094. reply_content: ""
  5095. },
  5096. isRight: {
  5097. type: Boolean,
  5098. default() {
  5099. return false;
  5100. }
  5101. }
  5102. },
  5103. setup(__props) {
  5104. const config2 = vue.inject("config");
  5105. const isLogin = vue.inject("isLogin");
  5106. const tags = vue.inject("tags");
  5107. const props = __props;
  5108. const myTags = vue.computed(() => {
  5109. return tags[props.comment.username] ?? [];
  5110. });
  5111. function jump() {
  5112. eventBus.emit(CMD.JUMP, props.comment.floor);
  5113. }
  5114. return (_ctx, _cache) => {
  5115. return vue.openBlock(), vue.createElementBlock("div", {
  5116. class: vue.normalizeClass(["comment", { isSimple: vue.unref(config2).viewType === "simple" }]),
  5117. ref: "comment"
  5118. }, [
  5119. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  5120. key: 0,
  5121. class: "avatar",
  5122. href: `/member/${__props.comment.username}`
  5123. }, [
  5124. vue.createElementVNode("img", {
  5125. src: __props.comment.avatar,
  5126. alt: ""
  5127. }, null, 8, _hoisted_2$4)
  5128. ], 8, _hoisted_1$7)) : vue.createCommentVNode("", true),
  5129. vue.createElementVNode("div", {
  5130. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  5131. }, [
  5132. vue.createElementVNode("div", _hoisted_3$4, [
  5133. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
  5134. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5135. key: 0,
  5136. color: "rgb(224,42,42)",
  5137. icon: "icon-park-solid:like"
  5138. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5139. key: 1,
  5140. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  5141. icon: "icon-park-outline:like"
  5142. }, null, 8, ["color"])),
  5143. vue.createElementVNode("div", _hoisted_5$4, vue.toDisplayString(__props.comment.thankCount), 1)
  5144. ])) : vue.createCommentVNode("", true),
  5145. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  5146. return vue.openBlock(), vue.createElementBlock("span", _hoisted_6$4, [
  5147. _hoisted_7$3,
  5148. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  5149. ]);
  5150. }), 256)) : vue.createCommentVNode("", true),
  5151. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$3, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  5152. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, "MOD")) : vue.createCommentVNode("", true),
  5153. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$3, "OP")) : vue.createCommentVNode("", true),
  5154. vue.createElementVNode("a", {
  5155. href: `/member/${__props.comment.username}`,
  5156. class: "username"
  5157. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_11$3),
  5158. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$3, "OP")) : vue.createCommentVNode("", true),
  5159. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$2, "MOD")) : vue.createCommentVNode("", true),
  5160. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  5161. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  5162. return vue.openBlock(), vue.createElementBlock("span", _hoisted_15$1, [
  5163. _hoisted_16$1,
  5164. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  5165. ]);
  5166. }), 256)) : vue.createCommentVNode("", true),
  5167. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, [
  5168. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5169. key: 0,
  5170. color: "rgb(224,42,42)",
  5171. icon: "icon-park-solid:like"
  5172. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5173. key: 1,
  5174. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  5175. icon: "icon-park-outline:like"
  5176. }, null, 8, ["color"])),
  5177. vue.createElementVNode("div", _hoisted_18$1, vue.toDisplayString(__props.comment.thankCount), 1)
  5178. ])) : vue.createCommentVNode("", true)
  5179. ]),
  5180. vue.createVNode(BaseHtmlRender, {
  5181. class: "reply_content",
  5182. html: __props.comment.reply_content
  5183. }, null, 8, ["html"])
  5184. ], 2),
  5185. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  5186. key: 1,
  5187. class: "avatar",
  5188. href: `/member/${__props.comment.username}`
  5189. }, [
  5190. vue.createElementVNode("img", {
  5191. src: __props.comment.avatar,
  5192. alt: ""
  5193. }, null, 8, _hoisted_20$1)
  5194. ], 8, _hoisted_19$1)) : vue.createCommentVNode("", true),
  5195. vue.createElementVNode("div", _hoisted_21$1, [
  5196. vue.createElementVNode("div", _hoisted_22$1, vue.toDisplayString(__props.comment.floor), 1),
  5197. vue.createElementVNode("div", {
  5198. class: "tool jump",
  5199. onClick: vue.withModifiers(jump, ["stop"])
  5200. }, _hoisted_24$1)
  5201. ])
  5202. ], 2);
  5203. };
  5204. }
  5205. };
  5206. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-4a063111"]]);
  5207. function _css(el, key, value) {
  5208. const reg = /^-?\d+.?\d*(px|pt|em|rem|vw|vh|%|rpx|ms)$/i;
  5209. if (value === void 0) {
  5210. let val = null;
  5211. if ("getComputedStyle" in window) {
  5212. val = window.getComputedStyle(el, null)[key];
  5213. } else {
  5214. val = el.currentStyle[key];
  5215. }
  5216. return reg.test(val) ? parseFloat(val) : val;
  5217. } else {
  5218. if ([
  5219. "top",
  5220. "left",
  5221. "bottom",
  5222. "right",
  5223. "width",
  5224. "height",
  5225. "font-size",
  5226. "margin",
  5227. "padding"
  5228. ].includes(key)) {
  5229. if (!reg.test(value)) {
  5230. if (!String(value).includes("calc")) {
  5231. value += "px";
  5232. }
  5233. }
  5234. }
  5235. if (key === "transform") {
  5236. el.style.webkitTransform = el.style.MsTransform = el.style.msTransform = el.style.MozTransform = el.style.OTransform = el.style.transform = value;
  5237. } else {
  5238. el.style[key] = value;
  5239. }
  5240. }
  5241. }
  5242. function getImgSize(naturalWidth, naturalHeight, maxWidth, maxHeight) {
  5243. const imgRatio = naturalWidth / naturalHeight;
  5244. const maxRatio = maxWidth / maxHeight;
  5245. let width, height;
  5246. if (imgRatio >= maxRatio) {
  5247. if (naturalWidth > maxWidth) {
  5248. width = maxWidth;
  5249. height = maxWidth / naturalWidth * naturalHeight;
  5250. } else {
  5251. width = naturalWidth;
  5252. height = naturalHeight;
  5253. }
  5254. } else {
  5255. if (naturalHeight > maxHeight) {
  5256. width = maxHeight / naturalHeight * naturalWidth;
  5257. height = maxHeight;
  5258. } else {
  5259. width = naturalWidth;
  5260. height = naturalHeight;
  5261. }
  5262. }
  5263. if (height === 0) {
  5264. height = maxHeight;
  5265. width = height * 1.3;
  5266. } else {
  5267. if (height < 24) {
  5268. height = 50;
  5269. width = height * imgRatio;
  5270. } else if (height < 100) {
  5271. height = 300;
  5272. width = height * imgRatio;
  5273. } else {
  5274. height = maxHeight;
  5275. width = height * imgRatio;
  5276. }
  5277. if (width > maxWidth) {
  5278. width = maxWidth;
  5279. height = width / imgRatio;
  5280. }
  5281. }
  5282. return { width, height };
  5283. }
  5284. const _sfc_main$6 = {
  5285. name: "detail",
  5286. components: {
  5287. BaseSelect,
  5288. BaseButton,
  5289. SingleComment,
  5290. PopConfirm,
  5291. Comment,
  5292. PostEditor,
  5293. Point,
  5294. Toolbar,
  5295. BaseHtmlRender,
  5296. Tooltip,
  5297. BaseLoading,
  5298. Icon
  5299. },
  5300. inject: ["allReplyUsers", "post", "tags", "isLogin", "config", "pageType", "isNight"],
  5301. provide() {
  5302. return {
  5303. postDetailWidth: vue.computed(() => this.postDetailWidth)
  5304. };
  5305. },
  5306. props: {
  5307. modelValue: {
  5308. type: Boolean,
  5309. default() {
  5310. return false;
  5311. }
  5312. },
  5313. loading: {
  5314. type: Boolean,
  5315. default() {
  5316. return false;
  5317. }
  5318. },
  5319. refreshLoading: {
  5320. type: Boolean,
  5321. default() {
  5322. return false;
  5323. }
  5324. },
  5325. displayType: CommentDisplayType.FloorInFloorNoCallUser
  5326. },
  5327. data() {
  5328. return {
  5329. isSticky: false,
  5330. selectCallIndex: 0,
  5331. postDetailWidth: 0,
  5332. showCallList: false,
  5333. showRelationReply: false,
  5334. replyText: "",
  5335. callStyle: {
  5336. top: 0,
  5337. left: 0
  5338. },
  5339. targetUser: {
  5340. left: [],
  5341. right: "",
  5342. rightFloor: -1
  5343. },
  5344. currentFloor: "",
  5345. showOpTag: false,
  5346. rect: {},
  5347. result: {},
  5348. x: 0,
  5349. y: 0,
  5350. scale: 1,
  5351. minScale: 0.2,
  5352. maxScale: 16,
  5353. preview: {
  5354. rect: {},
  5355. result: {},
  5356. x: 0,
  5357. y: 0,
  5358. scale: 1,
  5359. minScale: 0.2,
  5360. maxScale: 16
  5361. }
  5362. };
  5363. },
  5364. computed: {
  5365. canAppend() {
  5366. if (this.isMy) {
  5367. let create = new Date(this.post.createDate);
  5368. return Date.now() - create.valueOf() > 1e3 * 60 * 30;
  5369. }
  5370. return false;
  5371. },
  5372. canEditMove() {
  5373. if (this.isMy) {
  5374. let create = new Date(this.post.createDate);
  5375. return Date.now() - create.valueOf() < 1e3 * 60 * 10;
  5376. }
  5377. return false;
  5378. },
  5379. isMy() {
  5380. return this.post.member.username === window.user.username;
  5381. },
  5382. myTags() {
  5383. return this.tags[this.post.member.username] ?? [];
  5384. },
  5385. CommentDisplayType() {
  5386. return CommentDisplayType;
  5387. },
  5388. isPost() {
  5389. return this.pageType === PageType.Post;
  5390. },
  5391. filterCallList() {
  5392. if (this.showCallList) {
  5393. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  5394. if (this.replyText)
  5395. return list.filter((i) => i.search(this.replyText) > -1);
  5396. return list;
  5397. }
  5398. return [];
  5399. },
  5400. replyList() {
  5401. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  5402. return this.post.nestedReplies;
  5403. if (this.displayType === CommentDisplayType.Like) {
  5404. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  5405. }
  5406. if (this.displayType === CommentDisplayType.New) {
  5407. return window.clone(this.post.replyList).reverse();
  5408. }
  5409. if (this.displayType === CommentDisplayType.V2exOrigin)
  5410. return this.post.replyList;
  5411. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  5412. return this.post.nestedRedundReplies;
  5413. if (this.displayType === CommentDisplayType.OnlyOp)
  5414. return this.post.replyList.filter((v) => {
  5415. var _a;
  5416. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  5417. });
  5418. return [];
  5419. },
  5420. //关联回复
  5421. relationReply() {
  5422. if (this.targetUser.left.length && this.targetUser.right) {
  5423. return this.post.replyList.filter((v) => {
  5424. if (this.targetUser.left.includes(v.username)) {
  5425. if (v.floor > this.targetUser.rightFloor) {
  5426. if (v.replyUsers.includes(this.targetUser.right)) {
  5427. return true;
  5428. }
  5429. } else {
  5430. return true;
  5431. }
  5432. }
  5433. if (v.username === this.targetUser.right) {
  5434. for (let i = 0; i < this.targetUser.left.length; i++) {
  5435. if (v.replyUsers.includes(this.targetUser.left[i])) {
  5436. return true;
  5437. }
  5438. }
  5439. }
  5440. });
  5441. }
  5442. return [];
  5443. }
  5444. },
  5445. watch: {
  5446. "post.id"(n2, o) {
  5447. if (this.$refs["post-editor"]) {
  5448. this.$refs["post-editor"].content = "";
  5449. vue.nextTick(() => {
  5450. var _a, _b;
  5451. (_b = (_a = this.$refs) == null ? void 0 : _a.detail) == null ? void 0 : _b.scrollTo({ top: 0 });
  5452. });
  5453. }
  5454. },
  5455. "post.headerTemplate"(n2, o) {
  5456. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  5457. if (mountEl) {
  5458. this.showOpTag = true;
  5459. }
  5460. },
  5461. modelValue: {
  5462. handler(newVal) {
  5463. if (newVal) {
  5464. if ([0, 4, 5].includes(this.displayType)) {
  5465. window.parse.send("&b=2", 2);
  5466. }
  5467. }
  5468. if (this.isPost)
  5469. return;
  5470. if (newVal) {
  5471. this.currentFloor = "";
  5472. vue.nextTick(() => {
  5473. var _a, _b;
  5474. (_b = (_a = this.$refs) == null ? void 0 : _a.main) == null ? void 0 : _b.focus();
  5475. });
  5476. } else {
  5477. this.isSticky = false;
  5478. this.showRelationReply = false;
  5479. }
  5480. }
  5481. }
  5482. },
  5483. mounted() {
  5484. vue.nextTick(() => {
  5485. setTimeout(() => {
  5486. var _a;
  5487. this.postDetailWidth = ((_a = this.$refs.mainWrapper) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
  5488. }, 500);
  5489. });
  5490. if (this.isLogin) {
  5491. const observer = new IntersectionObserver(
  5492. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  5493. { threshold: [1] }
  5494. );
  5495. observer.observe(this.$refs.replyBox);
  5496. window.addEventListener("keydown", this.onKeyDown);
  5497. }
  5498. eventBus.on(CMD.SHOW_CALL, (val) => {
  5499. if (val.show) {
  5500. this.showCallList = true;
  5501. this.replyText = val.text;
  5502. if (this.isPost) {
  5503. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  5504. } else {
  5505. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  5506. }
  5507. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  5508. if (this.selectCallIndex >= this.filterCallList.length) {
  5509. this.selectCallIndex = 0;
  5510. }
  5511. } else {
  5512. this.replyText = "";
  5513. this.showCallList = false;
  5514. this.selectCallIndex = 0;
  5515. }
  5516. });
  5517. eventBus.on(CMD.RELATION_REPLY, (val) => {
  5518. this.targetUser = val;
  5519. this.showRelationReply = true;
  5520. });
  5521. eventBus.on(CMD.JUMP, this.jump);
  5522. },
  5523. beforeUnmount() {
  5524. window.removeEventListener("keydown", this.onKeyDown);
  5525. eventBus.off(CMD.SHOW_CALL);
  5526. },
  5527. methods: {
  5528. addTag() {
  5529. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  5530. },
  5531. removeTag(tag) {
  5532. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  5533. },
  5534. closePreviewModal() {
  5535. let previewModal = document.querySelector(".preview-modal");
  5536. let s = document.querySelector(".shadow");
  5537. let domRect = this.preview.rect;
  5538. _css(s, "transition", "all 0.3s");
  5539. _css(s, "width", domRect.width);
  5540. _css(s, "height", domRect.height);
  5541. _css(s, "transform", `translate3d(${domRect.x}px, ${domRect.y}px, 0) scale(1)`);
  5542. let mask = document.querySelector(".preview-modal .mask");
  5543. _css(mask, "opacity", 0);
  5544. setTimeout(() => {
  5545. _css(s, "transition", "all 0s");
  5546. s.remove();
  5547. _css(previewModal, "top", "-1000vh");
  5548. _css(document.body, "overflow", "auto");
  5549. }, 300);
  5550. },
  5551. stop(e2) {
  5552. e2.stopPropagation();
  5553. e2.stopImmediatePropagation();
  5554. if (e2.target.tagName === "IMG") {
  5555. if (/cdn\.v2ex\.com.*avatar/i.test(e2.target.src)) ;
  5556. this.preview = {
  5557. rect: {},
  5558. result: {},
  5559. x: 0,
  5560. y: 0,
  5561. scale: 1,
  5562. minScale: 0.2,
  5563. maxScale: 16
  5564. };
  5565. e2.preventDefault();
  5566. let domRect = e2.target.getBoundingClientRect();
  5567. let previewModal = document.querySelector(".preview-modal");
  5568. _css(previewModal, "top", "0");
  5569. let s = e2.target.cloneNode();
  5570. s.classList.add("shadow");
  5571. previewModal.append(s);
  5572. _css(s, "transition", "all 0s");
  5573. _css(s, "width", domRect.width);
  5574. _css(s, "height", domRect.height);
  5575. _css(s, "transform", `translate3d(${domRect.x}px, ${domRect.y}px, 0) scale(1)`);
  5576. let t = ".3";
  5577. let sw = domRect.width / window.innerWidth;
  5578. let sh = domRect.height / window.innerHeight;
  5579. domRect.sw = sw;
  5580. domRect.sh = sh;
  5581. this.preview.rect = domRect;
  5582. this.preview.result = getImgSize(
  5583. s.naturalWidth,
  5584. s.naturalHeight,
  5585. window.innerWidth * 0.95,
  5586. window.innerHeight * 0.9
  5587. );
  5588. this.preview.x = (window.innerWidth - this.preview.result.width) * 0.5;
  5589. this.preview.y = (window.innerHeight - this.preview.result.height) * 0.5;
  5590. let isPointerdown = false;
  5591. let isMove = false;
  5592. let lastPointermove = { x: 0, y: 0 };
  5593. let diff = { x: 0, y: 0 };
  5594. s.addEventListener("pointerdown", function(e3) {
  5595. isPointerdown = true;
  5596. isMove = false;
  5597. s.setPointerCapture(e3.pointerId);
  5598. lastPointermove = { x: e3.clientX, y: e3.clientY };
  5599. });
  5600. s.addEventListener("pointermove", (e3) => {
  5601. if (isPointerdown) {
  5602. isMove = true;
  5603. const current = { x: e3.clientX, y: e3.clientY };
  5604. diff.x = current.x - lastPointermove.x;
  5605. diff.y = current.y - lastPointermove.y;
  5606. lastPointermove = { x: current.x, y: current.y };
  5607. this.preview.x += diff.x;
  5608. this.preview.y += diff.y;
  5609. _css(s, "transition", "all 0.1s");
  5610. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5611. }
  5612. e3.preventDefault();
  5613. });
  5614. s.addEventListener("pointerup", () => {
  5615. if (isPointerdown) {
  5616. isPointerdown = false;
  5617. if (!isMove) {
  5618. this.closePreviewModal();
  5619. }
  5620. }
  5621. });
  5622. s.addEventListener("pointercancel", function(e3) {
  5623. if (isPointerdown) {
  5624. isPointerdown = false;
  5625. }
  5626. });
  5627. let mask = document.querySelector(".preview-modal .mask");
  5628. _css(mask, "transition", "all 0s");
  5629. _css(mask, "opacity", 0);
  5630. setTimeout(() => {
  5631. _css(s, "transition", `all ${t}s`);
  5632. _css(mask, "transition", `all ${t}s`);
  5633. _css(mask, "opacity", 1);
  5634. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5635. _css(s, "width", this.preview.result.width);
  5636. _css(s, "height", this.preview.result.height);
  5637. }, 0);
  5638. setTimeout(() => {
  5639. _css(document.body, "overflow", "hidden");
  5640. }, 300);
  5641. return false;
  5642. }
  5643. },
  5644. wheel(e2) {
  5645. let d2 = e2.deltaY < 0 ? 0.1 : -0.1;
  5646. let ratio = 1 + d2;
  5647. let _scale = this.preview.scale * ratio;
  5648. if (_scale > this.preview.maxScale) {
  5649. ratio = this.preview.maxScale / this.preview.scale;
  5650. this.preview.scale = this.preview.maxScale;
  5651. } else if (_scale < this.preview.minScale) {
  5652. ratio = this.preview.minScale / this.preview.scale;
  5653. this.preview.scale = this.preview.minScale;
  5654. } else {
  5655. this.preview.scale = _scale;
  5656. }
  5657. if (e2.target.tagName === "IMG") {
  5658. const origin = {
  5659. x: d2 * this.preview.result.width / 2,
  5660. y: d2 * this.preview.result.height / 2
  5661. };
  5662. this.preview.x -= d2 * (e2.clientX - this.preview.x) - origin.x;
  5663. this.preview.y -= d2 * (e2.clientY - this.preview.y) - origin.y;
  5664. }
  5665. let s = document.querySelector(".shadow");
  5666. _css(s, "transition", "all 0.2s");
  5667. _css(s, "transform", `translate3d(${this.preview.x}px, ${this.preview.y}px, 0) scale(${this.preview.scale})`);
  5668. e2.preventDefault();
  5669. },
  5670. jump(floor) {
  5671. let lastItem = this.replyList[this.replyList.length - 1];
  5672. if (floor === "") {
  5673. floor = lastItem.floor;
  5674. } else {
  5675. try {
  5676. floor = Number(floor);
  5677. } catch (e2) {
  5678. floor = lastItem.floor;
  5679. }
  5680. if (floor === 0) {
  5681. floor = 1;
  5682. }
  5683. if (floor > lastItem.floor)
  5684. floor = lastItem.floor;
  5685. }
  5686. if (!this.post.replyList.length) {
  5687. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  5688. return;
  5689. }
  5690. if (floor > this.post.replyList.length) {
  5691. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5692. return;
  5693. }
  5694. let comment = $(`.c_${floor}`);
  5695. if (!comment.length) {
  5696. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5697. return;
  5698. }
  5699. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  5700. comment.addClass("ding");
  5701. this.currentFloor = floor + 1;
  5702. setTimeout(() => {
  5703. comment.removeClass("ding");
  5704. }, 2e3);
  5705. },
  5706. collapseTopReplyList() {
  5707. $(this.$refs.topReply).slideToggle("fast");
  5708. },
  5709. goBottom() {
  5710. this.isSticky = false;
  5711. setTimeout(() => {
  5712. if (this.isPost) {
  5713. let body = $("body , html");
  5714. let scrollHeight = body.prop("scrollHeight");
  5715. body.animate({ scrollTop: scrollHeight - 850 }, 300);
  5716. } else {
  5717. this.$refs.detail.scrollTo({ top: this.$refs.detail.scrollHeight, behavior: "smooth" });
  5718. }
  5719. });
  5720. },
  5721. close(from) {
  5722. if (this.isPost)
  5723. return;
  5724. if (from === "space") {
  5725. if (this.config.closePostDetailBySpace) {
  5726. this.$emit("update:modelValue", false);
  5727. }
  5728. } else {
  5729. this.$emit("update:modelValue", false);
  5730. }
  5731. },
  5732. setCall(e2) {
  5733. eventBus.emit(CMD.SET_CALL, e2);
  5734. this.showCallList = false;
  5735. },
  5736. onKeyDown(e2) {
  5737. if (!this.modelValue)
  5738. return;
  5739. if (!this.showCallList)
  5740. return;
  5741. let length = this.filterCallList.slice(0, 10).length;
  5742. if (e2.keyCode === 13) {
  5743. this.setCall(this.filterCallList[this.selectCallIndex]);
  5744. e2.preventDefault();
  5745. }
  5746. if (e2.keyCode === 38) {
  5747. this.selectCallIndex--;
  5748. if (this.selectCallIndex < 0) {
  5749. this.selectCallIndex = length - 1;
  5750. }
  5751. e2.preventDefault();
  5752. }
  5753. if (e2.keyCode === 40) {
  5754. this.selectCallIndex++;
  5755. if (this.selectCallIndex > length - 1) {
  5756. this.selectCallIndex = 0;
  5757. }
  5758. e2.preventDefault();
  5759. }
  5760. },
  5761. changeOption(item) {
  5762. this.$emit("update:displayType", item);
  5763. },
  5764. addThank() {
  5765. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "add" });
  5766. },
  5767. recallThank() {
  5768. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "recall" });
  5769. },
  5770. scrollTop() {
  5771. if (this.isPost) {
  5772. $("body , html").animate({ scrollTop: 0 }, 300);
  5773. } else {
  5774. this.$refs.detail.scrollTo({ top: 0, behavior: "smooth" });
  5775. }
  5776. }
  5777. }
  5778. };
  5779. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-b5867eba"), n2 = n2(), vue.popScopeId(), n2);
  5780. const _hoisted_1$6 = { class: "my-box post-wrapper" };
  5781. const _hoisted_2$3 = { class: "header" };
  5782. const _hoisted_3$3 = { class: "fr" };
  5783. const _hoisted_4$3 = ["href"];
  5784. const _hoisted_5$3 = ["src", "alt"];
  5785. const _hoisted_6$3 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5786. const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5787. const _hoisted_8$2 = ["href"];
  5788. const _hoisted_9$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "sep10" }, null, -1));
  5789. const _hoisted_10$2 = ["id"];
  5790. const _hoisted_11$2 = ["onclick"];
  5791. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-up" }, null, -1));
  5792. const _hoisted_13$1 = ["onclick"];
  5793. const _hoisted_14 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-down" }, null, -1));
  5794. const _hoisted_15 = [
  5795. _hoisted_14
  5796. ];
  5797. const _hoisted_16 = { class: "gray" };
  5798. const _hoisted_17 = ["href"];
  5799. const _hoisted_18 = ["title"];
  5800. const _hoisted_19 = ["href"];
  5801. const _hoisted_20 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-info-circle" }, null, -1));
  5802. const _hoisted_21 = [
  5803. _hoisted_20
  5804. ];
  5805. const _hoisted_22 = ["href"];
  5806. const _hoisted_23 = ["href"];
  5807. const _hoisted_24 = ["href"];
  5808. const _hoisted_25 = { class: "my-tag" };
  5809. const _hoisted_26 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5810. const _hoisted_27 = ["onClick"];
  5811. const _hoisted_28 = {
  5812. key: 0,
  5813. class: "my-box"
  5814. };
  5815. const _hoisted_29 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "高赞回复", -1));
  5816. const _hoisted_30 = { class: "top-reply" };
  5817. const _hoisted_31 = { class: "tool" };
  5818. const _hoisted_32 = { ref: "topReply" };
  5819. const _hoisted_33 = { class: "my-box comment-wrapper" };
  5820. const _hoisted_34 = {
  5821. key: 0,
  5822. class: "my-cell flex"
  5823. };
  5824. const _hoisted_35 = { key: 0 };
  5825. const _hoisted_36 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("strong", { class: "snow" }, "•", -1));
  5826. const _hoisted_37 = ["innerHTML"];
  5827. const _hoisted_38 = {
  5828. key: 0,
  5829. class: "loading-wrapper"
  5830. };
  5831. const _hoisted_39 = {
  5832. key: 1,
  5833. class: "comments"
  5834. };
  5835. const _hoisted_40 = {
  5836. key: 1,
  5837. id: "no-comments-yet"
  5838. };
  5839. const _hoisted_41 = { class: "my-cell flex" };
  5840. const _hoisted_42 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "添加一条新回复", -1));
  5841. const _hoisted_43 = { class: "notice-right gray" };
  5842. const _hoisted_44 = { class: "p1" };
  5843. const _hoisted_45 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "gray" }, "上下文", -1));
  5844. const _hoisted_46 = { class: "top-reply" };
  5845. const _hoisted_47 = ["onClick"];
  5846. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5847. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5848. const _component_Point = vue.resolveComponent("Point");
  5849. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5850. const _component_Icon = vue.resolveComponent("Icon");
  5851. const _component_Tooltip = vue.resolveComponent("Tooltip");
  5852. const _component_Comment = vue.resolveComponent("Comment");
  5853. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5854. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5855. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5856. const _component_SingleComment = vue.resolveComponent("SingleComment");
  5857. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5858. class: vue.normalizeClass(["post-detail", [$options.isNight ? "isNight" : "", $options.pageType]]),
  5859. ref: "detail",
  5860. onKeydown: _cache[21] || (_cache[21] = vue.withKeys(($event) => $options.close(), ["esc"])),
  5861. onClick: _cache[22] || (_cache[22] = ($event) => $options.close("space"))
  5862. }, [
  5863. vue.createElementVNode("div", {
  5864. ref: "main",
  5865. class: "main",
  5866. tabindex: "1",
  5867. onClick: _cache[18] || (_cache[18] = (...args) => $options.stop && $options.stop(...args))
  5868. }, [
  5869. vue.createElementVNode("div", {
  5870. class: "main-wrapper",
  5871. ref: "mainWrapper",
  5872. style: vue.normalizeStyle({ width: $options.config.postWidth + "!important" })
  5873. }, [
  5874. vue.createElementVNode("div", _hoisted_1$6, [
  5875. vue.createElementVNode("div", _hoisted_2$3, [
  5876. vue.createElementVNode("div", _hoisted_3$3, [
  5877. vue.createElementVNode("a", {
  5878. href: `/member/${$options.post.member.username}`,
  5879. style: { "width": "73px", "height": "73px", "display": "inline-block" }
  5880. }, [
  5881. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("img", {
  5882. key: 0,
  5883. src: $options.post.member.avatar_large,
  5884. class: "avatar",
  5885. style: { "width": "73px", "height": "73px" },
  5886. border: "0",
  5887. align: "default",
  5888. alt: $options.post.member.username
  5889. }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
  5890. ], 8, _hoisted_4$3)
  5891. ]),
  5892. _hoisted_6$3,
  5893. _hoisted_7$2,
  5894. vue.createElementVNode("a", {
  5895. href: $options.post.node.url
  5896. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_8$2),
  5897. _hoisted_9$2,
  5898. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1),
  5899. vue.createElementVNode("div", {
  5900. id: `topic_${$options.post.id}_votes`,
  5901. class: "votes"
  5902. }, [
  5903. vue.createElementVNode("a", {
  5904. href: "javascript:",
  5905. onclick: `upVoteTopic(${$options.post.id});`,
  5906. class: "vote"
  5907. }, [
  5908. _hoisted_12$2,
  5909. vue.createTextVNode("   ")
  5910. ], 8, _hoisted_11$2),
  5911. vue.createTextVNode("   "),
  5912. vue.createElementVNode("a", {
  5913. href: "javascript:",
  5914. onclick: `downVoteTopic(${$options.post.id});`,
  5915. class: "vote"
  5916. }, _hoisted_15, 8, _hoisted_13$1)
  5917. ], 8, _hoisted_10$2),
  5918. vue.createTextVNode("   "),
  5919. vue.createElementVNode("small", _hoisted_16, [
  5920. vue.createElementVNode("a", {
  5921. href: `/member/${$options.post.member.username}`
  5922. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_17),
  5923. vue.createTextVNode(" · "),
  5924. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5925. vue.createElementVNode("span", {
  5926. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5927. }, vue.toDisplayString($options.post.member.createDate), 3),
  5928. vue.createTextVNode(" · ")
  5929. ], 64)) : vue.createCommentVNode("", true),
  5930. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5931. vue.createElementVNode("span", {
  5932. title: $options.post.createDate
  5933. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_18),
  5934. vue.createTextVNode(" · ")
  5935. ], 64)) : vue.createCommentVNode("", true),
  5936. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5937. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  5938. vue.createTextVNode("   "),
  5939. vue.createElementVNode("a", {
  5940. href: `/t/${$options.post.id}/info`
  5941. }, _hoisted_21, 8, _hoisted_19),
  5942. vue.createTextVNode("   "),
  5943. $options.canAppend ? (vue.openBlock(), vue.createElementBlock("a", {
  5944. key: 0,
  5945. href: `/append/topic/${$options.post.id}`,
  5946. class: "op"
  5947. }, "APPEND", 8, _hoisted_22)) : vue.createCommentVNode("", true),
  5948. $options.canEditMove ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5949. vue.createElementVNode("a", {
  5950. href: `/move/topic/${$options.post.id}`,
  5951. class: "op"
  5952. }, "MOVE", 8, _hoisted_23),
  5953. vue.createTextVNode("  "),
  5954. vue.createElementVNode("a", {
  5955. href: `/edit/topic/${$options.post.id}`,
  5956. class: "op"
  5957. }, "EDIT", 8, _hoisted_24)
  5958. ], 64)) : vue.createCommentVNode("", true)
  5959. ], 64)) : vue.createCommentVNode("", true)
  5960. ]),
  5961. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5962. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5963. return vue.openBlock(), vue.createElementBlock("span", _hoisted_25, [
  5964. _hoisted_26,
  5965. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5966. vue.createElementVNode("i", {
  5967. class: "fa fa-trash-o remove",
  5968. onClick: vue.withModifiers(($event) => $options.removeTag(i), ["stop"])
  5969. }, null, 8, _hoisted_27)
  5970. ]);
  5971. }), 256)),
  5972. vue.createElementVNode("span", {
  5973. class: "add-tag ago",
  5974. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.addTag && $options.addTag(...args), ["stop"])),
  5975. title: "添加标签"
  5976. }, "+")
  5977. ], 64)) : vue.createCommentVNode("", true)
  5978. ]),
  5979. $options.post.headerTemplate ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5980. key: 0,
  5981. html: $options.post.headerTemplate
  5982. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5983. key: 1,
  5984. html: $options.post.jsonContent
  5985. }, null, 8, ["html"])),
  5986. vue.createVNode(_component_Toolbar, {
  5987. onReply: _cache[1] || (_cache[1] = ($event) => $data.isSticky = !$data.isSticky)
  5988. }, {
  5989. default: vue.withCtx(() => [
  5990. vue.createVNode(_component_Point, {
  5991. onAddThank: $options.addThank,
  5992. onRecallThank: $options.recallThank,
  5993. item: {
  5994. isThanked: $options.post.isThanked,
  5995. thankCount: $options.post.thankCount,
  5996. username: $options.post.username
  5997. },
  5998. "api-url": "topic/" + $options.post.id
  5999. }, null, 8, ["onAddThank", "onRecallThank", "item", "api-url"])
  6000. ]),
  6001. _: 1
  6002. })
  6003. ]),
  6004. $options.post.topReplyList.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
  6005. vue.createElementVNode("div", {
  6006. class: "my-cell flex",
  6007. onClick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args), ["stop"]))
  6008. }, [
  6009. _hoisted_29,
  6010. vue.createElementVNode("div", _hoisted_30, [
  6011. vue.createVNode(_component_Tooltip, { title: "收起高赞回复" }, {
  6012. default: vue.withCtx(() => [
  6013. vue.createElementVNode("div", _hoisted_31, [
  6014. vue.createVNode(_component_Icon, { icon: "gravity-ui:chevrons-collapse-vertical" })
  6015. ])
  6016. ]),
  6017. _: 1
  6018. })
  6019. ])
  6020. ]),
  6021. vue.createElementVNode("div", _hoisted_32, [
  6022. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.post.topReplyList, (item, index) => {
  6023. return vue.openBlock(), vue.createBlock(_component_Comment, {
  6024. key: item.floor,
  6025. type: "top",
  6026. modelValue: $options.post.topReplyList[index],
  6027. "onUpdate:modelValue": ($event) => $options.post.topReplyList[index] = $event
  6028. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  6029. }), 128))
  6030. ], 512)
  6031. ])) : vue.createCommentVNode("", true),
  6032. vue.createElementVNode("div", _hoisted_33, [
  6033. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_34, [
  6034. vue.createElementVNode("div", null, [
  6035. vue.createTextVNode(vue.toDisplayString($options.post.replyCount) + " 条回复 ", 1),
  6036. $options.post.lastReplyDate ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_35, [
  6037. vue.createTextVNode("  "),
  6038. _hoisted_36,
  6039. vue.createTextVNode("  " + vue.toDisplayString($options.post.lastReplyDate), 1)
  6040. ])) : vue.createCommentVNode("", true)
  6041. ]),
  6042. $options.config.showToolbar ? (vue.openBlock(), vue.createBlock(_component_BaseSelect, {
  6043. key: 0,
  6044. "display-type": $props.displayType,
  6045. "onUpdate:displayType": _cache[3] || (_cache[3] = (e2) => _ctx.$emit("update:displayType", e2))
  6046. }, null, 8, ["display-type"])) : (vue.openBlock(), vue.createElementBlock("div", {
  6047. key: 1,
  6048. class: "fr",
  6049. innerHTML: $options.post.fr
  6050. }, null, 8, _hoisted_37))
  6051. ])) : vue.createCommentVNode("", true),
  6052. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  6053. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_38, [
  6054. vue.createVNode(_component_BaseLoading, { size: "large" })
  6055. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_39, [
  6056. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index) => {
  6057. return vue.openBlock(), vue.createBlock(_component_Comment, {
  6058. key: item.floor,
  6059. modelValue: $options.replyList[index],
  6060. "onUpdate:modelValue": ($event) => $options.replyList[index] = $event
  6061. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  6062. }), 128)) : vue.createCommentVNode("", true)
  6063. ]))
  6064. ], 64)) : vue.createCommentVNode("", true)
  6065. ]),
  6066. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40, "目前尚无回复")) : vue.createCommentVNode("", true),
  6067. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  6068. key: 2,
  6069. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  6070. ref: "replyBox"
  6071. }, [
  6072. vue.createElementVNode("div", _hoisted_41, [
  6073. _hoisted_42,
  6074. vue.createElementVNode("div", _hoisted_43, [
  6075. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  6076. key: 0,
  6077. style: { "margin-right": "2rem" },
  6078. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => $data.isSticky = false, ["stop"]))
  6079. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  6080. vue.createElementVNode("a", {
  6081. onClick: _cache[5] || (_cache[5] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  6082. }, "回到顶部")
  6083. ])
  6084. ]),
  6085. vue.createElementVNode("div", _hoisted_44, [
  6086. vue.createVNode(_component_PostEditor, {
  6087. onClose: $options.goBottom,
  6088. ref: "post-editor",
  6089. useType: "reply-post",
  6090. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => $data.isSticky = true, ["stop"]))
  6091. }, null, 8, ["onClose"])
  6092. ])
  6093. ], 2)) : vue.createCommentVNode("", true)
  6094. ], 4),
  6095. $data.showRelationReply ? (vue.openBlock(), vue.createElementBlock("div", {
  6096. key: 0,
  6097. class: "relationReply",
  6098. onClick: _cache[10] || (_cache[10] = vue.withModifiers(($event) => $options.close("space"), ["stop"]))
  6099. }, [
  6100. vue.createElementVNode("div", {
  6101. class: "my-cell flex",
  6102. onClick: _cache[8] || (_cache[8] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  6103. }, [
  6104. _hoisted_45,
  6105. vue.createElementVNode("div", _hoisted_46, [
  6106. vue.createVNode(_component_Icon, {
  6107. icon: "ic:round-close",
  6108. onClick: _cache[7] || (_cache[7] = vue.withModifiers(($event) => $data.showRelationReply = false, ["stop"]))
  6109. })
  6110. ])
  6111. ]),
  6112. vue.createElementVNode("div", {
  6113. class: "comments",
  6114. onClick: _cache[9] || (_cache[9] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  6115. }, [
  6116. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.relationReply, (item, index) => {
  6117. return vue.openBlock(), vue.createBlock(_component_SingleComment, {
  6118. "is-right": item.username === $data.targetUser.right,
  6119. key: item.floor,
  6120. comment: item
  6121. }, null, 8, ["is-right", "comment"]);
  6122. }), 128))
  6123. ])
  6124. ])) : vue.createCommentVNode("", true),
  6125. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  6126. key: 1,
  6127. class: "call-list",
  6128. style: vue.normalizeStyle($data.callStyle)
  6129. }, [
  6130. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index) => {
  6131. return vue.openBlock(), vue.createElementBlock("div", {
  6132. class: vue.normalizeClass(["call-item", { select: index === $data.selectCallIndex }]),
  6133. onClick: vue.withModifiers(($event) => $options.setCall(item), ["stop"])
  6134. }, [
  6135. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  6136. ], 10, _hoisted_47);
  6137. }), 256))
  6138. ], 4)) : vue.createCommentVNode("", true),
  6139. vue.createElementVNode("div", {
  6140. class: "close-btn",
  6141. onClick: _cache[11] || (_cache[11] = vue.withModifiers(($event) => $options.close("btn"), ["stop"]))
  6142. }, [
  6143. vue.createVNode(_component_Icon, { icon: "fontisto:close-a" })
  6144. ]),
  6145. vue.createElementVNode("div", {
  6146. class: "refresh gray",
  6147. onClick: _cache[12] || (_cache[12] = vue.withModifiers(($event) => _ctx.$emit("refresh"), ["stop"]))
  6148. }, [
  6149. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  6150. key: 1,
  6151. icon: "material-symbols:refresh"
  6152. }))
  6153. ]),
  6154. vue.createElementVNode("div", {
  6155. class: "scroll-to gray",
  6156. onClick: _cache[16] || (_cache[16] = vue.withModifiers(($event) => $options.jump($data.currentFloor), ["stop"]))
  6157. }, [
  6158. vue.createVNode(_component_Icon, { icon: "lucide:move-down" }),
  6159. vue.withDirectives(vue.createElementVNode("input", {
  6160. type: "text",
  6161. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.currentFloor = $event),
  6162. onClick: _cache[14] || (_cache[14] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"])),
  6163. onKeydown: _cache[15] || (_cache[15] = vue.withKeys(($event) => $options.jump($data.currentFloor), ["enter"]))
  6164. }, null, 544), [
  6165. [vue.vModelText, $data.currentFloor]
  6166. ])
  6167. ]),
  6168. vue.createElementVNode("div", {
  6169. class: "scroll-top gray",
  6170. onClick: _cache[17] || (_cache[17] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  6171. }, [
  6172. vue.createVNode(_component_Icon, { icon: "lucide:move-up" })
  6173. ])
  6174. ], 512),
  6175. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  6176. vue.createElementVNode("div", {
  6177. class: "preview-modal",
  6178. onWheel: _cache[20] || (_cache[20] = (...args) => $options.wheel && $options.wheel(...args))
  6179. }, [
  6180. vue.createElementVNode("div", {
  6181. class: "mask",
  6182. onClick: _cache[19] || (_cache[19] = (...args) => $options.closePreviewModal && $options.closePreviewModal(...args))
  6183. }),
  6184. vue.createVNode(_component_Icon, {
  6185. class: "close",
  6186. icon: "fontisto:close-a",
  6187. onClick: $options.closePreviewModal
  6188. }, null, 8, ["onClick"])
  6189. ], 32)
  6190. ]))
  6191. ], 34)), [
  6192. [vue.vShow, $props.modelValue]
  6193. ]);
  6194. }
  6195. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-b5867eba"]]);
  6196. const _hoisted_1$5 = { key: 1 };
  6197. const _sfc_main$5 = {
  6198. __name: "Base64Tooltip",
  6199. setup(__props) {
  6200. const tooltip = vue.ref(null);
  6201. const show = vue.ref(false);
  6202. const originalText = vue.ref("");
  6203. const decodeText = vue.ref("");
  6204. const styleObject = vue.reactive({
  6205. left: "-100vw",
  6206. top: "-100vh"
  6207. });
  6208. vue.onMounted(() => {
  6209. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  6210. setTimeout(() => show.value = true);
  6211. originalText.value = text;
  6212. decodeText.value = "";
  6213. styleObject.left = e2.clientX + "px";
  6214. styleObject.top = e2.clientY + 20 + "px";
  6215. });
  6216. window.addEventListener("click", (e2) => {
  6217. if (!tooltip.value)
  6218. return;
  6219. if (!tooltip.value.contains(e2.target) && show.value) {
  6220. show.value = false;
  6221. }
  6222. }, { capture: true });
  6223. const fn = () => show.value && (show.value = false);
  6224. $(".post-detail", window.win().doc).on("scroll", fn);
  6225. });
  6226. function copy() {
  6227. if (window.win().navigator.clipboard) {
  6228. window.win().navigator.clipboard.writeText(decodeText.value);
  6229. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  6230. } else {
  6231. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  6232. }
  6233. }
  6234. function base64ToArrayBuffer(base64) {
  6235. let binary_string = window.atob(base64);
  6236. let len = binary_string.length;
  6237. let bytes = new Uint8Array(len);
  6238. for (let i = 0; i < len; i++) {
  6239. bytes[i] = binary_string.charCodeAt(i);
  6240. }
  6241. return bytes.buffer;
  6242. }
  6243. function decode() {
  6244. try {
  6245. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  6246. decodeText.value = r2;
  6247. });
  6248. } catch (e2) {
  6249. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  6250. }
  6251. }
  6252. return (_ctx, _cache) => {
  6253. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  6254. class: "base64_tooltip",
  6255. style: vue.normalizeStyle(styleObject),
  6256. onClick: decode,
  6257. ref_key: "tooltip",
  6258. ref: tooltip
  6259. }, [
  6260. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6261. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  6262. vue.createVNode(vue.unref(Icon), { icon: "system-uicons:translate" })
  6263. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
  6264. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  6265. vue.createVNode(BaseButton, {
  6266. class: "btn",
  6267. size: "small",
  6268. onClick: copy
  6269. }, {
  6270. default: vue.withCtx(() => [
  6271. vue.createTextVNode("点击复制")
  6272. ]),
  6273. _: 1
  6274. })
  6275. ]))
  6276. ], 4)), [
  6277. [vue.vShow, show.value]
  6278. ]);
  6279. };
  6280. }
  6281. };
  6282. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c50fb66c"]]);
  6283. const _sfc_main$4 = {
  6284. name: "Msg",
  6285. components: { Icon },
  6286. props: {
  6287. type: "",
  6288. text: ""
  6289. },
  6290. created() {
  6291. setTimeout(() => {
  6292. this.$emit("close");
  6293. }, 3e3);
  6294. }
  6295. };
  6296. const _hoisted_1$4 = { class: "right" };
  6297. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  6298. const _component_Icon = vue.resolveComponent("Icon");
  6299. return vue.openBlock(), vue.createElementBlock("div", {
  6300. class: vue.normalizeClass(["msg", $props.type])
  6301. }, [
  6302. vue.createElementVNode("div", {
  6303. class: "left",
  6304. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  6305. }, [
  6306. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  6307. ]),
  6308. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  6309. ], 2);
  6310. }
  6311. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-8bf692ea"]]);
  6312. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-eef9961d"), n2 = n2(), vue.popScopeId(), n2);
  6313. const _hoisted_1$3 = {
  6314. key: 0,
  6315. class: "tag-modal modal"
  6316. };
  6317. const _hoisted_2$2 = { class: "wrapper" };
  6318. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  6319. const _hoisted_4$2 = { class: "option" };
  6320. const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  6321. const _hoisted_6$2 = { class: "btns" };
  6322. const _sfc_main$3 = {
  6323. __name: "TagModal",
  6324. props: ["tags"],
  6325. emits: ["update:tags"],
  6326. setup(__props, { emit: __emit }) {
  6327. const tagModal = vue.reactive({
  6328. show: false,
  6329. currentUsername: "",
  6330. tag: ""
  6331. });
  6332. const props = __props;
  6333. const emit = __emit;
  6334. const inputRef = vue.ref();
  6335. vue.onMounted(() => {
  6336. eventBus.on(CMD.ADD_TAG, (username) => {
  6337. tagModal.currentUsername = username;
  6338. tagModal.show = true;
  6339. vue.nextTick(() => {
  6340. inputRef.value.focus();
  6341. });
  6342. });
  6343. });
  6344. async function addTag() {
  6345. if (!tagModal.tag) {
  6346. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  6347. return;
  6348. }
  6349. let oldTag = window.clone(props.tags);
  6350. let tempTag = window.clone(props.tags);
  6351. let userTags = tempTag[tagModal.currentUsername] ?? [];
  6352. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  6353. if (rIndex > -1) {
  6354. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  6355. return;
  6356. } else {
  6357. userTags.push(tagModal.tag);
  6358. }
  6359. tempTag[tagModal.currentUsername] = userTags;
  6360. emit("update:tags", tempTag);
  6361. tagModal.tag = "";
  6362. tagModal.show = false;
  6363. let res = await window.parse.saveTags(tempTag);
  6364. if (!res) {
  6365. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  6366. emit("update:tags", oldTag);
  6367. }
  6368. }
  6369. return (_ctx, _cache) => {
  6370. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6371. default: vue.withCtx(() => [
  6372. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  6373. vue.createElementVNode("div", {
  6374. class: "mask",
  6375. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  6376. }),
  6377. vue.createElementVNode("div", _hoisted_2$2, [
  6378. _hoisted_3$2,
  6379. vue.createElementVNode("div", _hoisted_4$2, [
  6380. _hoisted_5$2,
  6381. vue.createElementVNode("div", null, [
  6382. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  6383. ])
  6384. ]),
  6385. vue.withDirectives(vue.createElementVNode("input", {
  6386. type: "text",
  6387. ref_key: "inputRef",
  6388. ref: inputRef,
  6389. style: { "width": "100%" },
  6390. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  6391. onKeydown: vue.withKeys(addTag, ["enter"])
  6392. }, null, 544), [
  6393. [vue.vModelText, tagModal.tag]
  6394. ]),
  6395. vue.createElementVNode("div", _hoisted_6$2, [
  6396. vue.createVNode(BaseButton, {
  6397. type: "link",
  6398. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => {
  6399. tagModal.show = false;
  6400. tagModal.tag = "";
  6401. }, ["stop"]))
  6402. }, {
  6403. default: vue.withCtx(() => [
  6404. vue.createTextVNode("取消")
  6405. ]),
  6406. _: 1
  6407. }),
  6408. vue.createVNode(BaseButton, {
  6409. onClick: vue.withModifiers(addTag, ["stop"])
  6410. }, {
  6411. default: vue.withCtx(() => [
  6412. vue.createTextVNode("确定")
  6413. ]),
  6414. _: 1
  6415. })
  6416. ])
  6417. ])
  6418. ])) : vue.createCommentVNode("", true)
  6419. ]),
  6420. _: 1
  6421. });
  6422. };
  6423. }
  6424. };
  6425. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-eef9961d"]]);
  6426. const _hoisted_1$2 = { class: "msgs" };
  6427. const _sfc_main$2 = {
  6428. __name: "MsgModal",
  6429. setup(__props) {
  6430. const msgList = vue.reactive([
  6431. // {type: 'success', text: '123', id: Date.now()}
  6432. ]);
  6433. vue.onMounted(() => {
  6434. eventBus.on(CMD.SHOW_MSG, (val) => {
  6435. msgList.push({ ...val, id: Date.now() });
  6436. });
  6437. });
  6438. function removeMsg(id) {
  6439. let rIndex = msgList.findIndex((item) => item.id === id);
  6440. if (rIndex > -1) {
  6441. msgList.splice(rIndex, 1);
  6442. }
  6443. }
  6444. return (_ctx, _cache) => {
  6445. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
  6446. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  6447. return vue.openBlock(), vue.createBlock(Msg, {
  6448. key: v.id,
  6449. type: v.type,
  6450. text: v.text,
  6451. onClose: ($event) => removeMsg(v.id)
  6452. }, null, 8, ["type", "text", "onClose"]);
  6453. }), 128))
  6454. ]);
  6455. };
  6456. }
  6457. };
  6458. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b73f4332"]]);
  6459. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  6460. function e(e2) {
  6461. }
  6462. function r(e2, t) {
  6463. let r2 = e2.substr(t, 2);
  6464. return parseInt(r2, 16);
  6465. }
  6466. function n(href, index) {
  6467. let o = "", a = r(href, index);
  6468. for (let i = index + 2; i < href.length; i += 2) {
  6469. let l = r(href, i) ^ a;
  6470. o += String.fromCharCode(l);
  6471. }
  6472. try {
  6473. o = decodeURIComponent(escape(o));
  6474. } catch (u2) {
  6475. }
  6476. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  6477. return d.childNodes[0].getAttribute("href") || "";
  6478. }
  6479. function decodeEmail(body) {
  6480. try {
  6481. let as = body.find(u);
  6482. as.each(function() {
  6483. try {
  6484. let o = this, a = o.parentNode, i = o.getAttribute(f);
  6485. if (i) {
  6486. let l = n(i, 0), d2 = document.createTextNode(l);
  6487. a.replaceChild(d2, o);
  6488. }
  6489. } catch (h2) {
  6490. e(h2);
  6491. }
  6492. });
  6493. } catch (s) {
  6494. }
  6495. }
  6496. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-77aa374e"), n2 = n2(), vue.popScopeId(), n2);
  6497. const _hoisted_1$1 = {
  6498. key: 0,
  6499. class: "NotificationModal modal"
  6500. };
  6501. const _hoisted_2$1 = { class: "modal-root" };
  6502. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  6503. const _hoisted_4$1 = { class: "modal-body" };
  6504. const _hoisted_5$1 = { class: "filter" };
  6505. const _hoisted_6$1 = { class: "list-wrap" };
  6506. const _hoisted_7$1 = { class: "notify-wrap" };
  6507. const _hoisted_8$1 = ["innerHTML"];
  6508. const _hoisted_9$1 = {
  6509. key: 0,
  6510. class: "loading-wrap"
  6511. };
  6512. const _hoisted_10$1 = { class: "footer" };
  6513. const _hoisted_11$1 = ["innerHTML"];
  6514. const _hoisted_12$1 = { class: "total" };
  6515. const _hoisted_13 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("span", null, "总共收到提醒", -1));
  6516. const _sfc_main$1 = {
  6517. __name: "NotificationModal",
  6518. props: ["modelValue", "list", "total", "pages", "loading"],
  6519. emits: ["update:modelValue"],
  6520. setup(__props, { emit: __emit }) {
  6521. const props = __props;
  6522. const emit = __emit;
  6523. const index = vue.ref("all");
  6524. vue.onMounted(() => {
  6525. });
  6526. vue.watch([index, () => props.list], () => {
  6527. $(".notify-wrap").scrollTop(0);
  6528. });
  6529. vue.watch(() => props.modelValue, (n2) => {
  6530. if (n2) {
  6531. document.body.style.overflow = "hidden";
  6532. } else {
  6533. document.body.style.overflow = "unset";
  6534. $(".notify-wrap").scrollTop(0);
  6535. }
  6536. });
  6537. function close() {
  6538. emit("update:modelValue", false);
  6539. }
  6540. return (_ctx, _cache) => {
  6541. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6542. default: vue.withCtx(() => [
  6543. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  6544. vue.createElementVNode("div", {
  6545. class: "mask",
  6546. onClick: vue.withModifiers(close, ["stop"])
  6547. }),
  6548. vue.createElementVNode("div", _hoisted_2$1, [
  6549. vue.createElementVNode("div", { class: "modal-header" }, [
  6550. _hoisted_3$1,
  6551. vue.createElementVNode("i", {
  6552. class: "fa fa-times",
  6553. onClick: close
  6554. })
  6555. ]),
  6556. vue.createElementVNode("div", _hoisted_4$1, [
  6557. vue.createElementVNode("div", _hoisted_5$1, [
  6558. vue.createElementVNode("div", {
  6559. class: vue.normalizeClass(index.value === "all" && "active"),
  6560. onClick: _cache[0] || (_cache[0] = ($event) => index.value = "all")
  6561. }, "全部", 2),
  6562. vue.createElementVNode("div", {
  6563. class: vue.normalizeClass(index.value === "reply" && "active"),
  6564. onClick: _cache[1] || (_cache[1] = ($event) => index.value = "reply")
  6565. }, "回复", 2),
  6566. vue.createElementVNode("div", {
  6567. class: vue.normalizeClass(index.value === "star" && "active"),
  6568. onClick: _cache[2] || (_cache[2] = ($event) => index.value = "star")
  6569. }, "感谢", 2),
  6570. vue.createElementVNode("div", {
  6571. class: vue.normalizeClass(index.value === "collect" && "active"),
  6572. onClick: _cache[3] || (_cache[3] = ($event) => index.value = "collect")
  6573. }, "收藏", 2)
  6574. ]),
  6575. vue.createElementVNode("div", _hoisted_6$1, [
  6576. vue.createElementVNode("div", _hoisted_7$1, [
  6577. vue.createElementVNode("div", {
  6578. id: "notifications",
  6579. class: vue.normalizeClass(index.value),
  6580. innerHTML: __props.list
  6581. }, null, 10, _hoisted_8$1)
  6582. ]),
  6583. __props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$1, [
  6584. vue.createVNode(BaseLoading)
  6585. ])) : vue.createCommentVNode("", true)
  6586. ]),
  6587. vue.createElementVNode("div", _hoisted_10$1, [
  6588. vue.createElementVNode("div", {
  6589. innerHTML: __props.pages,
  6590. class: "pages"
  6591. }, null, 8, _hoisted_11$1),
  6592. vue.createElementVNode("div", _hoisted_12$1, [
  6593. _hoisted_13,
  6594. vue.createTextVNode(vue.toDisplayString(__props.total), 1)
  6595. ])
  6596. ])
  6597. ])
  6598. ])
  6599. ])) : vue.createCommentVNode("", true)
  6600. ]),
  6601. _: 1
  6602. });
  6603. };
  6604. }
  6605. };
  6606. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-77aa374e"]]);
  6607. const _sfc_main = {
  6608. components: {
  6609. Icon,
  6610. BaseButton,
  6611. NotificationModal,
  6612. BaseLoading,
  6613. BaseSwitch,
  6614. MsgModal,
  6615. TagModal,
  6616. Tooltip,
  6617. Setting,
  6618. PostDetail,
  6619. Base64Tooltip,
  6620. Msg
  6621. },
  6622. provide() {
  6623. return {
  6624. isLogin: vue.computed(() => this.isLogin),
  6625. isNight: vue.computed(() => this.isNight),
  6626. pageType: vue.computed(() => this.pageType),
  6627. tags: vue.computed(() => this.tags),
  6628. show: vue.computed(() => this.show),
  6629. post: vue.computed(() => this.current),
  6630. config: vue.computed(() => this.config),
  6631. allReplyUsers: vue.computed(() => {
  6632. var _a, _b, _c;
  6633. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  6634. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  6635. }
  6636. return [];
  6637. }),
  6638. showConfig: this.showConfig
  6639. };
  6640. },
  6641. data() {
  6642. return {
  6643. loading: window.pageType === PageType.Post,
  6644. refreshLoading: false,
  6645. loadMore: false,
  6646. isLogin: !!window.user.username,
  6647. pageType: window.pageType,
  6648. isNight: window.isNight,
  6649. stopMe: window.stopMe,
  6650. //停止使用脚本
  6651. show: false,
  6652. current: window.clone(window.initPost),
  6653. list: [],
  6654. config: window.clone(window.config),
  6655. tags: window.user.tags,
  6656. configModal: {
  6657. show: false
  6658. },
  6659. notificationModal: {
  6660. show: false,
  6661. loading: false,
  6662. list: "",
  6663. total: 0
  6664. },
  6665. previewModal: {
  6666. show: false,
  6667. src: ""
  6668. },
  6669. popConfirmModal: {
  6670. show: false,
  6671. title: "",
  6672. id: ""
  6673. },
  6674. timer: -1,
  6675. timer2: -1,
  6676. pageInfo: {
  6677. title: "",
  6678. number: 0
  6679. }
  6680. };
  6681. },
  6682. computed: {
  6683. targetUserTags() {
  6684. return this.tags[window.targetUserName] ?? [];
  6685. },
  6686. isList() {
  6687. return [PageType.Home, PageType.Node].includes(this.pageType);
  6688. },
  6689. isPost() {
  6690. return this.pageType === PageType.Post;
  6691. },
  6692. isMember() {
  6693. return this.pageType === PageType.Member;
  6694. }
  6695. },
  6696. watch: {
  6697. config: {
  6698. handler(newVal, oldVal) {
  6699. let configStr = localStorage.getItem("v2ex-config");
  6700. if (configStr) {
  6701. let configObj = JSON.parse(configStr);
  6702. configObj[window.user.username || "default"] = newVal;
  6703. localStorage.setItem("v2ex-config", JSON.stringify(configObj));
  6704. }
  6705. window.config = newVal;
  6706. window.parse.editNoteItem(window.user.configPrefix + JSON.stringify(window.config), window.user.configNoteId);
  6707. },
  6708. deep: true
  6709. },
  6710. tags(newVal) {
  6711. window.user.tags = newVal;
  6712. },
  6713. "config.viewType"(newVal) {
  6714. if (!newVal)
  6715. return;
  6716. if (newVal === "card") {
  6717. $(".post-item").each(function() {
  6718. $(this).addClass("preview");
  6719. });
  6720. } else {
  6721. $(".post-item").each(function() {
  6722. $(this).removeClass("preview");
  6723. });
  6724. }
  6725. },
  6726. "pageInfo.number"(newVal) {
  6727. clearInterval(this.timer2);
  6728. if (newVal) {
  6729. document.title = `(${this.pageInfo.number}) ` + this.pageInfo.title;
  6730. if (this.config.notice.whenNewNoticeGlimmer) {
  6731. let c = 0;
  6732. this.timer2 = setInterval(() => {
  6733. c++;
  6734. document.title = this.pageInfo.title;
  6735. if (c % 2 === 0) {
  6736. document.title = `(${this.pageInfo.number}) ` + this.pageInfo.title;
  6737. }
  6738. }, 1e3);
  6739. }
  6740. } else {
  6741. document.title = this.pageInfo.title;
  6742. }
  6743. },
  6744. show(newVal) {
  6745. if (this.pageType === PageType.Post)
  6746. return;
  6747. if (newVal) {
  6748. document.body.style.overflow = "hidden";
  6749. if (!window.history.state) {
  6750. window.history.pushState({}, 0, this.current.href);
  6751. }
  6752. vue.nextTick(() => {
  6753. this.pageInfo.title = document.title = this.current.title ?? "V2EX";
  6754. });
  6755. } else {
  6756. document.body.style.overflow = "unset";
  6757. this.pageInfo.title = document.title = "V2EX";
  6758. if (window.history.state) {
  6759. window.history.back();
  6760. }
  6761. }
  6762. }
  6763. },
  6764. created() {
  6765. let that = this;
  6766. this.initEvent();
  6767. window.cb = this.winCb;
  6768. if (!window.canParseV2exPage)
  6769. return;
  6770. $(document).on("click", "a", this.clickA);
  6771. $(document).on("click", ".post-item", function(e2) {
  6772. if (e2.currentTarget.getAttribute("script"))
  6773. return;
  6774. if (that.stopMe)
  6775. return true;
  6776. if (this.classList.contains("preview")) {
  6777. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG" && !e2.target.classList.contains("toggle")) {
  6778. let id = this.dataset["id"];
  6779. let href = this.dataset["href"];
  6780. if (id) {
  6781. that.clickPost(e2, id, href);
  6782. } else {
  6783. if (href)
  6784. location.href = href;
  6785. }
  6786. }
  6787. }
  6788. });
  6789. $(document).on("click", ".toggle", (e2) => {
  6790. if (this.stopMe)
  6791. return true;
  6792. let id = e2.target.dataset["id"];
  6793. let itemDom = document.querySelector(`.id_${id}`);
  6794. if (itemDom.classList.contains("preview")) {
  6795. e2.target.innerText = "预览";
  6796. itemDom.classList.remove("preview");
  6797. } else {
  6798. if (this.config.viewType !== "card") {
  6799. let index = this.list.findIndex((v) => v.id == id);
  6800. if (index > -1) {
  6801. e2.target.innerText = "收起";
  6802. itemDom.classList.add("preview");
  6803. } else {
  6804. e2.target.innerText = "加载中";
  6805. functions.getPostDetailByApi(id).then((res) => {
  6806. if (res.content_rendered) {
  6807. res.href = itemDom.dataset["href"];
  6808. this.list.push(getDefaultPost(res));
  6809. itemDom.classList.add("preview");
  6810. e2.target.innerText = "收起";
  6811. functions.appendPostContent(res, itemDom);
  6812. } else {
  6813. e2.target.innerText = "预览";
  6814. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "主题暂无正文!" });
  6815. }
  6816. });
  6817. }
  6818. } else {
  6819. e2.target.innerText = "收起";
  6820. itemDom.classList.add("preview");
  6821. }
  6822. }
  6823. });
  6824. window.onpopstate = (event) => {
  6825. if (event.state) {
  6826. if (!this.show)
  6827. this.show = true;
  6828. } else {
  6829. if (this.show)
  6830. this.show = false;
  6831. }
  6832. };
  6833. if (this.config.notice.takeOverNoticePage) {
  6834. window.deleteNotification = (nId, token) => {
  6835. let item = $("#n_" + nId);
  6836. item.slideUp("fast");
  6837. $.post({
  6838. url: "/delete/notification/" + nId + "?once=" + token,
  6839. success() {
  6840. $.get({
  6841. url: "/notifications/below/" + window.notificationBottom,
  6842. success(data, status, request) {
  6843. item.remove();
  6844. $("#notifications").append(that.checkReplyItemType(data));
  6845. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  6846. },
  6847. error() {
  6848. item.slideDown("fast");
  6849. }
  6850. });
  6851. },
  6852. error() {
  6853. item.slideDown("fast");
  6854. }
  6855. });
  6856. };
  6857. }
  6858. },
  6859. mounted() {
  6860. },
  6861. beforeUnmount() {
  6862. clearInterval(this.timer);
  6863. eventBus.clear();
  6864. $(document).off("click", "a", this.clickA);
  6865. },
  6866. methods: {
  6867. checkReplyItemType(val) {
  6868. let d2 = $(val);
  6869. let str = d2.html();
  6870. if (str.includes("提到了你") || str.includes("回复了你")) {
  6871. d2.addClass("reply");
  6872. }
  6873. if (str.includes("感谢了你")) {
  6874. d2.addClass("star");
  6875. }
  6876. if (str.includes("收藏了你")) {
  6877. d2.addClass("collect");
  6878. }
  6879. return d2;
  6880. },
  6881. async getUnreadMessagesCount() {
  6882. var _a, _b;
  6883. const res = await fetch(`${location.origin}/mission`);
  6884. const htmlText = await res.text();
  6885. const $page = $(htmlText);
  6886. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  6887. if (text.includes("未读提醒")) {
  6888. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  6889. if (countStr) {
  6890. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  6891. }
  6892. } else {
  6893. return 0;
  6894. }
  6895. throw new Error("无法获取未读消息数量");
  6896. },
  6897. clickA(e2) {
  6898. let that = this;
  6899. if (e2.currentTarget.getAttribute("script"))
  6900. return;
  6901. if (that.stopMe)
  6902. return true;
  6903. let { pageType } = functions.checkPageType(e2.currentTarget);
  6904. let { href, id, title } = functions.parseA(e2.currentTarget);
  6905. switch (pageType) {
  6906. case PageType.Post:
  6907. if (id) {
  6908. that.clickPost(e2, id, href, title);
  6909. }
  6910. break;
  6911. case PageType.Node:
  6912. case PageType.Home:
  6913. case PageType.Changes:
  6914. return;
  6915. default:
  6916. if (e2.currentTarget.href.includes("/settings/night/toggle"))
  6917. return;
  6918. if (e2.currentTarget.href === location.origin + "/#;")
  6919. return;
  6920. if (e2.currentTarget.href.includes("/notifications")) {
  6921. this.pageInfo.number = 0;
  6922. $("#money").parent().prev().replaceWith(`<a href="/notifications">0 未读提醒</a>`);
  6923. if (this.config.notice.takeOverNoticePage) {
  6924. this.notificationModal.loading = true;
  6925. this.notificationModal.show = true;
  6926. fetch(href).then(async (r2) => {
  6927. let htmlText = await r2.text();
  6928. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6929. let res = htmlText.match(/var notificationBottom = ([\d]+);/);
  6930. if (res && res[1]) {
  6931. window.notificationBottom = Number(res[1]);
  6932. }
  6933. let body = $(bodyText[0]);
  6934. let list = body.find("#notifications");
  6935. list.children().each(function() {
  6936. that.checkReplyItemType(this);
  6937. });
  6938. let h2 = list.html();
  6939. let d2 = body.find("#Main > .box > .header .fr .gray");
  6940. if (d2.length) {
  6941. this.notificationModal.total = d2.text();
  6942. }
  6943. this.notificationModal.list = h2;
  6944. let p = list.next();
  6945. let tds = p.find(".button");
  6946. tds.each(function() {
  6947. let href2 = this.getAttribute("onclick");
  6948. if (href2) {
  6949. this.innerHTML = `<a href=${href2.replace("location.href=", "")}>${this.innerHTML}</a>`;
  6950. this.setAttribute("onclick", "");
  6951. }
  6952. });
  6953. this.notificationModal.pages = p.html();
  6954. this.notificationModal.loading = false;
  6955. }).catch((e3) => {
  6956. this.notificationModal.loading = false;
  6957. });
  6958. that.stopEvent(e2);
  6959. return;
  6960. }
  6961. }
  6962. if (that.config.newTabOpen) {
  6963. that.stopEvent(e2);
  6964. functions.openNewTab(e2.currentTarget.href, that.config.newTabOpenActive);
  6965. }
  6966. return;
  6967. }
  6968. },
  6969. stopEvent(e2) {
  6970. e2.preventDefault();
  6971. e2.stopPropagation();
  6972. },
  6973. async clickPost(e2, id, href, title = "") {
  6974. if (id) {
  6975. if (this.config.clickPostItemOpenDetail) {
  6976. this.stopEvent(e2);
  6977. let postItem = getDefaultPost();
  6978. let index = this.list.findIndex((v) => v.id == id);
  6979. if (index > -1) {
  6980. postItem = this.list[index];
  6981. }
  6982. if (!postItem.title)
  6983. postItem.title = title ?? "加载中";
  6984. postItem.id = id;
  6985. postItem.href = href;
  6986. this.getPostDetail(postItem);
  6987. return;
  6988. }
  6989. if (this.config.newTabOpen) {
  6990. this.stopEvent(e2);
  6991. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`, this.config.newTabOpenActive);
  6992. }
  6993. }
  6994. },
  6995. showPost() {
  6996. this.show = true;
  6997. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6998. $(this).hide();
  6999. });
  7000. },
  7001. showConfig() {
  7002. this.configModal.show = true;
  7003. },
  7004. resetTitle() {
  7005. let r2 = document.title.match(/\s?\(\d+\)\s?/);
  7006. if (r2 && r2.length) {
  7007. this.pageInfo.title = document.title.replace(r2[0], "");
  7008. } else {
  7009. this.pageInfo.title = document.title;
  7010. }
  7011. },
  7012. async getNotice(body) {
  7013. if (!body) {
  7014. let res = await fetch("/t");
  7015. if (res.status === 200) {
  7016. let htmlText = await res.text();
  7017. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7018. body = $(bodyText[0]);
  7019. }
  7020. }
  7021. let notify = body.find('a[href="/notifications"]');
  7022. if (notify.length) {
  7023. this.resetTitle();
  7024. let text = notify.text();
  7025. if (text !== "0 未读提醒") {
  7026. this.pageInfo.number = text.replace(" 未读提醒", "");
  7027. if (this.config.notice.text !== text) {
  7028. $("#money").parent().prev().replaceWith(`<div><div class="orange-dot"></div><strong><a href="/notifications">${text}</a></strong></div>`);
  7029. this.config.notice.text = text;
  7030. if (this.config.notice.ddWebhook) {
  7031. let n2 = /* @__PURE__ */ new Date();
  7032. let s = n2.getSeconds();
  7033. s = s < 10 ? "0" + s : s;
  7034. let m = n2.getMinutes();
  7035. m = m < 10 ? "0" + m : m;
  7036. let h2 = n2.getHours();
  7037. h2 = h2 < 10 ? "0" + h2 : h2;
  7038. $.ajax("https://car-back.ttentau.top/index.php/v1/config/forward", {
  7039. method: "POST",
  7040. contentType: "application/json",
  7041. data: JSON.stringify({
  7042. url: this.config.notice.ddWebhook,
  7043. "text": notify.text() + `,时间:${n2.getFullYear()}/${n2.getMonth() + 1}/${n2.getDate()} ${h2}:${m}:${s}`
  7044. })
  7045. });
  7046. }
  7047. }
  7048. } else {
  7049. $("#money").parent().prev().replaceWith(`<a href="/notifications">${text}</a>`);
  7050. this.config.notice.text = "";
  7051. }
  7052. }
  7053. },
  7054. async winCb({ type, value }) {
  7055. if (type === "openSetting") {
  7056. this.showConfig();
  7057. }
  7058. if (type === "syncData") {
  7059. this.stopMe = window.stopMe;
  7060. }
  7061. if (type === "getConfigSuccess") {
  7062. this.config = window.config;
  7063. this.tags = window.user.tags;
  7064. if (window.isLogin && this.config.notice.loopCheckNotice) {
  7065. this.getNotice($(document.body));
  7066. this.timer = setInterval(this.getNotice, 1e3 * 60 * Number(this.config.notice.loopCheckNoticeInterval));
  7067. }
  7068. }
  7069. if (type === "syncList") {
  7070. this.list = Object.assign(this.list, window.postList);
  7071. }
  7072. if (type === "warningNotice") {
  7073. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  7074. }
  7075. if (this.stopMe)
  7076. return;
  7077. if (type === "restorePost") {
  7078. this.show = false;
  7079. this.loading = false;
  7080. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  7081. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  7082. $(this).show();
  7083. });
  7084. }
  7085. if (type === "postContent") {
  7086. this.current = Object.assign(this.current, value);
  7087. this.current.inList = true;
  7088. if (this.config.autoOpenDetail) {
  7089. this.showPost();
  7090. }
  7091. }
  7092. if (type === "postReplies") {
  7093. this.loading = false;
  7094. this.current = Object.assign(this.current, value);
  7095. this.list.push(this.clone(this.current));
  7096. }
  7097. },
  7098. clone(val) {
  7099. return window.clone(val);
  7100. },
  7101. regenerateReplyList() {
  7102. if (this.current.replyList.length) {
  7103. functions.createList(this.current, this.current.replyList);
  7104. } else {
  7105. this.current.replyCount = 0;
  7106. this.current.nestedReplies = [];
  7107. this.current.nestedRedundReplies = [];
  7108. }
  7109. if (this.list.length) {
  7110. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7111. if (rIndex > -1) {
  7112. this.list[rIndex] = this.clone(this.current);
  7113. }
  7114. }
  7115. },
  7116. initEvent() {
  7117. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  7118. const { id, type } = val;
  7119. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  7120. if (currentI > -1) {
  7121. this.current.replyList[currentI].isThanked = type === "add";
  7122. if (type === "add") {
  7123. this.current.replyList[currentI].thankCount++;
  7124. } else {
  7125. this.current.replyList[currentI].thankCount--;
  7126. }
  7127. this.regenerateReplyList();
  7128. }
  7129. });
  7130. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  7131. const { id, type } = val;
  7132. this.current.isThanked = type === "add";
  7133. if (type === "add") {
  7134. this.current.thankCount++;
  7135. } else {
  7136. this.current.thankCount--;
  7137. }
  7138. let currentI = this.list.findIndex((i) => i.id === id);
  7139. if (currentI > -1) {
  7140. this.list[currentI].isThanked = type === "add";
  7141. if (type === "add") {
  7142. this.list[currentI].thankCount++;
  7143. } else {
  7144. this.list[currentI].thankCount++;
  7145. }
  7146. }
  7147. });
  7148. eventBus.on(CMD.REMOVE, (val) => {
  7149. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  7150. if (removeIndex > -1) {
  7151. this.current.replyList.splice(removeIndex, 1);
  7152. }
  7153. this.regenerateReplyList();
  7154. });
  7155. eventBus.on(CMD.IGNORE, () => {
  7156. this.show = false;
  7157. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7158. if (rIndex > -1) {
  7159. this.list.splice(rIndex, 1);
  7160. }
  7161. this.current = this.clone(window.initPost);
  7162. });
  7163. eventBus.on(CMD.MERGE, (val) => {
  7164. this.current = Object.assign(this.current, val);
  7165. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  7166. if (rIndex > -1) {
  7167. this.list[rIndex] = this.clone(this.current);
  7168. }
  7169. });
  7170. eventBus.on(CMD.ADD_REPLY, (item) => {
  7171. this.current.replyList.push(item);
  7172. this.regenerateReplyList();
  7173. });
  7174. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  7175. if (once) {
  7176. if (typeof once === "string") {
  7177. let res = once.match(/var once = "([\d]+)";/);
  7178. if (res && res[1]) {
  7179. this.current.once = Number(res[1]);
  7180. return;
  7181. }
  7182. }
  7183. if (typeof once === "number") {
  7184. this.current.once = once;
  7185. return;
  7186. }
  7187. }
  7188. window.fetchOnce().then((r2) => {
  7189. this.current.once = r2;
  7190. });
  7191. });
  7192. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  7193. let oldTag = this.clone(this.tags);
  7194. let tags = this.tags[username] ?? [];
  7195. let rIndex = tags.findIndex((v) => v === tag);
  7196. if (rIndex > -1) {
  7197. tags.splice(rIndex, 1);
  7198. }
  7199. this.tags[username] = tags;
  7200. let res = await window.parse.saveTags(this.tags);
  7201. if (!res) {
  7202. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  7203. this.tags = oldTag;
  7204. }
  7205. });
  7206. eventBus.on(CMD.SHOW_CONFIRM_MODAL, (val) => {
  7207. const { rect, title, id } = val;
  7208. this.popConfirmModal.show = true;
  7209. this.popConfirmModal.title = title;
  7210. this.popConfirmModal.id = id;
  7211. vue.nextTick(() => {
  7212. this.$refs.tip.style.top = rect.top + "px";
  7213. this.$refs.tip.style.left = rect.left + rect.width / 2 - 50 + "px";
  7214. });
  7215. });
  7216. },
  7217. async getPostDetail(post) {
  7218. this.current = post;
  7219. this.show = true;
  7220. let url = location.origin + "/t/" + this.current.id;
  7221. this.current.url = url;
  7222. let alreadyHasReply = this.current.replyList.length;
  7223. if (alreadyHasReply) {
  7224. this.refreshLoading = true;
  7225. } else {
  7226. this.loading = true;
  7227. functions.getPostDetailByApi(this.current.id).then((d2) => {
  7228. d2.replyCount = d2.replies;
  7229. this.current = Object.assign(this.current, d2);
  7230. if (this.current.replyCount > MAX_REPLY_LIMIT) {
  7231. functions.openNewTab(`${location.origin}/t/${this.current.id}?p=1&script=1`, true);
  7232. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  7233. this.loading = this.show = false;
  7234. return;
  7235. } else {
  7236. this.current.jsonContent = `
  7237. <div class="cell">
  7238. <div class="topic_content">
  7239. <div class="markdown_body">
  7240. ${(d2 == null ? void 0 : d2.content_rendered) ?? ""}
  7241. </div>
  7242. </div>
  7243. </div>`;
  7244. }
  7245. });
  7246. }
  7247. let apiRes = await window.fetch(url + "?p=1");
  7248. if (apiRes.status === 404) {
  7249. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  7250. return this.refreshLoading = this.loading = false;
  7251. }
  7252. if (apiRes.status === 403) {
  7253. this.refreshLoading = this.show = this.loading = false;
  7254. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`, true);
  7255. return;
  7256. }
  7257. if (apiRes.redirected) {
  7258. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  7259. return this.refreshLoading = this.loading = false;
  7260. }
  7261. let htmlText = await apiRes.text();
  7262. let hasPermission = htmlText.search("你要查看的页面需要先登录");
  7263. if (hasPermission > -1) {
  7264. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录" });
  7265. return this.refreshLoading = this.loading = false;
  7266. }
  7267. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7268. let body = $(bodyText[0]);
  7269. decodeEmail(body);
  7270. await window.parse.getPostDetail(this.current, body, htmlText);
  7271. let index = this.list.findIndex((v) => v.id == this.current.id);
  7272. if (index > -1) {
  7273. this.list[index] = this.clone(this.current);
  7274. } else {
  7275. this.list.push(this.clone(this.current));
  7276. }
  7277. this.refreshLoading = this.loading = false;
  7278. await window.parse.parseOp(this.current);
  7279. },
  7280. addTargetUserTag() {
  7281. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  7282. },
  7283. removeTargetUserTag(tag) {
  7284. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  7285. },
  7286. popConfirmModalCancel() {
  7287. this.popConfirmModal.show = false;
  7288. },
  7289. popConfirmModalConfirm() {
  7290. this.popConfirmModalCancel();
  7291. eventBus.emit(CMD.SHOW_CONFIRM_MODAL_CONFIRM, this.popConfirmModal.id);
  7292. }
  7293. }
  7294. };
  7295. const _withScopeId = (n2) => (vue.pushScopeId("data-v-bae2f48f"), n2 = n2(), vue.popScopeId(), n2);
  7296. const _hoisted_1 = {
  7297. key: 0,
  7298. class: "target-user-tags p1"
  7299. };
  7300. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  7301. const _hoisted_3 = { class: "my-tag" };
  7302. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  7303. const _hoisted_5 = ["onClick"];
  7304. const _hoisted_6 = {
  7305. key: 1,
  7306. class: "my-box p2",
  7307. style: { "margin-top": "2rem", "margin-bottom": "0" }
  7308. };
  7309. const _hoisted_7 = {
  7310. key: 0,
  7311. class: "flex flex-center"
  7312. };
  7313. const _hoisted_8 = {
  7314. key: 1,
  7315. class: "loaded"
  7316. };
  7317. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  7318. const _hoisted_10 = {
  7319. key: 0,
  7320. ref: "tip",
  7321. class: "pop-confirm-content"
  7322. };
  7323. const _hoisted_11 = { class: "text" };
  7324. const _hoisted_12 = { class: "options" };
  7325. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  7326. const _component_Setting = vue.resolveComponent("Setting");
  7327. const _component_TagModal = vue.resolveComponent("TagModal");
  7328. const _component_PostDetail = vue.resolveComponent("PostDetail");
  7329. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  7330. const _component_MsgModal = vue.resolveComponent("MsgModal");
  7331. const _component_NotificationModal = vue.resolveComponent("NotificationModal");
  7332. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  7333. const _component_BaseButton = vue.resolveComponent("BaseButton");
  7334. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  7335. vue.createVNode(_component_Setting, {
  7336. modelValue: $data.config,
  7337. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  7338. show: $data.configModal.show,
  7339. "onUpdate:show": _cache[1] || (_cache[1] = ($event) => $data.configModal.show = $event)
  7340. }, null, 8, ["modelValue", "show"]),
  7341. vue.createVNode(_component_TagModal, {
  7342. tags: $data.tags,
  7343. "onUpdate:tags": _cache[2] || (_cache[2] = ($event) => $data.tags = $event)
  7344. }, null, 8, ["tags"]),
  7345. vue.createVNode(_component_PostDetail, {
  7346. modelValue: $data.show,
  7347. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.show = $event),
  7348. ref: "postDetail",
  7349. displayType: $data.config.commentDisplayType,
  7350. "onUpdate:displayType": _cache[4] || (_cache[4] = ($event) => $data.config.commentDisplayType = $event),
  7351. onRefresh: _cache[5] || (_cache[5] = ($event) => $options.getPostDetail($data.current)),
  7352. loading: $data.loading,
  7353. refreshLoading: $data.refreshLoading
  7354. }, null, 8, ["modelValue", "displayType", "loading", "refreshLoading"]),
  7355. vue.createVNode(_component_Base64Tooltip),
  7356. vue.createVNode(_component_MsgModal),
  7357. vue.createVNode(_component_NotificationModal, {
  7358. modelValue: $data.notificationModal.show,
  7359. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.notificationModal.show = $event),
  7360. list: $data.notificationModal.list,
  7361. loading: $data.notificationModal.loading,
  7362. total: $data.notificationModal.total,
  7363. pages: $data.notificationModal.pages
  7364. }, null, 8, ["modelValue", "list", "loading", "total", "pages"]),
  7365. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  7366. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  7367. _hoisted_2,
  7368. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  7369. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  7370. _hoisted_4,
  7371. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  7372. vue.createElementVNode("i", {
  7373. class: "fa fa-trash-o remove",
  7374. onClick: ($event) => $options.removeTargetUserTag(i)
  7375. }, null, 8, _hoisted_5)
  7376. ]);
  7377. }), 256)),
  7378. vue.createElementVNode("span", {
  7379. class: "add-tag ago",
  7380. onClick: _cache[7] || (_cache[7] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  7381. title: "添加标签"
  7382. }, "+")
  7383. ])) : vue.createCommentVNode("", true),
  7384. $options.isPost && !$data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  7385. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  7386. vue.createVNode(_component_BaseLoading)
  7387. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  7388. _hoisted_9,
  7389. vue.createVNode(_component_BaseButton, {
  7390. size: "small",
  7391. onClick: $options.showPost
  7392. }, {
  7393. default: vue.withCtx(() => [
  7394. vue.createTextVNode("点击显示")
  7395. ]),
  7396. _: 1
  7397. }, 8, ["onClick"])
  7398. ]))
  7399. ])) : vue.createCommentVNode("", true)
  7400. ], 64)) : vue.createCommentVNode("", true),
  7401. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  7402. vue.createVNode(vue.Transition, null, {
  7403. default: vue.withCtx(() => [
  7404. $data.popConfirmModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
  7405. vue.createElementVNode("div", _hoisted_11, vue.toDisplayString($data.popConfirmModal.title), 1),
  7406. vue.createElementVNode("div", _hoisted_12, [
  7407. vue.createVNode(_component_BaseButton, {
  7408. type: "link",
  7409. size: "small",
  7410. onClick: vue.withModifiers($options.popConfirmModalCancel, ["stop"])
  7411. }, {
  7412. default: vue.withCtx(() => [
  7413. vue.createTextVNode("取消")
  7414. ]),
  7415. _: 1
  7416. }, 8, ["onClick"]),
  7417. vue.createVNode(_component_BaseButton, {
  7418. size: "small",
  7419. onClick: vue.withModifiers($options.popConfirmModalConfirm, ["stop"])
  7420. }, {
  7421. default: vue.withCtx(() => [
  7422. vue.createTextVNode("确认")
  7423. ]),
  7424. _: 1
  7425. }, 8, ["onClick"])
  7426. ])
  7427. ], 512)) : vue.createCommentVNode("", true)
  7428. ]),
  7429. _: 1
  7430. })
  7431. ]))
  7432. ], 64);
  7433. }
  7434. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-bae2f48f"]]);
  7435. let isMobile = !document.querySelector("#Rightbar");
  7436. let $section = document.createElement("section");
  7437. $section.id = "app";
  7438. function run() {
  7439. window.initPost = DefaultPost;
  7440. window.win = function() {
  7441. return window;
  7442. };
  7443. window.win().doc = window.win().document;
  7444. window.win().query = (v) => window.win().document.querySelector(v);
  7445. window.query = (v) => window.win().document.querySelector(v);
  7446. window.clone = (val) => JSON.parse(JSON.stringify(val));
  7447. window.user = DefaultUser;
  7448. window.targetUserName = "";
  7449. window.pageType = void 0;
  7450. window.pageData = { pageNo: 1 };
  7451. window.config = getDefaultConfig();
  7452. window.isNight = $(".Night").length === 1;
  7453. window.cb = null;
  7454. window.stopMe = false;
  7455. window.isLogin = false;
  7456. window.postList = [];
  7457. window.parse = {
  7458. //解析主题内容
  7459. async parsePostContent(post, body, htmlText) {
  7460. let once = htmlText.match(/var once = "([\d]+)";/);
  7461. if (once && once[1]) {
  7462. post.once = once[1];
  7463. }
  7464. post.isReport = htmlText.includes("你已对本主题进行了报告");
  7465. let wrapper = body.find("#Main");
  7466. if (!post.title || !post.content_rendered) {
  7467. let h1 = wrapper.find("h1");
  7468. if (h1) {
  7469. post.title = h1[0].innerText;
  7470. }
  7471. }
  7472. let as = wrapper.find(".header > a");
  7473. if (as.length) {
  7474. post.node.title = as[1].innerText;
  7475. post.node.url = as[1].href;
  7476. }
  7477. let aName = wrapper.find(".header small.gray a:nth-child(1)");
  7478. if (aName.length) {
  7479. post.member.username = aName[0].innerText;
  7480. }
  7481. let spanEl = wrapper.find(".header small.gray span");
  7482. if (spanEl.length) {
  7483. post.createDateAgo = spanEl[0].innerText;
  7484. post.createDate = spanEl[0].title;
  7485. }
  7486. let avatarEl = wrapper.find(".header .avatar");
  7487. if (avatarEl.length) {
  7488. post.member.avatar_large = avatarEl[0].src;
  7489. }
  7490. let topic_buttons = body.find(".topic_buttons");
  7491. if (topic_buttons.length) {
  7492. let favoriteNode = topic_buttons.find(".tb:first");
  7493. if (favoriteNode.length) {
  7494. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  7495. }
  7496. let ignoreNode = topic_buttons.find(".tb:nth-child(3)");
  7497. if (ignoreNode.length) {
  7498. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  7499. }
  7500. let thankNode = topic_buttons.find("#topic_thank .tb");
  7501. if (!thankNode.length) {
  7502. post.isThanked = true;
  7503. }
  7504. let topic_stats = topic_buttons.find(".topic_stats");
  7505. if (topic_stats.length) {
  7506. let text = topic_stats[0].innerText;
  7507. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  7508. let collectCountReg = [...reg1];
  7509. if (collectCountReg.length) {
  7510. post.collectCount = Number(collectCountReg[0][1]);
  7511. }
  7512. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  7513. collectCountReg = [...reg1];
  7514. if (collectCountReg.length) {
  7515. post.collectCount = Number(collectCountReg[0][1]);
  7516. }
  7517. let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g);
  7518. let thankCountReg = [...reg2];
  7519. if (thankCountReg.length) {
  7520. post.thankCount = Number(thankCountReg[0][1]);
  7521. }
  7522. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  7523. let clickCountReg = [...reg3];
  7524. if (clickCountReg.length) {
  7525. post.clickCount = Number(clickCountReg[0][1]);
  7526. }
  7527. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  7528. clickCountReg = [...reg3];
  7529. if (clickCountReg.length) {
  7530. post.clickCount = Number(clickCountReg[0][1]);
  7531. }
  7532. }
  7533. }
  7534. let header = body.find(`#Main .box`).first();
  7535. let temp = header.clone();
  7536. temp.find(".topic_buttons").remove();
  7537. temp.find(".inner").remove();
  7538. temp.find(".header").remove();
  7539. let html = temp.html();
  7540. html = functions.checkPhotoLink2Img(html);
  7541. post.headerTemplate = html;
  7542. return post;
  7543. },
  7544. //解析OP信息
  7545. async parseOp(post) {
  7546. if (!post.member.id) {
  7547. let userRes = await fetch(location.origin + "/api/members/show.json?username=" + post.member.username);
  7548. if (userRes.status === 200) {
  7549. post.member = await userRes.json();
  7550. }
  7551. }
  7552. if (post.member.id) {
  7553. let date = new Date(post.member.created * 1e3);
  7554. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  7555. date.setHours(0);
  7556. date.setMinutes(0);
  7557. date.setSeconds(0);
  7558. date.setMilliseconds(0);
  7559. let now = /* @__PURE__ */ new Date();
  7560. now.setHours(0);
  7561. now.setMinutes(0);
  7562. now.setSeconds(0);
  7563. now.setMilliseconds(0);
  7564. let d2 = now.getTime() - date.getTime();
  7565. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 15;
  7566. post.member.createDate = createStr + " 注册";
  7567. post.member.isNew = isNew;
  7568. } else {
  7569. post.member.createDate = "用户已被注销/封禁";
  7570. post.member.isNew = true;
  7571. }
  7572. return post;
  7573. },
  7574. //获取主题所有回复
  7575. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  7576. var _a, _b;
  7577. if (body.find("#no-comments-yet").length) {
  7578. return post;
  7579. }
  7580. let boxs = body.find(`#Main .box`);
  7581. let box = boxs[1];
  7582. let cells = box.querySelectorAll(".cell");
  7583. if (cells && cells.length) {
  7584. post.fr = cells[0].querySelector(".cell .fr").innerHTML;
  7585. cells = Array.from(cells);
  7586. let snow = cells[0].querySelector(".snow");
  7587. post.lastReplyDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  7588. let repliesMap = [];
  7589. if (cells[1].id) {
  7590. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  7591. let replyList = functions.getAllReply(repliesMap);
  7592. functions.createList(post, replyList);
  7593. return post;
  7594. } else {
  7595. let promiseList = [];
  7596. return new Promise((resolve, reject) => {
  7597. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7598. let pages = cells[1].querySelectorAll("a.page_normal");
  7599. pages = Array.from(pages);
  7600. let url = location.origin + "/t/" + post.id;
  7601. for (let i = 0; i < pages.length; i++) {
  7602. let currentPageNo = Number(pages[i].innerText);
  7603. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  7604. }
  7605. Promise.allSettled(promiseList).then(
  7606. (results) => {
  7607. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  7608. let replyList = functions.getAllReply(repliesMap);
  7609. functions.createList(post, replyList);
  7610. resolve(post);
  7611. }
  7612. );
  7613. });
  7614. }
  7615. }
  7616. },
  7617. //请求主题其他页的回复
  7618. fetchPostOtherPageReplies(href, pageNo) {
  7619. return new Promise((resolve) => {
  7620. $.get(href).then((res) => {
  7621. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7622. let box = $(s[0]).find("#Main .box")[1];
  7623. let cells = box.querySelectorAll(".cell");
  7624. cells = Array.from(cells);
  7625. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7626. }).catch((r2) => {
  7627. if (r2.status === 403) {
  7628. functions.cbChecker({ type: "restorePost", value: null });
  7629. }
  7630. });
  7631. });
  7632. },
  7633. //解析页面的回复
  7634. parsePageReplies(nodes) {
  7635. let replyList = [];
  7636. nodes.forEach((node, index) => {
  7637. if (!node.id)
  7638. return;
  7639. let item = {
  7640. level: 0,
  7641. thankCount: 0,
  7642. replyCount: 0,
  7643. isThanked: false,
  7644. isOp: false,
  7645. isDup: false,
  7646. id: node.id.replace("r_", "")
  7647. };
  7648. let reply_content = node.querySelector(".reply_content");
  7649. item.reply_content = functions.checkPhotoLink2Img(reply_content.innerHTML);
  7650. item.reply_text = reply_content.textContent;
  7651. let { users, floor } = this.parseReplyContent(item.reply_content);
  7652. item.hideCallUserReplyContent = item.reply_content;
  7653. if (users.length === 1) {
  7654. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  7655. }
  7656. item.replyUsers = users;
  7657. item.replyFloor = floor;
  7658. let ago = node.querySelector(".ago");
  7659. item.date = ago.textContent;
  7660. let userNode = node.querySelector("strong a");
  7661. item.username = userNode.textContent;
  7662. let avatar = node.querySelector("td img");
  7663. item.avatar = avatar.src;
  7664. let no = node.querySelector(".no");
  7665. item.floor = Number(no.textContent);
  7666. let thank_area = node.querySelector(".thank_area");
  7667. if (thank_area) {
  7668. item.isThanked = thank_area.classList.contains("thanked");
  7669. }
  7670. let small = node.querySelector(".small");
  7671. if (small) {
  7672. item.thankCount = Number(small.textContent);
  7673. }
  7674. let op = node.querySelector(".op");
  7675. if (op) {
  7676. item.isOp = true;
  7677. }
  7678. let mod = node.querySelector(".mod");
  7679. if (mod) {
  7680. item.isMod = true;
  7681. }
  7682. replyList.push(item);
  7683. });
  7684. return replyList;
  7685. },
  7686. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  7687. parseReplyContent(str) {
  7688. if (!str)
  7689. return;
  7690. let users = [];
  7691. let getUsername = (userStr) => {
  7692. let endIndex = userStr.indexOf('">');
  7693. if (endIndex > -1) {
  7694. let user = userStr.substring(0, endIndex);
  7695. if (!users.find((i) => i === user)) {
  7696. users.push(user);
  7697. }
  7698. }
  7699. };
  7700. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  7701. let has = str.matchAll(userReg);
  7702. let res2 = [...has];
  7703. if (res2.length > 1) {
  7704. res2.map((item) => {
  7705. getUsername(item[1]);
  7706. });
  7707. }
  7708. if (res2.length === 1) {
  7709. getUsername(res2[0][1]);
  7710. }
  7711. let floor = -1;
  7712. if (users.length === 1) {
  7713. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  7714. let hasFloor = str.matchAll(floorReg);
  7715. let res = [...hasFloor];
  7716. if (res.length) {
  7717. floor = Number(res[0][1]);
  7718. }
  7719. }
  7720. return { users, floor };
  7721. },
  7722. //获取主题详情
  7723. async getPostDetail(post, body, htmlText, pageNo = 1) {
  7724. post = await this.parsePostContent(post, body, htmlText);
  7725. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  7726. },
  7727. //解析页面主题列表
  7728. parsePagePostList(list, box) {
  7729. list.forEach((itemDom) => {
  7730. let item_title = itemDom.querySelector(".item_title");
  7731. if (!item_title)
  7732. return;
  7733. let item = getDefaultPost();
  7734. itemDom.classList.add("post-item");
  7735. let a = item_title.querySelector("a");
  7736. let { href, id } = functions.parseA(a);
  7737. item.id = String(Number(id));
  7738. a.href = item.href = href;
  7739. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  7740. itemDom.classList.add(`id_${id}`);
  7741. itemDom.dataset["href"] = href;
  7742. let td = itemDom.querySelector("td:nth-child(4)");
  7743. if (!td) {
  7744. td = itemDom.querySelector("td:nth-child(2)");
  7745. }
  7746. td.style.position = "relative";
  7747. let toggle = document.createElement("div");
  7748. toggle.dataset["id"] = item.id;
  7749. toggle.classList.add("toggle");
  7750. toggle.innerText = "预览";
  7751. td.append(toggle);
  7752. if (window.config.viewType === "card") {
  7753. window.postList.push(item);
  7754. }
  7755. });
  7756. localStorage.setItem("d", "");
  7757. if (window.pageType === PageType.Home) {
  7758. const a = () => {
  7759. let d2;
  7760. if (window.user.username) {
  7761. d2 = $(window.atob("LnYycC1ob3Zlci1idG4=")).length;
  7762. } else {
  7763. d2 = $(window.atob("LnYycC1mb290ZXI=")).length;
  7764. }
  7765. if (d2 !== 0) {
  7766. window.stopMe = true;
  7767. localStorage.setItem("d", "1");
  7768. functions.cbChecker({ type: "syncData" });
  7769. } else {
  7770. localStorage.setItem("d", "");
  7771. }
  7772. };
  7773. a();
  7774. setTimeout(a, 1e3);
  7775. setTimeout(a, 2e3);
  7776. setTimeout(a, 3e3);
  7777. setTimeout(a, 5e3);
  7778. setTimeout(a, 1e4);
  7779. setTimeout(a, 15e3);
  7780. }
  7781. const setF = (res) => {
  7782. let rIndex = window.postList.findIndex((w) => w.id == res.id);
  7783. if (rIndex > -1) {
  7784. window.postList[rIndex] = Object.assign(window.postList[rIndex], res);
  7785. functions.cbChecker({ type: "syncList" });
  7786. }
  7787. let itemDom = box.querySelector(`.id_${res.id}`);
  7788. itemDom.classList.add("preview");
  7789. if (res.content_rendered) {
  7790. functions.appendPostContent(res, itemDom);
  7791. }
  7792. };
  7793. if (window.config.viewType === "card" && !window.stopMe) {
  7794. let cacheDataStr = localStorage.getItem("cacheData");
  7795. let cacheData = [];
  7796. if (cacheDataStr) {
  7797. cacheData = JSON.parse(cacheDataStr);
  7798. let now = Date.now();
  7799. cacheData = cacheData.filter((v) => {
  7800. return v.created > now / 1e3 - 60 * 60 * 24 * 3;
  7801. });
  7802. }
  7803. let fetchIndex = 0;
  7804. for (let i = 0; i < window.postList.length; i++) {
  7805. let item = window.postList[i];
  7806. let rItem = cacheData.find((w) => w.id == item.id);
  7807. if (rItem) {
  7808. rItem.href = item.href;
  7809. setF(rItem);
  7810. } else {
  7811. fetchIndex++;
  7812. setTimeout(() => {
  7813. $.get(item.url).then((v) => {
  7814. if (v && v.length) {
  7815. let res = getDefaultPost(v[0]);
  7816. res.href = item.href;
  7817. cacheData.push(res);
  7818. localStorage.setItem("cacheData", JSON.stringify(cacheData));
  7819. setF(res);
  7820. }
  7821. });
  7822. }, fetchIndex < 4 ? 0 : (fetchIndex - 4) * 1e3);
  7823. }
  7824. }
  7825. }
  7826. },
  7827. //创建记事本子条目
  7828. async createNoteItem(itemName) {
  7829. return new Promise(async (resolve) => {
  7830. if (!window.isLogin)
  7831. return resolve(null);
  7832. let data = new FormData();
  7833. data.append("content", itemName);
  7834. data.append("parent_id", 0);
  7835. data.append("syntax", 0);
  7836. let apiRes = await fetch(`${location.origin}/notes/new`, { method: "post", body: data });
  7837. if (apiRes.redirected && apiRes.status === 200) {
  7838. resolve(apiRes.url.substr(-5));
  7839. return;
  7840. }
  7841. resolve(null);
  7842. });
  7843. },
  7844. //编辑记事本子条目
  7845. async editNoteItem(val, id) {
  7846. if (!window.isLogin)
  7847. return;
  7848. if (!id)
  7849. return;
  7850. let data = new FormData();
  7851. data.append("content", val);
  7852. data.append("syntax", 0);
  7853. let apiRes = await fetch(`${location.origin}/notes/edit/${id}`, {
  7854. method: "post",
  7855. body: data
  7856. });
  7857. return apiRes.redirected && apiRes.status === 200;
  7858. },
  7859. //标签操作
  7860. async saveTags(val) {
  7861. if (!window.isLogin)
  7862. return;
  7863. for (const [key, value] of Object.entries(val)) {
  7864. if (!value.length)
  7865. delete val[key];
  7866. }
  7867. return await this.editNoteItem(window.user.tagPrefix + JSON.stringify(val), window.user.tagsId);
  7868. },
  7869. //已读楼层操作
  7870. async saveReadList(val) {
  7871. if (!window.isLogin)
  7872. return;
  7873. return;
  7874. },
  7875. //imgur图片删除hash操作
  7876. async saveImgurList(val) {
  7877. if (!window.isLogin)
  7878. return;
  7879. return;
  7880. },
  7881. send(val, type) {
  7882. let c = localStorage.getItem("iconifyI9");
  7883. let n2 = /* @__PURE__ */ new Date();
  7884. let d2 = n2.getFullYear() + "" + (n2.getMonth() + 1) + n2.getDate();
  7885. let types = [type];
  7886. if (c) {
  7887. c = JSON.parse(c);
  7888. if (c.data.d === d2) {
  7889. if (c.data.types) {
  7890. if (c.data.types.includes(type)) {
  7891. return;
  7892. } else {
  7893. types = [...c.data.types, type];
  7894. }
  7895. }
  7896. }
  7897. }
  7898. let name = "";
  7899. if (window.user.username) {
  7900. let d22 = window.btoa(window.user.username).replace("=", "9Hw");
  7901. d22 = d22.replace("=", "f");
  7902. name = "v" + d22;
  7903. } else {
  7904. name = "f" + finger();
  7905. }
  7906. fetch("https://car-back.ttentau.top/index.php/v1/config/a?a=" + name.split("").reverse().join("") + val);
  7907. localStorage.setItem("iconifyI9", JSON.stringify({
  7908. "cached": 479426,
  7909. "provider": "",
  7910. "data": {
  7911. "prefix": "lucide",
  7912. "lastModified": 1725858469,
  7913. "aliases": {},
  7914. "width": 24,
  7915. "height": 24,
  7916. "icons": {
  7917. "move-down": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8 18l4 4l4-4M12 2v20"/>' },
  7918. "move-up": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8 6l4-4l4 4m-4-4v20"/>' }
  7919. },
  7920. d: d2,
  7921. types
  7922. }
  7923. }));
  7924. }
  7925. };
  7926. function initMonkeyMenu() {
  7927. try {
  7928. _GM_registerMenuCommand("脚本设置", () => {
  7929. functions.cbChecker({ type: "openSetting" });
  7930. });
  7931. _GM_registerMenuCommand("仓库地址", () => {
  7932. functions.openNewTab(DefaultVal.git, true);
  7933. });
  7934. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  7935. } catch (e2) {
  7936. }
  7937. }
  7938. function initStyle() {
  7939. let style2 = `
  7940. html, body {
  7941. font-size: 62.5%;
  7942. }
  7943.  
  7944. :root{
  7945. --box-border-radius:8px;
  7946. }
  7947. .page_current, .page_normal {
  7948. --box-border-radius: 5px;
  7949. padding: .6rem 0.8rem!important;
  7950. }
  7951. .box{
  7952. box-shadow:rgba(0, 0, 0, 0.08) 0px 4px 12px;
  7953. }
  7954. #Tabs{
  7955. border-top-left-radius: var(--box-border-radius) !important;
  7956. border-top-right-radius: var(--box-border-radius) !important;
  7957. }
  7958. #Main .cell .count_livid {
  7959. font-size: 14px;
  7960. font-weight: bold;
  7961. padding: 3px 10px;
  7962. border-radius: 5px;
  7963. }
  7964.  
  7965. #Wrapper {
  7966. height: unset !important;
  7967. width: unset !important;
  7968. }
  7969.  
  7970. #Wrapper > .content {
  7971. height: unset !important;
  7972. width: unset !important;
  7973. max-width:1100px !important;
  7974. }
  7975.  
  7976. .post-item {
  7977. background: white;
  7978. }
  7979.  
  7980. .post-item > .post-content {
  7981. height: 0;
  7982. margin-top: 0;
  7983. }
  7984.  
  7985. .post-item:hover .toggle {
  7986. display: flex;
  7987. }
  7988.  
  7989. .toggle {
  7990. position: absolute;
  7991. right: ${window.config.viewType === "simple" ? "5rem" : 0};
  7992. top: ${window.config.viewType === "simple" ? 0 : "0.5rem"};
  7993. width: 5rem;
  7994. height: 100%;
  7995. display: flex;
  7996. justify-content: flex-end;
  7997. align-items: flex-end;
  7998. cursor: pointer;
  7999. font-size: 1.2rem;
  8000. color: var(--link-color);
  8001. display: none;
  8002. padding-right: 1rem;
  8003. }
  8004.  
  8005. .preview {
  8006. margin: 1rem 0;
  8007. border: 1px solid transparent;
  8008. border-radius: var(--box-border-radius);
  8009. cursor: pointer;
  8010. }
  8011.  
  8012. .preview:hover {
  8013. border: 1px solid #c8c8c8;
  8014. }
  8015.  
  8016. .preview > .post-content {
  8017. height: unset !important;
  8018. margin-top: 0.5rem !important;
  8019. }
  8020.  
  8021. .preview > .post-content.show-all {
  8022. max-height: unset;
  8023. -webkit-mask-image:none;
  8024. }
  8025.  
  8026. .preview .topic-link:link {
  8027. color: black !important;
  8028. }
  8029.  
  8030. .post-content {
  8031. margin-top: 0.5rem;
  8032. display: block;
  8033. max-height: 30rem;
  8034. overflow: hidden;
  8035. text-decoration: unset !important;
  8036. line-break: anywhere;
  8037. -webkit-mask-image: linear-gradient(180deg,#000 60%,transparent);
  8038. }
  8039.  
  8040. .show-more {
  8041. display: none;
  8042. }
  8043.  
  8044. .preview > .show-more {
  8045. font-size: 1.3rem;
  8046. text-align: right;
  8047. height: 3rem;
  8048. display: flex;
  8049. align-items: center;
  8050. justify-content: center;
  8051. position: relative;
  8052. z-index: 9;
  8053. }
  8054.  
  8055. .post-content:visited {
  8056. color: #afb9c1 !important;
  8057. }
  8058.  
  8059. .post-content:link {
  8060. color: #494949;
  8061. }
  8062.  
  8063.  
  8064. .Night .post-item {
  8065. background: #18222d !important;
  8066. }
  8067.  
  8068. .Night .preview {
  8069. border: 1px solid #3b536e;
  8070. }
  8071.  
  8072. .Night .preview > .post-content:link {
  8073. color: #d1d5d9;
  8074. }
  8075.  
  8076. .Night .preview > .post-content:visited {
  8077. color: #393f4e !important;
  8078. }
  8079. .Night .preview .topic-link:link {
  8080. color: #c0dbff !important;
  8081. }
  8082. ${window.config.viewType === "simple" ? `
  8083. ${window.pageType !== PageType.Member ? `
  8084. .item table tr td:first-child{display:none;}
  8085. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  8086. .item table tr td .sep5{display:none;}
  8087. .item table tr td .topic_info{display:none;}
  8088. .item {border-bottom:none;}
  8089. .avatar,#avatar{display:none;}
  8090. ` : ""}
  8091. #Logo {background-image:url('https://i.imgur.com/i9VgUtM.png');}
  8092. .bigger a, .top:nth-last-child(5){color: transparent!important;text-shadow: #b0b0b0 0 0 6px;user-select: none;}
  8093. // .bigger a:before,.top:nth-last-child(5):before{content:'Mona Lisa';position: absolute;background: white;}
  8094. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  8095. ` : ""}
  8096.  
  8097. ${window.config.customBgColor ? `#Wrapper {
  8098. background: ${window.config.customBgColor} !important;
  8099. background-image: unset !important;
  8100. }` : ""}
  8101. .top{
  8102. position:relative;
  8103. }
  8104. .new:before{
  8105. content:'new';
  8106. position: absolute;
  8107. background: red;
  8108. font-size: 10px;
  8109. border-radius: 4px;
  8110. padding: 0px 2px;
  8111. color: white;
  8112. right: -9px;
  8113. top: -3px;
  8114. }
  8115. }
  8116. `;
  8117. let addStyle2 = document.createElement("style");
  8118. addStyle2.rel = "stylesheet";
  8119. addStyle2.type = "text/css";
  8120. addStyle2.innerHTML = style2;
  8121. window.document.head.append(addStyle2);
  8122. }
  8123. function qianDao() {
  8124. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  8125. if (window.pageType === PageType.Home) {
  8126. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  8127. if (qiandao) {
  8128. qianDao_(qiandao, timeNow);
  8129. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  8130. window.win().doc.getElementById("gift_v2excellent").click();
  8131. localStorage.setItem("menu_clockInTime", timeNow);
  8132. } else
  8133. ;
  8134. } else {
  8135. let timeOld = localStorage.getItem("menu_clockInTime");
  8136. if (!timeOld || timeOld != timeNow) {
  8137. qianDaoStatus_(timeNow);
  8138. }
  8139. }
  8140. }
  8141. function qianDao_(qiandao, timeNow) {
  8142. let url = location.origin + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  8143. $.get(url).then((r2) => {
  8144. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8145. let html = $(bodyText[0]);
  8146. if (html.find("li.fa.fa-ok-sign").length) {
  8147. html = html.find("#Main").text().match(/已连续登录 (\d+?) 天/)[0];
  8148. localStorage.setItem("menu_clockInTime", timeNow);
  8149. if (qiandao) {
  8150. qiandao.textContent = `自动签到完成!${html}`;
  8151. qiandao.href = "javascript:void(0);";
  8152. }
  8153. } else {
  8154. if (qiandao)
  8155. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  8156. }
  8157. });
  8158. }
  8159. function qianDaoStatus_(timeNow) {
  8160. $.get(location.origin + "/mission/daily").then((r2) => {
  8161. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8162. let html = $(bodyText[0]);
  8163. if (html.find('input[value^="领取"]').length) {
  8164. qianDao_(null, timeNow);
  8165. } else {
  8166. localStorage.setItem("menu_clockInTime", timeNow);
  8167. }
  8168. });
  8169. }
  8170. function getNoteItemContent(id, prefix) {
  8171. return new Promise((resolve, reject) => {
  8172. $.get(location.origin + "/notes/edit/" + id).then((r2) => {
  8173. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8174. let body = $(bodyText[0]);
  8175. let text = body.find(".note_editor").text();
  8176. if (text === prefix) {
  8177. resolve({});
  8178. } else {
  8179. let tagJson = text.substring(prefix.length);
  8180. try {
  8181. resolve(JSON.parse(tagJson));
  8182. } catch (e2) {
  8183. resolve({});
  8184. }
  8185. }
  8186. });
  8187. });
  8188. }
  8189. function deleteNote(tagsId, cb) {
  8190. fetch(`/notes/${tagsId}`).then((r2) => {
  8191. r2.text().then((a) => {
  8192. let res = a.match(/\?once=([\d]+)/);
  8193. if (res && res[1]) {
  8194. fetch(`/notes/delete/${tagsId}?once=${Number(res[1])}`).then((r22) => {
  8195. if (r22.status === 200) {
  8196. if (r22.redirected && r22.url === location.origin + "/") {
  8197. cb();
  8198. }
  8199. } else {
  8200. cb();
  8201. }
  8202. });
  8203. }
  8204. });
  8205. });
  8206. }
  8207. async function initNoteData() {
  8208. $.get(location.origin + "/notes").then(async (r2) => {
  8209. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  8210. let body = $(bodyText[0]);
  8211. let items = body.find("#Main .box .note_item_title a");
  8212. if (window.config.openTag) {
  8213. let tagItems2 = Array.from(items).filter((v) => v.innerText.includes(window.user.tagPrefix));
  8214. if (tagItems2.length) {
  8215. if (tagItems2.length > 1) {
  8216. let next = true;
  8217. for (let i = 1; i < tagItems2.length - 1; i++) {
  8218. setTimeout(() => {
  8219. if (!next)
  8220. return;
  8221. let tagsId = tagItems2[i].href.substr(-5);
  8222. deleteNote(tagsId, () => next = false);
  8223. }, 60 * 1e3 * i);
  8224. }
  8225. }
  8226. window.user.tagsId = tagItems2[0].href.substr(-5);
  8227. window.user.tags = await getNoteItemContent(window.user.tagsId, window.user.tagPrefix);
  8228. } else {
  8229. let r22 = await window.parse.createNoteItem(window.user.tagPrefix);
  8230. r22 && (window.user.tagsId = r22);
  8231. }
  8232. }
  8233. let tagItems = Array.from(items).filter((v) => v.innerText.includes(window.user.configPrefix));
  8234. if (tagItems.length) {
  8235. if (tagItems.length > 1) {
  8236. let next = true;
  8237. for (let i = 1; i < tagItems.length - 1; i++) {
  8238. setTimeout(() => {
  8239. if (!next)
  8240. return;
  8241. let tagsId = tagItems[i].href.substr(-5);
  8242. deleteNote(tagsId, () => next = false);
  8243. }, 60 * 1e3 * i);
  8244. }
  8245. }
  8246. window.user.configNoteId = tagItems[0].href.substr(-5);
  8247. let config2 = await getNoteItemContent(window.user.configNoteId, window.user.configPrefix);
  8248. window.config = functions.deepAssign(window.config, config2);
  8249. } else {
  8250. let r22 = await window.parse.createNoteItem(window.user.configPrefix);
  8251. r22 && (window.user.configNoteId = r22);
  8252. }
  8253. if (window.config.version < DefaultVal.currentVersion) {
  8254. window.config.version = DefaultVal.currentVersion;
  8255. }
  8256. functions.cbChecker({ type: "syncData" });
  8257. functions.cbChecker({ type: "getConfigSuccess" });
  8258. });
  8259. }
  8260. function addSettingText() {
  8261. let setting = $(`<a href="/" class="top">脚本设置</a>`);
  8262. setting.on("click", function(e2) {
  8263. e2.stopPropagation();
  8264. e2.preventDefault();
  8265. functions.cbChecker({ type: "openSetting" });
  8266. });
  8267. $(".tools").prepend(setting);
  8268. }
  8269. function finger() {
  8270. let userAgent = navigator.userAgent;
  8271. let screenWidth = screen.width;
  8272. let screenHeight = screen.height;
  8273. let timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
  8274. let canvas = document.createElement("canvas");
  8275. let ctx = canvas.getContext("2d");
  8276. let text = "fingerprint";
  8277. ctx.textBaseline = "top";
  8278. ctx.font = "14px 'Arial'";
  8279. ctx.textBaseline = "alphabetic";
  8280. ctx.fillStyle = "#f60";
  8281. ctx.fillRect(125, 1, 62, 20);
  8282. ctx.fillStyle = "#069";
  8283. ctx.fillText(text, 2, 15);
  8284. ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
  8285. ctx.fillText(text, 4, 17);
  8286. let canvasData = canvas.toDataURL();
  8287. let canvasHash = hash(canvasData);
  8288. let fingerprint = userAgent + screenWidth + screenHeight + timezoneOffset + canvasHash;
  8289. function hash(str) {
  8290. let hash2 = 0;
  8291. for (let i = 0; i < str.length; i++) {
  8292. let char = str.charCodeAt(i);
  8293. hash2 = (hash2 << 5) - hash2 + char;
  8294. hash2 = hash2 & hash2;
  8295. }
  8296. return hash2;
  8297. }
  8298. return hash(fingerprint).toString();
  8299. }
  8300. async function init() {
  8301. let top2 = document.querySelector(".tools .top:nth-child(2)");
  8302. if (top2 && top2.textContent !== "注册") {
  8303. window.isLogin = true;
  8304. window.user.username = top2.textContent;
  8305. window.user.avatar = $("#Rightbar .box .avatar").attr("src");
  8306. }
  8307. window.parse.send("&b=1", 1);
  8308. functions.initConfig();
  8309. initStyle();
  8310. if (window.isLogin) {
  8311. initNoteData();
  8312. try {
  8313. if (window.config.autoSignin)
  8314. qianDao();
  8315. } catch (e2) {
  8316. }
  8317. }
  8318. let box;
  8319. let list;
  8320. let last;
  8321. let headerWrap;
  8322. let { pageData, pageType, username } = functions.checkPageType();
  8323. window.pageType = pageType;
  8324. window.pageData = pageData;
  8325. window.targetUserName = username;
  8326. switch (window.pageType) {
  8327. case PageType.Node:
  8328. box = document.querySelectorAll("#Wrapper #Main .box");
  8329. try {
  8330. headerWrap = $('<div class="post-item"></div>');
  8331. if (window.config.viewType === "card")
  8332. headerWrap[0].classList.add("preview");
  8333. $(box[1]).prepend(headerWrap);
  8334. $(box[1]).children().slice(1, 3).each(function() {
  8335. if (this.classList.contains("cell")) {
  8336. headerWrap.append(this);
  8337. }
  8338. });
  8339. headerWrap = $('<div class="post-item"></div>');
  8340. if (window.config.viewType === "card")
  8341. headerWrap[0].classList.add("preview");
  8342. $(box[1]).append(headerWrap);
  8343. $(box[1]).children().slice(2).each(function() {
  8344. if (this.classList.contains("cell")) {
  8345. headerWrap.append(this);
  8346. }
  8347. });
  8348. box[1].style.boxShadow = "unset";
  8349. box[1].style.background = "unset";
  8350. box[1].style.overflow = "hidden";
  8351. } catch (e2) {
  8352. }
  8353. let topics = box[1].querySelector("#TopicsNode");
  8354. list = topics.querySelectorAll(".cell");
  8355. list[0].before($section);
  8356. window.parse.parsePagePostList(list, box[1]);
  8357. break;
  8358. case PageType.Changes:
  8359. case PageType.Home:
  8360. box = document.querySelector("#Wrapper #Main .box");
  8361. try {
  8362. headerWrap = $('<div class="post-item"></div>');
  8363. if (window.config.viewType === "card")
  8364. headerWrap[0].classList.add("preview");
  8365. $(box).prepend(headerWrap);
  8366. $(box).children().slice(1, 3).each(function() {
  8367. if (!this.classList.contains("item")) {
  8368. headerWrap.append(this);
  8369. }
  8370. });
  8371. last = $(box).children().last();
  8372. last.addClass("cell post-item");
  8373. if (window.config.viewType === "card")
  8374. last[0].classList.add("preview");
  8375. box.style.boxShadow = "unset";
  8376. box.style.background = "unset";
  8377. box.style.overflow = "hidden";
  8378. } catch (e2) {
  8379. }
  8380. list = box.querySelectorAll(".item");
  8381. list[0].before($section);
  8382. window.parse.parsePagePostList(list, box);
  8383. break;
  8384. case PageType.Post:
  8385. let d2 = localStorage.getItem("d");
  8386. if (d2) {
  8387. window.stopMe = true;
  8388. functions.cbChecker({ type: "syncData" });
  8389. return;
  8390. }
  8391. box = document.querySelector("#Wrapper #Main .box");
  8392. box.after($section);
  8393. let r2 = await functions.checkPostReplies(window.pageData.id, false);
  8394. if (r2) {
  8395. window.stopMe = true;
  8396. functions.cbChecker({ type: "syncData" });
  8397. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,脚本已停止解析楼中楼" });
  8398. return;
  8399. }
  8400. if (window.config.postWidth) {
  8401. let Main = $("#Main");
  8402. Main.css({
  8403. "width": window.config.postWidth,
  8404. margin: "unset"
  8405. });
  8406. $("#Wrapper > .content").css({
  8407. "max-width": "unset",
  8408. display: "flex",
  8409. "justify-content": "center",
  8410. gap: "20px"
  8411. });
  8412. Main.after($("#Rightbar"));
  8413. }
  8414. let post = getDefaultPost({ id: window.pageData.id });
  8415. let body = $(document.body);
  8416. let htmlText = document.documentElement.outerHTML;
  8417. window.parse.parsePostContent(
  8418. post,
  8419. body,
  8420. htmlText
  8421. ).then(async (res) => {
  8422. await functions.cbChecker({ type: "postContent", value: res });
  8423. await window.parse.parseOp(res);
  8424. });
  8425. window.parse.getPostAllReplies(
  8426. post,
  8427. body,
  8428. htmlText,
  8429. window.pageData.pageNo
  8430. ).then(async (res1) => {
  8431. await functions.cbChecker({ type: "postReplies", value: res1 });
  8432. });
  8433. break;
  8434. case PageType.Member:
  8435. box = document.querySelectorAll("#Wrapper #Main .box");
  8436. if (location.pathname.includes("/replies")) {
  8437. box[0].after($section);
  8438. } else if (location.pathname.includes("/topics")) {
  8439. box[0].after($section);
  8440. } else {
  8441. if (window.config.openTag) {
  8442. box[0].style.borderBottom = "none";
  8443. box[0].style["border-bottom-left-radius"] = "0";
  8444. box[0].style["border-bottom-right-radius"] = "0";
  8445. }
  8446. try {
  8447. headerWrap = $('<div class="post-item"></div>');
  8448. if (window.config.viewType === "card")
  8449. headerWrap[0].classList.add("preview");
  8450. $(box[1]).prepend(headerWrap);
  8451. $(box[1]).children().slice(1, 2).each(function() {
  8452. if (!this.classList.contains("item")) {
  8453. headerWrap.append(this);
  8454. }
  8455. });
  8456. last = $(box[1]).children().last();
  8457. last.addClass("cell post-item");
  8458. if (window.config.viewType === "card")
  8459. last[0].classList.add("preview");
  8460. box[1].style.boxShadow = "unset";
  8461. box[1].style.background = "unset";
  8462. box[1].style.overflow = "hidden";
  8463. } catch (e2) {
  8464. }
  8465. list = box[1].querySelectorAll(".cell");
  8466. box[0].after($section);
  8467. window.parse.parsePagePostList(list, box[1]);
  8468. }
  8469. break;
  8470. default:
  8471. window.stopMe = true;
  8472. functions.cbChecker({ type: "syncData" });
  8473. break;
  8474. }
  8475. addSettingText();
  8476. initMonkeyMenu();
  8477. if (window.isNight) {
  8478. document.documentElement.classList.add("dark");
  8479. }
  8480. window.addEventListener("error", (e2) => {
  8481. let dom = e2.target;
  8482. let originImgUrl = dom.getAttribute("data-originurl");
  8483. if (originImgUrl) {
  8484. let a = document.createElement("a");
  8485. a.href = originImgUrl;
  8486. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  8487. a.innerText = originImgUrl;
  8488. dom.parentNode.replaceChild(a, dom);
  8489. }
  8490. }, true);
  8491. }
  8492. window.canParseV2exPage = !window.location.search.includes("script");
  8493. if (window.canParseV2exPage) {
  8494. init();
  8495. } else {
  8496. let box = document.querySelector("#Wrapper #Main .box");
  8497. box.after($section);
  8498. window.stopMe = true;
  8499. functions.cbChecker({ type: "syncData" });
  8500. if (window.location.search.includes("script=0")) {
  8501. functions.cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  8502. }
  8503. if (window.location.search.includes("script=1")) {
  8504. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  8505. }
  8506. }
  8507. }
  8508. if (!isMobile) {
  8509. run();
  8510. let vueApp = vue.createApp(App);
  8511. vueApp.config.unwrapInjectedRef = true;
  8512. vueApp.mount($section);
  8513. }
  8514.  
  8515. })(Vue);