V2Next-Mobile

V2Next - 一个好用的V2EX脚本! 移动端专用

目前为 2024-03-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name V2Next-Mobile
  3. // @namespace http://tampermonkey.net/
  4. // @version 8.1
  5. // @author zyronon
  6. // @description V2Next - 一个好用的V2EX脚本! 移动端专用
  7. // @license GPL License
  8. // @icon https://v2next.netlify.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/485356/V2Next-Mobile.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 http://code.jquery.com/jquery-3.7.1.min.js
  27. // @require https://cdn.jsdelivr.net/npm/vue@3.4.14/dist/vue.global.prod.js
  28. // @grant GM_addStyle
  29. // @grant GM_notification
  30. // @grant GM_openInTab
  31. // @grant GM_registerMenuCommand
  32. // ==/UserScript==
  33.  
  34. (e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const o=document.createElement("style");o.textContent=e,document.head.append(o)})(' .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}.fade-in[data-v-e7c0fbef]{animation:fade-in-e7c0fbef .3s}.fade-out[data-v-e7c0fbef]{animation:fade-out-e7c0fbef .4s}@keyframes fade-in-e7c0fbef{0%{opacity:0}to{opacity:1}}@keyframes fade-out-e7c0fbef{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-e7c0fbef]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-e7c0fbef]{font-size:1.4rem;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 .remove[data-v-e7c0fbef]{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;position:absolute;display:none}.floor[data-v-e7c0fbef]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-e7c0fbef]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-e7c0fbef]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-e7c0fbef]{font-size:10px}[data-v-e7c0fbef]:root{--box-border-radius: 8px}#site-header[data-v-e7c0fbef]{height:4rem}#site-header #site-header-menu #menu-body[data-v-e7c0fbef]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-e7c0fbef]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-e7c0fbef]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-e7c0fbef]{background:var(--box-background-color)}.post-item .new-item[data-v-e7c0fbef]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-e7c0fbef]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-e7c0fbef],.post-item .new-item .left a.node[data-v-e7c0fbef]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-e7c0fbef]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-e7c0fbef]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-e7c0fbef]{text-decoration:none!important}.post-item .new-item .right[data-v-e7c0fbef]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-e7c0fbef]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-e7c0fbef]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-e7c0fbef]{margin-top:.5rem}.post-item .post-content p[data-v-e7c0fbef]:first-child{margin-top:0}.post-item .post-content[data-v-e7c0fbef]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-e7c0fbef]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-e7c0fbef]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-e7c0fbef]:link{color:#000!important}.preview .show-all[data-v-e7c0fbef]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-e7c0fbef]{height:unset!important}.preview .show-more[data-v-e7c0fbef]{display:flex}.preview .item_title[data-v-e7c0fbef]{font-weight:700}.Night .post-item[data-v-e7c0fbef]{background:#18222d!important}.Night .preview[data-v-e7c0fbef]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-e7c0fbef]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-e7c0fbef]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-e7c0fbef]:link{color:#c0dbff!important}[data-v-e7c0fbef]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--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-line2: #cecece;--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;--space: 1rem}html.dark[data-v-e7c0fbef]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--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}.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:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-e7c0fbef]{text-decoration:none}.tool[data-v-e7c0fbef]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-e7c0fbef]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-e7c0fbef]{cursor:not-allowed}.tool span[data-v-e7c0fbef]{line-height:1rem}.my-node[data-v-e7c0fbef]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.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]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-e7c0fbef]{padding:.5rem}.my-cell[data-v-e7c0fbef]{color:var(--color-font);height:4.2rem;padding:0 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:100;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}.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]{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-active);color:#fff}.pop-confirm[data-v-e7c0fbef]{position:relative;display:inline-flex;justify-content:center}input[data-v-e7c0fbef]{width:10rem;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]:focus{border:1px solid var(--color-active)}.danger[data-v-e7c0fbef]{color:red!important}.topic_content[data-v-e7c0fbef],.reply_content[data-v-e7c0fbef]{font-size:1.6rem}.mask[data-v-e7c0fbef]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-e7c0fbef]{background:#000000bb}.mask.light[data-v-e7c0fbef]{background:transparent}.mask.lightgray[data-v-e7c0fbef]{background:rgba(0,0,0,.25)}.mask.white[data-v-e7c0fbef]{background:transparent}.slide[data-v-e7c0fbef]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-e7c0fbef]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-e7c0fbef]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-e7c0fbef]{overflow:hidden!important}.post-wrapper[data-v-e7c0fbef],.setting-wrapper[data-v-e7c0fbef]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper[data-v-e7c0fbef],.setting-wrapper2[data-v-e7c0fbef]{height:100%;overflow:hidden;background:var(--color-second-bg)}.mobile-page[data-v-e7c0fbef]{height:100%;overflow:hidden;font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-e7c0fbef]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.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%}.nav-bar[data-v-fda0acaa]{box-sizing:border-box;width:100%;height:5rem;padding:0 var(--space);display:flex;align-items:center;justify-content:center;position:relative;font-size:2rem;color:var(--color-font-pure)}.nav-bar[data-v-fda0acaa] .back-icon{left:var(--space);position:absolute}.display-type[data-v-1d327f48]{height:3rem;padding:0 .3rem;background:var(--color-main-bg);border-radius:1rem;display:flex;font-size:1.4rem;align-items:center;color:#a9a9a9}.display-type .type[data-v-1d327f48]{border-radius:.8rem;padding:0 1.3rem;height:2.5rem;align-items:center;display:flex;position:relative}.display-type .type.active[data-v-1d327f48]{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-1d327f48]{position:absolute;background:white;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-1d327f48]{word-break:keep-all;padding:.8rem 1rem}.display-type .type-list .item.active[data-v-1d327f48]{color:var(--color-font-pure)}.display-type svg[data-v-1d327f48]{width:1.5rem}.font-size[data-v-a64ba8b8]{margin-bottom:3rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.font-size .steps[data-v-a64ba8b8]{width:100%;border-radius:10rpx;display:flex;justify-content:space-between;align-items:center;position:relative;z-index:2}.font-size .steps .step[data-v-a64ba8b8]{width:100%;font-size:20rpx;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:4.8rem;gap:1.5rem;color:gray}.font-size .steps .step .text[data-v-a64ba8b8]{font-size:1.4rem}.font-size .steps .step .point[data-v-a64ba8b8]{border-radius:50%;min-width:6px;min-height:6px;background:#adadad}.font-size .steps .step.active[data-v-a64ba8b8]{color:var(--color-font-pure)}.font-size .steps .step.active .point[data-v-a64ba8b8]{box-shadow:0 0 1px 1px #f1f1f1;background:white;transform:scale(3)}.font-size .line[data-v-a64ba8b8]{position:relative;z-index:1;margin-top:-4px;height:2px;width:76%;background:var(--color-font)}.row[data-v-424a2b09]{min-height:4rem;display:flex;justify-content:space-between;align-items:center;color:var(--color-font-8)}.row .wrapper[data-v-424a2b09]{height:3rem;flex:1;display:flex;justify-content:flex-end;align-items:center;gap:var(--space)}.row .main-title[data-v-424a2b09]{font-size:2.2rem;font-weight:700}.row .item-title[data-v-424a2b09]{font-size:1.8rem}.desc[data-v-424a2b09]{margin-bottom:1rem;font-size:1.4rem;text-align:left;color:var(--color-font)}.tool>svg[data-v-b7c6664e]{width:1.8rem!important;height:1.8rem!important}.more[data-v-e92e0529]{height:1.6rem;width:2.08rem;padding:1rem .8rem 1rem 0;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.more div[data-v-e92e0529]{background:var(--color-floor-font);width:.3rem;height:.3rem;border-radius:50%}.Author[data-v-9041586a]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative}.Author.expand[data-v-9041586a]{margin-bottom:0}.Author .Author-left[data-v-9041586a]{display:flex;align-items:center;width:80%;word-break:break-all}.Author .Author-left .info[data-v-9041586a]{display:flex;flex-direction:column}.Author .Author-left .username[data-v-9041586a]{font-size:1.4rem;margin-right:1rem}.Author .Author-left .expand-icon[data-v-9041586a]{margin-right:.8rem;width:2.4rem;height:2.4rem;transform:rotate(90deg)}.Author .Author-left .texts[data-v-9041586a]{flex:1}.Author .Author-left .owner[data-v-9041586a]{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)}.Author .Author-left .dup[data-v-9041586a]{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:1rem;transform:scale(.8)}.Author .Author-left .mod[data-v-9041586a]{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}.Author .Author-right[data-v-9041586a]{position:absolute;right:0;display:flex;align-items:center}.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-04f4c89d]{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-04f4c89d]{position:absolute}.base-button.disabled[data-v-04f4c89d]{opacity:.6;cursor:not-allowed;-webkit-user-select:none;user-select:none}.base-button.small[data-v-04f4c89d]{height:3rem}.base-button.small>span[data-v-04f4c89d]{font-size:1.3rem}.base-button.large[data-v-04f4c89d]{height:5rem;font-size:1.8rem;padding:0 2.2rem}.base-button.large>span[data-v-04f4c89d]{font-size:1.8rem}.base-button.primary[data-v-04f4c89d]{background:var(--color-active)}.base-button.primary>span[data-v-04f4c89d]{color:#fff}.base-button.gary[data-v-04f4c89d]{background:#4b5563}.base-button.link[data-v-04f4c89d]{border-radius:0;border-bottom:2px solid transparent}.base-button.link>span[data-v-04f4c89d]{color:var(--color-font-8)}.base-button.active[data-v-04f4c89d]{opacity:.4}.key-notice[data-v-04f4c89d]{margin-left:1rem;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:#fff}.key-notice .key[data-v-04f4c89d]{transform:scale(.8)}.post-editor-wrapper[data-v-0612e02f]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s;color:var(--color-font)}.post-editor-wrapper.isFocus .post-editor[data-v-0612e02f]{border:1px solid var(--color-active)}.post-editor-wrapper .post-editor[data-v-0612e02f]{border:1px solid var(--color-line);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.6rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure)}.post-editor-wrapper .toolbar[data-v-0612e02f]{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-0612e02f]{display:flex;gap:1rem}.post-editor-wrapper .toolbar .left .upload input[data-v-0612e02f]{position:absolute;width:20px;height:20px;opacity:0}.post-editor-wrapper .toolbar span[data-v-0612e02f]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-0612e02f]{border:1px solid var(--color-line);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.6rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);position:absolute;top:0;z-index:-100}.post-editor-wrapper .emoticon-pack[data-v-0612e02f]{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 i[data-v-0612e02f]{position:absolute;right:2rem;font-size:2rem;color:#e2e2e2}.post-editor-wrapper .emoticon-pack .list[data-v-0612e02f]{margin:1rem 0}.post-editor-wrapper .emoticon-pack img[data-v-0612e02f]{width:3rem;height:3rem;padding:.5rem}.post-editor-wrapper .emoticon-pack span[data-v-0612e02f]{display:inline-block;font-size:2.3rem;padding:.5rem}.v-enter-active[data-v-f8165980],.v-leave-active[data-v-f8165980]{transition:opacity .3s ease}.v-enter-from[data-v-f8165980],.v-leave-to[data-v-f8165980]{opacity:0}.fade-in[data-v-f8165980]{animation:fade-in-f8165980 .3s}.fade-out[data-v-f8165980]{animation:fade-out-f8165980 .4s}@keyframes fade-in-f8165980{0%{opacity:0}to{opacity:1}}@keyframes fade-out-f8165980{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-f8165980]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-f8165980]{font-size:1.4rem;color:#e02a2a}.owner[data-v-f8165980]{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-f8165980]{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-f8165980]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag .remove[data-v-f8165980]{margin-left:.5rem;display:none}.add-tag[data-v-f8165980]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor[data-v-f8165980]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-f8165980]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-f8165980]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-f8165980]{font-size:10px}[data-v-f8165980]:root{--box-border-radius: 8px}#site-header[data-v-f8165980]{height:4rem}#site-header #site-header-menu #menu-body[data-v-f8165980]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-f8165980]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-f8165980]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-f8165980]{background:var(--box-background-color)}.post-item .new-item[data-v-f8165980]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-f8165980]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-f8165980],.post-item .new-item .left a.node[data-v-f8165980]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-f8165980]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-f8165980]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-f8165980]{text-decoration:none!important}.post-item .new-item .right[data-v-f8165980]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-f8165980]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-f8165980]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-f8165980]{margin-top:.5rem}.post-item .post-content p[data-v-f8165980]:first-child{margin-top:0}.post-item .post-content[data-v-f8165980]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-f8165980]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-f8165980]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-f8165980]:link{color:#000!important}.preview .show-all[data-v-f8165980]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-f8165980]{height:unset!important}.preview .show-more[data-v-f8165980]{display:flex}.preview .item_title[data-v-f8165980]{font-weight:700}.Night .post-item[data-v-f8165980]{background:#18222d!important}.Night .preview[data-v-f8165980]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-f8165980]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-f8165980]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-f8165980]:link{color:#c0dbff!important}[data-v-f8165980]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--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-line2: #cecece;--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;--space: 1rem}html.dark[data-v-f8165980]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--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}.flex[data-v-f8165980]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-f8165980]{justify-content:flex-end}.flex-center[data-v-f8165980]{justify-content:center}.p1[data-v-f8165980]{padding:1rem}.p2[data-v-f8165980]{padding:2rem}.p0[data-v-f8165980]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-f8165980]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-f8165980]{text-decoration:none}.tool[data-v-f8165980]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-f8165980]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-f8165980]{cursor:not-allowed}.tool span[data-v-f8165980]{line-height:1rem}.my-node[data-v-f8165980]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs[data-v-f8165980]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-f8165980]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-f8165980]{padding:.5rem}.my-cell[data-v-f8165980]{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-f8165980]{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-f8165980]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-f8165980]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-f8165980]{position:relative}.radio-group2[data-v-f8165980]{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-f8165980]{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-f8165980]:first-child{border-left:none}.radio-group2 .active[data-v-f8165980]{background:var(--color-active);color:#fff}.pop-confirm[data-v-f8165980]{position:relative;display:inline-flex;justify-content:center}input[data-v-f8165980]{width:10rem;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-f8165980]:focus{border:1px solid var(--color-active)}.danger[data-v-f8165980]{color:red!important}.topic_content[data-v-f8165980],.reply_content[data-v-f8165980]{font-size:1.6rem}.mask[data-v-f8165980]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-f8165980]{background:#000000bb}.mask.light[data-v-f8165980]{background:transparent}.mask.lightgray[data-v-f8165980]{background:rgba(0,0,0,.25)}.mask.white[data-v-f8165980]{background:transparent}.slide[data-v-f8165980]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-f8165980]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-f8165980]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-f8165980]{overflow:hidden!important}.post-wrapper[data-v-f8165980],.setting-wrapper[data-v-f8165980]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper[data-v-f8165980],.setting-wrapper2[data-v-f8165980]{height:100%;overflow:hidden;background:var(--color-second-bg)}.mobile-page[data-v-f8165980]{height:100%;overflow:hidden;font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-f8165980]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.html-wrapper[data-v-f8165980]{position:relative}.html-wrapper .htmlMask[data-v-f8165980]{max-height:90rem;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 80%,transparent)}.html-wrapper .expand[data-v-f8165980]{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%)}.comment[data-v-312e9541]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-312e9541]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-312e9541]{background:rgba(255,255,0,.3)!important}.comment .comment-content-w .more[data-v-312e9541]{text-align:center;margin:1rem 0}.comment .comment-content[data-v-312e9541]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-312e9541]{margin-top:.6rem;width:1.8rem;min-width:1.8rem;position:relative}.comment .comment-content .expand-line[data-v-312e9541]:after{position:absolute;left:30%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .right[data-v-312e9541]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-312e9541]{margin:.5rem 0}.wrong-wrapper[data-v-312e9541]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper .del-line[data-v-312e9541]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-312e9541]{margin-left:.5rem}.wrong-wrapper .warning[data-v-312e9541]{border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1;padding:1rem 0;margin-top:1rem;font-size:1.2rem;color:red}.toolbar[data-v-6234240d]{border-top:1px solid var(--color-line);height:4rem;padding:0 1rem;display:flex;align-items:center;color:var(--color-font);font-size:1.4rem;justify-content:space-between}.toolbar .left[data-v-6234240d],.toolbar .right[data-v-6234240d]{gap:1rem;display:flex}.toolbar .right[data-v-6234240d]{gap:.6rem}.comment[data-v-0869dab5]{width:100%;box-sizing:border-box;display:flex;gap:1rem;padding:1rem;border-bottom:1px solid var(--color-line)}.comment .base-avatar[data-v-0869dab5]{display:flex;margin-right:0}.comment .base-avatar img[data-v-0869dab5]{width:2.8rem;height:2.8rem;border-radius:.3rem}.comment .comment-body[data-v-0869dab5]{flex:1;display:flex;flex-direction:column}.comment .comment-body .texts[data-v-0869dab5]{display:flex;align-items:center}.comment .comment-body .reply_content[data-v-0869dab5]{margin-top:1rem;max-width:calc(100% - 5rem)}.comment .isRight[data-v-0869dab5]{align-items:flex-end}.comment .isRight .owner[data-v-0869dab5],.comment .isRight .mod[data-v-0869dab5],.comment .isRight .username[data-v-0869dab5]{margin:0 0 0 1rem}.comment .Author-right[data-v-0869dab5]{display:flex;flex-direction:column;align-items:center}.comment .Author-right .floor[data-v-0869dab5]{margin:0;border-radius:.5rem;background-color:var(--color-floor);padding:3px 9px}.comment .Author-right .jump[data-v-0869dab5]{color:#929596;margin-top:.4rem;font-size:1.4rem}.comment .point[data-v-0869dab5]{margin:0 1rem;display:flex;gap:.5rem;align-items:center}.comment .point svg[data-v-0869dab5]{font-size:1.6rem}.FromBottomDialog[data-v-3a54f208]{z-index:11;position:fixed;width:100%;overflow-y:auto;bottom:0;box-sizing:border-box;border-radius:var(--0013fa15);transition:all .3s;background:var(--color-four-bg)}.FromBottomDialog.no-heng-gang[data-v-3a54f208]{padding-top:0}.FromBottomDialog .heng-gang[data-v-3a54f208]{border-radius:.5rem .5rem 0 0;border-radius:var(--0013fa15);z-index:3;width:100%;position:fixed;min-height:3rem;display:flex;justify-content:center;align-items:center}.FromBottomDialog .heng-gang .gang-content[data-v-3a54f208]{background:darkgray;border-radius:2px;height:.4rem;width:3rem}.FromBottomDialog .dialog-wrapper[data-v-3a54f208]{margin-top:3rem}.wrapper .options[data-v-ae322b31]{padding:1rem 2rem 3rem;display:grid;grid-template-columns:repeat(5,1fr);justify-content:space-between;gap:2rem}.wrapper .options .item[data-v-ae322b31]{display:flex;flex-direction:column;align-items:center;color:gray;font-size:1.2rem}.wrapper .options .item.disabled[data-v-ae322b31]{opacity:.5}.wrapper .options .item.disabled svg[data-v-ae322b31]{color:gray!important}.wrapper .options .item .icon-wrap[data-v-ae322b31]{margin-bottom:.5rem;width:100%;height:15vw;display:flex;justify-content:center;align-items:center;background:var(--color-second-bg);border-radius:1rem}.wrapper .options .item .icon-wrap svg[data-v-ae322b31]{font-size:3rem}.wrapper .options .black[data-v-ae322b31]{color:var(--color-font-pure)}.wrapper .cancel[data-v-ae322b31]{border-top:1px solid var(--color-tooltip-bg);display:flex;align-items:center;justify-content:center;font-size:1.6rem;height:5rem;color:#646f81}.wrapper .options[data-v-8ef13a81]{padding:1rem 2rem 3rem;display:grid;grid-template-columns:repeat(5,1fr);justify-content:space-between;gap:2rem}.wrapper .options .item[data-v-8ef13a81]{display:flex;flex-direction:column;align-items:center;color:gray;font-size:1.2rem}.wrapper .options .item.disabled[data-v-8ef13a81]{opacity:.5}.wrapper .options .item.disabled svg[data-v-8ef13a81]{color:gray!important}.wrapper .options .item.full svg[data-v-8ef13a81]{color:#e02a2a!important}.wrapper .options .item .icon-wrap[data-v-8ef13a81]{margin-bottom:.5rem;width:100%;height:15vw;display:flex;justify-content:center;align-items:center;background:var(--color-second-bg);border-radius:1rem}.wrapper .options .item .icon-wrap svg[data-v-8ef13a81]{font-size:3rem;color:#39ae55}.wrapper .cancel[data-v-8ef13a81]{border-top:1px solid var(--color-line2);display:flex;align-items:center;justify-content:center;font-size:1.6rem;height:5rem;color:#646f81}.sticky{position:sticky;bottom:-2px;z-index:2;background:var(--box-background-hover-color)!important}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.v-enter-active[data-v-546d3b11],.v-leave-active[data-v-546d3b11]{transition:opacity .3s ease}.v-enter-from[data-v-546d3b11],.v-leave-to[data-v-546d3b11]{opacity:0}.fade-in[data-v-546d3b11]{animation:fade-in-546d3b11 .3s}.fade-out[data-v-546d3b11]{animation:fade-out-546d3b11 .4s}@keyframes fade-in-546d3b11{0%{opacity:0}to{opacity:1}}@keyframes fade-out-546d3b11{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-546d3b11]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-546d3b11]{font-size:1.4rem;color:#e02a2a}.owner[data-v-546d3b11]{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-546d3b11]{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-546d3b11]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag .remove[data-v-546d3b11]{margin-left:.5rem;display:none}.add-tag[data-v-546d3b11]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor[data-v-546d3b11]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-546d3b11]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-546d3b11]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-546d3b11]{font-size:10px}[data-v-546d3b11]:root{--box-border-radius: 8px}#site-header[data-v-546d3b11]{height:4rem}#site-header #site-header-menu #menu-body[data-v-546d3b11]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-546d3b11]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-546d3b11]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-546d3b11]{background:var(--box-background-color)}.post-item .new-item[data-v-546d3b11]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-546d3b11]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-546d3b11],.post-item .new-item .left a.node[data-v-546d3b11]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-546d3b11]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-546d3b11]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-546d3b11]{text-decoration:none!important}.post-item .new-item .right[data-v-546d3b11]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-546d3b11]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-546d3b11]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-546d3b11]{margin-top:.5rem}.post-item .post-content p[data-v-546d3b11]:first-child{margin-top:0}.post-item .post-content[data-v-546d3b11]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-546d3b11]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-546d3b11]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-546d3b11]:link{color:#000!important}.preview .show-all[data-v-546d3b11]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-546d3b11]{height:unset!important}.preview .show-more[data-v-546d3b11]{display:flex}.preview .item_title[data-v-546d3b11]{font-weight:700}.Night .post-item[data-v-546d3b11]{background:#18222d!important}.Night .preview[data-v-546d3b11]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-546d3b11]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-546d3b11]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-546d3b11]:link{color:#c0dbff!important}[data-v-546d3b11]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--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-line2: #cecece;--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;--space: 1rem}html.dark[data-v-546d3b11]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--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}.flex[data-v-546d3b11]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-546d3b11]{justify-content:flex-end}.flex-center[data-v-546d3b11]{justify-content:center}.p1[data-v-546d3b11]{padding:1rem}.p2[data-v-546d3b11]{padding:2rem}.p0[data-v-546d3b11]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-546d3b11]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-546d3b11]{text-decoration:none}.tool[data-v-546d3b11]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-546d3b11]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-546d3b11]{cursor:not-allowed}.tool span[data-v-546d3b11]{line-height:1rem}.my-node[data-v-546d3b11]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs[data-v-546d3b11]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-546d3b11]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-546d3b11]{padding:.5rem}.my-cell[data-v-546d3b11]{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-546d3b11]{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-546d3b11]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-546d3b11]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-546d3b11]{position:relative}.radio-group2[data-v-546d3b11]{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-546d3b11]{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-546d3b11]:first-child{border-left:none}.radio-group2 .active[data-v-546d3b11]{background:var(--color-active);color:#fff}.pop-confirm[data-v-546d3b11]{position:relative;display:inline-flex;justify-content:center}input[data-v-546d3b11]{width:10rem;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-546d3b11]:focus{border:1px solid var(--color-active)}.danger[data-v-546d3b11]{color:red!important}.topic_content[data-v-546d3b11],.reply_content[data-v-546d3b11]{font-size:1.6rem}.mask[data-v-546d3b11]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-546d3b11]{background:#000000bb}.mask.light[data-v-546d3b11]{background:transparent}.mask.lightgray[data-v-546d3b11]{background:rgba(0,0,0,.25)}.mask.white[data-v-546d3b11]{background:transparent}.slide[data-v-546d3b11]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-546d3b11]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-546d3b11]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-546d3b11]{overflow:hidden!important}.post-wrapper[data-v-546d3b11],.setting-wrapper[data-v-546d3b11]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper[data-v-546d3b11],.setting-wrapper2[data-v-546d3b11]{height:100%;overflow:hidden;background:var(--color-second-bg)}.mobile-page[data-v-546d3b11]{height:100%;overflow:hidden;font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-546d3b11]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.post-detail[data-v-546d3b11]{text-align:start;background:var(--color-main-bg);font-size:1.6rem;display:flex;justify-content:center;flex-wrap:wrap;padding-bottom:10rem}.post-detail[data-v-546d3b11] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-546d3b11] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .nav-bar[data-v-546d3b11]{position:fixed;top:0;z-index:9;height:4.6rem;display:flex;justify-content:space-between;align-items:center;padding:1rem;margin-bottom:-1px}.post-detail .nav-bar svg[data-v-546d3b11]{width:2rem;height:2rem;color:var(--color-font)}.post-detail .nav-bar .left[data-v-546d3b11],.post-detail .nav-bar .right[data-v-546d3b11]{display:flex;align-items:center;gap:1rem}.post-detail .post-main-body .box-header[data-v-546d3b11]{padding:0 .5rem}.post-detail .post-main-body .box-header h1[data-v-546d3b11]{font-size:2.2rem;font-weight:700}.post-detail .post-main-body .box-header small[data-v-546d3b11]{display:flex;align-items:center}.post-detail .loading-wrapper[data-v-546d3b11]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .comments-header[data-v-546d3b11]{width:100%;padding:0 1rem;box-sizing:border-box;background:var(--box-background-color)}.post-detail #no-comments-yet[data-v-546d3b11]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin:2rem 1rem;box-sizing:border-box}.post-detail .relationReply[data-v-546d3b11]{position:fixed;width:25vw;top:6.5rem;bottom:15rem;z-index:100;transform:translate(calc(100% + 2rem));font-size:2rem;overflow:hidden}.post-detail .relationReply .my-cell[data-v-546d3b11]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .relationReply .comments[data-v-546d3b11]{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 .call-list[data-v-546d3b11]{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 .call-list .call-item[data-v-546d3b11]{border-top:1px solid var(--color-main-bg);height:3rem;display:flex;padding:0 1rem;align-items:center;font-size:14px;box-sizing:border-box}.post-detail .call-list .call-item .select[data-v-546d3b11],.post-detail .call-list .call-item.select[data-v-546d3b11]{background:var(--color-main-bg);text-decoration:none}.post-detail .call-list .call-item[data-v-546d3b11]:nth-child(1){border-top:1px solid transparent}.post-detail .top-reply[data-v-546d3b11]{color:var(--color-font-3);font-size:2rem;margin-right:1rem}.base64_tooltip[data-v-1988f33b]{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;line-break:anywhere;font-size:1.4rem;color:var(--color-font-8)}.base64_tooltip svg[data-v-1988f33b]{margin-left:1rem;min-width:1.8rem}.base64_tooltip[data-v-1988f33b] .base-button{margin-left:1rem;margin-top:1rem}.msg[data-v-0dcc0508]{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-0dcc0508]{background:var(--color-active)}.msg.warning .left[data-v-0dcc0508]{background:#c8c002}.msg.error .left[data-v-0dcc0508]{background:red}.msg .left[data-v-0dcc0508]{border-radius:var(--box-border-radius) 0 0 var(--box-border-radius);display:flex;align-items:center;background:var(--color-active)}.msg .left svg[data-v-0dcc0508]{color:#fff;font-size:2.2rem;margin:0 .6rem}.msg .right[data-v-0dcc0508]{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.tag-modal .wrapper[data-v-674b86aa]{z-index:9;background:var(--color-main-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;padding:2rem 4rem;width:25rem}.tag-modal .wrapper .title[data-v-674b86aa]{font-weight:700}.tag-modal .wrapper .btns[data-v-674b86aa]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.msgs[data-v-93c4dec0]{position:fixed;margin-left:calc(50% - 40vw);width:80vw;z-index:9999;bottom:0;left:0;right:0}.tag-modal .modal-root[data-v-19a5903e]{z-index:9;background:var(--color-second-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;width:50vw;height:70vh;display:flex;flex-direction:column}.tag-modal .modal-root .modal-header[data-v-19a5903e]{padding:2.4rem;display:flex;justify-content:space-between}.tag-modal .modal-root .modal-header .title[data-v-19a5903e]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.tag-modal .modal-root .modal-header i[data-v-19a5903e]{font-size:2.2rem}.tag-modal .modal-root .modal-body[data-v-19a5903e]{padding:2rem;padding-top:0;flex:1;overflow:auto}.tag-modal .modal-root .modal-body[data-v-19a5903e] .cell{padding:2rem}.v-enter-active,.v-leave-active{transition:opacity .3s ease}.v-enter-from,.v-leave-to{opacity:0}.fade-in{animation:fade-in .3s}.fade-out{animation:fade-out .4s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0;display:none}}.username{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num{font-size:1.4rem;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 .remove{margin-left:.5rem;display:none}.add-tag{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar{margin-right:1rem;display:inline-flex}.base-avatar img{width:2.8rem;height:2.8rem;border-radius:.4rem}html{font-size:10px}:root{--box-border-radius: 8px}#site-header{height:4rem}#site-header #site-header-menu #menu-body{top:5rem;right:1rem}#Wrapper .cell .count_livid{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item{background:var(--box-background-color)}.post-item .new-item{display:flex;justify-content:space-between}.post-item .new-item .left .top{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small,.post-item .new-item .left a.node{font-size:1.2rem}.post-item .new-item .left .bottom{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title{font-size:1.6rem}.post-item .new-item .left .bottom a{text-decoration:none!important}.post-item .new-item .right{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote{margin-top:.5rem}.post-item .post-content p:first-child{margin-top:0}.post-item .post-content:visited{color:var(--link-visited-color)}.post-item .show-more{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link:link{color:#000!important}.preview .show-all{max-height:unset;-webkit-mask-image:none}.preview .post-content{height:unset!important}.preview .show-more{display:flex}.preview .item_title{font-weight:700}.Night .post-item{background:#18222d!important}.Night .preview{border:1px solid #3b536e}.Night .preview>.post-content:link{color:#d1d5d9}.Night .preview>.post-content:visited{color:#393f4e!important}.Night .preview .topic-link:link{color:#c0dbff!important}:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--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-line2: #cecece;--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;--space: 1rem}html.dark{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--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}.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:.46ex;color:currentcolor;text-decoration:underline 1.5px}a{text-decoration:none}.tool{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg{width:2.2rem!important;height:2.2rem!important}.tool.disabled{cursor:not-allowed}.tool span{line-height:1rem}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content{padding:.5rem}.my-cell{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal{position:fixed;z-index:100;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}.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{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-active);color:#fff}.pop-confirm{position:relative;display:inline-flex;justify-content:center}input{width:10rem;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:focus{border:1px solid var(--color-active)}.danger{color:red!important}.topic_content,.reply_content{font-size:1.6rem}.mask{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark{background:#000000bb}.mask.light{background:transparent}.mask.lightgray{background:rgba(0,0,0,.25)}.mask.white{background:transparent}.slide{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1{overflow:hidden!important}.post-wrapper,.setting-wrapper{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper,.setting-wrapper2{height:100%;overflow:hidden;background:var(--color-second-bg)}.mobile-page{height:100%;overflow:hidden;font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.target-user-tags[data-v-cf079729]{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-cf079729]{display:inline-block}.loaded[data-v-cf079729]{font-size:1.4rem;display:flex;align-items:center;gap:1rem} ');
  35.  
  36. (function (vue) {
  37. 'use strict';
  38.  
  39. var PageType = /* @__PURE__ */ ((PageType2) => {
  40. PageType2["Home"] = "Home";
  41. PageType2["Node"] = "Node";
  42. PageType2["Post"] = "Post";
  43. PageType2["Member"] = "Member";
  44. PageType2["Changes"] = "Changes";
  45. return PageType2;
  46. })(PageType || {});
  47. var CommentDisplayType = /* @__PURE__ */ ((CommentDisplayType2) => {
  48. CommentDisplayType2[CommentDisplayType2["FloorInFloor"] = 0] = "FloorInFloor";
  49. CommentDisplayType2[CommentDisplayType2["FloorInFloorNoCallUser"] = 4] = "FloorInFloorNoCallUser";
  50. CommentDisplayType2[CommentDisplayType2["FloorInFloorNested"] = 5] = "FloorInFloorNested";
  51. CommentDisplayType2[CommentDisplayType2["Like"] = 1] = "Like";
  52. CommentDisplayType2[CommentDisplayType2["V2exOrigin"] = 2] = "V2exOrigin";
  53. CommentDisplayType2[CommentDisplayType2["OnlyOp"] = 3] = "OnlyOp";
  54. CommentDisplayType2[CommentDisplayType2["New"] = 6] = "New";
  55. return CommentDisplayType2;
  56. })(CommentDisplayType || {});
  57. const MAX_REPLY_LIMIT = 400;
  58. const _sfc_main$r = {
  59. name: "Tooltip",
  60. props: {
  61. title: {
  62. type: String,
  63. default() {
  64. return "";
  65. }
  66. },
  67. disabled: {
  68. type: Boolean,
  69. default() {
  70. return false;
  71. }
  72. }
  73. },
  74. data() {
  75. return {
  76. show: false
  77. };
  78. },
  79. methods: {
  80. showPop(e2) {
  81. if (this.disabled)
  82. return;
  83. if (!this.title)
  84. return;
  85. e2.stopPropagation();
  86. let rect = e2.target.getBoundingClientRect();
  87. this.show = true;
  88. vue.nextTick(() => {
  89. var _a, _b;
  90. let tip = (_b = (_a = this.$refs) == null ? void 0 : _a.tip) == null ? void 0 : _b.getBoundingClientRect();
  91. if (!tip)
  92. return;
  93. if (rect.top < 50) {
  94. this.$refs.tip.style.top = rect.top + rect.height + 10 + "px";
  95. } else {
  96. this.$refs.tip.style.top = rect.top - tip.height - 10 + "px";
  97. }
  98. let tipWidth = tip.width;
  99. let rectWidth = rect.width;
  100. this.$refs.tip.style.left = rect.left - (tipWidth - rectWidth) / 2 + "px";
  101. });
  102. }
  103. },
  104. render() {
  105. let Vnode = this.$slots.default()[0];
  106. return vue.createVNode(vue.Fragment, null, [this.show && this.title && vue.createVNode(vue.Teleport, {
  107. "to": "body"
  108. }, {
  109. default: () => [vue.createVNode(vue.Transition, {
  110. "name": "fade"
  111. }, {
  112. default: () => [vue.createVNode("div", {
  113. "ref": "tip",
  114. "className": "tip"
  115. }, [this.title])]
  116. })]
  117. }), vue.createVNode(Vnode, {
  118. "onClick": () => this.show = false,
  119. "onmouseenter": (e2) => this.showPop(e2),
  120. "onmouseleave": () => this.show = false
  121. }, null)]);
  122. }
  123. };
  124. const _export_sfc = (sfc, props) => {
  125. const target = sfc.__vccOpts || sfc;
  126. for (const [key, val] of props) {
  127. target[key] = val;
  128. }
  129. return target;
  130. };
  131. const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-ee672411"]]);
  132. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  133. __name: "BaseSwitch",
  134. props: {
  135. modelValue: { type: Boolean }
  136. },
  137. emits: ["update:modelValue"],
  138. setup(__props, { emit: __emit }) {
  139. return (_ctx, _cache) => {
  140. return vue.openBlock(), vue.createElementBlock("div", {
  141. class: vue.normalizeClass(["switch", { active: _ctx.modelValue }]),
  142. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", !_ctx.modelValue))
  143. }, null, 2);
  144. };
  145. }
  146. });
  147. const BaseSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e7c0fbef"]]);
  148. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  149. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  150. const colonSeparated = value.split(":");
  151. if (value.slice(0, 1) === "@") {
  152. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  153. return null;
  154. }
  155. provider = colonSeparated.shift().slice(1);
  156. }
  157. if (colonSeparated.length > 3 || !colonSeparated.length) {
  158. return null;
  159. }
  160. if (colonSeparated.length > 1) {
  161. const name2 = colonSeparated.pop();
  162. const prefix = colonSeparated.pop();
  163. const result = {
  164. // Allow provider without '@': "provider:prefix:name"
  165. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  166. prefix,
  167. name: name2
  168. };
  169. return validate && !validateIconName(result) ? null : result;
  170. }
  171. const name = colonSeparated[0];
  172. const dashSeparated = name.split("-");
  173. if (dashSeparated.length > 1) {
  174. const result = {
  175. provider,
  176. prefix: dashSeparated.shift(),
  177. name: dashSeparated.join("-")
  178. };
  179. return validate && !validateIconName(result) ? null : result;
  180. }
  181. if (allowSimpleName && provider === "") {
  182. const result = {
  183. provider,
  184. prefix: "",
  185. name
  186. };
  187. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  188. }
  189. return null;
  190. };
  191. const validateIconName = (icon, allowSimpleName) => {
  192. if (!icon) {
  193. return false;
  194. }
  195. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  196. };
  197. const defaultIconDimensions = Object.freeze(
  198. {
  199. left: 0,
  200. top: 0,
  201. width: 16,
  202. height: 16
  203. }
  204. );
  205. const defaultIconTransformations = Object.freeze({
  206. rotate: 0,
  207. vFlip: false,
  208. hFlip: false
  209. });
  210. const defaultIconProps = Object.freeze({
  211. ...defaultIconDimensions,
  212. ...defaultIconTransformations
  213. });
  214. const defaultExtendedIconProps = Object.freeze({
  215. ...defaultIconProps,
  216. body: "",
  217. hidden: false
  218. });
  219. function mergeIconTransformations(obj1, obj2) {
  220. const result = {};
  221. if (!obj1.hFlip !== !obj2.hFlip) {
  222. result.hFlip = true;
  223. }
  224. if (!obj1.vFlip !== !obj2.vFlip) {
  225. result.vFlip = true;
  226. }
  227. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  228. if (rotate) {
  229. result.rotate = rotate;
  230. }
  231. return result;
  232. }
  233. function mergeIconData(parent, child) {
  234. const result = mergeIconTransformations(parent, child);
  235. for (const key in defaultExtendedIconProps) {
  236. if (key in defaultIconTransformations) {
  237. if (key in parent && !(key in result)) {
  238. result[key] = defaultIconTransformations[key];
  239. }
  240. } else if (key in child) {
  241. result[key] = child[key];
  242. } else if (key in parent) {
  243. result[key] = parent[key];
  244. }
  245. }
  246. return result;
  247. }
  248. function getIconsTree(data, names) {
  249. const icons = data.icons;
  250. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  251. const resolved = /* @__PURE__ */ Object.create(null);
  252. function resolve(name) {
  253. if (icons[name]) {
  254. return resolved[name] = [];
  255. }
  256. if (!(name in resolved)) {
  257. resolved[name] = null;
  258. const parent = aliases[name] && aliases[name].parent;
  259. const value = parent && resolve(parent);
  260. if (value) {
  261. resolved[name] = [parent].concat(value);
  262. }
  263. }
  264. return resolved[name];
  265. }
  266. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  267. return resolved;
  268. }
  269. function internalGetIconData(data, name, tree) {
  270. const icons = data.icons;
  271. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  272. let currentProps = {};
  273. function parse(name2) {
  274. currentProps = mergeIconData(
  275. icons[name2] || aliases[name2],
  276. currentProps
  277. );
  278. }
  279. parse(name);
  280. tree.forEach(parse);
  281. return mergeIconData(data, currentProps);
  282. }
  283. function parseIconSet(data, callback) {
  284. const names = [];
  285. if (typeof data !== "object" || typeof data.icons !== "object") {
  286. return names;
  287. }
  288. if (data.not_found instanceof Array) {
  289. data.not_found.forEach((name) => {
  290. callback(name, null);
  291. names.push(name);
  292. });
  293. }
  294. const tree = getIconsTree(data);
  295. for (const name in tree) {
  296. const item = tree[name];
  297. if (item) {
  298. callback(name, internalGetIconData(data, name, item));
  299. names.push(name);
  300. }
  301. }
  302. return names;
  303. }
  304. const optionalPropertyDefaults = {
  305. provider: "",
  306. aliases: {},
  307. not_found: {},
  308. ...defaultIconDimensions
  309. };
  310. function checkOptionalProps(item, defaults) {
  311. for (const prop in defaults) {
  312. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  313. return false;
  314. }
  315. }
  316. return true;
  317. }
  318. function quicklyValidateIconSet(obj) {
  319. if (typeof obj !== "object" || obj === null) {
  320. return null;
  321. }
  322. const data = obj;
  323. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  324. return null;
  325. }
  326. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  327. return null;
  328. }
  329. const icons = data.icons;
  330. for (const name in icons) {
  331. const icon = icons[name];
  332. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  333. icon,
  334. defaultExtendedIconProps
  335. )) {
  336. return null;
  337. }
  338. }
  339. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  340. for (const name in aliases) {
  341. const icon = aliases[name];
  342. const parent = icon.parent;
  343. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  344. icon,
  345. defaultExtendedIconProps
  346. )) {
  347. return null;
  348. }
  349. }
  350. return data;
  351. }
  352. const dataStorage = /* @__PURE__ */ Object.create(null);
  353. function newStorage(provider, prefix) {
  354. return {
  355. provider,
  356. prefix,
  357. icons: /* @__PURE__ */ Object.create(null),
  358. missing: /* @__PURE__ */ new Set()
  359. };
  360. }
  361. function getStorage(provider, prefix) {
  362. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  363. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  364. }
  365. function addIconSet(storage2, data) {
  366. if (!quicklyValidateIconSet(data)) {
  367. return [];
  368. }
  369. return parseIconSet(data, (name, icon) => {
  370. if (icon) {
  371. storage2.icons[name] = icon;
  372. } else {
  373. storage2.missing.add(name);
  374. }
  375. });
  376. }
  377. function addIconToStorage(storage2, name, icon) {
  378. try {
  379. if (typeof icon.body === "string") {
  380. storage2.icons[name] = { ...icon };
  381. return true;
  382. }
  383. } catch (err) {
  384. }
  385. return false;
  386. }
  387. let simpleNames = false;
  388. function allowSimpleNames(allow) {
  389. if (typeof allow === "boolean") {
  390. simpleNames = allow;
  391. }
  392. return simpleNames;
  393. }
  394. function getIconData(name) {
  395. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  396. if (icon) {
  397. const storage2 = getStorage(icon.provider, icon.prefix);
  398. const iconName = icon.name;
  399. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  400. }
  401. }
  402. function addIcon(name, data) {
  403. const icon = stringToIcon(name, true, simpleNames);
  404. if (!icon) {
  405. return false;
  406. }
  407. const storage2 = getStorage(icon.provider, icon.prefix);
  408. return addIconToStorage(storage2, icon.name, data);
  409. }
  410. function addCollection(data, provider) {
  411. if (typeof data !== "object") {
  412. return false;
  413. }
  414. if (typeof provider !== "string") {
  415. provider = data.provider || "";
  416. }
  417. if (simpleNames && !provider && !data.prefix) {
  418. let added = false;
  419. if (quicklyValidateIconSet(data)) {
  420. data.prefix = "";
  421. parseIconSet(data, (name, icon) => {
  422. if (icon && addIcon(name, icon)) {
  423. added = true;
  424. }
  425. });
  426. }
  427. return added;
  428. }
  429. const prefix = data.prefix;
  430. if (!validateIconName({
  431. provider,
  432. prefix,
  433. name: "a"
  434. })) {
  435. return false;
  436. }
  437. const storage2 = getStorage(provider, prefix);
  438. return !!addIconSet(storage2, data);
  439. }
  440. const defaultIconSizeCustomisations = Object.freeze({
  441. width: null,
  442. height: null
  443. });
  444. const defaultIconCustomisations = Object.freeze({
  445. // Dimensions
  446. ...defaultIconSizeCustomisations,
  447. // Transformations
  448. ...defaultIconTransformations
  449. });
  450. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  451. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  452. function calculateSize(size, ratio, precision) {
  453. if (ratio === 1) {
  454. return size;
  455. }
  456. precision = precision || 100;
  457. if (typeof size === "number") {
  458. return Math.ceil(size * ratio * precision) / precision;
  459. }
  460. if (typeof size !== "string") {
  461. return size;
  462. }
  463. const oldParts = size.split(unitsSplit);
  464. if (oldParts === null || !oldParts.length) {
  465. return size;
  466. }
  467. const newParts = [];
  468. let code = oldParts.shift();
  469. let isNumber = unitsTest.test(code);
  470. while (true) {
  471. if (isNumber) {
  472. const num = parseFloat(code);
  473. if (isNaN(num)) {
  474. newParts.push(code);
  475. } else {
  476. newParts.push(Math.ceil(num * ratio * precision) / precision);
  477. }
  478. } else {
  479. newParts.push(code);
  480. }
  481. code = oldParts.shift();
  482. if (code === void 0) {
  483. return newParts.join("");
  484. }
  485. isNumber = !isNumber;
  486. }
  487. }
  488. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  489. function iconToSVG(icon, customisations) {
  490. const fullIcon = {
  491. ...defaultIconProps,
  492. ...icon
  493. };
  494. const fullCustomisations = {
  495. ...defaultIconCustomisations,
  496. ...customisations
  497. };
  498. const box = {
  499. left: fullIcon.left,
  500. top: fullIcon.top,
  501. width: fullIcon.width,
  502. height: fullIcon.height
  503. };
  504. let body = fullIcon.body;
  505. [fullIcon, fullCustomisations].forEach((props) => {
  506. const transformations = [];
  507. const hFlip = props.hFlip;
  508. const vFlip = props.vFlip;
  509. let rotation = props.rotate;
  510. if (hFlip) {
  511. if (vFlip) {
  512. rotation += 2;
  513. } else {
  514. transformations.push(
  515. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  516. );
  517. transformations.push("scale(-1 1)");
  518. box.top = box.left = 0;
  519. }
  520. } else if (vFlip) {
  521. transformations.push(
  522. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  523. );
  524. transformations.push("scale(1 -1)");
  525. box.top = box.left = 0;
  526. }
  527. let tempValue;
  528. if (rotation < 0) {
  529. rotation -= Math.floor(rotation / 4) * 4;
  530. }
  531. rotation = rotation % 4;
  532. switch (rotation) {
  533. case 1:
  534. tempValue = box.height / 2 + box.top;
  535. transformations.unshift(
  536. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  537. );
  538. break;
  539. case 2:
  540. transformations.unshift(
  541. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  542. );
  543. break;
  544. case 3:
  545. tempValue = box.width / 2 + box.left;
  546. transformations.unshift(
  547. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  548. );
  549. break;
  550. }
  551. if (rotation % 2 === 1) {
  552. if (box.left !== box.top) {
  553. tempValue = box.left;
  554. box.left = box.top;
  555. box.top = tempValue;
  556. }
  557. if (box.width !== box.height) {
  558. tempValue = box.width;
  559. box.width = box.height;
  560. box.height = tempValue;
  561. }
  562. }
  563. if (transformations.length) {
  564. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  565. }
  566. });
  567. const customisationsWidth = fullCustomisations.width;
  568. const customisationsHeight = fullCustomisations.height;
  569. const boxWidth = box.width;
  570. const boxHeight = box.height;
  571. let width;
  572. let height;
  573. if (customisationsWidth === null) {
  574. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  575. width = calculateSize(height, boxWidth / boxHeight);
  576. } else {
  577. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  578. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  579. }
  580. const attributes = {};
  581. const setAttr = (prop, value) => {
  582. if (!isUnsetKeyword(value)) {
  583. attributes[prop] = value.toString();
  584. }
  585. };
  586. setAttr("width", width);
  587. setAttr("height", height);
  588. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  589. return {
  590. attributes,
  591. body
  592. };
  593. }
  594. const regex = /\sid="(\S+)"/g;
  595. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  596. let counter = 0;
  597. function replaceIDs(body, prefix = randomPrefix) {
  598. const ids = [];
  599. let match;
  600. while (match = regex.exec(body)) {
  601. ids.push(match[1]);
  602. }
  603. if (!ids.length) {
  604. return body;
  605. }
  606. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  607. ids.forEach((id) => {
  608. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  609. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  610. body = body.replace(
  611. // Allowed characters before id: [#;"]
  612. // Allowed characters after id: [)"], .[a-z]
  613. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  614. "$1" + newID + suffix + "$3"
  615. );
  616. });
  617. body = body.replace(new RegExp(suffix, "g"), "");
  618. return body;
  619. }
  620. const storage = /* @__PURE__ */ Object.create(null);
  621. function setAPIModule(provider, item) {
  622. storage[provider] = item;
  623. }
  624. function getAPIModule(provider) {
  625. return storage[provider] || storage[""];
  626. }
  627. function createAPIConfig(source) {
  628. let resources;
  629. if (typeof source.resources === "string") {
  630. resources = [source.resources];
  631. } else {
  632. resources = source.resources;
  633. if (!(resources instanceof Array) || !resources.length) {
  634. return null;
  635. }
  636. }
  637. const result = {
  638. // API hosts
  639. resources,
  640. // Root path
  641. path: source.path || "/",
  642. // URL length limit
  643. maxURL: source.maxURL || 500,
  644. // Timeout before next host is used.
  645. rotate: source.rotate || 750,
  646. // Timeout before failing query.
  647. timeout: source.timeout || 5e3,
  648. // Randomise default API end point.
  649. random: source.random === true,
  650. // Start index
  651. index: source.index || 0,
  652. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  653. dataAfterTimeout: source.dataAfterTimeout !== false
  654. };
  655. return result;
  656. }
  657. const configStorage = /* @__PURE__ */ Object.create(null);
  658. const fallBackAPISources = [
  659. "https://api.simplesvg.com",
  660. "https://api.unisvg.com"
  661. ];
  662. const fallBackAPI = [];
  663. while (fallBackAPISources.length > 0) {
  664. if (fallBackAPISources.length === 1) {
  665. fallBackAPI.push(fallBackAPISources.shift());
  666. } else {
  667. if (Math.random() > 0.5) {
  668. fallBackAPI.push(fallBackAPISources.shift());
  669. } else {
  670. fallBackAPI.push(fallBackAPISources.pop());
  671. }
  672. }
  673. }
  674. configStorage[""] = createAPIConfig({
  675. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  676. });
  677. function addAPIProvider(provider, customConfig) {
  678. const config2 = createAPIConfig(customConfig);
  679. if (config2 === null) {
  680. return false;
  681. }
  682. configStorage[provider] = config2;
  683. return true;
  684. }
  685. function getAPIConfig(provider) {
  686. return configStorage[provider];
  687. }
  688. const detectFetch = () => {
  689. let callback;
  690. try {
  691. callback = fetch;
  692. if (typeof callback === "function") {
  693. return callback;
  694. }
  695. } catch (err) {
  696. }
  697. };
  698. let fetchModule = detectFetch();
  699. function calculateMaxLength(provider, prefix) {
  700. const config2 = getAPIConfig(provider);
  701. if (!config2) {
  702. return 0;
  703. }
  704. let result;
  705. if (!config2.maxURL) {
  706. result = 0;
  707. } else {
  708. let maxHostLength = 0;
  709. config2.resources.forEach((item) => {
  710. const host = item;
  711. maxHostLength = Math.max(maxHostLength, host.length);
  712. });
  713. const url = prefix + ".json?icons=";
  714. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  715. }
  716. return result;
  717. }
  718. function shouldAbort(status) {
  719. return status === 404;
  720. }
  721. const prepare = (provider, prefix, icons) => {
  722. const results = [];
  723. const maxLength = calculateMaxLength(provider, prefix);
  724. const type = "icons";
  725. let item = {
  726. type,
  727. provider,
  728. prefix,
  729. icons: []
  730. };
  731. let length = 0;
  732. icons.forEach((name, index) => {
  733. length += name.length + 1;
  734. if (length >= maxLength && index > 0) {
  735. results.push(item);
  736. item = {
  737. type,
  738. provider,
  739. prefix,
  740. icons: []
  741. };
  742. length = name.length;
  743. }
  744. item.icons.push(name);
  745. });
  746. results.push(item);
  747. return results;
  748. };
  749. function getPath(provider) {
  750. if (typeof provider === "string") {
  751. const config2 = getAPIConfig(provider);
  752. if (config2) {
  753. return config2.path;
  754. }
  755. }
  756. return "/";
  757. }
  758. const send = (host, params, callback) => {
  759. if (!fetchModule) {
  760. callback("abort", 424);
  761. return;
  762. }
  763. let path = getPath(params.provider);
  764. switch (params.type) {
  765. case "icons": {
  766. const prefix = params.prefix;
  767. const icons = params.icons;
  768. const iconsList = icons.join(",");
  769. const urlParams = new URLSearchParams({
  770. icons: iconsList
  771. });
  772. path += prefix + ".json?" + urlParams.toString();
  773. break;
  774. }
  775. case "custom": {
  776. const uri = params.uri;
  777. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  778. break;
  779. }
  780. default:
  781. callback("abort", 400);
  782. return;
  783. }
  784. let defaultError = 503;
  785. fetchModule(host + path).then((response) => {
  786. const status = response.status;
  787. if (status !== 200) {
  788. setTimeout(() => {
  789. callback(shouldAbort(status) ? "abort" : "next", status);
  790. });
  791. return;
  792. }
  793. defaultError = 501;
  794. return response.json();
  795. }).then((data) => {
  796. if (typeof data !== "object" || data === null) {
  797. setTimeout(() => {
  798. if (data === 404) {
  799. callback("abort", data);
  800. } else {
  801. callback("next", defaultError);
  802. }
  803. });
  804. return;
  805. }
  806. setTimeout(() => {
  807. callback("success", data);
  808. });
  809. }).catch(() => {
  810. callback("next", defaultError);
  811. });
  812. };
  813. const fetchAPIModule = {
  814. prepare,
  815. send
  816. };
  817. function sortIcons(icons) {
  818. const result = {
  819. loaded: [],
  820. missing: [],
  821. pending: []
  822. };
  823. const storage2 = /* @__PURE__ */ Object.create(null);
  824. icons.sort((a, b) => {
  825. if (a.provider !== b.provider) {
  826. return a.provider.localeCompare(b.provider);
  827. }
  828. if (a.prefix !== b.prefix) {
  829. return a.prefix.localeCompare(b.prefix);
  830. }
  831. return a.name.localeCompare(b.name);
  832. });
  833. let lastIcon = {
  834. provider: "",
  835. prefix: "",
  836. name: ""
  837. };
  838. icons.forEach((icon) => {
  839. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  840. return;
  841. }
  842. lastIcon = icon;
  843. const provider = icon.provider;
  844. const prefix = icon.prefix;
  845. const name = icon.name;
  846. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  847. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  848. let list;
  849. if (name in localStorage2.icons) {
  850. list = result.loaded;
  851. } else if (prefix === "" || localStorage2.missing.has(name)) {
  852. list = result.missing;
  853. } else {
  854. list = result.pending;
  855. }
  856. const item = {
  857. provider,
  858. prefix,
  859. name
  860. };
  861. list.push(item);
  862. });
  863. return result;
  864. }
  865. function removeCallback(storages, id) {
  866. storages.forEach((storage2) => {
  867. const items = storage2.loaderCallbacks;
  868. if (items) {
  869. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  870. }
  871. });
  872. }
  873. function updateCallbacks(storage2) {
  874. if (!storage2.pendingCallbacksFlag) {
  875. storage2.pendingCallbacksFlag = true;
  876. setTimeout(() => {
  877. storage2.pendingCallbacksFlag = false;
  878. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  879. if (!items.length) {
  880. return;
  881. }
  882. let hasPending = false;
  883. const provider = storage2.provider;
  884. const prefix = storage2.prefix;
  885. items.forEach((item) => {
  886. const icons = item.icons;
  887. const oldLength = icons.pending.length;
  888. icons.pending = icons.pending.filter((icon) => {
  889. if (icon.prefix !== prefix) {
  890. return true;
  891. }
  892. const name = icon.name;
  893. if (storage2.icons[name]) {
  894. icons.loaded.push({
  895. provider,
  896. prefix,
  897. name
  898. });
  899. } else if (storage2.missing.has(name)) {
  900. icons.missing.push({
  901. provider,
  902. prefix,
  903. name
  904. });
  905. } else {
  906. hasPending = true;
  907. return true;
  908. }
  909. return false;
  910. });
  911. if (icons.pending.length !== oldLength) {
  912. if (!hasPending) {
  913. removeCallback([storage2], item.id);
  914. }
  915. item.callback(
  916. icons.loaded.slice(0),
  917. icons.missing.slice(0),
  918. icons.pending.slice(0),
  919. item.abort
  920. );
  921. }
  922. });
  923. });
  924. }
  925. }
  926. let idCounter = 0;
  927. function storeCallback(callback, icons, pendingSources) {
  928. const id = idCounter++;
  929. const abort = removeCallback.bind(null, pendingSources, id);
  930. if (!icons.pending.length) {
  931. return abort;
  932. }
  933. const item = {
  934. id,
  935. icons,
  936. callback,
  937. abort
  938. };
  939. pendingSources.forEach((storage2) => {
  940. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  941. });
  942. return abort;
  943. }
  944. function listToIcons(list, validate = true, simpleNames2 = false) {
  945. const result = [];
  946. list.forEach((item) => {
  947. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  948. if (icon) {
  949. result.push(icon);
  950. }
  951. });
  952. return result;
  953. }
  954. var defaultConfig = {
  955. resources: [],
  956. index: 0,
  957. timeout: 2e3,
  958. rotate: 750,
  959. random: false,
  960. dataAfterTimeout: false
  961. };
  962. function sendQuery(config2, payload, query, done) {
  963. const resourcesCount = config2.resources.length;
  964. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  965. let resources;
  966. if (config2.random) {
  967. let list = config2.resources.slice(0);
  968. resources = [];
  969. while (list.length > 1) {
  970. const nextIndex = Math.floor(Math.random() * list.length);
  971. resources.push(list[nextIndex]);
  972. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  973. }
  974. resources = resources.concat(list);
  975. } else {
  976. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  977. }
  978. const startTime = Date.now();
  979. let status = "pending";
  980. let queriesSent = 0;
  981. let lastError;
  982. let timer = null;
  983. let queue = [];
  984. let doneCallbacks = [];
  985. if (typeof done === "function") {
  986. doneCallbacks.push(done);
  987. }
  988. function resetTimer() {
  989. if (timer) {
  990. clearTimeout(timer);
  991. timer = null;
  992. }
  993. }
  994. function abort() {
  995. if (status === "pending") {
  996. status = "aborted";
  997. }
  998. resetTimer();
  999. queue.forEach((item) => {
  1000. if (item.status === "pending") {
  1001. item.status = "aborted";
  1002. }
  1003. });
  1004. queue = [];
  1005. }
  1006. function subscribe(callback, overwrite) {
  1007. if (overwrite) {
  1008. doneCallbacks = [];
  1009. }
  1010. if (typeof callback === "function") {
  1011. doneCallbacks.push(callback);
  1012. }
  1013. }
  1014. function getQueryStatus() {
  1015. return {
  1016. startTime,
  1017. payload,
  1018. status,
  1019. queriesSent,
  1020. queriesPending: queue.length,
  1021. subscribe,
  1022. abort
  1023. };
  1024. }
  1025. function failQuery() {
  1026. status = "failed";
  1027. doneCallbacks.forEach((callback) => {
  1028. callback(void 0, lastError);
  1029. });
  1030. }
  1031. function clearQueue() {
  1032. queue.forEach((item) => {
  1033. if (item.status === "pending") {
  1034. item.status = "aborted";
  1035. }
  1036. });
  1037. queue = [];
  1038. }
  1039. function moduleResponse(item, response, data) {
  1040. const isError = response !== "success";
  1041. queue = queue.filter((queued) => queued !== item);
  1042. switch (status) {
  1043. case "pending":
  1044. break;
  1045. case "failed":
  1046. if (isError || !config2.dataAfterTimeout) {
  1047. return;
  1048. }
  1049. break;
  1050. default:
  1051. return;
  1052. }
  1053. if (response === "abort") {
  1054. lastError = data;
  1055. failQuery();
  1056. return;
  1057. }
  1058. if (isError) {
  1059. lastError = data;
  1060. if (!queue.length) {
  1061. if (!resources.length) {
  1062. failQuery();
  1063. } else {
  1064. execNext();
  1065. }
  1066. }
  1067. return;
  1068. }
  1069. resetTimer();
  1070. clearQueue();
  1071. if (!config2.random) {
  1072. const index = config2.resources.indexOf(item.resource);
  1073. if (index !== -1 && index !== config2.index) {
  1074. config2.index = index;
  1075. }
  1076. }
  1077. status = "completed";
  1078. doneCallbacks.forEach((callback) => {
  1079. callback(data);
  1080. });
  1081. }
  1082. function execNext() {
  1083. if (status !== "pending") {
  1084. return;
  1085. }
  1086. resetTimer();
  1087. const resource = resources.shift();
  1088. if (resource === void 0) {
  1089. if (queue.length) {
  1090. timer = setTimeout(() => {
  1091. resetTimer();
  1092. if (status === "pending") {
  1093. clearQueue();
  1094. failQuery();
  1095. }
  1096. }, config2.timeout);
  1097. return;
  1098. }
  1099. failQuery();
  1100. return;
  1101. }
  1102. const item = {
  1103. status: "pending",
  1104. resource,
  1105. callback: (status2, data) => {
  1106. moduleResponse(item, status2, data);
  1107. }
  1108. };
  1109. queue.push(item);
  1110. queriesSent++;
  1111. timer = setTimeout(execNext, config2.rotate);
  1112. query(resource, payload, item.callback);
  1113. }
  1114. setTimeout(execNext);
  1115. return getQueryStatus;
  1116. }
  1117. function initRedundancy(cfg) {
  1118. const config2 = {
  1119. ...defaultConfig,
  1120. ...cfg
  1121. };
  1122. let queries = [];
  1123. function cleanup() {
  1124. queries = queries.filter((item) => item().status === "pending");
  1125. }
  1126. function query(payload, queryCallback, doneCallback) {
  1127. const query2 = sendQuery(
  1128. config2,
  1129. payload,
  1130. queryCallback,
  1131. (data, error) => {
  1132. cleanup();
  1133. if (doneCallback) {
  1134. doneCallback(data, error);
  1135. }
  1136. }
  1137. );
  1138. queries.push(query2);
  1139. return query2;
  1140. }
  1141. function find(callback) {
  1142. return queries.find((value) => {
  1143. return callback(value);
  1144. }) || null;
  1145. }
  1146. const instance = {
  1147. query,
  1148. find,
  1149. setIndex: (index) => {
  1150. config2.index = index;
  1151. },
  1152. getIndex: () => config2.index,
  1153. cleanup
  1154. };
  1155. return instance;
  1156. }
  1157. function emptyCallback$1() {
  1158. }
  1159. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1160. function getRedundancyCache(provider) {
  1161. if (!redundancyCache[provider]) {
  1162. const config2 = getAPIConfig(provider);
  1163. if (!config2) {
  1164. return;
  1165. }
  1166. const redundancy = initRedundancy(config2);
  1167. const cachedReundancy = {
  1168. config: config2,
  1169. redundancy
  1170. };
  1171. redundancyCache[provider] = cachedReundancy;
  1172. }
  1173. return redundancyCache[provider];
  1174. }
  1175. function sendAPIQuery(target, query, callback) {
  1176. let redundancy;
  1177. let send2;
  1178. if (typeof target === "string") {
  1179. const api = getAPIModule(target);
  1180. if (!api) {
  1181. callback(void 0, 424);
  1182. return emptyCallback$1;
  1183. }
  1184. send2 = api.send;
  1185. const cached = getRedundancyCache(target);
  1186. if (cached) {
  1187. redundancy = cached.redundancy;
  1188. }
  1189. } else {
  1190. const config2 = createAPIConfig(target);
  1191. if (config2) {
  1192. redundancy = initRedundancy(config2);
  1193. const moduleKey = target.resources ? target.resources[0] : "";
  1194. const api = getAPIModule(moduleKey);
  1195. if (api) {
  1196. send2 = api.send;
  1197. }
  1198. }
  1199. }
  1200. if (!redundancy || !send2) {
  1201. callback(void 0, 424);
  1202. return emptyCallback$1;
  1203. }
  1204. return redundancy.query(query, send2, callback)().abort;
  1205. }
  1206. const browserCacheVersion = "iconify2";
  1207. const browserCachePrefix = "iconify";
  1208. const browserCacheCountKey = browserCachePrefix + "-count";
  1209. const browserCacheVersionKey = browserCachePrefix + "-version";
  1210. const browserStorageHour = 36e5;
  1211. const browserStorageCacheExpiration = 168;
  1212. function getStoredItem(func, key) {
  1213. try {
  1214. return func.getItem(key);
  1215. } catch (err) {
  1216. }
  1217. }
  1218. function setStoredItem(func, key, value) {
  1219. try {
  1220. func.setItem(key, value);
  1221. return true;
  1222. } catch (err) {
  1223. }
  1224. }
  1225. function removeStoredItem(func, key) {
  1226. try {
  1227. func.removeItem(key);
  1228. } catch (err) {
  1229. }
  1230. }
  1231. function setBrowserStorageItemsCount(storage2, value) {
  1232. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  1233. }
  1234. function getBrowserStorageItemsCount(storage2) {
  1235. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  1236. }
  1237. const browserStorageConfig = {
  1238. local: true,
  1239. session: true
  1240. };
  1241. const browserStorageEmptyItems = {
  1242. local: /* @__PURE__ */ new Set(),
  1243. session: /* @__PURE__ */ new Set()
  1244. };
  1245. let browserStorageStatus = false;
  1246. function setBrowserStorageStatus(status) {
  1247. browserStorageStatus = status;
  1248. }
  1249. let _window = typeof window === "undefined" ? {} : window;
  1250. function getBrowserStorage(key) {
  1251. const attr = key + "Storage";
  1252. try {
  1253. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  1254. return _window[attr];
  1255. }
  1256. } catch (err) {
  1257. }
  1258. browserStorageConfig[key] = false;
  1259. }
  1260. function iterateBrowserStorage(key, callback) {
  1261. const func = getBrowserStorage(key);
  1262. if (!func) {
  1263. return;
  1264. }
  1265. const version = getStoredItem(func, browserCacheVersionKey);
  1266. if (version !== browserCacheVersion) {
  1267. if (version) {
  1268. const total2 = getBrowserStorageItemsCount(func);
  1269. for (let i = 0; i < total2; i++) {
  1270. removeStoredItem(func, browserCachePrefix + i.toString());
  1271. }
  1272. }
  1273. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  1274. setBrowserStorageItemsCount(func, 0);
  1275. return;
  1276. }
  1277. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  1278. const parseItem = (index) => {
  1279. const name = browserCachePrefix + index.toString();
  1280. const item = getStoredItem(func, name);
  1281. if (typeof item !== "string") {
  1282. return;
  1283. }
  1284. try {
  1285. const data = JSON.parse(item);
  1286. 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
  1287. callback(data, index)) {
  1288. return true;
  1289. }
  1290. } catch (err) {
  1291. }
  1292. removeStoredItem(func, name);
  1293. };
  1294. let total = getBrowserStorageItemsCount(func);
  1295. for (let i = total - 1; i >= 0; i--) {
  1296. if (!parseItem(i)) {
  1297. if (i === total - 1) {
  1298. total--;
  1299. setBrowserStorageItemsCount(func, total);
  1300. } else {
  1301. browserStorageEmptyItems[key].add(i);
  1302. }
  1303. }
  1304. }
  1305. }
  1306. function initBrowserStorage() {
  1307. if (browserStorageStatus) {
  1308. return;
  1309. }
  1310. setBrowserStorageStatus(true);
  1311. for (const key in browserStorageConfig) {
  1312. iterateBrowserStorage(key, (item) => {
  1313. const iconSet = item.data;
  1314. const provider = item.provider;
  1315. const prefix = iconSet.prefix;
  1316. const storage2 = getStorage(
  1317. provider,
  1318. prefix
  1319. );
  1320. if (!addIconSet(storage2, iconSet).length) {
  1321. return false;
  1322. }
  1323. const lastModified = iconSet.lastModified || -1;
  1324. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  1325. return true;
  1326. });
  1327. }
  1328. }
  1329. function updateLastModified(storage2, lastModified) {
  1330. const lastValue = storage2.lastModifiedCached;
  1331. if (
  1332. // Matches or newer
  1333. lastValue && lastValue >= lastModified
  1334. ) {
  1335. return lastValue === lastModified;
  1336. }
  1337. storage2.lastModifiedCached = lastModified;
  1338. if (lastValue) {
  1339. for (const key in browserStorageConfig) {
  1340. iterateBrowserStorage(key, (item) => {
  1341. const iconSet = item.data;
  1342. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  1343. });
  1344. }
  1345. }
  1346. return true;
  1347. }
  1348. function storeInBrowserStorage(storage2, data) {
  1349. if (!browserStorageStatus) {
  1350. initBrowserStorage();
  1351. }
  1352. function store(key) {
  1353. let func;
  1354. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  1355. return;
  1356. }
  1357. const set = browserStorageEmptyItems[key];
  1358. let index;
  1359. if (set.size) {
  1360. set.delete(index = Array.from(set).shift());
  1361. } else {
  1362. index = getBrowserStorageItemsCount(func);
  1363. if (!setBrowserStorageItemsCount(func, index + 1)) {
  1364. return;
  1365. }
  1366. }
  1367. const item = {
  1368. cached: Math.floor(Date.now() / browserStorageHour),
  1369. provider: storage2.provider,
  1370. data
  1371. };
  1372. return setStoredItem(
  1373. func,
  1374. browserCachePrefix + index.toString(),
  1375. JSON.stringify(item)
  1376. );
  1377. }
  1378. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  1379. return;
  1380. }
  1381. if (!Object.keys(data.icons).length) {
  1382. return;
  1383. }
  1384. if (data.not_found) {
  1385. data = Object.assign({}, data);
  1386. delete data.not_found;
  1387. }
  1388. if (!store("local")) {
  1389. store("session");
  1390. }
  1391. }
  1392. function emptyCallback() {
  1393. }
  1394. function loadedNewIcons(storage2) {
  1395. if (!storage2.iconsLoaderFlag) {
  1396. storage2.iconsLoaderFlag = true;
  1397. setTimeout(() => {
  1398. storage2.iconsLoaderFlag = false;
  1399. updateCallbacks(storage2);
  1400. });
  1401. }
  1402. }
  1403. function loadNewIcons(storage2, icons) {
  1404. if (!storage2.iconsToLoad) {
  1405. storage2.iconsToLoad = icons;
  1406. } else {
  1407. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  1408. }
  1409. if (!storage2.iconsQueueFlag) {
  1410. storage2.iconsQueueFlag = true;
  1411. setTimeout(() => {
  1412. storage2.iconsQueueFlag = false;
  1413. const { provider, prefix } = storage2;
  1414. const icons2 = storage2.iconsToLoad;
  1415. delete storage2.iconsToLoad;
  1416. let api;
  1417. if (!icons2 || !(api = getAPIModule(provider))) {
  1418. return;
  1419. }
  1420. const params = api.prepare(provider, prefix, icons2);
  1421. params.forEach((item) => {
  1422. sendAPIQuery(provider, item, (data) => {
  1423. if (typeof data !== "object") {
  1424. item.icons.forEach((name) => {
  1425. storage2.missing.add(name);
  1426. });
  1427. } else {
  1428. try {
  1429. const parsed = addIconSet(
  1430. storage2,
  1431. data
  1432. );
  1433. if (!parsed.length) {
  1434. return;
  1435. }
  1436. const pending = storage2.pendingIcons;
  1437. if (pending) {
  1438. parsed.forEach((name) => {
  1439. pending.delete(name);
  1440. });
  1441. }
  1442. storeInBrowserStorage(storage2, data);
  1443. } catch (err) {
  1444. console.error(err);
  1445. }
  1446. }
  1447. loadedNewIcons(storage2);
  1448. });
  1449. });
  1450. });
  1451. }
  1452. }
  1453. const loadIcons = (icons, callback) => {
  1454. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  1455. const sortedIcons = sortIcons(cleanedIcons);
  1456. if (!sortedIcons.pending.length) {
  1457. let callCallback = true;
  1458. if (callback) {
  1459. setTimeout(() => {
  1460. if (callCallback) {
  1461. callback(
  1462. sortedIcons.loaded,
  1463. sortedIcons.missing,
  1464. sortedIcons.pending,
  1465. emptyCallback
  1466. );
  1467. }
  1468. });
  1469. }
  1470. return () => {
  1471. callCallback = false;
  1472. };
  1473. }
  1474. const newIcons = /* @__PURE__ */ Object.create(null);
  1475. const sources = [];
  1476. let lastProvider, lastPrefix;
  1477. sortedIcons.pending.forEach((icon) => {
  1478. const { provider, prefix } = icon;
  1479. if (prefix === lastPrefix && provider === lastProvider) {
  1480. return;
  1481. }
  1482. lastProvider = provider;
  1483. lastPrefix = prefix;
  1484. sources.push(getStorage(provider, prefix));
  1485. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  1486. if (!providerNewIcons[prefix]) {
  1487. providerNewIcons[prefix] = [];
  1488. }
  1489. });
  1490. sortedIcons.pending.forEach((icon) => {
  1491. const { provider, prefix, name } = icon;
  1492. const storage2 = getStorage(provider, prefix);
  1493. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  1494. if (!pendingQueue.has(name)) {
  1495. pendingQueue.add(name);
  1496. newIcons[provider][prefix].push(name);
  1497. }
  1498. });
  1499. sources.forEach((storage2) => {
  1500. const { provider, prefix } = storage2;
  1501. if (newIcons[provider][prefix].length) {
  1502. loadNewIcons(storage2, newIcons[provider][prefix]);
  1503. }
  1504. });
  1505. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  1506. };
  1507. function mergeCustomisations(defaults, item) {
  1508. const result = {
  1509. ...defaults
  1510. };
  1511. for (const key in item) {
  1512. const value = item[key];
  1513. const valueType = typeof value;
  1514. if (key in defaultIconSizeCustomisations) {
  1515. if (value === null || value && (valueType === "string" || valueType === "number")) {
  1516. result[key] = value;
  1517. }
  1518. } else if (valueType === typeof result[key]) {
  1519. result[key] = key === "rotate" ? value % 4 : value;
  1520. }
  1521. }
  1522. return result;
  1523. }
  1524. const separator = /[\s,]+/;
  1525. function flipFromString(custom, flip) {
  1526. flip.split(separator).forEach((str) => {
  1527. const value = str.trim();
  1528. switch (value) {
  1529. case "horizontal":
  1530. custom.hFlip = true;
  1531. break;
  1532. case "vertical":
  1533. custom.vFlip = true;
  1534. break;
  1535. }
  1536. });
  1537. }
  1538. function rotateFromString(value, defaultValue = 0) {
  1539. const units = value.replace(/^-?[0-9.]*/, "");
  1540. function cleanup(value2) {
  1541. while (value2 < 0) {
  1542. value2 += 4;
  1543. }
  1544. return value2 % 4;
  1545. }
  1546. if (units === "") {
  1547. const num = parseInt(value);
  1548. return isNaN(num) ? 0 : cleanup(num);
  1549. } else if (units !== value) {
  1550. let split = 0;
  1551. switch (units) {
  1552. case "%":
  1553. split = 25;
  1554. break;
  1555. case "deg":
  1556. split = 90;
  1557. }
  1558. if (split) {
  1559. let num = parseFloat(value.slice(0, value.length - units.length));
  1560. if (isNaN(num)) {
  1561. return 0;
  1562. }
  1563. num = num / split;
  1564. return num % 1 === 0 ? cleanup(num) : 0;
  1565. }
  1566. }
  1567. return defaultValue;
  1568. }
  1569. function iconToHTML(body, attributes) {
  1570. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  1571. for (const attr in attributes) {
  1572. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  1573. }
  1574. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  1575. }
  1576. function encodeSVGforURL(svg) {
  1577. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  1578. }
  1579. function svgToData(svg) {
  1580. return "data:image/svg+xml," + encodeSVGforURL(svg);
  1581. }
  1582. function svgToURL(svg) {
  1583. return 'url("' + svgToData(svg) + '")';
  1584. }
  1585. const defaultExtendedIconCustomisations = {
  1586. ...defaultIconCustomisations,
  1587. inline: false
  1588. };
  1589. const svgDefaults = {
  1590. "xmlns": "http://www.w3.org/2000/svg",
  1591. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  1592. "aria-hidden": true,
  1593. "role": "img"
  1594. };
  1595. const commonProps = {
  1596. display: "inline-block"
  1597. };
  1598. const monotoneProps = {
  1599. backgroundColor: "currentColor"
  1600. };
  1601. const coloredProps = {
  1602. backgroundColor: "transparent"
  1603. };
  1604. const propsToAdd = {
  1605. Image: "var(--svg)",
  1606. Repeat: "no-repeat",
  1607. Size: "100% 100%"
  1608. };
  1609. const propsToAddTo = {
  1610. webkitMask: monotoneProps,
  1611. mask: monotoneProps,
  1612. background: coloredProps
  1613. };
  1614. for (const prefix in propsToAddTo) {
  1615. const list = propsToAddTo[prefix];
  1616. for (const prop in propsToAdd) {
  1617. list[prefix + prop] = propsToAdd[prop];
  1618. }
  1619. }
  1620. const customisationAliases = {};
  1621. ["horizontal", "vertical"].forEach((prefix) => {
  1622. const attr = prefix.slice(0, 1) + "Flip";
  1623. customisationAliases[prefix + "-flip"] = attr;
  1624. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  1625. customisationAliases[prefix + "Flip"] = attr;
  1626. });
  1627. function fixSize(value) {
  1628. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  1629. }
  1630. const render = (icon, props) => {
  1631. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  1632. const componentProps = { ...svgDefaults };
  1633. const mode = props.mode || "svg";
  1634. const style = {};
  1635. const propsStyle = props.style;
  1636. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  1637. for (let key in props) {
  1638. const value = props[key];
  1639. if (value === void 0) {
  1640. continue;
  1641. }
  1642. switch (key) {
  1643. case "icon":
  1644. case "style":
  1645. case "onLoad":
  1646. case "mode":
  1647. break;
  1648. case "inline":
  1649. case "hFlip":
  1650. case "vFlip":
  1651. customisations[key] = value === true || value === "true" || value === 1;
  1652. break;
  1653. case "flip":
  1654. if (typeof value === "string") {
  1655. flipFromString(customisations, value);
  1656. }
  1657. break;
  1658. case "color":
  1659. style.color = value;
  1660. break;
  1661. case "rotate":
  1662. if (typeof value === "string") {
  1663. customisations[key] = rotateFromString(value);
  1664. } else if (typeof value === "number") {
  1665. customisations[key] = value;
  1666. }
  1667. break;
  1668. case "ariaHidden":
  1669. case "aria-hidden":
  1670. if (value !== true && value !== "true") {
  1671. delete componentProps["aria-hidden"];
  1672. }
  1673. break;
  1674. default: {
  1675. const alias = customisationAliases[key];
  1676. if (alias) {
  1677. if (value === true || value === "true" || value === 1) {
  1678. customisations[alias] = true;
  1679. }
  1680. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  1681. componentProps[key] = value;
  1682. }
  1683. }
  1684. }
  1685. }
  1686. const item = iconToSVG(icon, customisations);
  1687. const renderAttribs = item.attributes;
  1688. if (customisations.inline) {
  1689. style.verticalAlign = "-0.125em";
  1690. }
  1691. if (mode === "svg") {
  1692. componentProps.style = {
  1693. ...style,
  1694. ...customStyle
  1695. };
  1696. Object.assign(componentProps, renderAttribs);
  1697. let localCounter = 0;
  1698. let id = props.id;
  1699. if (typeof id === "string") {
  1700. id = id.replace(/-/g, "_");
  1701. }
  1702. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  1703. return vue.h("svg", componentProps);
  1704. }
  1705. const { body, width, height } = icon;
  1706. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  1707. const html = iconToHTML(body, {
  1708. ...renderAttribs,
  1709. width: width + "",
  1710. height: height + ""
  1711. });
  1712. componentProps.style = {
  1713. ...style,
  1714. "--svg": svgToURL(html),
  1715. "width": fixSize(renderAttribs.width),
  1716. "height": fixSize(renderAttribs.height),
  1717. ...commonProps,
  1718. ...useMask ? monotoneProps : coloredProps,
  1719. ...customStyle
  1720. };
  1721. return vue.h("span", componentProps);
  1722. };
  1723. allowSimpleNames(true);
  1724. setAPIModule("", fetchAPIModule);
  1725. if (typeof document !== "undefined" && typeof window !== "undefined") {
  1726. initBrowserStorage();
  1727. const _window2 = window;
  1728. if (_window2.IconifyPreload !== void 0) {
  1729. const preload = _window2.IconifyPreload;
  1730. const err = "Invalid IconifyPreload syntax.";
  1731. if (typeof preload === "object" && preload !== null) {
  1732. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  1733. try {
  1734. if (
  1735. // Check if item is an object and not null/array
  1736. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  1737. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  1738. !addCollection(item)
  1739. ) {
  1740. console.error(err);
  1741. }
  1742. } catch (e2) {
  1743. console.error(err);
  1744. }
  1745. });
  1746. }
  1747. }
  1748. if (_window2.IconifyProviders !== void 0) {
  1749. const providers = _window2.IconifyProviders;
  1750. if (typeof providers === "object" && providers !== null) {
  1751. for (let key in providers) {
  1752. const err = "IconifyProviders[" + key + "] is invalid.";
  1753. try {
  1754. const value = providers[key];
  1755. if (typeof value !== "object" || !value || value.resources === void 0) {
  1756. continue;
  1757. }
  1758. if (!addAPIProvider(key, value)) {
  1759. console.error(err);
  1760. }
  1761. } catch (e2) {
  1762. console.error(err);
  1763. }
  1764. }
  1765. }
  1766. }
  1767. }
  1768. const emptyIcon = {
  1769. ...defaultIconProps,
  1770. body: ""
  1771. };
  1772. const Icon = vue.defineComponent({
  1773. // Do not inherit other attributes: it is handled by render()
  1774. inheritAttrs: false,
  1775. // Set initial data
  1776. data() {
  1777. return {
  1778. // Mounted status
  1779. iconMounted: false,
  1780. // Callback counter to trigger re-render
  1781. counter: 0
  1782. };
  1783. },
  1784. mounted() {
  1785. this._name = "";
  1786. this._loadingIcon = null;
  1787. this.iconMounted = true;
  1788. },
  1789. unmounted() {
  1790. this.abortLoading();
  1791. },
  1792. methods: {
  1793. abortLoading() {
  1794. if (this._loadingIcon) {
  1795. this._loadingIcon.abort();
  1796. this._loadingIcon = null;
  1797. }
  1798. },
  1799. // Get data for icon to render or null
  1800. getIcon(icon, onload) {
  1801. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  1802. this._name = "";
  1803. this.abortLoading();
  1804. return {
  1805. data: icon
  1806. };
  1807. }
  1808. let iconName;
  1809. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  1810. this.abortLoading();
  1811. return null;
  1812. }
  1813. const data = getIconData(iconName);
  1814. if (!data) {
  1815. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  1816. this.abortLoading();
  1817. this._name = "";
  1818. if (data !== null) {
  1819. this._loadingIcon = {
  1820. name: icon,
  1821. abort: loadIcons([iconName], () => {
  1822. this.counter++;
  1823. })
  1824. };
  1825. }
  1826. }
  1827. return null;
  1828. }
  1829. this.abortLoading();
  1830. if (this._name !== icon) {
  1831. this._name = icon;
  1832. if (onload) {
  1833. onload(icon);
  1834. }
  1835. }
  1836. const classes = ["iconify"];
  1837. if (iconName.prefix !== "") {
  1838. classes.push("iconify--" + iconName.prefix);
  1839. }
  1840. if (iconName.provider !== "") {
  1841. classes.push("iconify--" + iconName.provider);
  1842. }
  1843. return { data, classes };
  1844. }
  1845. },
  1846. // Render icon
  1847. render() {
  1848. this.counter;
  1849. const props = this.$attrs;
  1850. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  1851. if (!icon) {
  1852. return render(emptyIcon, props);
  1853. }
  1854. let newProps = props;
  1855. if (icon.classes) {
  1856. newProps = {
  1857. ...props,
  1858. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  1859. };
  1860. }
  1861. return render({
  1862. ...defaultIconProps,
  1863. ...icon.data
  1864. }, newProps);
  1865. }
  1866. });
  1867. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  1868. __name: "BackIcon",
  1869. setup(__props) {
  1870. return (_ctx, _cache) => {
  1871. return vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  1872. class: "back-icon",
  1873. icon: "octicon:arrow-left-24",
  1874. width: "22"
  1875. });
  1876. };
  1877. }
  1878. });
  1879. const _hoisted_1$n = { class: "nav-bar" };
  1880. const _hoisted_2$j = {
  1881. key: 0,
  1882. class: "title"
  1883. };
  1884. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  1885. __name: "NavBar",
  1886. props: {
  1887. title: {}
  1888. },
  1889. emits: ["back"],
  1890. setup(__props, { emit: __emit }) {
  1891. const emit = __emit;
  1892. return (_ctx, _cache) => {
  1893. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
  1894. vue.createVNode(_sfc_main$p, {
  1895. onClick: _cache[0] || (_cache[0] = ($event) => emit("back"))
  1896. }),
  1897. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, vue.toDisplayString(_ctx.title), 1)) : vue.createCommentVNode("", true)
  1898. ]);
  1899. };
  1900. }
  1901. });
  1902. const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-fda0acaa"]]);
  1903. const _hoisted_1$m = { class: "display-type" };
  1904. const _hoisted_2$i = { style: { "position": "relative" } };
  1905. const _hoisted_3$f = {
  1906. key: 0,
  1907. class: "type-list"
  1908. };
  1909. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  1910. __name: "BaseSelect",
  1911. props: {
  1912. displayType: {}
  1913. },
  1914. emits: ["update:displayType"],
  1915. setup(__props, { emit: __emit }) {
  1916. const props = __props;
  1917. const emit = __emit;
  1918. let state = vue.reactive({
  1919. showChangeDisplayType: false,
  1920. lastDisplayType: null
  1921. });
  1922. function changeOption(item) {
  1923. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1924. state.lastDisplayType = props.displayType;
  1925. }
  1926. emit("update:displayType", item);
  1927. state.showChangeDisplayType = false;
  1928. }
  1929. function clickDisplayType() {
  1930. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1931. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  1932. }
  1933. state.showChangeDisplayType = !state.showChangeDisplayType;
  1934. }
  1935. const currentDisplayType = vue.computed(() => {
  1936. let judge = props.displayType;
  1937. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1938. judge = state.lastDisplayType;
  1939. }
  1940. switch (judge) {
  1941. case CommentDisplayType.FloorInFloorNoCallUser:
  1942. return "楼中楼";
  1943. case CommentDisplayType.FloorInFloor:
  1944. return "楼中楼(@)";
  1945. case CommentDisplayType.FloorInFloorNested:
  1946. return "冗余楼中楼";
  1947. case CommentDisplayType.V2exOrigin:
  1948. return "V2原版";
  1949. case CommentDisplayType.OnlyOp:
  1950. return "只看楼主";
  1951. default:
  1952. return "楼中楼";
  1953. }
  1954. });
  1955. return (_ctx, _cache) => {
  1956. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
  1957. vue.createElementVNode("div", {
  1958. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  1959. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  1960. }, "最热 ", 2),
  1961. vue.createElementVNode("div", _hoisted_2$i, [
  1962. vue.createElementVNode("div", {
  1963. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  1964. onClick: clickDisplayType
  1965. }, [
  1966. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  1967. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  1968. ], 2),
  1969. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$f, [
  1970. vue.createElementVNode("div", {
  1971. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  1972. onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  1973. }, "楼中楼 ", 2),
  1974. vue.createElementVNode("div", {
  1975. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  1976. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  1977. }, "楼中楼(@) ", 2),
  1978. vue.createElementVNode("div", {
  1979. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  1980. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  1981. }, "冗余楼中楼 ", 2),
  1982. vue.createElementVNode("div", {
  1983. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  1984. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  1985. }, "只看楼主 ", 2),
  1986. vue.createElementVNode("div", {
  1987. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  1988. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  1989. }, "V2原版 ", 2)
  1990. ])) : vue.createCommentVNode("", true)
  1991. ])
  1992. ]);
  1993. };
  1994. }
  1995. });
  1996. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-1d327f48"]]);
  1997. const eventBus = {
  1998. eventMap: /* @__PURE__ */ new Map(),
  1999. on(eventType, cb) {
  2000. let cbs = this.eventMap.get(eventType);
  2001. if (cbs) {
  2002. cbs.push(cb);
  2003. } else {
  2004. cbs = [cb];
  2005. }
  2006. this.eventMap.set(eventType, cbs);
  2007. },
  2008. emit(eventType, val) {
  2009. let cbs = this.eventMap.get(eventType);
  2010. if (cbs) {
  2011. cbs.map((cb) => cb(val));
  2012. }
  2013. },
  2014. off(eventType) {
  2015. let cbs = this.eventMap.has(eventType);
  2016. if (cbs) {
  2017. this.eventMap.delete(eventType);
  2018. }
  2019. },
  2020. clear() {
  2021. this.eventMap = /* @__PURE__ */ new Map();
  2022. }
  2023. };
  2024. const CMD = {
  2025. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  2026. SHOW_MSG: "SHOW_MSG",
  2027. SET_CALL: "SET_CALL",
  2028. SHOW_CALL: "SHOW_CALL",
  2029. REFRESH_ONCE: "REFRESH_ONCE",
  2030. ADD_REPLY: "ADD_REPLY",
  2031. IGNORE: "IGNORE",
  2032. MERGE: "MERGE",
  2033. MERGE_CONFIG: "MERGE_CONFIG",
  2034. REMOVE: "REMOVE",
  2035. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  2036. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  2037. ADD_TAG: "ADD_TAG",
  2038. REMOVE_TAG: "REMOVE_TAG",
  2039. RELATION_REPLY: "RELATION_REPLY",
  2040. JUMP: "JUMP",
  2041. ADD_READ: "ADD_READ",
  2042. REFRESH_POST: "REFRESH_POST",
  2043. SHOW_COMMENT_OPTIONS: "SHOW_COMMENT_OPTIONS",
  2044. SHOW_EDITOR: "COMMENT_REPLY"
  2045. };
  2046. const _withScopeId$e = (n2) => (vue.pushScopeId("data-v-a64ba8b8"), n2 = n2(), vue.popScopeId(), n2);
  2047. const _hoisted_1$l = { class: "font-size" };
  2048. const _hoisted_2$h = { class: "steps" };
  2049. const _hoisted_3$e = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2050. class: "text",
  2051. style: { "font-size": "1.2rem" }
  2052. }, "小", -1));
  2053. const _hoisted_4$d = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2054. const _hoisted_5$b = [
  2055. _hoisted_3$e,
  2056. _hoisted_4$d
  2057. ];
  2058. const _hoisted_6$a = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "text" }, "标准", -1));
  2059. const _hoisted_7$9 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2060. const _hoisted_8$9 = [
  2061. _hoisted_6$a,
  2062. _hoisted_7$9
  2063. ];
  2064. const _hoisted_9$9 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2065. class: "text",
  2066. style: { "font-size": "1.8rem" }
  2067. }, "大", -1));
  2068. const _hoisted_10$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2069. const _hoisted_11$8 = [
  2070. _hoisted_9$9,
  2071. _hoisted_10$8
  2072. ];
  2073. const _hoisted_12$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2074. class: "text",
  2075. style: { "font-size": "2.2rem" }
  2076. }, "特大", -1));
  2077. const _hoisted_13$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2078. const _hoisted_14$7 = [
  2079. _hoisted_12$8,
  2080. _hoisted_13$8
  2081. ];
  2082. const _hoisted_15$7 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "line" }, null, -1));
  2083. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  2084. __name: "FontSizeType",
  2085. setup(__props) {
  2086. const config2 = vue.inject("config");
  2087. return (_ctx, _cache) => {
  2088. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
  2089. vue.createElementVNode("div", _hoisted_2$h, [
  2090. vue.createElementVNode("div", {
  2091. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "small" && "active"]]),
  2092. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "small" }))
  2093. }, _hoisted_5$b, 2),
  2094. vue.createElementVNode("div", {
  2095. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "normal" && "active"]]),
  2096. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "normal" }))
  2097. }, _hoisted_8$9, 2),
  2098. vue.createElementVNode("div", {
  2099. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "large" && "active"]]),
  2100. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "large" }))
  2101. }, _hoisted_11$8, 2),
  2102. vue.createElementVNode("div", {
  2103. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "big-large" && "active"]]),
  2104. onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "big-large" }))
  2105. }, _hoisted_14$7, 2)
  2106. ]),
  2107. _hoisted_15$7
  2108. ]);
  2109. };
  2110. }
  2111. });
  2112. const FontSizeType = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-a64ba8b8"]]);
  2113. var _GM_notification = /* @__PURE__ */ (() => typeof GM_notification != "undefined" ? GM_notification : void 0)();
  2114. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  2115. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  2116. const functions = {
  2117. //获取所有回复
  2118. getAllReply(repliesMap = []) {
  2119. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  2120. pre = pre.concat(i.replyList);
  2121. return pre;
  2122. }, []);
  2123. },
  2124. //查找子回复
  2125. findChildren(item, endList, all) {
  2126. var _a;
  2127. const fn = (child, endList2, parent) => {
  2128. child.level = parent.level + 1;
  2129. let rIndex = all.findIndex((v) => v.floor === child.floor);
  2130. if (rIndex > -1) {
  2131. all[rIndex].isUse = true;
  2132. }
  2133. parent.children.push(this.findChildren(child, endList2, all));
  2134. };
  2135. item.children = [];
  2136. let floorReplyList = [];
  2137. for (let i = 0; i < endList.length; i++) {
  2138. let currentItem = endList[i];
  2139. if (currentItem.isUse)
  2140. continue;
  2141. if (currentItem.replyFloor === item.floor) {
  2142. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  2143. currentItem.isUse = true;
  2144. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  2145. } else {
  2146. currentItem.isWrong = true;
  2147. }
  2148. }
  2149. }
  2150. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  2151. fn(currentItem, endList2, item);
  2152. });
  2153. let nextMeIndex = endList.findIndex((v) => {
  2154. var _a2;
  2155. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  2156. });
  2157. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  2158. for (let i = 0; i < findList.length; i++) {
  2159. let currentItem = findList[i];
  2160. if (currentItem.isUse)
  2161. continue;
  2162. if (currentItem.replyUsers.length === 1) {
  2163. if (currentItem.replyFloor !== -1) {
  2164. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  2165. continue;
  2166. }
  2167. }
  2168. let endList2 = endList.slice(i + 1);
  2169. if (currentItem.username === item.username) {
  2170. if (currentItem.replyUsers[0] === item.username) {
  2171. fn(currentItem, endList2, item);
  2172. }
  2173. break;
  2174. } else {
  2175. if (currentItem.replyUsers[0] === item.username) {
  2176. fn(currentItem, endList2, item);
  2177. }
  2178. }
  2179. } else {
  2180. if (currentItem.username === item.username)
  2181. break;
  2182. }
  2183. }
  2184. item.children = item.children.sort((a, b) => a.floor - b.floor);
  2185. return item;
  2186. },
  2187. //生成嵌套回复
  2188. createNestedList(allList = []) {
  2189. if (!allList.length)
  2190. return [];
  2191. let list = window.clone(allList);
  2192. let nestedList = [];
  2193. list.map((item, index) => {
  2194. let startList = list.slice(0, index);
  2195. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  2196. let endList = list.slice(index + 1);
  2197. if (index === 0) {
  2198. nestedList.push(this.findChildren(item, endList, list));
  2199. } else {
  2200. if (!item.isUse) {
  2201. let isOneLevelReply = false;
  2202. if (item.replyUsers.length) {
  2203. if (item.replyUsers.length > 1) {
  2204. isOneLevelReply = true;
  2205. } else {
  2206. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  2207. }
  2208. } else {
  2209. isOneLevelReply = true;
  2210. }
  2211. if (isOneLevelReply) {
  2212. item.level = 0;
  2213. nestedList.push(this.findChildren(item, endList, list));
  2214. }
  2215. }
  2216. }
  2217. });
  2218. return nestedList;
  2219. },
  2220. //生成嵌套冗余回复
  2221. createNestedRedundantList(allList = []) {
  2222. if (!allList.length)
  2223. return [];
  2224. let list = window.clone(allList);
  2225. let nestedList = [];
  2226. list.map((item, index) => {
  2227. let startList = list.slice(0, index);
  2228. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  2229. let endList = list.slice(index + 1);
  2230. if (index === 0) {
  2231. nestedList.push(this.findChildren(item, endList, list));
  2232. } else {
  2233. if (!item.isUse) {
  2234. let isOneLevelReply = false;
  2235. if (item.replyUsers.length) {
  2236. if (item.replyUsers.length > 1) {
  2237. isOneLevelReply = true;
  2238. } else {
  2239. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  2240. }
  2241. } else {
  2242. isOneLevelReply = true;
  2243. }
  2244. if (isOneLevelReply) {
  2245. item.level = 0;
  2246. nestedList.push(this.findChildren(item, endList, list));
  2247. }
  2248. } else {
  2249. let newItem = window.clone(item);
  2250. newItem.children = [];
  2251. newItem.level = 0;
  2252. newItem.isDup = true;
  2253. nestedList.push(newItem);
  2254. }
  2255. }
  2256. });
  2257. return nestedList;
  2258. },
  2259. //解析A标签
  2260. parseA(a) {
  2261. let href = a.href;
  2262. let id;
  2263. if (href.includes("/t/")) {
  2264. id = a.pathname.substring("/t/".length);
  2265. }
  2266. return { href, id, title: a.innerText };
  2267. },
  2268. //图片链接转Img标签
  2269. checkPhotoLink2Img(str) {
  2270. if (!str)
  2271. return;
  2272. try {
  2273. let imgWebs = [
  2274. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  2275. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  2276. ];
  2277. imgWebs.map((v, i) => {
  2278. let has = str.matchAll(v);
  2279. let res2 = [...has];
  2280. res2.map((r2) => {
  2281. let p = i === 0 ? r2[4] : r2[5];
  2282. if (p) {
  2283. let link = p.toLowerCase();
  2284. let src = p;
  2285. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  2286. } else {
  2287. src = p + ".png";
  2288. }
  2289. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  2290. }
  2291. });
  2292. });
  2293. } catch (e2) {
  2294. console.log("正则解析html里面的a标签的图片链接出错了");
  2295. }
  2296. return str;
  2297. },
  2298. //检测帖子回复长度
  2299. async checkPostReplies(id, needOpen = true) {
  2300. return new Promise(async (resolve) => {
  2301. let res = await functions.getPostDetailByApi(id);
  2302. if ((res == null ? void 0 : res.replies) > MAX_REPLY_LIMIT) {
  2303. if (needOpen) {
  2304. functions.openNewTab(`https://${location.origin}/t/${id}?p=1&script=1`);
  2305. }
  2306. return resolve(true);
  2307. }
  2308. resolve(false);
  2309. });
  2310. },
  2311. async sleep(time) {
  2312. return new Promise((resolve) => {
  2313. setTimeout(resolve, time);
  2314. });
  2315. },
  2316. //打开新标签页
  2317. openNewTab(href, active = false) {
  2318. _GM_openInTab(href, { active });
  2319. },
  2320. async cbChecker(val, count = 0) {
  2321. if (window.cb) {
  2322. window.cb(val);
  2323. } else {
  2324. while (!window.cb && count < 30) {
  2325. await functions.sleep(500);
  2326. count++;
  2327. }
  2328. window.cb && window.cb(val);
  2329. }
  2330. },
  2331. //初始化脚本菜单
  2332. initMonkeyMenu() {
  2333. try {
  2334. _GM_registerMenuCommand("脚本设置", () => {
  2335. functions.cbChecker({ type: "openSetting" });
  2336. });
  2337. _GM_registerMenuCommand("仓库地址", () => {
  2338. functions.openNewTab(window.const.git);
  2339. });
  2340. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  2341. } catch (e2) {
  2342. console.error("无法使用Tampermonkey");
  2343. }
  2344. },
  2345. clone(val) {
  2346. return JSON.parse(JSON.stringify(val));
  2347. },
  2348. feedback() {
  2349. functions.openNewTab(DefaultVal.issue);
  2350. },
  2351. //检测页面类型
  2352. checkPageType(a) {
  2353. let l = a || window.location;
  2354. let data = { pageType: null, pageData: { id: "", pageNo: null }, username: "" };
  2355. if (l.pathname === "/") {
  2356. data.pageType = PageType.Home;
  2357. } else if (l.pathname === "/changes") {
  2358. data.pageType = PageType.Changes;
  2359. } else if (l.pathname === "/recent") {
  2360. data.pageType = PageType.Changes;
  2361. } else if (l.href.match(/.com\/?tab=/)) {
  2362. data.pageType = PageType.Home;
  2363. } else if (l.href.match(/.com\/go\//)) {
  2364. if (!l.href.includes("/links")) {
  2365. data.pageType = PageType.Node;
  2366. }
  2367. } else if (l.href.match(/.com\/member/)) {
  2368. data.pageType = PageType.Member;
  2369. data.username = l.pathname.replace("/member/", "").replace("/replies", "");
  2370. } else {
  2371. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  2372. if (r2 && !l.pathname.includes("review") && !l.pathname.includes("info")) {
  2373. data.pageType = PageType.Post;
  2374. data.pageData.id = r2[1];
  2375. if (l.search) {
  2376. let pr = l.href.match(/\?p=([\d]+)/);
  2377. if (pr)
  2378. data.pageData.pageNo = Number(pr[1]);
  2379. }
  2380. }
  2381. }
  2382. return data;
  2383. },
  2384. //通过api获取主题详情
  2385. getPostDetailByApi(id) {
  2386. return new Promise((resolve) => {
  2387. fetch(`${location.origin}/api/topics/show.json?id=${id}`).then(async (r2) => {
  2388. if (r2.status === 200) {
  2389. let res = await r2.json();
  2390. if (res) {
  2391. let d2 = res[0];
  2392. resolve(d2);
  2393. }
  2394. }
  2395. });
  2396. });
  2397. },
  2398. appendPostContent(res, el) {
  2399. let a = document.createElement("a");
  2400. a.href = res.href;
  2401. a.classList.add("post-content");
  2402. let div = document.createElement("div");
  2403. div.innerHTML = res.content_rendered;
  2404. a.append(div);
  2405. el.append(a);
  2406. const checkHeight2 = () => {
  2407. var _a;
  2408. if (div.clientHeight < 300) {
  2409. a.classList.add("show-all");
  2410. } else {
  2411. let showMore = document.createElement("div");
  2412. showMore.classList.add("show-more");
  2413. showMore.innerHTML = "显示更多/收起";
  2414. showMore.onclick = function(e2) {
  2415. e2.stopPropagation();
  2416. a.classList.toggle("show-all");
  2417. };
  2418. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  2419. }
  2420. };
  2421. checkHeight2();
  2422. },
  2423. //从本地读取配置
  2424. initConfig() {
  2425. return new Promise((resolve) => {
  2426. let configStr = localStorage.getItem("v2ex-config");
  2427. if (configStr) {
  2428. let configObj = JSON.parse(configStr);
  2429. configObj = configObj[window.user.username ?? "default"];
  2430. if (configObj) {
  2431. window.config = Object.assign(window.config, configObj);
  2432. }
  2433. }
  2434. resolve(window.config);
  2435. });
  2436. }
  2437. };
  2438. const DefaultPost = {
  2439. allReplyUsers: [],
  2440. content_rendered: "",
  2441. createDate: "",
  2442. createDateAgo: "",
  2443. lastReplyDate: "",
  2444. fr: "",
  2445. replyList: [],
  2446. nestedReplies: [],
  2447. nestedRedundReplies: [],
  2448. username: "",
  2449. url: "",
  2450. href: "",
  2451. member: {},
  2452. node: {
  2453. title: "",
  2454. url: ""
  2455. },
  2456. headerTemplate: "",
  2457. title: "",
  2458. id: "",
  2459. type: "post",
  2460. once: "",
  2461. replyCount: 0,
  2462. clickCount: 0,
  2463. thankCount: 0,
  2464. collectCount: 0,
  2465. lastReadFloor: 0,
  2466. isFavorite: false,
  2467. isIgnore: false,
  2468. isThanked: false,
  2469. isReport: false,
  2470. inList: false
  2471. };
  2472. const DefaultUser = {
  2473. tagPrefix: "--用户标签--",
  2474. tags: {},
  2475. tagsId: "",
  2476. username: "",
  2477. avatar: "",
  2478. readPrefix: "--已读楼层--",
  2479. readNoteItemId: "",
  2480. readList: {},
  2481. imgurPrefix: "--imgur图片删除hash--",
  2482. imgurList: {},
  2483. imgurNoteId: "",
  2484. configPrefix: "--config--",
  2485. configNoteId: ""
  2486. };
  2487. const DefaultVal = {
  2488. pageType: void 0,
  2489. pageData: { pageNo: 1 },
  2490. targetUserName: "",
  2491. currentVersion: 1,
  2492. isNight: false,
  2493. cb: null,
  2494. stopMe: null,
  2495. postList: [],
  2496. git: "https://github.com/zyronon/web-scripts",
  2497. shortGit: "zyronon/web-scripts",
  2498. issue: "https://github.com/zyronon/web-scripts/issues",
  2499. pcLog: "https://greasyfork.org/zh-CN/scripts/458024/versions",
  2500. pcScript: "https://greasyfork.org/zh-CN/scripts/458024",
  2501. mobileScript: "https://greasyfork.org/zh-CN/scripts/485356",
  2502. homeUrl: "https://v2next.netlify.app/"
  2503. };
  2504. const DefaultConfig = {
  2505. showToolbar: true,
  2506. autoOpenDetail: true,
  2507. openTag: false,
  2508. //给用户打标签
  2509. clickPostItemOpenDetail: true,
  2510. closePostDetailBySpace: true,
  2511. //点击空白处关闭详情
  2512. contentAutoCollapse: true,
  2513. //正文超长自动折叠
  2514. viewType: "table",
  2515. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  2516. newTabOpen: false,
  2517. //新标签打开
  2518. newTabOpenActive: false,
  2519. base64: true,
  2520. //base功能
  2521. sov2ex: false,
  2522. postWidth: "",
  2523. showTopReply: true,
  2524. topReplyLoveMinCount: 3,
  2525. topReplyCount: 3,
  2526. autoJumpLastReadFloor: false,
  2527. rememberLastReadFloor: false,
  2528. autoSignin: true,
  2529. customBgColor: "",
  2530. version: DefaultVal.currentVersion,
  2531. collectBrowserNotice: false,
  2532. fontSizeType: "normal"
  2533. };
  2534. const _sfc_main$l = {
  2535. name: "Setting",
  2536. components: {
  2537. FontSizeType,
  2538. BaseSelect,
  2539. NavBar,
  2540. BaseSwitch,
  2541. Tooltip,
  2542. Icon
  2543. },
  2544. emits: ["back"],
  2545. props: {
  2546. modelValue: {
  2547. type: Object,
  2548. default() {
  2549. return {};
  2550. }
  2551. },
  2552. show: {
  2553. type: Boolean,
  2554. default() {
  2555. return false;
  2556. }
  2557. },
  2558. to: {
  2559. type: String,
  2560. default() {
  2561. return "";
  2562. }
  2563. }
  2564. },
  2565. data() {
  2566. return {
  2567. activeEruda: !!localStorage.getItem("active-eruda"),
  2568. config: window.clone(this.modelValue)
  2569. };
  2570. },
  2571. computed: {
  2572. DefaultVal() {
  2573. return DefaultVal;
  2574. },
  2575. functions() {
  2576. return functions;
  2577. },
  2578. CommentDisplayType() {
  2579. return CommentDisplayType;
  2580. },
  2581. isNew() {
  2582. return this.config.version < window.currentVersion;
  2583. }
  2584. },
  2585. watch: {
  2586. config: {
  2587. handler(n2) {
  2588. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  2589. if (n2.topReplyLoveMinCount < 0) {
  2590. n2.topReplyLoveMinCount = 1;
  2591. }
  2592. this.$emit("update:modelValue", n2);
  2593. },
  2594. deep: true
  2595. },
  2596. activeEruda(n2) {
  2597. if (n2) {
  2598. localStorage.setItem("active-eruda", 1);
  2599. } else {
  2600. localStorage.setItem("active-eruda", "");
  2601. }
  2602. }
  2603. }
  2604. };
  2605. const _withScopeId$d = (n2) => (vue.pushScopeId("data-v-424a2b09"), n2 = n2(), vue.popScopeId(), n2);
  2606. const _hoisted_1$k = { class: "mobile-page" };
  2607. const _hoisted_2$g = { class: "page-content" };
  2608. const _hoisted_3$d = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2609. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "关于脚本")
  2610. ], -1));
  2611. const _hoisted_4$c = { class: "row" };
  2612. const _hoisted_5$a = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "GitHub", -1));
  2613. const _hoisted_6$9 = { class: "wrapper" };
  2614. const _hoisted_7$8 = ["href"];
  2615. const _hoisted_8$8 = { class: "row" };
  2616. const _hoisted_9$8 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "反馈 & 建议", -1));
  2617. const _hoisted_10$7 = { class: "wrapper" };
  2618. const _hoisted_11$7 = ["href"];
  2619. const _hoisted_12$7 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2620. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "列表设置")
  2621. ], -1));
  2622. const _hoisted_13$7 = { class: "row" };
  2623. const _hoisted_14$6 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  2624. const _hoisted_15$6 = { class: "wrapper" };
  2625. const _hoisted_16$6 = { class: "radio-group2" };
  2626. const _hoisted_17$3 = { class: "row" };
  2627. const _hoisted_18$3 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子弹框显示", -1));
  2628. const _hoisted_19$3 = { class: "wrapper" };
  2629. const _hoisted_20$3 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此选项后,帖子始终会以弹框的方式显示。优先级大于“新标签页打开链接” ", -1));
  2630. const _hoisted_21$2 = { class: "row" };
  2631. const _hoisted_22$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  2632. const _hoisted_23$2 = { class: "wrapper" };
  2633. const _hoisted_24$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  2634. const _hoisted_25$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2635. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "主题设置")
  2636. ], -1));
  2637. const _hoisted_26$1 = { class: "row" };
  2638. const _hoisted_27$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  2639. const _hoisted_28$1 = { class: "wrapper" };
  2640. const _hoisted_29$1 = { class: "row" };
  2641. const _hoisted_30$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  2642. const _hoisted_31$1 = { class: "wrapper" };
  2643. const _hoisted_32$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2644. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  2645. ], -1));
  2646. const _hoisted_33$1 = { class: "row" };
  2647. const _hoisted_34$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  2648. const _hoisted_35$1 = { class: "wrapper" };
  2649. const _hoisted_36$1 = { class: "row" };
  2650. const _hoisted_37$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  2651. const _hoisted_38$1 = { class: "wrapper" };
  2652. const _hoisted_39$1 = { class: "row" };
  2653. const _hoisted_40 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  2654. const _hoisted_41 = { class: "wrapper" };
  2655. const _hoisted_42 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2656. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "记忆阅读")
  2657. ], -1));
  2658. const _hoisted_43 = { class: "row" };
  2659. const _hoisted_44 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "记录上次阅读楼层(误差1层左右):", -1));
  2660. const _hoisted_45 = { class: "wrapper" };
  2661. const _hoisted_46 = { class: "row" };
  2662. const _hoisted_47 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开帖子自动跳转到上次阅读楼层", -1));
  2663. const _hoisted_48 = { class: "wrapper" };
  2664. const _hoisted_49 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2665. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "其他设置")
  2666. ], -1));
  2667. const _hoisted_50 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2668. /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "字体设置")
  2669. ], -1));
  2670. const _hoisted_51 = { class: "row" };
  2671. const _hoisted_52 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  2672. const _hoisted_53 = { class: "wrapper" };
  2673. const _hoisted_54 = { class: "row" };
  2674. const _hoisted_55 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  2675. const _hoisted_56 = { class: "wrapper" };
  2676. const _hoisted_57 = { class: "row" };
  2677. const _hoisted_58 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  2678. const _hoisted_59 = { class: "wrapper" };
  2679. const _hoisted_60 = { class: "row" };
  2680. const _hoisted_61 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  2681. const _hoisted_62 = { class: "wrapper" };
  2682. const _hoisted_63 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录,无法查看账号收藏了 ", -1));
  2683. const _hoisted_64 = { class: "row" };
  2684. const _hoisted_65 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "调试模式", -1));
  2685. const _hoisted_66 = { class: "wrapper" };
  2686. const _hoisted_67 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此项会显示调试控制台,刷新页面生效 ", -1));
  2687. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2688. const _component_NavBar = vue.resolveComponent("NavBar");
  2689. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  2690. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  2691. const _component_font_size_type = vue.resolveComponent("font-size-type");
  2692. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: $props.to }, [
  2693. vue.createElementVNode("div", _hoisted_1$k, [
  2694. vue.createVNode(_component_NavBar, {
  2695. title: "设置",
  2696. onBack: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("back"))
  2697. }),
  2698. vue.createElementVNode("div", _hoisted_2$g, [
  2699. _hoisted_3$d,
  2700. vue.createElementVNode("div", _hoisted_4$c, [
  2701. _hoisted_5$a,
  2702. vue.createElementVNode("div", _hoisted_6$9, [
  2703. vue.createElementVNode("a", {
  2704. href: $options.DefaultVal.git,
  2705. target: "_blank"
  2706. }, vue.toDisplayString($options.DefaultVal.shortGit), 9, _hoisted_7$8)
  2707. ])
  2708. ]),
  2709. vue.createElementVNode("div", _hoisted_8$8, [
  2710. _hoisted_9$8,
  2711. vue.createElementVNode("div", _hoisted_10$7, [
  2712. vue.createElementVNode("a", {
  2713. href: $options.DefaultVal.issue,
  2714. target: "_blank"
  2715. }, "点此填写Issue", 8, _hoisted_11$7)
  2716. ])
  2717. ]),
  2718. _hoisted_12$7,
  2719. vue.createElementVNode("div", _hoisted_13$7, [
  2720. _hoisted_14$6,
  2721. vue.createElementVNode("div", _hoisted_15$6, [
  2722. vue.createElementVNode("div", _hoisted_16$6, [
  2723. vue.createElementVNode("div", {
  2724. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  2725. onClick: _cache[1] || (_cache[1] = ($event) => $data.config.viewType = "table")
  2726. }, "表格 ", 2),
  2727. vue.createElementVNode("div", {
  2728. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  2729. onClick: _cache[2] || (_cache[2] = ($event) => $data.config.viewType = "card")
  2730. }, "卡片 ", 2)
  2731. ])
  2732. ])
  2733. ]),
  2734. vue.createElementVNode("div", _hoisted_17$3, [
  2735. _hoisted_18$3,
  2736. vue.createElementVNode("div", _hoisted_19$3, [
  2737. vue.createVNode(_component_BaseSwitch, {
  2738. modelValue: $data.config.clickPostItemOpenDetail,
  2739. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  2740. }, null, 8, ["modelValue"])
  2741. ])
  2742. ]),
  2743. _hoisted_20$3,
  2744. vue.createElementVNode("div", _hoisted_21$2, [
  2745. _hoisted_22$2,
  2746. vue.createElementVNode("div", _hoisted_23$2, [
  2747. vue.createVNode(_component_BaseSwitch, {
  2748. modelValue: $data.config.newTabOpen,
  2749. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.config.newTabOpen = $event)
  2750. }, null, 8, ["modelValue"])
  2751. ])
  2752. ]),
  2753. _hoisted_24$2,
  2754. _hoisted_25$2,
  2755. vue.createElementVNode("div", _hoisted_26$1, [
  2756. _hoisted_27$1,
  2757. vue.createElementVNode("div", _hoisted_28$1, [
  2758. vue.createVNode(_component_BaseSelect, {
  2759. "display-type": $data.config.commentDisplayType,
  2760. "onUpdate:displayType": _cache[5] || (_cache[5] = ($event) => $data.config.commentDisplayType = $event)
  2761. }, null, 8, ["display-type"])
  2762. ])
  2763. ]),
  2764. vue.createElementVNode("div", _hoisted_29$1, [
  2765. _hoisted_30$1,
  2766. vue.createElementVNode("div", _hoisted_31$1, [
  2767. vue.createVNode(_component_BaseSwitch, {
  2768. modelValue: $data.config.contentAutoCollapse,
  2769. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.config.contentAutoCollapse = $event)
  2770. }, null, 8, ["modelValue"])
  2771. ])
  2772. ]),
  2773. _hoisted_32$1,
  2774. vue.createElementVNode("div", _hoisted_33$1, [
  2775. _hoisted_34$1,
  2776. vue.createElementVNode("div", _hoisted_35$1, [
  2777. vue.createVNode(_component_BaseSwitch, {
  2778. modelValue: $data.config.showTopReply,
  2779. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.config.showTopReply = $event)
  2780. }, null, 8, ["modelValue"])
  2781. ])
  2782. ]),
  2783. vue.createElementVNode("div", _hoisted_36$1, [
  2784. _hoisted_37$1,
  2785. vue.createElementVNode("div", _hoisted_38$1, [
  2786. vue.withDirectives(vue.createElementVNode("input", {
  2787. type: "number",
  2788. min: "1",
  2789. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.topReplyCount = $event)
  2790. }, null, 512), [
  2791. [vue.vModelText, $data.config.topReplyCount]
  2792. ])
  2793. ])
  2794. ]),
  2795. vue.createElementVNode("div", _hoisted_39$1, [
  2796. _hoisted_40,
  2797. vue.createElementVNode("div", _hoisted_41, [
  2798. vue.withDirectives(vue.createElementVNode("input", {
  2799. type: "number",
  2800. min: "1",
  2801. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.topReplyLoveMinCount = $event)
  2802. }, null, 512), [
  2803. [vue.vModelText, $data.config.topReplyLoveMinCount]
  2804. ])
  2805. ])
  2806. ]),
  2807. _hoisted_42,
  2808. vue.createElementVNode("div", _hoisted_43, [
  2809. _hoisted_44,
  2810. vue.createElementVNode("div", _hoisted_45, [
  2811. vue.createVNode(_component_BaseSwitch, {
  2812. "model-value": $data.config.rememberLastReadFloor,
  2813. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => {
  2814. $data.config.rememberLastReadFloor = !$data.config.rememberLastReadFloor;
  2815. $data.config.autoJumpLastReadFloor = false;
  2816. })
  2817. }, null, 8, ["model-value"])
  2818. ])
  2819. ]),
  2820. vue.createElementVNode("div", _hoisted_46, [
  2821. _hoisted_47,
  2822. vue.createElementVNode("div", _hoisted_48, [
  2823. vue.createVNode(_component_BaseSwitch, {
  2824. modelValue: $data.config.autoJumpLastReadFloor,
  2825. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.autoJumpLastReadFloor = $event)
  2826. }, null, 8, ["modelValue"])
  2827. ])
  2828. ]),
  2829. _hoisted_49,
  2830. _hoisted_50,
  2831. vue.createVNode(_component_font_size_type),
  2832. vue.createElementVNode("div", _hoisted_51, [
  2833. _hoisted_52,
  2834. vue.createElementVNode("div", _hoisted_53, [
  2835. vue.createVNode(_component_BaseSwitch, {
  2836. modelValue: $data.config.openTag,
  2837. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.config.openTag = $event)
  2838. }, null, 8, ["modelValue"])
  2839. ])
  2840. ]),
  2841. vue.createElementVNode("div", _hoisted_54, [
  2842. _hoisted_55,
  2843. vue.createElementVNode("div", _hoisted_56, [
  2844. vue.createVNode(_component_BaseSwitch, {
  2845. modelValue: $data.config.base64,
  2846. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.base64 = $event)
  2847. }, null, 8, ["modelValue"])
  2848. ])
  2849. ]),
  2850. vue.createElementVNode("div", _hoisted_57, [
  2851. _hoisted_58,
  2852. vue.createElementVNode("div", _hoisted_59, [
  2853. vue.createVNode(_component_BaseSwitch, {
  2854. modelValue: $data.config.autoSignin,
  2855. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.autoSignin = $event)
  2856. }, null, 8, ["modelValue"])
  2857. ])
  2858. ]),
  2859. vue.createElementVNode("div", _hoisted_60, [
  2860. _hoisted_61,
  2861. vue.createElementVNode("div", _hoisted_62, [
  2862. vue.createVNode(_component_BaseSwitch, {
  2863. modelValue: $data.config.collectBrowserNotice,
  2864. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.collectBrowserNotice = $event)
  2865. }, null, 8, ["modelValue"])
  2866. ])
  2867. ]),
  2868. _hoisted_63,
  2869. vue.createElementVNode("div", _hoisted_64, [
  2870. _hoisted_65,
  2871. vue.createElementVNode("div", _hoisted_66, [
  2872. vue.createVNode(_component_BaseSwitch, {
  2873. modelValue: $data.activeEruda,
  2874. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.activeEruda = $event)
  2875. }, null, 8, ["modelValue"])
  2876. ])
  2877. ]),
  2878. _hoisted_67
  2879. ])
  2880. ])
  2881. ], 8, ["to"]);
  2882. }
  2883. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$9], ["__scopeId", "data-v-424a2b09"]]);
  2884. const _sfc_main$k = {
  2885. name: "Point",
  2886. components: { Icon },
  2887. inject: ["post", "isLogin"],
  2888. props: {
  2889. item: {
  2890. type: Object,
  2891. default() {
  2892. return {};
  2893. }
  2894. },
  2895. full: {
  2896. type: Boolean,
  2897. default() {
  2898. return true;
  2899. }
  2900. },
  2901. apiUrl: ""
  2902. },
  2903. methods: {
  2904. thankError() {
  2905. if (!this.isLogin) {
  2906. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  2907. }
  2908. if (this.item.username === window.user.username) {
  2909. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  2910. }
  2911. if (this.item.isThanked) {
  2912. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  2913. }
  2914. this.thank();
  2915. },
  2916. async thank() {
  2917. this.$emit("addThank");
  2918. let url = `${window.baseUrl}/thank/${this.apiUrl}?once=${this.post.once}`;
  2919. $.post(url).then((res) => {
  2920. if (!res.success) {
  2921. this.$emit("recallThank");
  2922. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  2923. }
  2924. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  2925. }, (err) => {
  2926. this.$emit("recallThank");
  2927. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  2928. eventBus.emit(CMD.REFRESH_ONCE);
  2929. });
  2930. }
  2931. }
  2932. };
  2933. const _hoisted_1$j = {
  2934. key: 2,
  2935. class: "link-num"
  2936. };
  2937. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2938. const _component_Icon = vue.resolveComponent("Icon");
  2939. return vue.openBlock(), vue.createElementBlock("div", {
  2940. class: "tool",
  2941. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  2942. }, [
  2943. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  2944. key: 0,
  2945. color: "red",
  2946. icon: "icon-park-solid:like"
  2947. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  2948. key: 1,
  2949. color: "rgb(224,42,42)",
  2950. icon: "icon-park-outline:like"
  2951. })),
  2952. $props.item.thankCount ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, vue.toDisplayString($props.item.thankCount), 1)) : vue.createCommentVNode("", true)
  2953. ]);
  2954. }
  2955. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$8], ["__scopeId", "data-v-b7c6664e"]]);
  2956. const _sfc_main$j = {};
  2957. const _withScopeId$c = (n2) => (vue.pushScopeId("data-v-e92e0529"), n2 = n2(), vue.popScopeId(), n2);
  2958. const _hoisted_1$i = { class: "more" };
  2959. const _hoisted_2$f = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2960. const _hoisted_3$c = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2961. const _hoisted_4$b = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2962. const _hoisted_5$9 = [
  2963. _hoisted_2$f,
  2964. _hoisted_3$c,
  2965. _hoisted_4$b
  2966. ];
  2967. function _sfc_render$7(_ctx, _cache) {
  2968. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, _hoisted_5$9);
  2969. }
  2970. const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$7], ["__scopeId", "data-v-e92e0529"]]);
  2971. const _sfc_main$i = {
  2972. name: "Author",
  2973. components: { MoreIcon, Point, Icon },
  2974. inject: ["isLogin", "tags", "config", "isNight"],
  2975. props: {
  2976. modelValue: false,
  2977. comment: {
  2978. type: Object,
  2979. default() {
  2980. return {};
  2981. }
  2982. },
  2983. type: {
  2984. type: String,
  2985. default() {
  2986. return "list";
  2987. }
  2988. }
  2989. },
  2990. computed: {
  2991. eventBus() {
  2992. return eventBus;
  2993. },
  2994. CMD() {
  2995. return CMD;
  2996. },
  2997. pointInfo() {
  2998. return {
  2999. isThanked: this.comment.isThanked,
  3000. thankCount: this.comment.thankCount,
  3001. username: this.comment.username
  3002. };
  3003. },
  3004. myTags() {
  3005. return this.tags[this.comment.username] ?? [];
  3006. }
  3007. },
  3008. methods: {
  3009. addTag() {
  3010. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  3011. },
  3012. removeTag(tag) {
  3013. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  3014. },
  3015. checkIsLogin(emitName = "") {
  3016. if (!this.isLogin) {
  3017. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3018. return false;
  3019. }
  3020. this.$emit(emitName);
  3021. return true;
  3022. },
  3023. addThank() {
  3024. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  3025. },
  3026. recallThank() {
  3027. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  3028. }
  3029. }
  3030. };
  3031. const _withScopeId$b = (n2) => (vue.pushScopeId("data-v-9041586a"), n2 = n2(), vue.popScopeId(), n2);
  3032. const _hoisted_1$h = { class: "Author-left" };
  3033. const _hoisted_2$e = ["href"];
  3034. const _hoisted_3$b = ["src"];
  3035. const _hoisted_4$a = { class: "info" };
  3036. const _hoisted_5$8 = { class: "top" };
  3037. const _hoisted_6$8 = { class: "texts" };
  3038. const _hoisted_7$7 = ["href"];
  3039. const _hoisted_8$7 = {
  3040. key: 0,
  3041. class: "owner"
  3042. };
  3043. const _hoisted_9$7 = {
  3044. key: 1,
  3045. class: "dup"
  3046. };
  3047. const _hoisted_10$6 = {
  3048. key: 2,
  3049. class: "mod"
  3050. };
  3051. const _hoisted_11$6 = { class: "my-tag" };
  3052. const _hoisted_12$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3053. const _hoisted_13$6 = ["onClick"];
  3054. const _hoisted_14$5 = { class: "floor" };
  3055. const _hoisted_15$5 = { class: "ago" };
  3056. const _hoisted_16$5 = { class: "Author-right" };
  3057. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  3058. const _component_Icon = vue.resolveComponent("Icon");
  3059. const _component_Point = vue.resolveComponent("Point");
  3060. const _component_MoreIcon = vue.resolveComponent("MoreIcon");
  3061. return vue.openBlock(), vue.createElementBlock("div", {
  3062. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  3063. }, [
  3064. vue.createElementVNode("div", _hoisted_1$h, [
  3065. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3066. key: 0,
  3067. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", true)),
  3068. color: "#177EC9",
  3069. class: "expand-icon",
  3070. icon: "gravity-ui:chevrons-expand-up-right"
  3071. })) : vue.createCommentVNode("", true),
  3072. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  3073. key: 1,
  3074. class: "base-avatar",
  3075. href: `/member/${$props.comment.username}`
  3076. }, [
  3077. vue.createElementVNode("img", {
  3078. src: $props.comment.avatar,
  3079. alt: ""
  3080. }, null, 8, _hoisted_3$b)
  3081. ], 8, _hoisted_2$e)) : vue.createCommentVNode("", true),
  3082. vue.createElementVNode("div", _hoisted_4$a, [
  3083. vue.createElementVNode("div", _hoisted_5$8, [
  3084. vue.createElementVNode("span", _hoisted_6$8, [
  3085. vue.createElementVNode("strong", null, [
  3086. vue.createElementVNode("a", {
  3087. href: `/member/${$props.comment.username}`,
  3088. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  3089. }, vue.toDisplayString($props.comment.username), 11, _hoisted_7$7)
  3090. ]),
  3091. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$7, "OP")) : vue.createCommentVNode("", true),
  3092. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$7, "DUP")) : vue.createCommentVNode("", true),
  3093. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$6, "MOD")) : vue.createCommentVNode("", true),
  3094. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  3095. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3096. return vue.openBlock(), vue.createElementBlock("span", _hoisted_11$6, [
  3097. _hoisted_12$6,
  3098. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3099. vue.createElementVNode("i", {
  3100. class: "fa fa-trash-o remove",
  3101. onClick: ($event) => $options.removeTag(i)
  3102. }, null, 8, _hoisted_13$6)
  3103. ]);
  3104. }), 256)),
  3105. vue.createElementVNode("span", {
  3106. class: "add-tag ago",
  3107. onClick: _cache[1] || (_cache[1] = (...args) => $options.addTag && $options.addTag(...args)),
  3108. title: "添加标签"
  3109. }, "+")
  3110. ], 64)) : vue.createCommentVNode("", true)
  3111. ])
  3112. ]),
  3113. vue.createElementVNode("div", null, [
  3114. vue.createElementVNode("span", _hoisted_14$5, vue.toDisplayString($props.comment.floor) + "楼", 1),
  3115. vue.createElementVNode("span", _hoisted_15$5, vue.toDisplayString($props.comment.date), 1)
  3116. ])
  3117. ])
  3118. ]),
  3119. vue.createElementVNode("div", _hoisted_16$5, [
  3120. vue.withDirectives(vue.createVNode(_component_Point, {
  3121. item: $options.pointInfo,
  3122. onAddThank: $options.addThank,
  3123. onRecallThank: $options.recallThank,
  3124. "api-url": "reply/" + $props.comment.id
  3125. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3126. [vue.vShow, $props.comment.thankCount]
  3127. ]),
  3128. vue.createVNode(_component_MoreIcon, {
  3129. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => $options.eventBus.emit($options.CMD.SHOW_COMMENT_OPTIONS, { ...$props.comment, top: $props.type === "top" }), ["stop"]))
  3130. })
  3131. ])
  3132. ], 2);
  3133. }
  3134. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$6], ["__scopeId", "data-v-9041586a"]]);
  3135. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  3136. __name: "BaseLoading",
  3137. props: {
  3138. size: { default: "normal" }
  3139. },
  3140. setup(__props) {
  3141. return (_ctx, _cache) => {
  3142. return vue.openBlock(), vue.createElementBlock("div", {
  3143. class: vue.normalizeClass(["loading", [_ctx.size]])
  3144. }, null, 2);
  3145. };
  3146. }
  3147. });
  3148. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-2697baa2"]]);
  3149. const _hoisted_1$g = {
  3150. key: 1,
  3151. class: "key-notice"
  3152. };
  3153. const _hoisted_2$d = { class: "key" };
  3154. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  3155. __name: "BaseButton",
  3156. props: {
  3157. keyboard: {},
  3158. active: { type: Boolean },
  3159. disabled: { type: Boolean },
  3160. loading: { type: Boolean },
  3161. size: { default: "normal" },
  3162. type: { default: "primary" }
  3163. },
  3164. emits: ["click"],
  3165. setup(__props) {
  3166. return (_ctx, _cache) => {
  3167. return vue.openBlock(), vue.createBlock(Tooltip, {
  3168. disabled: !_ctx.keyboard,
  3169. title: `快捷键: ${_ctx.keyboard}`
  3170. }, {
  3171. default: vue.withCtx(() => [
  3172. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  3173. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  3174. class: [
  3175. _ctx.active && "active",
  3176. _ctx.size,
  3177. _ctx.type,
  3178. (_ctx.disabled || _ctx.loading) && "disabled",
  3179. !_ctx.disabled && "hvr-grow"
  3180. ]
  3181. }), [
  3182. vue.createElementVNode("span", {
  3183. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  3184. }, [
  3185. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  3186. ], 4),
  3187. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  3188. key: 0,
  3189. size: "small"
  3190. })) : vue.createCommentVNode("", true),
  3191. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  3192. vue.createElementVNode("span", _hoisted_2$d, vue.toDisplayString(_ctx.keyboard), 1)
  3193. ])) : vue.createCommentVNode("", true)
  3194. ], 16)
  3195. ]),
  3196. _: 3
  3197. }, 8, ["disabled", "title"]);
  3198. };
  3199. }
  3200. });
  3201. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-04f4c89d"]]);
  3202. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-0612e02f"), n2 = n2(), vue.popScopeId(), n2);
  3203. const _hoisted_1$f = { class: "get-cursor" };
  3204. const _hoisted_2$c = ["innerHTML"];
  3205. const _hoisted_3$a = { class: "toolbar" };
  3206. const _hoisted_4$9 = { class: "left" };
  3207. const _hoisted_5$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  3208. d: "M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",
  3209. fill: "none",
  3210. stroke: "#929596",
  3211. "stroke-width": "2",
  3212. "stroke-linejoin": "round"
  3213. }, null, -1));
  3214. const _hoisted_6$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  3215. d: "M24 35C29 35 31 31 31 31H17C17 31 19 35 24 35Z",
  3216. stroke: "#929596",
  3217. "stroke-width": "2",
  3218. "stroke-linecap": "round",
  3219. "stroke-linejoin": "round"
  3220. }, null, -1));
  3221. const _hoisted_7$6 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  3222. d: "M31 18V22",
  3223. stroke: "#929596",
  3224. "stroke-width": "2",
  3225. "stroke-linecap": "round",
  3226. "stroke-linejoin": "round"
  3227. }, null, -1));
  3228. const _hoisted_8$6 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  3229. d: "M17 18V22",
  3230. stroke: "#929596",
  3231. "stroke-width": "2",
  3232. "stroke-linecap": "round",
  3233. "stroke-linejoin": "round"
  3234. }, null, -1));
  3235. const _hoisted_9$6 = [
  3236. _hoisted_5$7,
  3237. _hoisted_6$7,
  3238. _hoisted_7$6,
  3239. _hoisted_8$6
  3240. ];
  3241. const _hoisted_10$5 = { class: "upload" };
  3242. const _hoisted_11$5 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  3243. width: "20",
  3244. height: "20",
  3245. viewBox: "0 0 48 48",
  3246. fill: "none",
  3247. xmlns: "http://www.w3.org/2000/svg"
  3248. }, [
  3249. /* @__PURE__ */ vue.createElementVNode("path", {
  3250. "fill-rule": "evenodd",
  3251. "clip-rule": "evenodd",
  3252. d: "M5 10C5 8.89543 5.89543 8 7 8L41 8C42.1046 8 43 8.89543 43 10V38C43 39.1046 42.1046 40 41 40H7C5.89543 40 5 39.1046 5 38V10Z",
  3253. stroke: "#929596",
  3254. "stroke-width": "2",
  3255. "stroke-linecap": "round",
  3256. "stroke-linejoin": "round"
  3257. }),
  3258. /* @__PURE__ */ vue.createElementVNode("path", {
  3259. "fill-rule": "evenodd",
  3260. "clip-rule": "evenodd",
  3261. d: "M14.5 18C15.3284 18 16 17.3284 16 16.5C16 15.6716 15.3284 15 14.5 15C13.6716 15 13 15.6716 13 16.5C13 17.3284 13.6716 18 14.5 18Z",
  3262. stroke: "#929596",
  3263. "stroke-width": "2",
  3264. "stroke-linecap": "round",
  3265. "stroke-linejoin": "round"
  3266. }),
  3267. /* @__PURE__ */ vue.createElementVNode("path", {
  3268. d: "M15 24L20 28L26 21L43 34V38C43 39.1046 42.1046 40 41 40H7C5.89543 40 5 39.1046 5 38V34L15 24Z",
  3269. fill: "none",
  3270. stroke: "#929596",
  3271. "stroke-width": "2",
  3272. "stroke-linejoin": "round"
  3273. })
  3274. ], -1));
  3275. const _hoisted_12$5 = {
  3276. key: 0,
  3277. style: { "color": "black", "font-size": "1.4rem" }
  3278. };
  3279. const _hoisted_13$5 = { class: "right" };
  3280. const _hoisted_14$4 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典表情", -1));
  3281. const _hoisted_15$4 = { class: "list" };
  3282. const _hoisted_16$4 = ["src", "onClick"];
  3283. const _hoisted_17$2 = { class: "emoji" };
  3284. const _hoisted_18$2 = { class: "title" };
  3285. const _hoisted_19$2 = { class: "list" };
  3286. const _hoisted_20$2 = ["onClick"];
  3287. const _sfc_main$f = {
  3288. __name: "PostEditor",
  3289. props: {
  3290. replyUser: null,
  3291. replyFloor: null,
  3292. useType: {
  3293. type: String,
  3294. default() {
  3295. return "reply-comment";
  3296. }
  3297. }
  3298. },
  3299. emits: ["close"],
  3300. setup(__props, { expose: __expose, emit: __emit }) {
  3301. let props = __props;
  3302. let { replyUser, replyFloor, useType } = props;
  3303. let replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3304. const emits = __emit;
  3305. const post = vue.inject("post");
  3306. const show = vue.inject("show");
  3307. const isNight = vue.inject("isNight");
  3308. const allReplyUsers = vue.inject("allReplyUsers");
  3309. let isFocus = vue.ref(false);
  3310. const loading = vue.ref(false);
  3311. const uploadLoading = vue.ref(false);
  3312. const isShowEmoticons = vue.ref(false);
  3313. const editorId = vue.ref("editorId_" + Date.now());
  3314. const content = vue.ref(replyInfo);
  3315. const txtRef = vue.ref(null);
  3316. const cursorRef = vue.ref(null);
  3317. const emoticonsRef = vue.ref(null);
  3318. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  3319. vue.watch(props, (n2) => {
  3320. replyUser = props.replyUser;
  3321. replyFloor = props.replyFloor;
  3322. useType = props.useType;
  3323. replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3324. content.value = replyInfo;
  3325. });
  3326. const emojiEmoticons = [
  3327. {
  3328. title: "小黄脸",
  3329. list: [
  3330. "😀",
  3331. "😁",
  3332. "😂",
  3333. "🤣",
  3334. "😅",
  3335. "😊",
  3336. "😋",
  3337. "😘",
  3338. "🥰",
  3339. "😗",
  3340. "🤩",
  3341. "🤔",
  3342. "🤨",
  3343. "😐",
  3344. "😑",
  3345. "🙄",
  3346. "😏",
  3347. "😪",
  3348. "😫",
  3349. "🥱",
  3350. "😜",
  3351. "😒",
  3352. "😔",
  3353. "😨",
  3354. "😰",
  3355. "😱",
  3356. "🥵",
  3357. "😡",
  3358. "🥳",
  3359. "🥺",
  3360. "🤭",
  3361. "🧐",
  3362. "😎",
  3363. "🤓",
  3364. "😭",
  3365. "🤑",
  3366. "🤮"
  3367. ]
  3368. },
  3369. {
  3370. title: "手势",
  3371. list: [
  3372. "🙋",
  3373. "🙎",
  3374. "🙅",
  3375. "🙇",
  3376. "🤷",
  3377. "🤏",
  3378. "👉",
  3379. "✌️",
  3380. "🤘",
  3381. "🤙",
  3382. "👌",
  3383. "🤌",
  3384. "👍",
  3385. "👎",
  3386. "👋",
  3387. "🤝",
  3388. "🙏",
  3389. "👏"
  3390. ]
  3391. },
  3392. {
  3393. title: "庆祝",
  3394. list: ["✨", "🎉", "🎊"]
  3395. },
  3396. {
  3397. title: "其他",
  3398. list: ["👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶", "🐒", "🙈", "🙉", "🙊", "🐵"]
  3399. }
  3400. ];
  3401. const classicsEmoticons = [
  3402. {
  3403. name: "[狗头]",
  3404. low: "https://i.imgur.com/io2SM1h.png",
  3405. high: "https://i.imgur.com/0icl60r.png"
  3406. },
  3407. {
  3408. name: "[马]",
  3409. low: "https://i.imgur.com/8EKZv7I.png",
  3410. high: "https://i.imgur.com/ANFUX52.png"
  3411. },
  3412. {
  3413. name: "[不高兴]",
  3414. low: "https://i.imgur.com/huX6coX.png",
  3415. high: "https://i.imgur.com/N7JEuvc.png"
  3416. },
  3417. {
  3418. name: "[呵呵]",
  3419. low: "https://i.imgur.com/RvoLAbX.png",
  3420. high: "https://i.imgur.com/xSzIqrK.png"
  3421. },
  3422. {
  3423. name: "[真棒]",
  3424. low: "https://i.imgur.com/xr1UOz1.png",
  3425. high: "https://i.imgur.com/w8YEw9Q.png"
  3426. },
  3427. {
  3428. name: "[鄙视]",
  3429. low: "https://i.imgur.com/u6jlqVq.png",
  3430. high: "https://i.imgur.com/8JFNANq.png"
  3431. },
  3432. {
  3433. name: "[疑问]",
  3434. low: "https://i.imgur.com/F29pmQ6.png",
  3435. high: "https://i.imgur.com/EbbTQAR.png"
  3436. },
  3437. {
  3438. name: "[吐舌]",
  3439. low: "https://i.imgur.com/InmIzl9.png",
  3440. high: "https://i.imgur.com/Ovj56Cd.png"
  3441. },
  3442. // {
  3443. // name: '[嘲笑]',
  3444. // low: 'https://i.imgur.com/BaWcsMR.png',
  3445. // high: 'https://i.imgur.com/0OGfJw4.png'
  3446. // },
  3447. // {
  3448. // name: '[滑稽]',
  3449. // low: 'https://i.imgur.com/lmbN0yI.png',
  3450. // high: 'https://i.imgur.com/Pc0wH85.png'
  3451. // },
  3452. {
  3453. name: "[笑眼]",
  3454. low: "https://i.imgur.com/ZveiiGy.png",
  3455. high: "https://i.imgur.com/PI1CfEr.png"
  3456. },
  3457. {
  3458. name: "[狂汗]",
  3459. low: "https://i.imgur.com/veWihk6.png",
  3460. high: "https://i.imgur.com/3LtHdQv.png"
  3461. },
  3462. {
  3463. name: "[大哭]",
  3464. low: "https://i.imgur.com/hu4oR6C.png",
  3465. high: "https://i.imgur.com/b4X9XLE.png"
  3466. },
  3467. {
  3468. name: "[喷]",
  3469. low: "https://i.imgur.com/bkw3VRr.png",
  3470. high: "https://i.imgur.com/wnZL13L.png"
  3471. },
  3472. {
  3473. name: "[苦笑]",
  3474. low: "https://i.imgur.com/VUWFktU.png",
  3475. high: "https://i.imgur.com/NAfspZ1.png"
  3476. },
  3477. {
  3478. name: "[喝酒]",
  3479. low: "https://i.imgur.com/2ZZSapE.png",
  3480. high: "https://i.imgur.com/rVbSVak.png"
  3481. },
  3482. {
  3483. name: "[吃瓜]",
  3484. low: "https://i.imgur.com/ee8Lq7H.png",
  3485. high: "https://i.imgur.com/0L26og9.png"
  3486. },
  3487. {
  3488. name: "[捂脸]",
  3489. low: "https://i.imgur.com/krir4IG.png",
  3490. high: "https://i.imgur.com/qqBqgVm.png"
  3491. },
  3492. {
  3493. name: "[呕]",
  3494. low: "https://i.imgur.com/6CUiUxv.png",
  3495. high: "https://i.imgur.com/kgdxRsG.png"
  3496. },
  3497. {
  3498. name: "[阴险]",
  3499. low: "https://i.imgur.com/MA8YqTP.png",
  3500. high: "https://i.imgur.com/e94jbaT.png"
  3501. },
  3502. {
  3503. name: "[怒]",
  3504. low: "https://i.imgur.com/n4kWfGB.png",
  3505. high: "https://i.imgur.com/iMXxNxh.png"
  3506. },
  3507. {
  3508. name: "[衰]",
  3509. low: "https://i.imgur.com/voHFDyQ.png",
  3510. high: "https://i.imgur.com/XffE6gu.png"
  3511. },
  3512. {
  3513. name: "[合十]",
  3514. low: "https://i.imgur.com/I8x3ang.png",
  3515. high: "https://i.imgur.com/T4rJVee.png"
  3516. },
  3517. {
  3518. name: "[赞]",
  3519. low: "https://i.imgur.com/lG44yUl.png",
  3520. high: "https://i.imgur.com/AoF5PLp.png"
  3521. },
  3522. {
  3523. name: "[踩]",
  3524. low: "https://i.imgur.com/cJp0uKZ.png",
  3525. high: "https://i.imgur.com/1XYGfXj.png"
  3526. },
  3527. {
  3528. name: "[爱心]",
  3529. low: "https://i.imgur.com/sLENaF5.png",
  3530. high: "https://i.imgur.com/dND56oX.png"
  3531. },
  3532. {
  3533. name: "[心碎]",
  3534. low: "https://i.imgur.com/AZxJzve.png",
  3535. high: "https://i.imgur.com/RiUsPci.png"
  3536. }
  3537. ];
  3538. const imgurClientIdPool = [
  3539. "3107b9ef8b316f3",
  3540. "442b04f26eefc8a",
  3541. "59cfebe717c09e4",
  3542. "60605aad4a62882",
  3543. "6c65ab1d3f5452a",
  3544. "83e123737849aa9",
  3545. "9311f6be1c10160",
  3546. "c4a4a563f698595",
  3547. "81be04b9e4a08ce"
  3548. ];
  3549. const editorClass = vue.computed(() => {
  3550. return [isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  3551. });
  3552. const cursorHtml = vue.computed(() => {
  3553. var _a;
  3554. if (!txtRef.value || !content.value)
  3555. return "";
  3556. let index = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  3557. return content.value.substring(0, index).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  3558. });
  3559. const disabled = vue.computed(() => {
  3560. if (content.value) {
  3561. return content.value === replyInfo;
  3562. } else {
  3563. return true;
  3564. }
  3565. });
  3566. function focus() {
  3567. txtRef.value.focus();
  3568. }
  3569. __expose({ content, focus });
  3570. function drop(e2) {
  3571. e2.preventDefault();
  3572. upload(e2.dataTransfer.files[0]);
  3573. }
  3574. async function upload(file) {
  3575. if (!file)
  3576. return;
  3577. if (uploadLoading.value)
  3578. return;
  3579. uploadLoading.value = true;
  3580. const formData = new FormData();
  3581. formData.append("image", file);
  3582. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  3583. const clidenId = imgurClientIdPool[randomIndex];
  3584. const res = await fetch("https://api.imgur.com/3/upload", {
  3585. method: "POST",
  3586. headers: { Authorization: `Client-ID ${clidenId}` },
  3587. body: formData
  3588. });
  3589. uploadLoading.value = false;
  3590. if (res.ok) {
  3591. const resData = await res.json();
  3592. if (resData.success) {
  3593. return insert(" " + resData.data.link + " ");
  3594. }
  3595. }
  3596. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  3597. }
  3598. async function submit() {
  3599. if (disabled.value || loading.value)
  3600. return;
  3601. loading.value = true;
  3602. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  3603. let item2 = classicsEmoticons.find((v) => v.name === match);
  3604. if (item2) {
  3605. return item2.low + " ";
  3606. }
  3607. return match;
  3608. });
  3609. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  3610. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  3611. });
  3612. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  3613. let item2 = classicsEmoticons.find((v) => v.name === match);
  3614. if (item2) {
  3615. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  3616. }
  3617. return match;
  3618. });
  3619. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  3620. if (matchUsers) {
  3621. matchUsers.map((i) => {
  3622. let username = i.replace("@", "").replace(" ", "");
  3623. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  3624. });
  3625. }
  3626. show_content = show_content.replaceAll("\n", "<br/>");
  3627. let item = {
  3628. thankCount: 0,
  3629. isThanked: false,
  3630. isOp: post.value.username === window.user.username,
  3631. isDup: false,
  3632. id: Date.now(),
  3633. username: window.user.username,
  3634. avatar: window.user.avatar,
  3635. date: "几秒前",
  3636. floor: post.value.replyCount + 1,
  3637. reply_content: show_content ?? "",
  3638. children: [],
  3639. replyUsers: replyUser ? [replyUser] : [],
  3640. replyFloor: replyFloor || -1,
  3641. level: useType === "reply-comment" ? 1 : 0
  3642. };
  3643. item.hideCallUserReplyContent = item.reply_content;
  3644. if (item.replyUsers.length === 1) {
  3645. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  3646. }
  3647. console.log("回复", item);
  3648. let url = `${window.baseUrl}/t/${post.value.id}`;
  3649. $.post(url, { content: submit_content, once: post.value.once }).then(
  3650. // $.post(url, {content: submit_content, once: 123}).then(
  3651. (res) => {
  3652. loading.value = false;
  3653. let r2 = res.search("你上一条回复的内容和这条相同");
  3654. if (r2 > -1)
  3655. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  3656. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  3657. if (r2 > -1)
  3658. return eventBus.emit(CMD.SHOW_MSG, {
  3659. type: "error",
  3660. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  3661. });
  3662. let r22 = res.search("创建新回复");
  3663. if (r22 > -1) {
  3664. eventBus.emit(CMD.REFRESH_ONCE, res);
  3665. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  3666. let clientWidth = window.document.body.clientWidth;
  3667. let windowWidth = 1200;
  3668. let left = clientWidth / 2 - windowWidth / 2;
  3669. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  3670. newWin.document.write(res);
  3671. let loop = setInterval(function() {
  3672. if (newWin.closed) {
  3673. clearInterval(loop);
  3674. eventBus.emit(CMD.REFRESH_POST);
  3675. }
  3676. }, 1e3);
  3677. return;
  3678. }
  3679. content.value = replyInfo;
  3680. emits("close");
  3681. eventBus.emit(CMD.REFRESH_ONCE, res);
  3682. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  3683. eventBus.emit(CMD.ADD_REPLY, item);
  3684. },
  3685. (err) => {
  3686. console.log("err", err);
  3687. loading.value = false;
  3688. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  3689. }
  3690. ).catch((r2) => {
  3691. console.log("catch", r2);
  3692. });
  3693. }
  3694. function showEmoticons(e2) {
  3695. if (isShowEmoticons.value) {
  3696. return isShowEmoticons.value = false;
  3697. }
  3698. let rect = e2.currentTarget.getBoundingClientRect();
  3699. emoticonsRef.value.style.left = rect.left + 30 + "px";
  3700. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  3701. isShowEmoticons.value = true;
  3702. }
  3703. function off() {
  3704. eventBus.emit(CMD.SHOW_CALL, { show: false });
  3705. eventBus.off(CMD.SET_CALL);
  3706. }
  3707. function checkHeight2() {
  3708. txtRef.value.style.height = 0;
  3709. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  3710. }
  3711. function insert(str) {
  3712. let cursorPos = txtRef.value.selectionStart;
  3713. let start = content.value.slice(0, cursorPos);
  3714. let end = content.value.slice(cursorPos, content.value.length);
  3715. content.value = start + str + end;
  3716. let moveCursorPos = start.length + str.length;
  3717. setTimeout(() => {
  3718. txtRef.value.focus();
  3719. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3720. checkHeight2();
  3721. });
  3722. }
  3723. function showCallPopover(text) {
  3724. let r2 = cursorRef.value.getBoundingClientRect();
  3725. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  3726. eventBus.off(CMD.SET_CALL);
  3727. eventBus.on(CMD.SET_CALL, (e2) => {
  3728. let cursorPos = txtRef.value.selectionStart;
  3729. let start = content.value.slice(0, cursorPos);
  3730. let end = content.value.slice(cursorPos, content.value.length);
  3731. let lastCallPos = start.lastIndexOf("@");
  3732. start = content.value.slice(0, lastCallPos + 1);
  3733. if (e2 === "管理员") {
  3734. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid";
  3735. }
  3736. if (e2 === "所有人") {
  3737. e2 = allReplyUsers.value.map((v, i) => {
  3738. if (i)
  3739. return "@" + v;
  3740. else
  3741. return v;
  3742. }).join(" ");
  3743. }
  3744. content.value = start + e2 + " " + end;
  3745. let moveCursorPos = start.length + e2.length + 1;
  3746. setTimeout(() => {
  3747. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3748. checkHeight2();
  3749. });
  3750. eventBus.off(CMD.SET_CALL);
  3751. });
  3752. }
  3753. function onKeydown(e2) {
  3754. let code = e2.keyCode;
  3755. switch (code) {
  3756. case 8:
  3757. if (content.value === "@") {
  3758. off();
  3759. }
  3760. break;
  3761. case 37:
  3762. case 38:
  3763. case 39:
  3764. case 40:
  3765. setTimeout(() => onInput({ data: "" }), 100);
  3766. break;
  3767. case 27:
  3768. e2.preventDefault();
  3769. e2.stopPropagation();
  3770. e2.stopImmediatePropagation();
  3771. return false;
  3772. case 13:
  3773. if (e2.ctrlKey)
  3774. submit();
  3775. if (e2.metaKey)
  3776. submit();
  3777. break;
  3778. }
  3779. }
  3780. function onInput(e2) {
  3781. let cursorPos = txtRef.value.selectionStart;
  3782. if (!content.value)
  3783. return;
  3784. if (e2.data === " ") {
  3785. return off();
  3786. }
  3787. if (e2.data === "@") {
  3788. if (content.value.length !== 1) {
  3789. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  3790. return showCallPopover("");
  3791. }
  3792. } else {
  3793. return showCallPopover("");
  3794. }
  3795. off();
  3796. } else {
  3797. let judgeStr = content.value.slice(0, cursorPos);
  3798. let lastCallPos = judgeStr.lastIndexOf("@");
  3799. if (lastCallPos === -1) {
  3800. return off();
  3801. }
  3802. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  3803. let hasSpace = callStr.includes(" ");
  3804. if (hasSpace) {
  3805. off();
  3806. } else {
  3807. if (lastCallPos === 0) {
  3808. return showCallPopover(callStr.replace("@", ""));
  3809. }
  3810. if (content.value.length !== 1) {
  3811. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  3812. return showCallPopover(callStr.replace("@", ""));
  3813. }
  3814. } else {
  3815. return showCallPopover(callStr.replace("@", ""));
  3816. }
  3817. off();
  3818. }
  3819. }
  3820. }
  3821. function onPaste(e2) {
  3822. const dataTransferItemList = e2.clipboardData.items;
  3823. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  3824. return item.type.indexOf("image") !== -1;
  3825. });
  3826. if (items.length === 0) {
  3827. return;
  3828. }
  3829. const dataTransferItem = items[0];
  3830. const blob = dataTransferItem.getAsFile();
  3831. upload(blob);
  3832. }
  3833. function onBlur() {
  3834. document.removeEventListener("paste", onPaste);
  3835. isFocus.value = false;
  3836. }
  3837. function onFocusin() {
  3838. document.addEventListener("paste", onPaste);
  3839. }
  3840. vue.watch(() => show, (n2) => {
  3841. if (n2.value)
  3842. isShowEmoticons.value = false;
  3843. }, { deep: true });
  3844. vue.onMounted(() => {
  3845. $(`.${editorId.value}`).each(function() {
  3846. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  3847. }).on("input", function() {
  3848. this.style.height = 0;
  3849. this.style.height = this.scrollHeight + "px";
  3850. });
  3851. });
  3852. return (_ctx, _cache) => {
  3853. return vue.openBlock(), vue.createElementBlock("div", {
  3854. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  3855. }, [
  3856. vue.withDirectives(vue.createElementVNode("textarea", {
  3857. class: vue.normalizeClass(["post-editor", editorId.value]),
  3858. ref_key: "txtRef",
  3859. ref: txtRef,
  3860. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  3861. onBlur,
  3862. onFocusin,
  3863. placeholder: "请尽量让自己的回复能够对别人有帮助",
  3864. onInput,
  3865. onKeydown,
  3866. onDrop: drop,
  3867. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  3868. }, null, 34), [
  3869. [vue.vModelText, content.value]
  3870. ]),
  3871. vue.createElementVNode("div", _hoisted_1$f, [
  3872. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$c),
  3873. vue.createElementVNode("span", {
  3874. class: "cursor",
  3875. ref_key: "cursorRef",
  3876. ref: cursorRef
  3877. }, "|", 512)
  3878. ]),
  3879. vue.createElementVNode("div", _hoisted_3$a, [
  3880. vue.createElementVNode("div", _hoisted_4$9, [
  3881. (vue.openBlock(), vue.createElementBlock("svg", {
  3882. onClick: showEmoticons,
  3883. width: "20",
  3884. height: "20",
  3885. viewBox: "0 0 48 48",
  3886. fill: "none",
  3887. xmlns: "http://www.w3.org/2000/svg"
  3888. }, _hoisted_9$6)),
  3889. vue.createElementVNode("div", _hoisted_10$5, [
  3890. vue.createElementVNode("input", {
  3891. type: "file",
  3892. accept: "image/*",
  3893. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  3894. }, null, 32),
  3895. _hoisted_11$5
  3896. ]),
  3897. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12$5, "上传中.....")) : vue.createCommentVNode("", true)
  3898. ]),
  3899. vue.createElementVNode("div", _hoisted_13$5, [
  3900. vue.createVNode(BaseButton, {
  3901. size: "small",
  3902. disabled: disabled.value,
  3903. loading: loading.value,
  3904. onClick: submit
  3905. }, {
  3906. default: vue.withCtx(() => [
  3907. vue.createTextVNode("回复 ")
  3908. ]),
  3909. _: 1
  3910. }, 8, ["disabled", "loading"])
  3911. ])
  3912. ]),
  3913. vue.withDirectives(vue.createElementVNode("div", {
  3914. class: "emoticon-pack",
  3915. ref_key: "emoticonsRef",
  3916. ref: emoticonsRef
  3917. }, [
  3918. vue.createElementVNode("i", {
  3919. class: "fa fa-times",
  3920. "aria-hidden": "true",
  3921. onClick: _cache[3] || (_cache[3] = ($event) => isShowEmoticons.value = false)
  3922. }),
  3923. _hoisted_14$4,
  3924. vue.createElementVNode("div", _hoisted_15$4, [
  3925. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(classicsEmoticons, (item) => {
  3926. return vue.createElementVNode("img", {
  3927. src: item.high,
  3928. onClick: ($event) => {
  3929. insert(item.name);
  3930. isShowEmoticons.value = false;
  3931. }
  3932. }, null, 8, _hoisted_16$4);
  3933. }), 64))
  3934. ]),
  3935. vue.createElementVNode("div", _hoisted_17$2, [
  3936. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiEmoticons, (item) => {
  3937. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  3938. vue.createElementVNode("div", _hoisted_18$2, vue.toDisplayString(item.title), 1),
  3939. vue.createElementVNode("div", _hoisted_19$2, [
  3940. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  3941. return vue.openBlock(), vue.createElementBlock("span", {
  3942. onClick: ($event) => {
  3943. insert(emoji);
  3944. isShowEmoticons.value = false;
  3945. }
  3946. }, vue.toDisplayString(emoji), 9, _hoisted_20$2);
  3947. }), 256))
  3948. ])
  3949. ], 64);
  3950. }), 64))
  3951. ])
  3952. ], 512), [
  3953. [vue.vShow, isShowEmoticons.value]
  3954. ])
  3955. ], 2);
  3956. };
  3957. }
  3958. };
  3959. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0612e02f"]]);
  3960. const _hoisted_1$e = {
  3961. key: 0,
  3962. class: "html-wrapper"
  3963. };
  3964. const _hoisted_2$b = ["innerHTML"];
  3965. const checkHeight = 900;
  3966. const _sfc_main$e = {
  3967. __name: "BaseHtmlRender",
  3968. props: ["html"],
  3969. setup(__props) {
  3970. const config2 = vue.inject("config");
  3971. const props = __props;
  3972. const contentRef = vue.ref(null);
  3973. const htmlMask = vue.ref(false);
  3974. const handOpen = vue.ref(false);
  3975. function mouseup(e2) {
  3976. if (!config2.value.base64)
  3977. return;
  3978. let selectionText = window.win().getSelection().toString();
  3979. if (selectionText) {
  3980. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  3981. if (r2) {
  3982. if (r2[0].length < 4)
  3983. return;
  3984. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  3985. }
  3986. }
  3987. }
  3988. vue.watch(config2.value, (newVale) => {
  3989. if (!newVale.contentAutoCollapse) {
  3990. htmlMask.value = false;
  3991. }
  3992. });
  3993. vue.watch([() => contentRef.value, () => props.html], () => {
  3994. if (!contentRef.value || !props.html)
  3995. return;
  3996. if (!config2.value.contentAutoCollapse)
  3997. return;
  3998. contentRef.value.querySelectorAll("img").forEach((item) => {
  3999. item.removeEventListener("load", checkContentHeight);
  4000. item.addEventListener("load", checkContentHeight);
  4001. });
  4002. checkContentHeight();
  4003. }, { immediate: true, flush: "post" });
  4004. function checkContentHeight() {
  4005. if (handOpen.value)
  4006. return;
  4007. let rect = contentRef.value.getBoundingClientRect();
  4008. htmlMask.value = rect.height >= checkHeight;
  4009. }
  4010. return (_ctx, _cache) => {
  4011. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
  4012. vue.createElementVNode("div", {
  4013. class: vue.normalizeClass({ htmlMask: htmlMask.value })
  4014. }, [
  4015. vue.createElementVNode("div", {
  4016. ref_key: "contentRef",
  4017. ref: contentRef,
  4018. innerHTML: props.html,
  4019. onMouseup: mouseup
  4020. }, null, 40, _hoisted_2$b)
  4021. ], 2),
  4022. htmlMask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  4023. key: 0,
  4024. class: "expand",
  4025. onClick: _cache[0] || (_cache[0] = ($event) => {
  4026. htmlMask.value = false;
  4027. handOpen.value = true;
  4028. })
  4029. }, "展开")) : vue.createCommentVNode("", true)
  4030. ])) : vue.createCommentVNode("", true);
  4031. };
  4032. }
  4033. };
  4034. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-f8165980"]]);
  4035. const _sfc_main$d = {
  4036. name: "Comment",
  4037. components: { MoreIcon, BaseHtmlRender, Author, PostEditor, Point },
  4038. inject: ["post", "show", "isNight", "config"],
  4039. props: {
  4040. modelValue: {
  4041. reply_content: ""
  4042. },
  4043. type: {
  4044. type: String,
  4045. default() {
  4046. return "list";
  4047. }
  4048. }
  4049. },
  4050. data() {
  4051. return {
  4052. edit: false,
  4053. ding: false,
  4054. expand: true,
  4055. expandWrong: false,
  4056. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4057. cssStyle: null,
  4058. floor: this.modelValue.floor
  4059. };
  4060. },
  4061. watch: {
  4062. show(e2) {
  4063. if (e2) {
  4064. this.edit = false;
  4065. }
  4066. },
  4067. postDetailWidth(n2, o) {
  4068. this.checkIsTooLong(n2);
  4069. }
  4070. },
  4071. computed: {
  4072. eventBus() {
  4073. return eventBus;
  4074. },
  4075. CMD() {
  4076. return CMD;
  4077. },
  4078. CommentDisplayType() {
  4079. return CommentDisplayType;
  4080. },
  4081. myClass() {
  4082. return {
  4083. isOp: this.modelValue.isOp,
  4084. ding: this.ding,
  4085. isLevelOne: this.modelValue.level === 0,
  4086. ["c_" + this.floor]: this.type !== "top"
  4087. };
  4088. }
  4089. },
  4090. mounted() {
  4091. this.checkIsTooLong();
  4092. },
  4093. methods: {
  4094. checkIsTooLong() {
  4095. let rect = this.$refs.comment.getBoundingClientRect();
  4096. let postDetailWidth = document.body.clientWidth;
  4097. let ban = postDetailWidth / 2;
  4098. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  4099. this.expand = false;
  4100. let padding = 2;
  4101. this.cssStyle = {
  4102. padding: "1rem 0",
  4103. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  4104. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  4105. background: this.isNight ? "#18222d" : "white"
  4106. };
  4107. }
  4108. },
  4109. //高亮一下
  4110. showDing() {
  4111. this.ding = true;
  4112. setTimeout(() => {
  4113. this.ding = false;
  4114. }, 2e3);
  4115. },
  4116. toggle() {
  4117. this.expand = !this.expand;
  4118. }
  4119. }
  4120. };
  4121. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-312e9541"), n2 = n2(), vue.popScopeId(), n2);
  4122. const _hoisted_1$d = ["data-floor"];
  4123. const _hoisted_2$a = { class: "comment-content" };
  4124. const _hoisted_3$9 = { class: "right" };
  4125. const _hoisted_4$8 = { class: "w" };
  4126. const _hoisted_5$6 = {
  4127. key: 0,
  4128. class: "wrong-wrapper"
  4129. };
  4130. const _hoisted_6$6 = ["href"];
  4131. const _hoisted_7$5 = { class: "del-line" };
  4132. const _hoisted_8$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("i", {
  4133. class: "fa fa-question-circle-o wrong-icon",
  4134. "aria-hidden": "true"
  4135. }, null, -1));
  4136. const _hoisted_9$5 = {
  4137. key: 0,
  4138. class: "warning"
  4139. };
  4140. const _hoisted_10$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4141. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4142. const _hoisted_12$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4143. const _hoisted_13$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4144. const _hoisted_14$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4145. const _hoisted_15$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("a", {
  4146. href: "https://github.com/zyronon/web-scripts/issues",
  4147. target: "_blank"
  4148. }, "这里", -1));
  4149. const _hoisted_16$3 = { class: "simple-wrapper" };
  4150. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  4151. const _component_Author = vue.resolveComponent("Author");
  4152. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4153. const _component_Comment = vue.resolveComponent("Comment", true);
  4154. return vue.openBlock(), vue.createElementBlock("div", {
  4155. class: vue.normalizeClass(["comment", $options.myClass]),
  4156. ref: "comment",
  4157. "data-floor": $data.floor
  4158. }, [
  4159. vue.createVNode(_component_Author, {
  4160. modelValue: $data.expand,
  4161. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4162. comment: $props.modelValue,
  4163. type: $props.type
  4164. }, null, 8, ["modelValue", "comment", "type"]),
  4165. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4166. key: 0,
  4167. class: "more ago",
  4168. onClick: _cache[1] || (_cache[1] = ($event) => $data.expand = !$data.expand)
  4169. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  4170. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4171. key: 1,
  4172. class: "comment-content-w",
  4173. style: vue.normalizeStyle($data.cssStyle)
  4174. }, [
  4175. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4176. key: 0,
  4177. class: "more ago",
  4178. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  4179. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  4180. vue.createElementVNode("div", _hoisted_2$a, [
  4181. vue.createElementVNode("div", {
  4182. class: "left expand-line",
  4183. onClick: _cache[3] || (_cache[3] = (...args) => $options.toggle && $options.toggle(...args))
  4184. }),
  4185. vue.createElementVNode("div", _hoisted_3$9, [
  4186. vue.createElementVNode("div", _hoisted_4$8, [
  4187. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$6, [
  4188. vue.createElementVNode("span", {
  4189. onClick: _cache[4] || (_cache[4] = ($event) => $data.expandWrong = !$data.expandWrong),
  4190. title: "点击楼层号查看提示"
  4191. }, [
  4192. vue.createElementVNode("a", {
  4193. href: "/member/" + $props.modelValue.replyUsers[0]
  4194. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$6),
  4195. vue.createElementVNode("span", _hoisted_7$5, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  4196. _hoisted_8$5
  4197. ]),
  4198. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$5, [
  4199. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  4200. _hoisted_10$4,
  4201. vue.createTextVNode(" 原因可能有下面几种: "),
  4202. _hoisted_11$4,
  4203. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  4204. _hoisted_12$4,
  4205. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  4206. _hoisted_13$4,
  4207. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  4208. _hoisted_14$3,
  4209. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  4210. _hoisted_15$3,
  4211. vue.createTextVNode("反馈 ")
  4212. ])) : vue.createCommentVNode("", true)
  4213. ])) : vue.createCommentVNode("", true),
  4214. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && this.type !== "top" ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4215. key: 1,
  4216. class: "reply_content",
  4217. html: $props.modelValue.hideCallUserReplyContent
  4218. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4219. key: 2,
  4220. class: "reply_content",
  4221. html: $props.modelValue.reply_content
  4222. }, null, 8, ["html"]))
  4223. ]),
  4224. vue.createElementVNode("div", _hoisted_16$3, [
  4225. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4226. return vue.openBlock(), vue.createBlock(_component_Comment, {
  4227. modelValue: $props.modelValue.children[index],
  4228. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4229. key: index
  4230. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4231. }), 128))
  4232. ])
  4233. ])
  4234. ]),
  4235. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4236. key: 1,
  4237. class: "more ago",
  4238. onClick: _cache[5] || (_cache[5] = ($event) => $data.expand = !$data.expand)
  4239. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  4240. ], 4)) : vue.createCommentVNode("", true)
  4241. ], 10, _hoisted_1$d);
  4242. }
  4243. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5], ["__scopeId", "data-v-312e9541"]]);
  4244. const _sfc_main$c = {
  4245. name: "Toolbar",
  4246. components: { Icon, BaseLoading },
  4247. inject: [
  4248. "isLogin",
  4249. "post",
  4250. "pageType"
  4251. ],
  4252. data() {
  4253. return {
  4254. timer: null,
  4255. loading: false,
  4256. loading3: false
  4257. };
  4258. },
  4259. methods: {
  4260. checkIsLogin(emitName = "") {
  4261. if (!this.isLogin) {
  4262. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4263. return false;
  4264. }
  4265. this.$emit(emitName);
  4266. return true;
  4267. },
  4268. async toggleFavorite() {
  4269. if (config.collectBrowserNotice) {
  4270. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记添加到书签哦" });
  4271. }
  4272. if (!this.checkIsLogin())
  4273. return;
  4274. let isFavorite = this.post.isFavorite;
  4275. let url = `${window.baseUrl}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  4276. this.loading = true;
  4277. let apiRes = await fetch(url);
  4278. this.loading = false;
  4279. if (apiRes.redirected) {
  4280. let htmlText = await apiRes.text();
  4281. if (htmlText.search(this.post.isFavorite ? "加入收藏" : "取消收藏")) {
  4282. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  4283. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4284. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4285. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4286. return;
  4287. }
  4288. }
  4289. eventBus.emit(CMD.REFRESH_ONCE);
  4290. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  4291. }
  4292. }
  4293. };
  4294. const _hoisted_1$c = { class: "toolbar" };
  4295. const _hoisted_2$9 = { class: "left" };
  4296. const _hoisted_3$8 = { class: "right" };
  4297. const _hoisted_4$7 = { key: 2 };
  4298. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4299. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4300. const _component_Icon = vue.resolveComponent("Icon");
  4301. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
  4302. vue.createElementVNode("div", _hoisted_2$9, [
  4303. vue.createElementVNode("div", null, vue.toDisplayString($options.post.createDate.substring(0, 16)), 1)
  4304. ]),
  4305. vue.createElementVNode("div", _hoisted_3$8, [
  4306. vue.createElementVNode("div", {
  4307. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  4308. onClick: _cache[0] || (_cache[0] = (...args) => $options.toggleFavorite && $options.toggleFavorite(...args))
  4309. }, [
  4310. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4311. key: 0,
  4312. size: "small"
  4313. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4314. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4315. key: 0,
  4316. color: "rgb(224,42,42)",
  4317. icon: "iconoir:star-solid"
  4318. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4319. key: 1,
  4320. icon: "iconoir:star"
  4321. }))
  4322. ], 64)),
  4323. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$7, vue.toDisplayString($options.post.collectCount), 1)) : vue.createCommentVNode("", true)
  4324. ], 2),
  4325. vue.createElementVNode("div", {
  4326. class: "tool",
  4327. onClick: _cache[1] || (_cache[1] = ($event) => $options.checkIsLogin("reply"))
  4328. }, [
  4329. vue.createVNode(_component_Icon, { icon: "mynaui:message" })
  4330. ])
  4331. ])
  4332. ]);
  4333. }
  4334. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$4], ["__scopeId", "data-v-6234240d"]]);
  4335. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-0869dab5"), n2 = n2(), vue.popScopeId(), n2);
  4336. const _hoisted_1$b = {
  4337. class: "comment",
  4338. ref: "comment"
  4339. };
  4340. const _hoisted_2$8 = ["href"];
  4341. const _hoisted_3$7 = ["src"];
  4342. const _hoisted_4$6 = { class: "texts" };
  4343. const _hoisted_5$5 = {
  4344. key: 0,
  4345. class: "point"
  4346. };
  4347. const _hoisted_6$5 = { class: "link-num" };
  4348. const _hoisted_7$4 = { class: "my-tag" };
  4349. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4350. const _hoisted_9$4 = {
  4351. key: 2,
  4352. class: "ago"
  4353. };
  4354. const _hoisted_10$3 = {
  4355. key: 3,
  4356. class: "mod"
  4357. };
  4358. const _hoisted_11$3 = {
  4359. key: 4,
  4360. class: "owner"
  4361. };
  4362. const _hoisted_12$3 = ["href"];
  4363. const _hoisted_13$3 = {
  4364. key: 5,
  4365. class: "owner"
  4366. };
  4367. const _hoisted_14$2 = {
  4368. key: 6,
  4369. class: "mod"
  4370. };
  4371. const _hoisted_15$2 = {
  4372. key: 7,
  4373. class: "ago"
  4374. };
  4375. const _hoisted_16$2 = { class: "my-tag" };
  4376. const _hoisted_17$1 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4377. const _hoisted_18$1 = {
  4378. key: 9,
  4379. class: "point"
  4380. };
  4381. const _hoisted_19$1 = { class: "link-num" };
  4382. const _hoisted_20$1 = ["href"];
  4383. const _hoisted_21$1 = ["src"];
  4384. const _hoisted_22$1 = { class: "Author-right" };
  4385. const _hoisted_23$1 = { class: "floor" };
  4386. const _hoisted_24$1 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  4387. const _hoisted_25$1 = [
  4388. _hoisted_24$1
  4389. ];
  4390. const _sfc_main$b = {
  4391. __name: "SingleComment",
  4392. props: {
  4393. comment: {
  4394. reply_content: ""
  4395. },
  4396. isRight: {
  4397. type: Boolean,
  4398. default() {
  4399. return false;
  4400. }
  4401. }
  4402. },
  4403. setup(__props) {
  4404. const config2 = vue.inject("config");
  4405. const isLogin = vue.inject("isLogin");
  4406. const tags = vue.inject("tags");
  4407. const props = __props;
  4408. const myTags = vue.computed(() => {
  4409. return tags[props.comment.username] ?? [];
  4410. });
  4411. function jump() {
  4412. eventBus.emit(CMD.JUMP, props.comment.floor);
  4413. }
  4414. return (_ctx, _cache) => {
  4415. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
  4416. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4417. key: 0,
  4418. class: "base-avatar",
  4419. href: `/member/${__props.comment.username}`
  4420. }, [
  4421. vue.createElementVNode("img", {
  4422. src: __props.comment.avatar,
  4423. alt: ""
  4424. }, null, 8, _hoisted_3$7)
  4425. ], 8, _hoisted_2$8)) : vue.createCommentVNode("", true),
  4426. vue.createElementVNode("div", {
  4427. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  4428. }, [
  4429. vue.createElementVNode("div", _hoisted_4$6, [
  4430. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
  4431. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4432. key: 0,
  4433. color: "red",
  4434. icon: "icon-park-solid:like"
  4435. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4436. key: 1,
  4437. color: "rgb(224,42,42)",
  4438. icon: "icon-park-outline:like"
  4439. })),
  4440. vue.createElementVNode("div", _hoisted_6$5, vue.toDisplayString(__props.comment.thankCount), 1)
  4441. ])) : vue.createCommentVNode("", true),
  4442. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  4443. return vue.openBlock(), vue.createElementBlock("span", _hoisted_7$4, [
  4444. _hoisted_8$4,
  4445. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4446. ]);
  4447. }), 256)) : vue.createCommentVNode("", true),
  4448. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9$4, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4449. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$3, "MOD")) : vue.createCommentVNode("", true),
  4450. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$3, "OP")) : vue.createCommentVNode("", true),
  4451. vue.createElementVNode("a", {
  4452. href: `/member/${__props.comment.username}`,
  4453. class: "username"
  4454. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_12$3),
  4455. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$3, "OP")) : vue.createCommentVNode("", true),
  4456. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$2, "MOD")) : vue.createCommentVNode("", true),
  4457. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_15$2, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4458. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  4459. return vue.openBlock(), vue.createElementBlock("span", _hoisted_16$2, [
  4460. _hoisted_17$1,
  4461. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4462. ]);
  4463. }), 256)) : vue.createCommentVNode("", true),
  4464. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$1, [
  4465. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4466. key: 0,
  4467. color: "red",
  4468. icon: "icon-park-solid:like"
  4469. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4470. key: 1,
  4471. color: "rgb(224,42,42)",
  4472. icon: "icon-park-outline:like"
  4473. })),
  4474. vue.createElementVNode("div", _hoisted_19$1, vue.toDisplayString(__props.comment.thankCount), 1)
  4475. ])) : vue.createCommentVNode("", true)
  4476. ]),
  4477. vue.createVNode(BaseHtmlRender, {
  4478. class: "reply_content",
  4479. html: __props.comment.reply_content
  4480. }, null, 8, ["html"])
  4481. ], 2),
  4482. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4483. key: 1,
  4484. class: "base-avatar",
  4485. href: `/member/${__props.comment.username}`
  4486. }, [
  4487. vue.createElementVNode("img", {
  4488. src: __props.comment.avatar,
  4489. alt: ""
  4490. }, null, 8, _hoisted_21$1)
  4491. ], 8, _hoisted_20$1)) : vue.createCommentVNode("", true),
  4492. vue.createElementVNode("div", _hoisted_22$1, [
  4493. vue.createElementVNode("div", _hoisted_23$1, vue.toDisplayString(__props.comment.floor) + "楼", 1),
  4494. vue.createElementVNode("div", {
  4495. class: "tool jump",
  4496. onClick: jump
  4497. }, _hoisted_25$1)
  4498. ])
  4499. ], 512);
  4500. };
  4501. }
  4502. };
  4503. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0869dab5"]]);
  4504. function debounce(fn, delay, scope) {
  4505. let timer = null;
  4506. return function() {
  4507. let context = scope || this, args = arguments;
  4508. clearTimeout(timer);
  4509. timer = setTimeout(function() {
  4510. fn.apply(context, args);
  4511. timer = null;
  4512. }, delay);
  4513. };
  4514. }
  4515. async function copy(text) {
  4516. if (navigator.clipboard) {
  4517. await navigator.clipboard.writeText(text);
  4518. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  4519. return true;
  4520. } else {
  4521. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  4522. }
  4523. }
  4524. const _sfc_main$a = {
  4525. name: "FromBottomDialog",
  4526. props: {
  4527. modelValue: {
  4528. type: Boolean,
  4529. default: false
  4530. },
  4531. mode: {
  4532. type: String,
  4533. // default: 'dark'
  4534. default: "light"
  4535. // default: 'white'
  4536. },
  4537. maskMode: {
  4538. type: String,
  4539. default: "dark"
  4540. },
  4541. height: {
  4542. type: String,
  4543. default: "70vh"
  4544. },
  4545. showHengGang: {
  4546. type: Boolean,
  4547. default: true
  4548. },
  4549. pageId: {
  4550. type: String,
  4551. default: null,
  4552. required: true
  4553. },
  4554. borderRadius: {
  4555. type: String,
  4556. default: "1rem 1rem 0 0"
  4557. },
  4558. tag: {
  4559. type: String,
  4560. default: ""
  4561. }
  4562. },
  4563. watch: {
  4564. modelValue(newVal) {
  4565. let page = document.getElementById(this.pageId);
  4566. if (newVal) {
  4567. page.style.overflow = "hidden";
  4568. this.scroll = page.scrollTop;
  4569. let mask = $(`<div class="mask fade-in ${this.maskMode}"></div>`);
  4570. mask.on("click", (e2) => {
  4571. this.hide(false);
  4572. });
  4573. page.appendChild(mask[0]);
  4574. } else {
  4575. page.style.overflow = "unset";
  4576. let mask = $(".mask");
  4577. mask.removeClass("fade-in");
  4578. mask.addClass("fade-out");
  4579. setTimeout(() => {
  4580. mask.remove();
  4581. }, 250);
  4582. }
  4583. }
  4584. },
  4585. data() {
  4586. return {
  4587. scroll: 0,
  4588. startLocationY: 0,
  4589. moveYDistance: 0,
  4590. startTime: 0,
  4591. pagePosition: null
  4592. };
  4593. },
  4594. computed: {},
  4595. created() {
  4596. },
  4597. methods: {
  4598. beforeEnter(el) {
  4599. el.style["transition-duration"] = `250ms`;
  4600. el.style["transform"] = `translate3d(0,${this.height},0)`;
  4601. },
  4602. enter(el, done) {
  4603. setTimeout(() => {
  4604. el.style["transform"] = `translate3d(0,0,0)`;
  4605. }, 0);
  4606. setTimeout(() => {
  4607. el.style["transform"] = `none`;
  4608. done();
  4609. }, 250);
  4610. },
  4611. afterEnter() {
  4612. },
  4613. beforeLeave(el) {
  4614. el.style["transition-duration"] = `250ms`;
  4615. el.style["transform"] = `translate3d(0,0,0)`;
  4616. },
  4617. leave(el, done) {
  4618. let maxHeight = $(".FromBottomDialog").css("max-height");
  4619. el.style["transform"] = `translate3d(0,${maxHeight},0)`;
  4620. setTimeout(done, 250);
  4621. },
  4622. afterLeave() {
  4623. },
  4624. hide(val = false) {
  4625. this.$emit("update:modelValue", val);
  4626. this.$emit("cancel");
  4627. },
  4628. start(e2) {
  4629. if (this.$refs.dialog.scrollTop !== 0)
  4630. return;
  4631. this.startLocationY = e2.touches[0].pageY;
  4632. this.startTime = Date.now();
  4633. this.$refs.dialog.style["transition-duration"] = `0ms`;
  4634. },
  4635. move(e2) {
  4636. if (this.$refs.dialog.scrollTop !== 0)
  4637. return;
  4638. this.moveYDistance = e2.touches[0].pageY - this.startLocationY;
  4639. if (this.moveYDistance > 0) {
  4640. this.$refs.dialog.style["transform"] = `translate3d(0,${this.moveYDistance}px,0)`;
  4641. }
  4642. },
  4643. end(e2) {
  4644. if (Date.now() - this.startTime < 150 && Math.abs(this.moveYDistance) < 30) {
  4645. return;
  4646. }
  4647. if (this.$refs.dialog.scrollTop !== 0)
  4648. return;
  4649. let clientHeight = this.$refs.dialog.clientHeight;
  4650. this.$refs.dialog.style["transition-duration"] = `250ms`;
  4651. if (Math.abs(this.moveYDistance) > clientHeight / 2) {
  4652. this.$refs.dialog.style["transform"] = `translate3d(0,${clientHeight}px,0)`;
  4653. setTimeout(this.hide, 250);
  4654. } else {
  4655. this.$refs.dialog.style["transform"] = `translate3d(0,0,0)`;
  4656. setTimeout(() => {
  4657. if (this.$refs.dialog) {
  4658. this.$refs.dialog.style["transform"] = `none`;
  4659. }
  4660. }, 250);
  4661. }
  4662. this.moveYDistance = 0;
  4663. }
  4664. }
  4665. };
  4666. const __injectCSSVars__ = () => {
  4667. vue.useCssVars((_ctx) => ({
  4668. "0013fa15": _ctx.borderRadius
  4669. }));
  4670. };
  4671. const __setup__ = _sfc_main$a.setup;
  4672. _sfc_main$a.setup = __setup__ ? (props, ctx) => {
  4673. __injectCSSVars__();
  4674. return __setup__(props, ctx);
  4675. } : __injectCSSVars__;
  4676. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-3a54f208"), n2 = n2(), vue.popScopeId(), n2);
  4677. const _hoisted_1$a = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "gang-content" }, null, -1));
  4678. const _hoisted_2$7 = [
  4679. _hoisted_1$a
  4680. ];
  4681. const _hoisted_3$6 = { class: "dialog-wrapper" };
  4682. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4683. return vue.openBlock(), vue.createBlock(vue.Transition, {
  4684. onBeforeEnter: $options.beforeEnter,
  4685. onEnter: $options.enter,
  4686. onAfterEnter: $options.afterEnter,
  4687. onBeforeLeave: $options.beforeLeave,
  4688. onLeave: $options.leave,
  4689. onAfterLeave: $options.afterLeave,
  4690. css: false
  4691. }, {
  4692. default: vue.withCtx(() => [
  4693. $props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", {
  4694. key: 0,
  4695. ref: "dialog",
  4696. class: vue.normalizeClass(["FromBottomDialog", [$props.mode, $props.showHengGang ? "" : "no-heng-gang"]]),
  4697. style: vue.normalizeStyle({ "max-height": $props.height }),
  4698. onTouchstart: _cache[0] || (_cache[0] = (...args) => $options.start && $options.start(...args)),
  4699. onTouchmove: _cache[1] || (_cache[1] = (...args) => $options.move && $options.move(...args)),
  4700. onTouchend: _cache[2] || (_cache[2] = (...args) => $options.end && $options.end(...args))
  4701. }, [
  4702. vue.renderSlot(_ctx.$slots, "header", {}, void 0, true),
  4703. $props.showHengGang ? (vue.openBlock(), vue.createElementBlock("div", {
  4704. key: 0,
  4705. class: vue.normalizeClass(["heng-gang", $props.mode])
  4706. }, _hoisted_2$7, 2)) : vue.createCommentVNode("", true),
  4707. vue.createElementVNode("div", _hoisted_3$6, [
  4708. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  4709. ])
  4710. ], 38)) : vue.createCommentVNode("", true)
  4711. ]),
  4712. _: 3
  4713. }, 8, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"]);
  4714. }
  4715. const FromBottomDialog = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$3], ["__scopeId", "data-v-3a54f208"]]);
  4716. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-ae322b31"), n2 = n2(), vue.popScopeId(), n2);
  4717. const _hoisted_1$9 = { class: "wrapper" };
  4718. const _hoisted_2$6 = { class: "options" };
  4719. const _hoisted_3$5 = { class: "icon-wrap" };
  4720. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "分享", -1));
  4721. const _hoisted_5$4 = { class: "icon-wrap" };
  4722. const _hoisted_6$4 = { class: "icon-wrap" };
  4723. const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4724. const _hoisted_8$3 = { class: "icon-wrap" };
  4725. const _hoisted_9$3 = { class: "icon-wrap" };
  4726. const _hoisted_10$2 = { class: "icon-wrap" };
  4727. const _hoisted_11$2 = { class: "icon-wrap" };
  4728. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制链接", -1));
  4729. const _hoisted_13$2 = { class: "icon-wrap" };
  4730. const _hoisted_14$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制内容", -1));
  4731. const _hoisted_15$1 = { class: "icon-wrap" };
  4732. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "刷新", -1));
  4733. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  4734. __name: "PostOptions",
  4735. props: {
  4736. modelValue: { type: Boolean },
  4737. post: {}
  4738. },
  4739. emits: ["close", "reply", "refresh", "merge", "update:modelValue"],
  4740. setup(__props, { emit: __emit }) {
  4741. let state = vue.reactive({
  4742. timer: null,
  4743. loading: false,
  4744. loading1: false,
  4745. loading2: false,
  4746. loading3: false,
  4747. loading4: false
  4748. });
  4749. const props = __props;
  4750. const emit = __emit;
  4751. const isLogin = vue.inject("isLogin");
  4752. const pageType = vue.inject("pageType");
  4753. const config2 = vue.inject("config");
  4754. function close() {
  4755. emit("close");
  4756. emit("update:modelValue", false);
  4757. }
  4758. function checkIsLogin() {
  4759. if (!isLogin.value) {
  4760. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4761. return false;
  4762. }
  4763. return true;
  4764. }
  4765. async function copyLink() {
  4766. let text = props.post.url;
  4767. if (await copy(text)) {
  4768. close();
  4769. }
  4770. }
  4771. async function copyContent() {
  4772. let text = props.post.headerTemplate;
  4773. text = $(`<div>${text}</div>`).text();
  4774. if (await copy(text)) {
  4775. close();
  4776. }
  4777. }
  4778. function share() {
  4779. var _a;
  4780. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4781. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${props.post.id}?r=${username}&related=v2ex&text=${props.post.title}`;
  4782. window.open(url, "_blank");
  4783. close();
  4784. }
  4785. function reply() {
  4786. if (!checkIsLogin())
  4787. return;
  4788. emit("reply");
  4789. close();
  4790. }
  4791. async function toggleIgnore() {
  4792. if (!checkIsLogin())
  4793. return;
  4794. if (state.loading2)
  4795. return;
  4796. let isIgnore = props.post.isIgnore;
  4797. let url = `${location.origin}/${isIgnore ? "unignore" : "ignore"}/topic/${props.post.id}?once=${props.post.once}`;
  4798. state.loading2 = true;
  4799. let apiRes = await fetch(url);
  4800. state.loading2 = false;
  4801. if (apiRes.redirected) {
  4802. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isIgnore ? "取消成功" : "忽略成功" });
  4803. } else {
  4804. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4805. }
  4806. if (isIgnore) {
  4807. eventBus.emit(CMD.MERGE, { isIgnore: !isIgnore });
  4808. } else {
  4809. if (pageType.value === PageType.Post) {
  4810. location.href = location.origin;
  4811. } else {
  4812. eventBus.emit(CMD.IGNORE);
  4813. }
  4814. }
  4815. eventBus.emit(CMD.REFRESH_ONCE);
  4816. close();
  4817. }
  4818. async function toggleFavorite() {
  4819. if (!checkIsLogin())
  4820. return;
  4821. if (state.loading)
  4822. return;
  4823. let isFavorite = props.post.isFavorite;
  4824. if (!isFavorite && config2.value.collectBrowserNotice) {
  4825. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记添加到书签哦" });
  4826. }
  4827. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${props.post.id}?once=${props.post.once}`;
  4828. state.loading = true;
  4829. let apiRes = await fetch(url);
  4830. state.loading = false;
  4831. if (apiRes.redirected) {
  4832. let htmlText = await apiRes.text();
  4833. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4834. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4835. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? props.post.collectCount - 1 : props.post.collectCount + 1 });
  4836. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4837. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4838. return close();
  4839. }
  4840. }
  4841. eventBus.emit(CMD.REFRESH_ONCE);
  4842. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4843. }
  4844. async function report() {
  4845. if (!checkIsLogin())
  4846. return;
  4847. if (state.loading1)
  4848. return;
  4849. let isReport = props.post.isReport;
  4850. if (isReport) {
  4851. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4852. return;
  4853. }
  4854. let url = `${location.origin}/report/topic/${props.post.id}?once=${props.post.once}`;
  4855. state.loading1 = true;
  4856. let apiRes = await fetch(url);
  4857. state.loading1 = false;
  4858. if (apiRes.redirected) {
  4859. let htmlText = await apiRes.text();
  4860. if (htmlText.search("你已对本主题进行了报告")) {
  4861. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4862. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4863. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4864. return close();
  4865. }
  4866. }
  4867. eventBus.emit(CMD.REFRESH_ONCE);
  4868. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4869. }
  4870. async function thank() {
  4871. if (!isLogin.value) {
  4872. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4873. }
  4874. if (props.post.username === window.user.username) {
  4875. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  4876. }
  4877. let isThanked = props.post.isThanked;
  4878. if (isThanked) {
  4879. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  4880. }
  4881. if (state.loading4)
  4882. return;
  4883. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4884. let url = `${location.origin}/thank/reply/${props.post.id}?once=${props.post.once}`;
  4885. state.loading4 = true;
  4886. await fetch(url);
  4887. state.loading4 = false;
  4888. $.post(url).then((res) => {
  4889. if (!res.success) {
  4890. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4891. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  4892. }
  4893. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  4894. }, (err) => {
  4895. state.loading4 = false;
  4896. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4897. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  4898. eventBus.emit(CMD.REFRESH_ONCE);
  4899. });
  4900. close();
  4901. }
  4902. return (_ctx, _cache) => {
  4903. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  4904. "page-id": "post-detail",
  4905. height: "40rem",
  4906. "model-value": _ctx.modelValue,
  4907. onCancel: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", false))
  4908. }, {
  4909. default: vue.withCtx(() => [
  4910. vue.createElementVNode("div", _hoisted_1$9, [
  4911. vue.createElementVNode("div", _hoisted_2$6, [
  4912. vue.createElementVNode("div", {
  4913. class: "item",
  4914. onClick: share
  4915. }, [
  4916. vue.createElementVNode("div", _hoisted_3$5, [
  4917. vue.createVNode(vue.unref(Icon), {
  4918. color: "rgb(57,174,85)",
  4919. icon: "uil:share"
  4920. })
  4921. ]),
  4922. _hoisted_4$5
  4923. ]),
  4924. vue.createElementVNode("div", {
  4925. class: "item",
  4926. onClick: toggleIgnore
  4927. }, [
  4928. vue.createElementVNode("div", _hoisted_5$4, [
  4929. vue.unref(state).loading2 ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4930. _ctx.post.isIgnore ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4931. key: 0,
  4932. color: "rgb(224,42,42)",
  4933. icon: "mdi:eye-off-outline"
  4934. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4935. key: 1,
  4936. color: "rgb(57,174,85)",
  4937. icon: "mdi:eye-outline"
  4938. }))
  4939. ], 64))
  4940. ]),
  4941. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isIgnore ? "取消" : "") + "忽略", 1)
  4942. ]),
  4943. vue.createElementVNode("div", {
  4944. class: "item",
  4945. onClick: reply
  4946. }, [
  4947. vue.createElementVNode("div", _hoisted_6$4, [
  4948. vue.createVNode(vue.unref(Icon), {
  4949. color: "rgb(57,174,85)",
  4950. icon: "mynaui:message"
  4951. })
  4952. ]),
  4953. _hoisted_7$3
  4954. ]),
  4955. vue.createElementVNode("div", {
  4956. class: "item",
  4957. onClick: thank
  4958. }, [
  4959. vue.createElementVNode("div", _hoisted_8$3, [
  4960. _ctx.post.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4961. key: 0,
  4962. icon: "flat-color-icons:like"
  4963. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4964. key: 1,
  4965. color: "rgb(57,174,85)",
  4966. icon: "icon-park-outline:like"
  4967. }))
  4968. ]),
  4969. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isThanked ? "已" : "") + "感谢", 1)
  4970. ]),
  4971. vue.createElementVNode("div", {
  4972. class: "item",
  4973. onClick: toggleFavorite
  4974. }, [
  4975. vue.createElementVNode("div", _hoisted_9$3, [
  4976. vue.unref(state).loading ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4977. _ctx.post.isFavorite ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4978. key: 0,
  4979. color: "rgb(224,42,42)",
  4980. icon: "iconoir:star-solid"
  4981. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4982. key: 1,
  4983. color: "rgb(57,174,85)",
  4984. icon: "iconoir:star"
  4985. }))
  4986. ], 64))
  4987. ]),
  4988. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isFavorite ? "取消" : "") + "收藏", 1)
  4989. ]),
  4990. vue.createElementVNode("div", {
  4991. class: vue.normalizeClass(["item", [_ctx.post.isReport && "disabled"]]),
  4992. onClick: report
  4993. }, [
  4994. vue.createElementVNode("div", _hoisted_10$2, [
  4995. vue.unref(state).loading1 ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4996. key: 1,
  4997. class: "black",
  4998. icon: "solar:danger-triangle-outline"
  4999. }))
  5000. ]),
  5001. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isReport ? "已报告" : "报告问题"), 1)
  5002. ], 2),
  5003. vue.createElementVNode("div", {
  5004. class: "item",
  5005. onClick: copyLink
  5006. }, [
  5007. vue.createElementVNode("div", _hoisted_11$2, [
  5008. vue.createVNode(vue.unref(Icon), {
  5009. class: "black",
  5010. icon: "solar:link-broken"
  5011. })
  5012. ]),
  5013. _hoisted_12$2
  5014. ]),
  5015. vue.createElementVNode("div", {
  5016. class: "item",
  5017. onClick: copyContent
  5018. }, [
  5019. vue.createElementVNode("div", _hoisted_13$2, [
  5020. vue.createVNode(vue.unref(Icon), {
  5021. class: "black",
  5022. icon: "octicon:copy-24"
  5023. })
  5024. ]),
  5025. _hoisted_14$1
  5026. ]),
  5027. vue.createElementVNode("div", {
  5028. class: "item",
  5029. onClick: _cache[0] || (_cache[0] = ($event) => (emit("refresh"), close()))
  5030. }, [
  5031. vue.createElementVNode("div", _hoisted_15$1, [
  5032. vue.createVNode(vue.unref(Icon), {
  5033. class: "black",
  5034. icon: "ion:refresh"
  5035. })
  5036. ]),
  5037. _hoisted_16$1
  5038. ])
  5039. ]),
  5040. vue.createVNode(FontSizeType),
  5041. vue.createElementVNode("div", {
  5042. class: "cancel",
  5043. onClick: close
  5044. }, "取消")
  5045. ])
  5046. ]),
  5047. _: 1
  5048. }, 8, ["model-value"]);
  5049. };
  5050. }
  5051. });
  5052. const PostOptions = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ae322b31"]]);
  5053. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-8ef13a81"), n2 = n2(), vue.popScopeId(), n2);
  5054. const _hoisted_1$8 = { class: "wrapper" };
  5055. const _hoisted_2$5 = { class: "options" };
  5056. const _hoisted_3$4 = { class: "icon-wrap" };
  5057. const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "忽略", -1));
  5058. const _hoisted_5$3 = { class: "icon-wrap" };
  5059. const _hoisted_6$3 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制", -1));
  5060. const _hoisted_7$2 = { class: "icon-wrap" };
  5061. const _hoisted_8$2 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  5062. const _hoisted_9$2 = { class: "icon-wrap" };
  5063. const _hoisted_10$1 = { class: "icon-wrap" };
  5064. const _hoisted_11$1 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  5065. const _hoisted_12$1 = { class: "icon-wrap" };
  5066. const _hoisted_13$1 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  5067. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  5068. __name: "CommentOptions",
  5069. props: {
  5070. modelValue: { type: Boolean },
  5071. comment: {},
  5072. post: {}
  5073. },
  5074. emits: ["close", "reply", "merge", "update:modelValue"],
  5075. setup(__props, { emit: __emit }) {
  5076. const props = __props;
  5077. const emit = __emit;
  5078. const config2 = vue.inject("config");
  5079. const isLogin = vue.inject("isLogin");
  5080. function close() {
  5081. emit("close");
  5082. emit("update:modelValue", false);
  5083. }
  5084. function checkIsLogin() {
  5085. if (!isLogin.value) {
  5086. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  5087. return false;
  5088. }
  5089. return true;
  5090. }
  5091. async function handleCopy() {
  5092. let text = props.comment.reply_content;
  5093. if (config2.value.commentDisplayType === CommentDisplayType.FloorInFloorNoCallUser) {
  5094. text = props.comment.hideCallUserReplyContent;
  5095. }
  5096. text = $(`<div>${text}</div>`).text();
  5097. if (await copy(text)) {
  5098. close();
  5099. }
  5100. }
  5101. async function hide() {
  5102. if (!checkIsLogin())
  5103. return;
  5104. let url = `${window.baseUrl}/ignore/reply/${props.comment.id}?once=${props.post.once}`;
  5105. eventBus.emit(CMD.REMOVE, props.comment.floor);
  5106. close();
  5107. $.post(url).then((res) => {
  5108. eventBus.emit(CMD.REFRESH_ONCE);
  5109. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  5110. }, (err) => {
  5111. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  5112. });
  5113. }
  5114. function jump() {
  5115. eventBus.emit(CMD.JUMP, props.comment.floor);
  5116. close();
  5117. }
  5118. function showRelationReply() {
  5119. if (!props.comment.replyUsers.length) {
  5120. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  5121. return;
  5122. }
  5123. eventBus.emit(CMD.RELATION_REPLY, {
  5124. left: props.comment.replyUsers,
  5125. right: props.comment.username,
  5126. rightFloor: props.comment.floor
  5127. });
  5128. close();
  5129. }
  5130. function recallThank() {
  5131. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: props.comment.id, type: "recall" });
  5132. }
  5133. function thank() {
  5134. if (!checkIsLogin())
  5135. return;
  5136. if (props.comment.username === window.user.username) {
  5137. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  5138. }
  5139. if (props.comment.isThanked) {
  5140. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  5141. }
  5142. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: props.comment.id, type: "add" });
  5143. let url = `${window.baseUrl}/thank/reply/${props.comment.id}?once=${props.post.once}`;
  5144. $.post(url).then((res) => {
  5145. if (!res.success) {
  5146. recallThank();
  5147. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  5148. }
  5149. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  5150. }, (err) => {
  5151. recallThank();
  5152. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  5153. eventBus.emit(CMD.REFRESH_ONCE);
  5154. });
  5155. close();
  5156. }
  5157. return (_ctx, _cache) => {
  5158. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  5159. "page-id": "post-detail",
  5160. height: "40rem",
  5161. "model-value": _ctx.modelValue,
  5162. onCancel: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", false))
  5163. }, {
  5164. default: vue.withCtx(() => [
  5165. vue.createElementVNode("div", _hoisted_1$8, [
  5166. vue.createElementVNode("div", _hoisted_2$5, [
  5167. vue.createElementVNode("div", {
  5168. class: "item",
  5169. onClick: hide
  5170. }, [
  5171. vue.createElementVNode("div", _hoisted_3$4, [
  5172. vue.createVNode(vue.unref(Icon), { icon: "solar:forbidden-circle-outline" })
  5173. ]),
  5174. _hoisted_4$4
  5175. ]),
  5176. vue.createElementVNode("div", {
  5177. class: "item",
  5178. onClick: handleCopy
  5179. }, [
  5180. vue.createElementVNode("div", _hoisted_5$3, [
  5181. vue.createVNode(vue.unref(Icon), { icon: "octicon:copy-24" })
  5182. ]),
  5183. _hoisted_6$3
  5184. ]),
  5185. vue.createElementVNode("div", {
  5186. class: vue.normalizeClass(["item", [!_ctx.comment.replyUsers.length && "disabled"]]),
  5187. onClick: showRelationReply
  5188. }, [
  5189. vue.createElementVNode("div", _hoisted_7$2, [
  5190. vue.createVNode(vue.unref(Icon), { icon: "iconoir:page-search" })
  5191. ]),
  5192. _hoisted_8$2
  5193. ], 2),
  5194. vue.createElementVNode("div", {
  5195. class: vue.normalizeClass(["item", [_ctx.comment.isThanked && "full"]]),
  5196. onClick: thank
  5197. }, [
  5198. vue.createElementVNode("div", _hoisted_9$2, [
  5199. _ctx.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5200. key: 0,
  5201. icon: "icon-park-solid:like"
  5202. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  5203. key: 1,
  5204. icon: "icon-park-outline:like"
  5205. }))
  5206. ]),
  5207. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.comment.isThanked ? "已" : "") + "感谢", 1)
  5208. ], 2),
  5209. vue.createElementVNode("div", {
  5210. class: "item",
  5211. onClick: _cache[0] || (_cache[0] = ($event) => emit("reply"))
  5212. }, [
  5213. vue.createElementVNode("div", _hoisted_10$1, [
  5214. vue.createVNode(vue.unref(Icon), { icon: "mynaui:message" })
  5215. ]),
  5216. _hoisted_11$1
  5217. ]),
  5218. _ctx.comment.top ? (vue.openBlock(), vue.createElementBlock("div", {
  5219. key: 0,
  5220. class: "item",
  5221. onClick: jump
  5222. }, [
  5223. vue.createElementVNode("div", _hoisted_12$1, [
  5224. vue.createVNode(vue.unref(Icon), { icon: "icon-park-outline:to-bottom" })
  5225. ]),
  5226. _hoisted_13$1
  5227. ])) : vue.createCommentVNode("", true)
  5228. ]),
  5229. vue.createElementVNode("div", {
  5230. class: "cancel",
  5231. onClick: close
  5232. }, "取消")
  5233. ])
  5234. ]),
  5235. _: 1
  5236. }, 8, ["model-value"]);
  5237. };
  5238. }
  5239. });
  5240. const CommentOptions = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-8ef13a81"]]);
  5241. const _hoisted_1$7 = { class: "comments" };
  5242. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  5243. __name: "RelationReply",
  5244. props: {
  5245. modelValue: { type: Boolean },
  5246. relationReply: {},
  5247. targetUser: {},
  5248. post: {}
  5249. },
  5250. emits: ["close", "reply", "merge", "update:modelValue"],
  5251. setup(__props, { emit: __emit }) {
  5252. const emit = __emit;
  5253. vue.inject("config");
  5254. vue.inject("isLogin");
  5255. return (_ctx, _cache) => {
  5256. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  5257. "page-id": "post-detail",
  5258. height: "70vh",
  5259. "model-value": _ctx.modelValue,
  5260. onCancel: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", false))
  5261. }, {
  5262. default: vue.withCtx(() => [
  5263. vue.createElementVNode("div", _hoisted_1$7, [
  5264. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.relationReply, (item, index) => {
  5265. return vue.openBlock(), vue.createBlock(SingleComment, {
  5266. "is-right": item.username === _ctx.targetUser.right,
  5267. key: item.floor,
  5268. comment: item
  5269. }, null, 8, ["is-right", "comment"]);
  5270. }), 128))
  5271. ])
  5272. ]),
  5273. _: 1
  5274. }, 8, ["model-value"]);
  5275. };
  5276. }
  5277. });
  5278. const _sfc_main$6 = {
  5279. name: "detail",
  5280. emits: ["saveReadList", "refresh"],
  5281. components: {
  5282. BackIcon: _sfc_main$p,
  5283. BaseSelect,
  5284. RelationReply: _sfc_main$7,
  5285. CommentOptions,
  5286. FromBottomDialog,
  5287. PostOptions,
  5288. MoreIcon,
  5289. BaseButton,
  5290. SingleComment,
  5291. Comment,
  5292. PostEditor,
  5293. Point,
  5294. Toolbar,
  5295. BaseHtmlRender,
  5296. Tooltip,
  5297. BaseLoading,
  5298. Icon
  5299. },
  5300. inject: ["allReplyUsers", "user", "post", "tags", "isLogin", "config", "pageType", "isNight"],
  5301. props: {
  5302. modelValue: {
  5303. type: Boolean,
  5304. default() {
  5305. return false;
  5306. }
  5307. },
  5308. loading: {
  5309. type: Boolean,
  5310. default() {
  5311. return false;
  5312. }
  5313. },
  5314. refreshLoading: {
  5315. type: Boolean,
  5316. default() {
  5317. return false;
  5318. }
  5319. },
  5320. displayType: CommentDisplayType.FloorInFloorNoCallUser
  5321. },
  5322. data() {
  5323. return {
  5324. isSticky: false,
  5325. showPostOptions: false,
  5326. showCommentOptions: false,
  5327. selectCallIndex: 0,
  5328. showCallList: false,
  5329. showRelationReply: false,
  5330. replyText: "",
  5331. callStyle: {
  5332. top: 0,
  5333. left: 0
  5334. },
  5335. targetUser: {
  5336. left: [],
  5337. right: "",
  5338. rightFloor: -1
  5339. },
  5340. debounceScroll: () => {
  5341. },
  5342. read: {
  5343. floor: 0,
  5344. total: 0
  5345. },
  5346. currentFloor: "",
  5347. showOpTag: false,
  5348. currentComment: null
  5349. };
  5350. },
  5351. computed: {
  5352. eventBus() {
  5353. return eventBus;
  5354. },
  5355. CMD() {
  5356. return CMD;
  5357. },
  5358. replyUser() {
  5359. if (this.currentComment)
  5360. return this.currentComment.username;
  5361. return null;
  5362. },
  5363. replyFloor() {
  5364. if (this.currentComment)
  5365. return this.currentComment.floor;
  5366. return null;
  5367. },
  5368. isMy() {
  5369. return this.post.member.username === window.user.username;
  5370. },
  5371. myTags() {
  5372. return this.tags[this.post.member.username] ?? [];
  5373. },
  5374. CommentDisplayType() {
  5375. return CommentDisplayType;
  5376. },
  5377. isPost() {
  5378. return this.pageType === PageType.Post;
  5379. },
  5380. filterCallList() {
  5381. if (this.showCallList) {
  5382. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  5383. if (this.replyText)
  5384. return list.filter((i) => i.search(this.replyText) > -1);
  5385. return list;
  5386. }
  5387. return [];
  5388. },
  5389. topReply() {
  5390. return this.post.replyList.filter((v) => v.thankCount >= this.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, this.config.topReplyCount);
  5391. },
  5392. replyList() {
  5393. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  5394. return this.post.nestedReplies;
  5395. if (this.displayType === CommentDisplayType.Like) {
  5396. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  5397. }
  5398. if (this.displayType === CommentDisplayType.V2exOrigin)
  5399. return this.post.replyList;
  5400. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  5401. return this.post.nestedRedundReplies;
  5402. if (this.displayType === CommentDisplayType.OnlyOp)
  5403. return this.post.replyList.filter((v) => {
  5404. var _a;
  5405. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  5406. });
  5407. return [];
  5408. },
  5409. //关联回复
  5410. relationReply() {
  5411. if (this.targetUser.left.length && this.targetUser.right) {
  5412. return this.post.replyList.filter((v) => {
  5413. if (this.targetUser.left.includes(v.username)) {
  5414. if (v.floor > this.targetUser.rightFloor) {
  5415. if (v.replyUsers.includes(this.targetUser.right)) {
  5416. return true;
  5417. }
  5418. } else {
  5419. return true;
  5420. }
  5421. }
  5422. if (v.username === this.targetUser.right) {
  5423. for (let i = 0; i < this.targetUser.left.length; i++) {
  5424. if (v.replyUsers.includes(this.targetUser.left[i])) {
  5425. return true;
  5426. }
  5427. }
  5428. }
  5429. });
  5430. }
  5431. return [];
  5432. }
  5433. },
  5434. watch: {
  5435. "post.id"(n2, o) {
  5436. if (this.$refs["post-editor"]) {
  5437. this.$refs["post-editor"].content = "";
  5438. vue.nextTick(() => {
  5439. this.scrollTop(false);
  5440. });
  5441. }
  5442. },
  5443. "post.headerTemplate"(n2, o) {
  5444. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  5445. if (mountEl) {
  5446. this.showOpTag = true;
  5447. }
  5448. },
  5449. modelValue: {
  5450. handler(newVal) {
  5451. if (this.isPost) {
  5452. return;
  5453. }
  5454. if (newVal) {
  5455. if (!window.history.state) {
  5456. window.history.pushState({}, 0, this.post.href);
  5457. }
  5458. this.read = this.post.read;
  5459. this.currentFloor = "";
  5460. vue.nextTick(() => {
  5461. window.document.title = this.post.title ?? "V2EX";
  5462. });
  5463. } else {
  5464. this.$emit("saveReadList");
  5465. window.document.title = "V2EX";
  5466. this.isSticky = false;
  5467. this.showRelationReply = false;
  5468. if (window.history.state) {
  5469. window.history.back();
  5470. }
  5471. }
  5472. }
  5473. }
  5474. },
  5475. mounted() {
  5476. this.debounceScroll = debounce(this.scroll, 300, false);
  5477. if (this.isLogin) {
  5478. const observer = new IntersectionObserver(
  5479. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  5480. { threshold: [1] }
  5481. );
  5482. observer.observe(this.$refs.replyBox);
  5483. window.addEventListener("keydown", this.onKeyDown);
  5484. }
  5485. eventBus.on(CMD.SHOW_CALL, (val) => {
  5486. if (val.show) {
  5487. this.showCallList = true;
  5488. this.replyText = val.text;
  5489. if (this.isPost) {
  5490. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  5491. } else {
  5492. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  5493. }
  5494. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  5495. if (this.selectCallIndex >= this.filterCallList.length) {
  5496. this.selectCallIndex = 0;
  5497. }
  5498. } else {
  5499. this.replyText = "";
  5500. this.showCallList = false;
  5501. this.selectCallIndex = 0;
  5502. }
  5503. });
  5504. eventBus.on(CMD.RELATION_REPLY, (val) => {
  5505. this.targetUser = val;
  5506. this.showRelationReply = true;
  5507. });
  5508. eventBus.on(CMD.JUMP, this.jump);
  5509. if (this.isPost) {
  5510. window.addEventListener("scroll", this.debounceScroll);
  5511. }
  5512. eventBus.on(CMD.SHOW_COMMENT_OPTIONS, (comment) => {
  5513. this.currentComment = comment;
  5514. this.showCommentOptions = true;
  5515. });
  5516. eventBus.on(CMD.SHOW_EDITOR, (comment) => {
  5517. this.currentComment = comment;
  5518. this.isSticky = true;
  5519. setTimeout(() => {
  5520. var _a;
  5521. (_a = this.$refs["post-editor"]) == null ? void 0 : _a.focus();
  5522. }, 300);
  5523. });
  5524. },
  5525. beforeUnmount() {
  5526. window.removeEventListener("keydown", this.onKeyDown);
  5527. eventBus.off(CMD.SHOW_CALL);
  5528. },
  5529. methods: {
  5530. clickAvatar() {
  5531. window.functions.clickAvatar(".post-wrapper ");
  5532. },
  5533. addTag() {
  5534. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  5535. },
  5536. removeTag(tag) {
  5537. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  5538. },
  5539. scroll() {
  5540. if (!this.config.rememberLastReadFloor)
  5541. return;
  5542. let height = window.innerHeight * 0.3;
  5543. let comments = $(".comments .comment");
  5544. let forCount = 0;
  5545. for (let i = 0; i < comments.length; i++) {
  5546. forCount++;
  5547. let ins = comments[i];
  5548. let rect = ins.getBoundingClientRect();
  5549. if (rect.top > height) {
  5550. let lastReadFloor = Number(ins.dataset["floor"]);
  5551. console.log("当前阅读楼层", lastReadFloor);
  5552. eventBus.emit(CMD.ADD_READ, {
  5553. floor: lastReadFloor > 3 ? lastReadFloor : 0,
  5554. total: this.post.replyList.length
  5555. });
  5556. if (lastReadFloor > 3) {
  5557. this.read.floor = 0;
  5558. }
  5559. break;
  5560. }
  5561. }
  5562. if (forCount === comments.length) {
  5563. console.log("看到最后了");
  5564. eventBus.emit(CMD.ADD_READ, {
  5565. floor: forCount,
  5566. total: this.post.replyList.length
  5567. });
  5568. }
  5569. },
  5570. jump(floor) {
  5571. let lastItem = this.replyList[this.replyList.length - 1];
  5572. if (floor === "") {
  5573. floor = lastItem.floor;
  5574. } else {
  5575. try {
  5576. floor = Number(floor);
  5577. } catch (e2) {
  5578. floor = lastItem.floor;
  5579. }
  5580. if (floor === 0) {
  5581. floor = 1;
  5582. }
  5583. if (floor > lastItem.floor)
  5584. floor = lastItem.floor;
  5585. }
  5586. if (!this.post.replyList.length) {
  5587. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  5588. this.read.floor = 0;
  5589. return;
  5590. }
  5591. if (floor > this.post.replyList.length) {
  5592. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5593. this.read.floor = 0;
  5594. return;
  5595. }
  5596. let comment = $(`.c_${floor}`);
  5597. if (!comment.length) {
  5598. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5599. this.read.floor = 0;
  5600. return;
  5601. }
  5602. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  5603. comment.addClass("ding");
  5604. this.read.floor = 0;
  5605. this.currentFloor = floor + 1;
  5606. setTimeout(() => {
  5607. comment.removeClass("ding");
  5608. }, 2e3);
  5609. },
  5610. jumpLastRead(floor) {
  5611. if (this.config.autoJumpLastReadFloor) {
  5612. if (!floor)
  5613. return;
  5614. setTimeout(() => {
  5615. console.log("上次跳转", floor);
  5616. this.jump(floor);
  5617. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "已跳转到上次阅读位置" });
  5618. }, 300);
  5619. }
  5620. },
  5621. collapseTopReplyList() {
  5622. $(this.$refs.topReply).slideToggle("fast");
  5623. },
  5624. goBottom() {
  5625. this.isSticky = false;
  5626. setTimeout(() => {
  5627. let postWrapper = document.querySelector(".post-wrapper");
  5628. postWrapper.scrollTo({ top: this.$refs["detail"].clientHeight, behavior: "smooth" });
  5629. });
  5630. },
  5631. close() {
  5632. this.$emit("update:modelValue", false);
  5633. },
  5634. setCall(e2) {
  5635. eventBus.emit(CMD.SET_CALL, e2);
  5636. this.showCallList = false;
  5637. },
  5638. onKeyDown(e2) {
  5639. if (!this.modelValue)
  5640. return;
  5641. if (!this.showCallList)
  5642. return;
  5643. let length = this.filterCallList.slice(0, 10).length;
  5644. if (e2.keyCode === 13) {
  5645. this.setCall(this.filterCallList[this.selectCallIndex]);
  5646. e2.preventDefault();
  5647. }
  5648. if (e2.keyCode === 38) {
  5649. this.selectCallIndex--;
  5650. if (this.selectCallIndex < 0) {
  5651. this.selectCallIndex = length - 1;
  5652. }
  5653. e2.preventDefault();
  5654. }
  5655. if (e2.keyCode === 40) {
  5656. this.selectCallIndex++;
  5657. if (this.selectCallIndex > length - 1) {
  5658. this.selectCallIndex = 0;
  5659. }
  5660. e2.preventDefault();
  5661. }
  5662. },
  5663. scrollTop(anim = true) {
  5664. document.querySelector(".post-wrapper").scrollTo({ top: 0, behavior: anim ? "smooth" : "instant" });
  5665. }
  5666. }
  5667. };
  5668. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-546d3b11"), n2 = n2(), vue.popScopeId(), n2);
  5669. const _hoisted_1$6 = { class: "left" };
  5670. const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5671. const _hoisted_3$3 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5672. const _hoisted_4$3 = ["href"];
  5673. const _hoisted_5$2 = { class: "right" };
  5674. const _hoisted_6$2 = ["src"];
  5675. const _hoisted_7$1 = { class: "my-box post-main-body" };
  5676. const _hoisted_8$1 = { class: "box-content" };
  5677. const _hoisted_9$1 = { class: "box-header" };
  5678. const _hoisted_10 = { class: "gray" };
  5679. const _hoisted_11 = ["href"];
  5680. const _hoisted_12 = ["src"];
  5681. const _hoisted_13 = { class: "info" };
  5682. const _hoisted_14 = { class: "top" };
  5683. const _hoisted_15 = ["href"];
  5684. const _hoisted_16 = {
  5685. key: 0,
  5686. class: "center"
  5687. };
  5688. const _hoisted_17 = { class: "my-tag" };
  5689. const _hoisted_18 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5690. const _hoisted_19 = ["onClick"];
  5691. const _hoisted_20 = { class: "bottom" };
  5692. const _hoisted_21 = ["title"];
  5693. const _hoisted_22 = ["href"];
  5694. const _hoisted_23 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-info-circle" }, null, -1));
  5695. const _hoisted_24 = [
  5696. _hoisted_23
  5697. ];
  5698. const _hoisted_25 = ["href"];
  5699. const _hoisted_26 = {
  5700. key: 0,
  5701. class: "my-box"
  5702. };
  5703. const _hoisted_27 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "" }, "高赞回复", -1));
  5704. const _hoisted_28 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "top-reply" }, [
  5705. /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-compress" })
  5706. ], -1));
  5707. const _hoisted_29 = [
  5708. _hoisted_27,
  5709. _hoisted_28
  5710. ];
  5711. const _hoisted_30 = { ref: "topReply" };
  5712. const _hoisted_31 = {
  5713. key: 1,
  5714. class: "my-cell flex comments-header"
  5715. };
  5716. const _hoisted_32 = {
  5717. key: 2,
  5718. class: "my-box comment-wrapper"
  5719. };
  5720. const _hoisted_33 = {
  5721. key: 0,
  5722. class: "loading-wrapper"
  5723. };
  5724. const _hoisted_34 = {
  5725. key: 1,
  5726. class: "comments"
  5727. };
  5728. const _hoisted_35 = {
  5729. key: 3,
  5730. id: "no-comments-yet"
  5731. };
  5732. const _hoisted_36 = { class: "my-cell flex" };
  5733. const _hoisted_37 = { class: "notice-right gray" };
  5734. const _hoisted_38 = { class: "p1" };
  5735. const _hoisted_39 = ["onClick"];
  5736. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5737. const _component_BackIcon = vue.resolveComponent("BackIcon");
  5738. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5739. const _component_MoreIcon = vue.resolveComponent("MoreIcon");
  5740. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5741. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5742. const _component_Comment = vue.resolveComponent("Comment");
  5743. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5744. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5745. const _component_post_options = vue.resolveComponent("post-options");
  5746. const _component_comment_options = vue.resolveComponent("comment-options");
  5747. const _component_relation_reply = vue.resolveComponent("relation-reply");
  5748. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: ".post-wrapper" }, [
  5749. vue.createElementVNode("div", {
  5750. class: vue.normalizeClass(["post-detail", [
  5751. $options.isNight ? "isNight" : "",
  5752. $options.pageType
  5753. ]]),
  5754. ref: "detail",
  5755. id: "post-detail",
  5756. onScroll: _cache[20] || (_cache[20] = (...args) => $data.debounceScroll && $data.debounceScroll(...args))
  5757. }, [
  5758. vue.createElementVNode("div", {
  5759. class: "my-box nav-bar",
  5760. onDblclick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  5761. }, [
  5762. vue.createElementVNode("div", _hoisted_1$6, [
  5763. !$options.isPost ? (vue.openBlock(), vue.createBlock(_component_BackIcon, {
  5764. key: 0,
  5765. onClick: vue.withModifiers($options.close, ["stop"])
  5766. }, null, 8, ["onClick"])) : vue.createCommentVNode("", true),
  5767. $options.isPost ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5768. _hoisted_2$4,
  5769. _hoisted_3$3
  5770. ], 64)) : vue.createCommentVNode("", true),
  5771. vue.createElementVNode("a", {
  5772. href: $options.post.node.url
  5773. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_4$3)
  5774. ]),
  5775. vue.createElementVNode("div", _hoisted_5$2, [
  5776. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : vue.createCommentVNode("", true),
  5777. vue.createVNode(_component_MoreIcon, {
  5778. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => $data.showPostOptions = true, ["stop"]))
  5779. }),
  5780. $options.user.avatar ? (vue.openBlock(), vue.createElementBlock("img", {
  5781. key: 1,
  5782. onClick: _cache[1] || (_cache[1] = (...args) => $options.clickAvatar && $options.clickAvatar(...args)),
  5783. style: { "margin-right": "0" },
  5784. class: "avatar mobile",
  5785. src: $options.user.avatar
  5786. }, null, 8, _hoisted_6$2)) : vue.createCommentVNode("", true)
  5787. ])
  5788. ], 32),
  5789. vue.createElementVNode("div", _hoisted_7$1, [
  5790. vue.createElementVNode("div", _hoisted_8$1, [
  5791. vue.createElementVNode("div", _hoisted_9$1, [
  5792. vue.createElementVNode("small", _hoisted_10, [
  5793. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("a", {
  5794. key: 0,
  5795. class: "base-avatar",
  5796. href: `/member/${$options.post.member.username}`
  5797. }, [
  5798. vue.createElementVNode("img", {
  5799. src: $options.post.member.avatar_large
  5800. }, null, 8, _hoisted_12)
  5801. ], 8, _hoisted_11)) : vue.createCommentVNode("", true),
  5802. vue.createElementVNode("div", _hoisted_13, [
  5803. vue.createElementVNode("div", _hoisted_14, [
  5804. vue.createElementVNode("a", {
  5805. href: `/member/${$options.post.member.username}`
  5806. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_15),
  5807. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5808. vue.createTextVNode(" · "),
  5809. vue.createElementVNode("span", {
  5810. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5811. }, vue.toDisplayString($options.post.member.createDate), 3)
  5812. ], 64)) : vue.createCommentVNode("", true)
  5813. ]),
  5814. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
  5815. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5816. return vue.openBlock(), vue.createElementBlock("span", _hoisted_17, [
  5817. _hoisted_18,
  5818. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5819. vue.createElementVNode("i", {
  5820. class: "fa fa-trash-o remove",
  5821. onClick: ($event) => $options.removeTag(i)
  5822. }, null, 8, _hoisted_19)
  5823. ]);
  5824. }), 256)),
  5825. vue.createElementVNode("span", {
  5826. class: "add-tag ago",
  5827. onClick: _cache[3] || (_cache[3] = (...args) => $options.addTag && $options.addTag(...args)),
  5828. title: "添加标签"
  5829. }, "+")
  5830. ])) : vue.createCommentVNode("", true),
  5831. vue.createElementVNode("div", _hoisted_20, [
  5832. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5833. vue.createElementVNode("span", {
  5834. title: $options.post.createDate
  5835. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_21),
  5836. vue.createTextVNode(" · ")
  5837. ], 64)) : vue.createCommentVNode("", true),
  5838. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5839. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5840. vue.createTextVNode("   "),
  5841. vue.createElementVNode("a", {
  5842. href: `/t/${$options.post.id}/info`
  5843. }, _hoisted_24, 8, _hoisted_22),
  5844. vue.createTextVNode("   "),
  5845. vue.createElementVNode("a", {
  5846. href: `/append/topic/${$options.post.id}`,
  5847. class: "op"
  5848. }, "APPEND", 8, _hoisted_25)
  5849. ], 64)) : vue.createCommentVNode("", true)
  5850. ])
  5851. ])
  5852. ]),
  5853. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1)
  5854. ]),
  5855. vue.createVNode(_component_BaseHtmlRender, {
  5856. html: $options.post.headerTemplate
  5857. }, null, 8, ["html"])
  5858. ]),
  5859. vue.createVNode(_component_Toolbar, {
  5860. onReply: _cache[4] || (_cache[4] = ($event) => {
  5861. $data.isSticky = !$data.isSticky;
  5862. $data.currentComment = null;
  5863. })
  5864. })
  5865. ]),
  5866. $options.topReply.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_26, [
  5867. vue.createElementVNode("div", {
  5868. class: "my-cell flex",
  5869. onClick: _cache[5] || (_cache[5] = (...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args))
  5870. }, _hoisted_29),
  5871. vue.createElementVNode("div", _hoisted_30, [
  5872. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.topReply, (item, index) => {
  5873. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5874. key: item.floor,
  5875. type: "top",
  5876. modelValue: $options.topReply[index],
  5877. "onUpdate:modelValue": ($event) => $options.topReply[index] = $event
  5878. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5879. }), 128))
  5880. ], 512)
  5881. ])) : vue.createCommentVNode("", true),
  5882. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_31, [
  5883. vue.createElementVNode("span", null, vue.toDisplayString($options.post.replyCount) + " 条回复", 1),
  5884. vue.createVNode(_component_BaseSelect, {
  5885. "display-type": $props.displayType,
  5886. "onUpdate:displayType": _cache[6] || (_cache[6] = (e2) => _ctx.$emit("update:displayType", e2))
  5887. }, null, 8, ["display-type"])
  5888. ])) : vue.createCommentVNode("", true),
  5889. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_32, [
  5890. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_33, [
  5891. vue.createVNode(_component_BaseLoading, { size: "large" })
  5892. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_34, [
  5893. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index) => {
  5894. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5895. key: item.floor,
  5896. modelValue: $options.replyList[index],
  5897. "onUpdate:modelValue": ($event) => $options.replyList[index] = $event
  5898. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5899. }), 128)) : vue.createCommentVNode("", true)
  5900. ]))
  5901. ])) : vue.createCommentVNode("", true),
  5902. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_35, "目前尚无回复")) : vue.createCommentVNode("", true),
  5903. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  5904. key: 4,
  5905. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  5906. ref: "replyBox"
  5907. }, [
  5908. vue.createElementVNode("div", _hoisted_36, [
  5909. vue.createElementVNode("span", null, vue.toDisplayString($data.currentComment ? `回复${$data.currentComment.floor}楼` : "回复主题"), 1),
  5910. vue.createElementVNode("div", _hoisted_37, [
  5911. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  5912. key: 0,
  5913. style: { "margin-right": "2rem" },
  5914. onClick: _cache[7] || (_cache[7] = ($event) => {
  5915. $data.isSticky = false;
  5916. $data.currentComment = null;
  5917. })
  5918. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  5919. vue.createElementVNode("a", {
  5920. onClick: _cache[8] || (_cache[8] = (...args) => $options.scrollTop && $options.scrollTop(...args))
  5921. }, "回到顶部")
  5922. ])
  5923. ]),
  5924. vue.createElementVNode("div", _hoisted_38, [
  5925. vue.createVNode(_component_PostEditor, {
  5926. onClose: $options.goBottom,
  5927. ref: "post-editor",
  5928. useType: $data.currentComment ? "reply-comment" : "reply-post",
  5929. replyUser: $options.replyUser,
  5930. replyFloor: $options.replyFloor,
  5931. onClick: _cache[9] || (_cache[9] = ($event) => $data.isSticky = true)
  5932. }, null, 8, ["onClose", "useType", "replyUser", "replyFloor"])
  5933. ])
  5934. ], 2)) : vue.createCommentVNode("", true),
  5935. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  5936. key: 5,
  5937. class: "call-list",
  5938. style: vue.normalizeStyle($data.callStyle)
  5939. }, [
  5940. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index) => {
  5941. return vue.openBlock(), vue.createElementBlock("div", {
  5942. class: vue.normalizeClass(["call-item", { select: index === $data.selectCallIndex }]),
  5943. onClick: ($event) => $options.setCall(item)
  5944. }, [
  5945. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  5946. ], 10, _hoisted_39);
  5947. }), 256))
  5948. ], 4)) : vue.createCommentVNode("", true),
  5949. vue.createVNode(_component_post_options, {
  5950. onMerge: _cache[10] || (_cache[10] = (val) => {
  5951. $options.post = Object.assign($options.post, val);
  5952. console.log("va", val, $options.post);
  5953. }),
  5954. post: $options.post,
  5955. onReply: _cache[11] || (_cache[11] = ($event) => ($options.eventBus.emit($options.CMD.SHOW_EDITOR, null), $data.showPostOptions = false)),
  5956. onRefresh: _cache[12] || (_cache[12] = ($event) => _ctx.$emit("refresh")),
  5957. modelValue: $data.showPostOptions,
  5958. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.showPostOptions = $event)
  5959. }, null, 8, ["post", "modelValue"]),
  5960. vue.createVNode(_component_comment_options, {
  5961. onMerge: _cache[14] || (_cache[14] = (val) => $data.currentComment = Object.assign($data.currentComment, val)),
  5962. onRecallThank: _cache[15] || (_cache[15] = ($event) => $data.currentComment.isThanked = false),
  5963. post: $options.post,
  5964. comment: $data.currentComment,
  5965. onClose: _cache[16] || (_cache[16] = ($event) => $data.currentComment = null),
  5966. onReply: _cache[17] || (_cache[17] = ($event) => ($options.eventBus.emit($options.CMD.SHOW_EDITOR, $data.currentComment), $data.showCommentOptions = false)),
  5967. modelValue: $data.showCommentOptions,
  5968. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.showCommentOptions = $event)
  5969. }, null, 8, ["post", "comment", "modelValue"]),
  5970. vue.createVNode(_component_relation_reply, {
  5971. post: $options.post,
  5972. "relation-reply": $options.relationReply,
  5973. modelValue: $data.showRelationReply,
  5974. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.showRelationReply = $event),
  5975. "target-user": $data.targetUser
  5976. }, null, 8, ["post", "relation-reply", "modelValue", "target-user"])
  5977. ], 34)
  5978. ]);
  5979. }
  5980. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-546d3b11"]]);
  5981. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-1988f33b"), n2 = n2(), vue.popScopeId(), n2);
  5982. const _hoisted_1$5 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  5983. width: "24",
  5984. height: "24",
  5985. viewBox: "0 0 48 48",
  5986. fill: "none",
  5987. xmlns: "http://www.w3.org/2000/svg"
  5988. }, [
  5989. /* @__PURE__ */ vue.createElementVNode("path", {
  5990. d: "M17 32L19.1875 27M31 32L28.8125 27M19.1875 27L24 16L28.8125 27M19.1875 27H28.8125",
  5991. stroke: "#929596",
  5992. "stroke-width": "4",
  5993. "stroke-linecap": "round",
  5994. "stroke-linejoin": "round"
  5995. }),
  5996. /* @__PURE__ */ vue.createElementVNode("path", {
  5997. d: "M43.1999 20C41.3468 10.871 33.2758 4 23.5999 4C13.9241 4 5.85308 10.871 4 20L10 18",
  5998. stroke: "#929596",
  5999. "stroke-width": "4",
  6000. "stroke-linecap": "round",
  6001. "stroke-linejoin": "round"
  6002. }),
  6003. /* @__PURE__ */ vue.createElementVNode("path", {
  6004. d: "M4 28C5.85308 37.129 13.9241 44 23.5999 44C33.2758 44 41.3468 37.129 43.1999 28L38 30",
  6005. stroke: "#929596",
  6006. "stroke-width": "4",
  6007. "stroke-linecap": "round",
  6008. "stroke-linejoin": "round"
  6009. })
  6010. ], -1));
  6011. const _hoisted_2$3 = { key: 1 };
  6012. const _sfc_main$5 = {
  6013. __name: "Base64Tooltip",
  6014. setup(__props) {
  6015. const tooltip = vue.ref(null);
  6016. const show = vue.ref(false);
  6017. const originalText = vue.ref("");
  6018. const decodeText = vue.ref("");
  6019. const styleObject = vue.reactive({
  6020. left: "-100vw",
  6021. top: "-100vh"
  6022. });
  6023. vue.onMounted(() => {
  6024. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  6025. setTimeout(() => show.value = true);
  6026. originalText.value = text;
  6027. decodeText.value = "";
  6028. styleObject.left = e2.clientX + "px";
  6029. styleObject.top = e2.clientY + 20 + "px";
  6030. });
  6031. window.addEventListener("click", (e2) => {
  6032. if (!tooltip.value)
  6033. return;
  6034. if (!tooltip.value.contains(e2.target) && show.value) {
  6035. show.value = false;
  6036. }
  6037. }, { capture: true });
  6038. const fn = () => show.value && (show.value = false);
  6039. $(".post-detail", window.win().doc).on("scroll", fn);
  6040. });
  6041. function base64ToArrayBuffer(base64) {
  6042. let binary_string = window.atob(base64);
  6043. let len = binary_string.length;
  6044. let bytes = new Uint8Array(len);
  6045. for (let i = 0; i < len; i++) {
  6046. bytes[i] = binary_string.charCodeAt(i);
  6047. }
  6048. return bytes.buffer;
  6049. }
  6050. function decode() {
  6051. try {
  6052. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  6053. decodeText.value = r2;
  6054. });
  6055. } catch (e2) {
  6056. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  6057. }
  6058. }
  6059. return (_ctx, _cache) => {
  6060. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  6061. class: "base64_tooltip",
  6062. style: vue.normalizeStyle(styleObject),
  6063. onClick: decode,
  6064. ref_key: "tooltip",
  6065. ref: tooltip
  6066. }, [
  6067. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6068. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  6069. _hoisted_1$5
  6070. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
  6071. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  6072. vue.createVNode(BaseButton, {
  6073. class: "btn",
  6074. size: "small",
  6075. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(copy)(decodeText.value))
  6076. }, {
  6077. default: vue.withCtx(() => [
  6078. vue.createTextVNode("点击复制")
  6079. ]),
  6080. _: 1
  6081. })
  6082. ]))
  6083. ], 4)), [
  6084. [vue.vShow, show.value]
  6085. ]);
  6086. };
  6087. }
  6088. };
  6089. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1988f33b"]]);
  6090. const _sfc_main$4 = {
  6091. name: "Msg",
  6092. components: { Icon },
  6093. props: {
  6094. type: "",
  6095. text: ""
  6096. },
  6097. created() {
  6098. setTimeout(() => {
  6099. this.$emit("close");
  6100. }, 3e3);
  6101. }
  6102. };
  6103. const _hoisted_1$4 = { class: "right" };
  6104. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  6105. const _component_Icon = vue.resolveComponent("Icon");
  6106. return vue.openBlock(), vue.createElementBlock("div", {
  6107. class: vue.normalizeClass(["msg", $props.type])
  6108. }, [
  6109. vue.createElementVNode("div", {
  6110. class: "left",
  6111. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  6112. }, [
  6113. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  6114. ]),
  6115. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  6116. ], 2);
  6117. }
  6118. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-0dcc0508"]]);
  6119. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-674b86aa"), n2 = n2(), vue.popScopeId(), n2);
  6120. const _hoisted_1$3 = {
  6121. key: 0,
  6122. class: "tag-modal modal"
  6123. };
  6124. const _hoisted_2$2 = { class: "wrapper" };
  6125. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  6126. const _hoisted_4$2 = { class: "option" };
  6127. const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  6128. const _hoisted_6$1 = { class: "btns" };
  6129. const _sfc_main$3 = {
  6130. __name: "TagModal",
  6131. props: ["tags"],
  6132. emits: ["update:tags"],
  6133. setup(__props, { emit: __emit }) {
  6134. const tagModal = vue.reactive({
  6135. show: false,
  6136. currentUsername: "",
  6137. tag: ""
  6138. });
  6139. const props = __props;
  6140. const emit = __emit;
  6141. const inputRef = vue.ref();
  6142. vue.onMounted(() => {
  6143. eventBus.on(CMD.ADD_TAG, (username) => {
  6144. tagModal.currentUsername = username;
  6145. tagModal.show = true;
  6146. vue.nextTick(() => {
  6147. inputRef.value.focus();
  6148. });
  6149. });
  6150. });
  6151. async function addTag() {
  6152. if (!tagModal.tag) {
  6153. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  6154. return;
  6155. }
  6156. let oldTag = window.clone(props.tags);
  6157. let tempTag = window.clone(props.tags);
  6158. let userTags = tempTag[tagModal.currentUsername] ?? [];
  6159. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  6160. if (rIndex > -1) {
  6161. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  6162. return;
  6163. } else {
  6164. userTags.push(tagModal.tag);
  6165. }
  6166. tempTag[tagModal.currentUsername] = userTags;
  6167. emit("update:tags", tempTag);
  6168. tagModal.tag = "";
  6169. tagModal.show = false;
  6170. let res = await window.parse.saveTags(tempTag);
  6171. if (!res) {
  6172. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  6173. emit("update:tags", oldTag);
  6174. }
  6175. }
  6176. return (_ctx, _cache) => {
  6177. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6178. default: vue.withCtx(() => [
  6179. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  6180. vue.createElementVNode("div", {
  6181. class: "mask",
  6182. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  6183. }),
  6184. vue.createElementVNode("div", _hoisted_2$2, [
  6185. _hoisted_3$2,
  6186. vue.createElementVNode("div", _hoisted_4$2, [
  6187. _hoisted_5$1,
  6188. vue.createElementVNode("div", null, [
  6189. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  6190. ])
  6191. ]),
  6192. vue.withDirectives(vue.createElementVNode("input", {
  6193. type: "text",
  6194. ref_key: "inputRef",
  6195. ref: inputRef,
  6196. style: { "width": "100%" },
  6197. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  6198. onKeydown: vue.withKeys(addTag, ["enter"])
  6199. }, null, 544), [
  6200. [vue.vModelText, tagModal.tag]
  6201. ]),
  6202. vue.createElementVNode("div", _hoisted_6$1, [
  6203. vue.createVNode(BaseButton, {
  6204. type: "link",
  6205. onClick: _cache[2] || (_cache[2] = ($event) => tagModal.show = false)
  6206. }, {
  6207. default: vue.withCtx(() => [
  6208. vue.createTextVNode("取消")
  6209. ]),
  6210. _: 1
  6211. }),
  6212. vue.createVNode(BaseButton, { onClick: addTag }, {
  6213. default: vue.withCtx(() => [
  6214. vue.createTextVNode("确定")
  6215. ]),
  6216. _: 1
  6217. })
  6218. ])
  6219. ])
  6220. ])) : vue.createCommentVNode("", true)
  6221. ]),
  6222. _: 1
  6223. });
  6224. };
  6225. }
  6226. };
  6227. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-674b86aa"]]);
  6228. const _hoisted_1$2 = { class: "msgs" };
  6229. const _sfc_main$2 = {
  6230. __name: "MsgModal",
  6231. setup(__props) {
  6232. const msgList = vue.reactive([
  6233. // {type: 'success', text: '123', id: Date.now()}
  6234. ]);
  6235. vue.onMounted(() => {
  6236. eventBus.on(CMD.SHOW_MSG, (val) => {
  6237. msgList.push({ ...val, id: Date.now() });
  6238. });
  6239. });
  6240. function removeMsg(id) {
  6241. let rIndex = msgList.findIndex((item) => item.id === id);
  6242. if (rIndex > -1) {
  6243. msgList.splice(rIndex, 1);
  6244. }
  6245. }
  6246. return (_ctx, _cache) => {
  6247. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  6248. vue.createElementVNode("div", _hoisted_1$2, [
  6249. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  6250. return vue.openBlock(), vue.createBlock(Msg, {
  6251. key: v.id,
  6252. type: v.type,
  6253. text: v.text,
  6254. onClose: ($event) => removeMsg(v.id)
  6255. }, null, 8, ["type", "text", "onClose"]);
  6256. }), 128))
  6257. ])
  6258. ]);
  6259. };
  6260. }
  6261. };
  6262. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-93c4dec0"]]);
  6263. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  6264. function e(e2) {
  6265. console.error(e2);
  6266. }
  6267. function r(e2, t) {
  6268. let r2 = e2.substr(t, 2);
  6269. return parseInt(r2, 16);
  6270. }
  6271. function n(href, index) {
  6272. let o = "", a = r(href, index);
  6273. for (let i = index + 2; i < href.length; i += 2) {
  6274. let l = r(href, i) ^ a;
  6275. o += String.fromCharCode(l);
  6276. }
  6277. try {
  6278. o = decodeURIComponent(escape(o));
  6279. } catch (u2) {
  6280. e(u2);
  6281. }
  6282. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  6283. return d.childNodes[0].getAttribute("href") || "";
  6284. }
  6285. function decodeEmail(body) {
  6286. try {
  6287. let as = body.find(u);
  6288. as.each(function() {
  6289. try {
  6290. let o = this, a = o.parentNode, i = o.getAttribute(f);
  6291. if (i) {
  6292. let l = n(i, 0), d2 = document.createTextNode(l);
  6293. a.replaceChild(d2, o);
  6294. }
  6295. } catch (h2) {
  6296. e(h2);
  6297. }
  6298. });
  6299. } catch (s) {
  6300. e(s);
  6301. }
  6302. }
  6303. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-19a5903e"), n2 = n2(), vue.popScopeId(), n2);
  6304. const _hoisted_1$1 = {
  6305. key: 0,
  6306. class: "tag-modal modal"
  6307. };
  6308. const _hoisted_2$1 = { class: "modal-root" };
  6309. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  6310. const _hoisted_4$1 = ["innerHTML"];
  6311. const _sfc_main$1 = {
  6312. __name: "NotificationModal",
  6313. props: ["modelValue", "h"],
  6314. emits: ["update:modelValue"],
  6315. setup(__props, { emit: __emit }) {
  6316. const emit = __emit;
  6317. vue.onMounted(() => {
  6318. });
  6319. function close() {
  6320. emit("update:modelValue", false);
  6321. }
  6322. return (_ctx, _cache) => {
  6323. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  6324. default: vue.withCtx(() => [
  6325. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  6326. vue.createElementVNode("div", {
  6327. class: "mask",
  6328. onClick: vue.withModifiers(close, ["stop"])
  6329. }),
  6330. vue.createElementVNode("div", _hoisted_2$1, [
  6331. vue.createElementVNode("div", { class: "modal-header" }, [
  6332. _hoisted_3$1,
  6333. vue.createElementVNode("i", {
  6334. class: "fa fa-times",
  6335. onClick: close
  6336. })
  6337. ]),
  6338. vue.createElementVNode("div", {
  6339. innerHTML: __props.h,
  6340. class: "modal-body"
  6341. }, null, 8, _hoisted_4$1)
  6342. ])
  6343. ])) : vue.createCommentVNode("", true)
  6344. ]),
  6345. _: 1
  6346. });
  6347. };
  6348. }
  6349. };
  6350. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-19a5903e"]]);
  6351. const _sfc_main = {
  6352. components: {
  6353. BaseButton,
  6354. NotificationModal,
  6355. BaseLoading,
  6356. BaseSwitch,
  6357. MsgModal,
  6358. TagModal,
  6359. Tooltip,
  6360. Setting,
  6361. PostDetail,
  6362. Base64Tooltip,
  6363. Msg
  6364. },
  6365. provide() {
  6366. return {
  6367. user: vue.computed(() => window.user),
  6368. isLogin: vue.computed(() => this.isLogin),
  6369. isNight: vue.computed(() => this.isNight),
  6370. pageType: vue.computed(() => this.pageType),
  6371. tags: vue.computed(() => this.tags),
  6372. show: vue.computed(() => this.show),
  6373. post: vue.computed(() => this.current),
  6374. config: vue.computed(() => this.config),
  6375. allReplyUsers: vue.computed(() => {
  6376. var _a, _b, _c;
  6377. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  6378. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  6379. }
  6380. return [];
  6381. })
  6382. };
  6383. },
  6384. data() {
  6385. return {
  6386. loading: window.pageType === PageType.Post,
  6387. refreshLoading: false,
  6388. loadMore: false,
  6389. isLogin: !!window.user.username,
  6390. pageType: window.pageType,
  6391. isNight: window.isNight,
  6392. stopMe: window.stopMe,
  6393. //停止使用脚本
  6394. show: false,
  6395. current: window.clone(window.initPost),
  6396. list: [],
  6397. config: window.clone(window.config),
  6398. tags: window.user.tags,
  6399. readList: window.user.readList,
  6400. notificationModal: {
  6401. show: false,
  6402. h: ""
  6403. },
  6404. step: 0
  6405. };
  6406. },
  6407. computed: {
  6408. targetUserTags() {
  6409. return this.tags[window.targetUserName] ?? [];
  6410. },
  6411. isList() {
  6412. return [PageType.Home, PageType.Node].includes(this.pageType);
  6413. },
  6414. isPost() {
  6415. return this.pageType === PageType.Post;
  6416. },
  6417. isMember() {
  6418. return this.pageType === PageType.Member;
  6419. }
  6420. },
  6421. watch: {
  6422. config: {
  6423. handler(newVal) {
  6424. let config2 = { [window.user.username ?? "default"]: newVal };
  6425. localStorage.setItem("v2ex-config", JSON.stringify(config2));
  6426. window.config = newVal;
  6427. },
  6428. deep: true
  6429. },
  6430. tags(newVal) {
  6431. window.user.tags = newVal;
  6432. },
  6433. "config.viewType"(newVal) {
  6434. if (!newVal)
  6435. return;
  6436. if (newVal === "card") {
  6437. $(".post-item").each(function() {
  6438. $(this).addClass("preview");
  6439. });
  6440. } else {
  6441. $(".post-item").each(function() {
  6442. $(this).removeClass("preview");
  6443. });
  6444. }
  6445. },
  6446. "config.fontSizeType": {
  6447. handler(newVal) {
  6448. switch (newVal) {
  6449. case "small":
  6450. return $("html").css("font-size", "8px");
  6451. case "normal":
  6452. return $("html").css("font-size", "10px");
  6453. case "large":
  6454. return $("html").css("font-size", "12px");
  6455. case "big-large":
  6456. return $("html").css("font-size", "14px");
  6457. }
  6458. },
  6459. deep: true
  6460. },
  6461. show(n2) {
  6462. if (n2)
  6463. this.step++;
  6464. else
  6465. this.step--;
  6466. this.slide("post");
  6467. }
  6468. },
  6469. created() {
  6470. let that = this;
  6471. this.initEvent();
  6472. window.cb = this.winCb;
  6473. if (!window.canParseV2exPage)
  6474. return;
  6475. document.addEventListener("click", this.clickA, true);
  6476. $(document).on("click", ".post-item", function(e2) {
  6477. if (e2.currentTarget.getAttribute("script"))
  6478. return;
  6479. if (that.stopMe)
  6480. return true;
  6481. if (this.classList.contains("preview")) {
  6482. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG") {
  6483. console.log("点空白处", this);
  6484. let id = this.dataset["id"];
  6485. let href = this.dataset["href"];
  6486. if (id) {
  6487. that.clickPost(e2, id, href);
  6488. } else {
  6489. if (href)
  6490. location.href = href;
  6491. }
  6492. }
  6493. }
  6494. });
  6495. window.onpopstate = (event) => {
  6496. if (event.state) {
  6497. if (!this.show)
  6498. this.show = true;
  6499. } else {
  6500. if (this.show)
  6501. this.show = false;
  6502. }
  6503. };
  6504. window.onbeforeunload = () => {
  6505. };
  6506. window.deleteNotification = (nId, token) => {
  6507. console.log("deleteNotification", nId, token);
  6508. let item = $("#n_" + nId);
  6509. item.slideUp("fast");
  6510. $.post({
  6511. url: "/delete/notification/" + nId + "?once=" + token,
  6512. success() {
  6513. $.get({
  6514. url: "/notifications/below/" + window.notificationBottom,
  6515. success(data, status, request) {
  6516. item.remove();
  6517. $("#notifications").append(data);
  6518. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  6519. },
  6520. error() {
  6521. item.slideDown("fast");
  6522. }
  6523. });
  6524. },
  6525. error() {
  6526. item.slideDown("fast");
  6527. }
  6528. });
  6529. };
  6530. },
  6531. beforeUnmount() {
  6532. eventBus.clear();
  6533. document.removeEventListener("click", this.clickA, true);
  6534. },
  6535. methods: {
  6536. async getUnreadMessagesCount() {
  6537. var _a, _b;
  6538. const res = await fetch(`${location.origin}/mission`);
  6539. const htmlText = await res.text();
  6540. const $page = $(htmlText);
  6541. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  6542. if (text.includes("未读提醒")) {
  6543. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  6544. if (countStr) {
  6545. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  6546. }
  6547. } else {
  6548. return 0;
  6549. }
  6550. throw new Error("无法获取未读消息数量");
  6551. },
  6552. clickA(e2) {
  6553. if (!(e2 == null ? void 0 : e2.target))
  6554. return;
  6555. if (e2.target.tagName !== "A")
  6556. return;
  6557. let that = this;
  6558. if (e2.target.getAttribute("script"))
  6559. return;
  6560. if (that.stopMe)
  6561. return true;
  6562. let { href, id, title } = functions.parseA(e2.target);
  6563. if (href.includes("/settings/night/toggle"))
  6564. return;
  6565. if (href.includes("/?tab="))
  6566. return;
  6567. if (href.includes("/go"))
  6568. return;
  6569. if (href === window.origin + "/#;")
  6570. return;
  6571. if (href === window.origin + "/")
  6572. return;
  6573. if (href === window.origin + "/recent")
  6574. return;
  6575. if (href.includes("/notifications"))
  6576. return;
  6577. if (href === window.origin + "/script-setting") {
  6578. window.functions.clickAvatar(this.show ? ".post-wrapper " : "");
  6579. this.slide("setting", this.step++);
  6580. that.stopEvent(e2);
  6581. return;
  6582. }
  6583. if (id) {
  6584. that.clickPost(e2, id, href, title);
  6585. } else {
  6586. if (that.config.newTabOpen) {
  6587. that.stopEvent(e2);
  6588. functions.openNewTab(href);
  6589. }
  6590. }
  6591. },
  6592. stopEvent(e2) {
  6593. e2.preventDefault();
  6594. e2.stopPropagation();
  6595. },
  6596. saveReadList() {
  6597. if (this.config.rememberLastReadFloor) {
  6598. window.parse.saveReadList(this.readList);
  6599. }
  6600. },
  6601. async clickPost(e2, id, href, title = "") {
  6602. if (id) {
  6603. if (this.config.clickPostItemOpenDetail) {
  6604. this.stopEvent(e2);
  6605. let index = this.list.findIndex((v) => v.id == id);
  6606. let postItem = this.clone(window.initPost);
  6607. if (index > -1) {
  6608. postItem = this.list[index];
  6609. }
  6610. if (!postItem.title) {
  6611. postItem.title = title ?? "加载中";
  6612. }
  6613. postItem.inList = index > -1;
  6614. if (postItem.inList) {
  6615. if (postItem.replyCount > MAX_REPLY_LIMIT) {
  6616. return functions.openNewTab(`${location.origin}/t/${id}?p=1&script=1`);
  6617. }
  6618. }
  6619. postItem.id = id;
  6620. postItem.href = href;
  6621. if (!postItem.headerTemplate) {
  6622. let template = `
  6623. <div class="cell">
  6624. <div class="topic_content">
  6625. <div class="markdown_body">
  6626. ${(postItem == null ? void 0 : postItem.content_rendered) ?? ""}
  6627. </div>
  6628. </div>
  6629. </div>
  6630. `;
  6631. postItem.headerTemplate = template;
  6632. }
  6633. this.getPostDetail(postItem);
  6634. return;
  6635. }
  6636. if (this.config.newTabOpen) {
  6637. this.stopEvent(e2);
  6638. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`);
  6639. }
  6640. }
  6641. },
  6642. showPost() {
  6643. $(".slide-list").css("transition", `0s`);
  6644. setTimeout(() => {
  6645. $(".slide-list").css("transition", `transform .3s`);
  6646. }, 500);
  6647. this.show = true;
  6648. $("#site-header").css("margin-top", "-42px");
  6649. $(`#Wrapper .box:lt(5)`).each(function() {
  6650. $(this).hide();
  6651. });
  6652. },
  6653. slide(to = "post", v) {
  6654. if (this.step === 1) {
  6655. if (to === "post") {
  6656. $(".post-wrapper").css("z-index", 10);
  6657. $(".setting-wrapper").css("z-index", 9);
  6658. } else {
  6659. $(".post-wrapper").css("z-index", 9);
  6660. $(".setting-wrapper").css("z-index", 10);
  6661. }
  6662. }
  6663. $(".slide-list").css("transform", `translateX(-${this.step * 100}vw)`);
  6664. },
  6665. async winCb({ type, value }) {
  6666. console.log("回调的类型", type, value);
  6667. if (type === "syncList") {
  6668. this.list = Object.assign(this.list, window.postList);
  6669. }
  6670. if (type === "syncData") {
  6671. this.list = window.postList;
  6672. this.config = window.config;
  6673. this.stopMe = window.stopMe;
  6674. this.tags = window.user.tags;
  6675. this.readList = window.user.readList;
  6676. this.current.read = this.readList[this.current.id] ?? {};
  6677. if (this.show && this.isPost && this.current.read.floor) {
  6678. this.$refs.postDetail.read = this.current.read;
  6679. }
  6680. }
  6681. if (type === "warningNotice") {
  6682. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  6683. }
  6684. if (this.stopMe)
  6685. return;
  6686. if (type === "restorePost") {
  6687. this.show = false;
  6688. this.loading = false;
  6689. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  6690. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6691. $(this).show();
  6692. });
  6693. }
  6694. if (type === "postContent") {
  6695. this.current = Object.assign(this.current, value);
  6696. this.current.inList = true;
  6697. this.showPost();
  6698. }
  6699. if (type === "postReplies") {
  6700. this.current = Object.assign(this.current, value);
  6701. this.list.push(this.clone(this.current));
  6702. this.loading = false;
  6703. }
  6704. },
  6705. clone(val) {
  6706. return functions.clone(val);
  6707. },
  6708. regenerateReplyList() {
  6709. if (this.current.replyList.length) {
  6710. this.current.replyCount = this.current.replyList.length;
  6711. let res = functions.createNestedList(this.current.replyList);
  6712. if (res) {
  6713. this.current.nestedReplies = res;
  6714. }
  6715. let dup_res = functions.createNestedRedundantList(this.current.replyList);
  6716. if (dup_res) {
  6717. this.current.nestedRedundReplies = dup_res;
  6718. }
  6719. } else {
  6720. this.current.replyCount = 0;
  6721. this.current.nestedReplies = [];
  6722. this.current.nestedRedundReplies = [];
  6723. }
  6724. if (this.list.length) {
  6725. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6726. if (rIndex > -1) {
  6727. this.list[rIndex] = this.clone(this.current);
  6728. }
  6729. }
  6730. },
  6731. initEvent() {
  6732. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  6733. console.log("CHANGE_COMMENT_THANK", val);
  6734. const { id, type } = val;
  6735. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  6736. if (currentI > -1) {
  6737. this.current.replyList[currentI].isThanked = type === "add";
  6738. if (type === "add") {
  6739. this.current.replyList[currentI].thankCount++;
  6740. } else {
  6741. this.current.replyList[currentI].thankCount--;
  6742. }
  6743. this.regenerateReplyList();
  6744. }
  6745. });
  6746. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  6747. const { id, type } = val;
  6748. this.current.isThanked = type === "add";
  6749. if (type === "add") {
  6750. this.current.thankCount++;
  6751. } else {
  6752. this.current.thankCount--;
  6753. }
  6754. let currentI = this.list.findIndex((i) => i.id === id);
  6755. if (currentI > -1) {
  6756. this.list[currentI].isThanked = type === "add";
  6757. if (type === "add") {
  6758. this.list[currentI].thankCount++;
  6759. } else {
  6760. this.list[currentI].thankCount++;
  6761. }
  6762. }
  6763. });
  6764. eventBus.on(CMD.REMOVE, (val) => {
  6765. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  6766. if (removeIndex > -1) {
  6767. this.current.replyList.splice(removeIndex, 1);
  6768. }
  6769. this.regenerateReplyList();
  6770. });
  6771. eventBus.on(CMD.IGNORE, () => {
  6772. this.show = false;
  6773. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6774. if (rIndex > -1) {
  6775. this.list.splice(rIndex, 1);
  6776. }
  6777. let el = document.querySelector(`.id_${this.current.id}`);
  6778. if (el)
  6779. el.remove();
  6780. this.current = this.clone(window.initPost);
  6781. });
  6782. eventBus.on(CMD.MERGE, (val) => {
  6783. this.current = Object.assign(this.current, val);
  6784. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6785. if (rIndex > -1) {
  6786. this.list[rIndex] = this.clone(this.current);
  6787. }
  6788. });
  6789. eventBus.on(CMD.MERGE_CONFIG, (val) => {
  6790. this.config = Object.assign(this.config, val);
  6791. });
  6792. eventBus.on(CMD.ADD_READ, (val) => {
  6793. this.readList[this.current.id] = val;
  6794. });
  6795. eventBus.on(CMD.ADD_REPLY, (item) => {
  6796. this.current.replyList.push(item);
  6797. this.regenerateReplyList();
  6798. });
  6799. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  6800. if (once) {
  6801. if (typeof once === "string") {
  6802. let res = once.match(/var once = "([\d]+)";/);
  6803. if (res && res[1]) {
  6804. this.current.once = Number(res[1]);
  6805. return;
  6806. }
  6807. }
  6808. if (typeof once === "number") {
  6809. this.current.once = once;
  6810. return;
  6811. }
  6812. }
  6813. window.fetchOnce().then((r2) => {
  6814. this.current.once = r2;
  6815. });
  6816. });
  6817. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  6818. let oldTag = this.clone(this.tags);
  6819. let tags = this.tags[username] ?? [];
  6820. let rIndex = tags.findIndex((v) => v === tag);
  6821. if (rIndex > -1) {
  6822. tags.splice(rIndex, 1);
  6823. }
  6824. this.tags[username] = tags;
  6825. let res = await window.parse.saveTags(this.tags);
  6826. if (!res) {
  6827. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  6828. this.tags = oldTag;
  6829. }
  6830. });
  6831. eventBus.on(CMD.REFRESH_POST, () => this.getPostDetail(this.current));
  6832. },
  6833. async getPostDetail(post) {
  6834. console.log("getPostDetail", this.clone(post));
  6835. this.current = post;
  6836. this.current.read = this.readList[this.current.id] ?? { floor: 0, total: 0 };
  6837. this.show = true;
  6838. if (!this.current.inList) {
  6839. this.loading = true;
  6840. let r2 = await functions.checkPostReplies(post.id, true);
  6841. if (r2) {
  6842. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  6843. this.loading = this.show = false;
  6844. return;
  6845. }
  6846. }
  6847. let url = window.baseUrl + "/t/" + post.id;
  6848. this.current.url = url;
  6849. let alreadyHasReply = this.current.replyList.length;
  6850. if (alreadyHasReply) {
  6851. this.refreshLoading = true;
  6852. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  6853. } else {
  6854. this.loading = true;
  6855. }
  6856. let apiRes = await window.fetch(url + "?p=1");
  6857. if (apiRes.status === 404) {
  6858. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  6859. return this.refreshLoading = this.loading = false;
  6860. }
  6861. if (apiRes.status === 403) {
  6862. this.refreshLoading = this.show = this.loading = false;
  6863. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`);
  6864. return;
  6865. }
  6866. if (apiRes.redirected) {
  6867. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  6868. return this.refreshLoading = this.loading = false;
  6869. }
  6870. let htmlText = await apiRes.text();
  6871. let hasPermission = htmlText.search("你要查看的页面需要先登录");
  6872. if (hasPermission > -1) {
  6873. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录" });
  6874. return this.refreshLoading = this.loading = false;
  6875. }
  6876. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6877. let body = $(bodyText[0]);
  6878. decodeEmail(body);
  6879. await window.parse.getPostDetail(this.current, body, htmlText);
  6880. let index = this.list.findIndex((v) => v.id == this.current.id);
  6881. if (index > -1) {
  6882. this.list[index] = this.clone(this.current);
  6883. } else {
  6884. this.list.push(this.clone(this.current));
  6885. }
  6886. this.refreshLoading = this.loading = false;
  6887. if (!alreadyHasReply) {
  6888. vue.nextTick(() => {
  6889. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  6890. });
  6891. }
  6892. await window.parse.parseOp(this.current);
  6893. console.log("当前帖子", this.current);
  6894. },
  6895. addTargetUserTag() {
  6896. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  6897. },
  6898. removeTargetUserTag(tag) {
  6899. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  6900. }
  6901. }
  6902. };
  6903. const _withScopeId = (n2) => (vue.pushScopeId("data-v-cf079729"), n2 = n2(), vue.popScopeId(), n2);
  6904. const _hoisted_1 = {
  6905. key: 0,
  6906. class: "target-user-tags p1"
  6907. };
  6908. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  6909. const _hoisted_3 = { class: "my-tag" };
  6910. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  6911. const _hoisted_5 = ["onClick"];
  6912. const _hoisted_6 = {
  6913. key: 1,
  6914. class: "my-box p2",
  6915. style: { "margin-top": "2rem" }
  6916. };
  6917. const _hoisted_7 = {
  6918. key: 0,
  6919. class: "flex flex-center"
  6920. };
  6921. const _hoisted_8 = {
  6922. key: 1,
  6923. class: "loaded"
  6924. };
  6925. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  6926. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  6927. const _component_Setting = vue.resolveComponent("Setting");
  6928. const _component_PostDetail = vue.resolveComponent("PostDetail");
  6929. const _component_TagModal = vue.resolveComponent("TagModal");
  6930. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  6931. const _component_MsgModal = vue.resolveComponent("MsgModal");
  6932. vue.resolveComponent("NotificationModal");
  6933. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  6934. const _component_BaseButton = vue.resolveComponent("BaseButton");
  6935. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  6936. vue.createVNode(_component_Setting, {
  6937. modelValue: $data.config,
  6938. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  6939. onBack: _cache[1] || (_cache[1] = ($event) => $options.slide("post", $data.step--)),
  6940. to: ".setting-wrapper"
  6941. }, null, 8, ["modelValue"]),
  6942. vue.createVNode(_component_Setting, {
  6943. modelValue: $data.config,
  6944. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.config = $event),
  6945. onBack: _cache[3] || (_cache[3] = ($event) => $options.slide("post", $data.step--)),
  6946. to: ".setting-wrapper2"
  6947. }, null, 8, ["modelValue"]),
  6948. vue.createVNode(_component_PostDetail, {
  6949. modelValue: $data.show,
  6950. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.show = $event),
  6951. ref: "postDetail",
  6952. displayType: $data.config.commentDisplayType,
  6953. "onUpdate:displayType": _cache[5] || (_cache[5] = ($event) => $data.config.commentDisplayType = $event),
  6954. onSaveReadList: $options.saveReadList,
  6955. onRefresh: _cache[6] || (_cache[6] = ($event) => $options.getPostDetail($data.current)),
  6956. loading: $data.loading,
  6957. refreshLoading: $data.refreshLoading
  6958. }, null, 8, ["modelValue", "displayType", "onSaveReadList", "loading", "refreshLoading"]),
  6959. vue.createVNode(_component_TagModal, {
  6960. tags: $data.tags,
  6961. "onUpdate:tags": _cache[7] || (_cache[7] = ($event) => $data.tags = $event)
  6962. }, null, 8, ["tags"]),
  6963. vue.createVNode(_component_Base64Tooltip),
  6964. vue.createVNode(_component_MsgModal),
  6965. vue.createCommentVNode("", true),
  6966. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  6967. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  6968. _hoisted_2,
  6969. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  6970. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  6971. _hoisted_4,
  6972. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  6973. vue.createElementVNode("i", {
  6974. class: "fa fa-trash-o remove",
  6975. onClick: ($event) => $options.removeTargetUserTag(i)
  6976. }, null, 8, _hoisted_5)
  6977. ]);
  6978. }), 256)),
  6979. vue.createElementVNode("span", {
  6980. class: "add-tag ago",
  6981. onClick: _cache[9] || (_cache[9] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  6982. title: "添加标签"
  6983. }, "+")
  6984. ])) : vue.createCommentVNode("", true),
  6985. $options.isPost && !$data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  6986. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  6987. vue.createVNode(_component_BaseLoading)
  6988. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  6989. _hoisted_9,
  6990. vue.createVNode(_component_BaseButton, {
  6991. size: "small",
  6992. onClick: $options.showPost
  6993. }, {
  6994. default: vue.withCtx(() => [
  6995. vue.createTextVNode("点击显示")
  6996. ]),
  6997. _: 1
  6998. }, 8, ["onClick"])
  6999. ]))
  7000. ])) : vue.createCommentVNode("", true)
  7001. ], 64)) : vue.createCommentVNode("", true)
  7002. ], 64);
  7003. }
  7004. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cf079729"]]);
  7005. let isMobile = !document.querySelector("#Rightbar");
  7006. let $section = document.createElement("section");
  7007. $section.id = "app";
  7008. function run() {
  7009. window.baseUrl = location.origin;
  7010. window.initPost = DefaultPost;
  7011. window.win = function() {
  7012. return window;
  7013. };
  7014. window.win().doc = window.win().document;
  7015. window.win().query = (v) => window.win().document.querySelector(v);
  7016. window.query = (v) => window.win().document.querySelector(v);
  7017. window.clone = (val) => JSON.parse(JSON.stringify(val));
  7018. window.user = DefaultUser;
  7019. window.targetUserName = "";
  7020. window.pageType = void 0;
  7021. window.pageData = { pageNo: 1 };
  7022. window.config = { ...DefaultConfig, ...{ viewType: "card" } };
  7023. window.const = {
  7024. git: "https://github.com/zyronon/v2ex-script",
  7025. issue: "https://github.com/zyronon/v2ex-script/issues"
  7026. };
  7027. window.currentVersion = 1;
  7028. window.isNight = $(".Night").length === 1;
  7029. window.cb = null;
  7030. window.stopMe = false;
  7031. window.postList = [];
  7032. window.parse = {
  7033. //解析帖子内容
  7034. async parsePostContent(post, body, htmlText) {
  7035. var _a, _b;
  7036. let once = htmlText.match(/var once = "([\d]+)";/);
  7037. if (once && once[1]) {
  7038. post.once = once[1];
  7039. }
  7040. post.isReport = htmlText.includes("你已对本主题进行了报告");
  7041. let wrapperClass = "Wrapper";
  7042. let wrapper;
  7043. let boxs;
  7044. if (body.length > 1) {
  7045. body.each(function() {
  7046. if (this.id === wrapperClass) {
  7047. wrapper = $(this);
  7048. boxs = this.querySelectorAll(".box");
  7049. }
  7050. });
  7051. } else {
  7052. wrapper = body;
  7053. boxs = body.find(`#${wrapperClass} .box`);
  7054. }
  7055. let box1 = $(boxs[0]);
  7056. let header1 = wrapper.find(".header");
  7057. if (!post.title || !post.content_rendered) {
  7058. let h1 = wrapper.find("h1");
  7059. if (h1) {
  7060. post.title = h1[0].innerText;
  7061. }
  7062. }
  7063. let as = wrapper.find(".header > a");
  7064. if (as.length) {
  7065. post.node.title = as[1].innerText;
  7066. post.node.url = as[1].href;
  7067. }
  7068. let aName = header1.find("small.gray a:nth-child(1)");
  7069. if (aName) {
  7070. post.member.username = aName[0].innerText;
  7071. }
  7072. let small = header1.find("small.gray");
  7073. if (small[0]) {
  7074. let spanEl = (_b = (_a = small[0]) == null ? void 0 : _a.lastChild) == null ? void 0 : _b.nodeValue;
  7075. if (spanEl) {
  7076. let dianIndex = spanEl.indexOf("·");
  7077. post.createDateAgo = spanEl.substring(4, dianIndex - 1);
  7078. let text = spanEl.substring(dianIndex + 1).trim();
  7079. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  7080. let clickCountReg = [...reg3];
  7081. if (clickCountReg.length) {
  7082. post.clickCount = Number(clickCountReg[0][1]);
  7083. }
  7084. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  7085. clickCountReg = [...reg3];
  7086. if (clickCountReg.length) {
  7087. post.clickCount = Number(clickCountReg[0][1]);
  7088. }
  7089. }
  7090. }
  7091. let avatarEl = header1.find(".avatar");
  7092. if (avatarEl) {
  7093. post.member.avatar_large = avatarEl[0].src;
  7094. }
  7095. let topic_buttons = box1.find(".inner .fr");
  7096. if (topic_buttons.length) {
  7097. let favoriteNode = topic_buttons.find(".op:first");
  7098. if (favoriteNode.length) {
  7099. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  7100. }
  7101. let ignoreNode = topic_buttons.find(".tb");
  7102. if (ignoreNode.length) {
  7103. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  7104. }
  7105. let thankNode = topic_buttons.find(".topic_thanked");
  7106. if (thankNode.length) {
  7107. post.isThanked = true;
  7108. }
  7109. let span = topic_buttons.find("span");
  7110. if (span.length) {
  7111. let text = span[0].innerText;
  7112. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  7113. let collectCountReg = [...reg1];
  7114. if (collectCountReg.length) {
  7115. post.collectCount = Number(collectCountReg[0][1]);
  7116. }
  7117. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  7118. collectCountReg = [...reg1];
  7119. if (collectCountReg.length) {
  7120. post.collectCount = Number(collectCountReg[0][1]);
  7121. }
  7122. }
  7123. }
  7124. let header = $(boxs[0]);
  7125. let temp = header.clone();
  7126. temp.find(".topic_buttons").remove();
  7127. temp.find(".inner").remove();
  7128. temp.find(".header").remove();
  7129. let html = temp.html();
  7130. html = functions.checkPhotoLink2Img(html);
  7131. post.headerTemplate = html;
  7132. return post;
  7133. },
  7134. //解析OP信息
  7135. async parseOp(post) {
  7136. if (!post.member.id) {
  7137. let userRes = await fetch(window.baseUrl + "/api/members/show.json?username=" + post.member.username);
  7138. if (userRes.status === 200) {
  7139. post.member = await userRes.json();
  7140. }
  7141. }
  7142. if (post.member.id) {
  7143. let date = new Date(post.member.created * 1e3);
  7144. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  7145. date.setHours(0);
  7146. date.setMinutes(0);
  7147. date.setSeconds(0);
  7148. date.setMilliseconds(0);
  7149. let now = /* @__PURE__ */ new Date();
  7150. now.setHours(0);
  7151. now.setMinutes(0);
  7152. now.setSeconds(0);
  7153. now.setMilliseconds(0);
  7154. let d2 = now.getTime() - date.getTime();
  7155. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 7;
  7156. post.member.createDate = createStr + " 注册";
  7157. post.member.isNew = isNew;
  7158. } else {
  7159. post.member.createDate = "用户已被注销/封禁";
  7160. post.member.isNew = true;
  7161. }
  7162. return post;
  7163. },
  7164. //获取帖子所有回复
  7165. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  7166. var _a, _b;
  7167. if (body.find("#no-comments-yet").length) {
  7168. return post;
  7169. }
  7170. let wrapperClass = "Wrapper";
  7171. let boxs;
  7172. let box;
  7173. if (body.length > 1) {
  7174. body.each(function() {
  7175. if (this.id === wrapperClass) {
  7176. boxs = this.querySelectorAll(".box");
  7177. box = boxs[1];
  7178. }
  7179. });
  7180. } else {
  7181. boxs = body.find(`#${wrapperClass} .box`);
  7182. box = boxs[1];
  7183. }
  7184. let cells = box.querySelectorAll(".cell");
  7185. if (cells && cells.length) {
  7186. cells = Array.from(cells);
  7187. let snow = cells[0].querySelector(".snow");
  7188. post.createDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  7189. let repliesMap = [];
  7190. if (cells[1].id) {
  7191. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  7192. let replyList = functions.getAllReply(repliesMap);
  7193. post.replyList = replyList;
  7194. post.replyCount = replyList.length;
  7195. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  7196. let nestedList = functions.createNestedList(replyList);
  7197. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  7198. if (nestedList)
  7199. post.nestedReplies = nestedList;
  7200. if (nestedRedundantList)
  7201. post.nestedRedundReplies = nestedRedundantList;
  7202. return post;
  7203. } else {
  7204. let promiseList = [];
  7205. return new Promise((resolve, reject) => {
  7206. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7207. let pages = cells[1].querySelectorAll("a.page_normal");
  7208. pages = Array.from(pages);
  7209. let url = window.baseUrl + "/t/" + post.id;
  7210. for (let i = 0; i < pages.length; i++) {
  7211. let currentPageNo = Number(pages[i].innerText);
  7212. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  7213. }
  7214. Promise.allSettled(promiseList).then(
  7215. (results) => {
  7216. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  7217. let replyList = functions.getAllReply(repliesMap);
  7218. post.replyList = replyList;
  7219. post.replyCount = replyList.length;
  7220. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  7221. let nestedList = functions.createNestedList(replyList);
  7222. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  7223. if (nestedList)
  7224. post.nestedReplies = nestedList;
  7225. if (nestedRedundantList)
  7226. post.nestedRedundReplies = nestedRedundantList;
  7227. resolve(post);
  7228. }
  7229. );
  7230. });
  7231. }
  7232. }
  7233. },
  7234. //请求帖子其他页的回复
  7235. fetchPostOtherPageReplies(href, pageNo) {
  7236. return new Promise((resolve) => {
  7237. $.get(href).then((res) => {
  7238. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7239. let wrapperClass = "Wrapper";
  7240. let box;
  7241. $(s[0]).each(function() {
  7242. if (this.id === wrapperClass) {
  7243. box = this.querySelectorAll(".box")[2];
  7244. }
  7245. });
  7246. let cells = box.querySelectorAll(".cell");
  7247. cells = Array.from(cells);
  7248. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7249. }).catch((r2) => {
  7250. if (r2.status === 403) {
  7251. functions.cbChecker({ type: "restorePost", value: null });
  7252. }
  7253. });
  7254. });
  7255. },
  7256. //解析页面的回复
  7257. parsePageReplies(nodes) {
  7258. let replyList = [];
  7259. nodes.forEach((node, index) => {
  7260. if (!node.id)
  7261. return;
  7262. let item = {
  7263. level: 0,
  7264. thankCount: 0,
  7265. isThanked: false,
  7266. isOp: false,
  7267. isDup: false,
  7268. id: node.id.replace("r_", "")
  7269. };
  7270. let reply_content = node.querySelector(".reply_content");
  7271. item.reply_content = functions.checkPhotoLink2Img(reply_content.innerHTML);
  7272. item.reply_text = reply_content.textContent;
  7273. let { users, floor } = this.parseReplyContent(item.reply_content);
  7274. item.hideCallUserReplyContent = item.reply_content;
  7275. if (users.length === 1) {
  7276. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  7277. }
  7278. item.replyUsers = users;
  7279. item.replyFloor = floor;
  7280. let spans = node.querySelectorAll("span");
  7281. let ago = spans[1];
  7282. item.date = ago.textContent;
  7283. let userNode = node.querySelector("strong a");
  7284. item.username = userNode.textContent;
  7285. let avatar = node.querySelector("td img");
  7286. item.avatar = avatar.src;
  7287. let no = node.querySelector(".no");
  7288. item.floor = Number(no.textContent);
  7289. let thank_area = node.querySelector(".thank_area");
  7290. if (thank_area) {
  7291. item.isThanked = thank_area.classList.contains("thanked");
  7292. }
  7293. let small = spans[2];
  7294. if (small) {
  7295. item.thankCount = Number(small.textContent);
  7296. }
  7297. let op = node.querySelector(".op");
  7298. if (op) {
  7299. item.isOp = true;
  7300. }
  7301. let mod = node.querySelector(".mod");
  7302. if (mod) {
  7303. item.isMod = true;
  7304. }
  7305. replyList.push(item);
  7306. });
  7307. return replyList;
  7308. },
  7309. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  7310. parseReplyContent(str) {
  7311. if (!str)
  7312. return;
  7313. let users = [];
  7314. let getUsername = (userStr) => {
  7315. let endIndex = userStr.indexOf('">');
  7316. if (endIndex > -1) {
  7317. let user = userStr.substring(0, endIndex);
  7318. if (!users.find((i) => i === user)) {
  7319. users.push(user);
  7320. }
  7321. }
  7322. };
  7323. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  7324. let has = str.matchAll(userReg);
  7325. let res2 = [...has];
  7326. if (res2.length > 1) {
  7327. res2.map((item) => {
  7328. getUsername(item[1]);
  7329. });
  7330. }
  7331. if (res2.length === 1) {
  7332. getUsername(res2[0][1]);
  7333. }
  7334. let floor = -1;
  7335. if (users.length === 1) {
  7336. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  7337. let hasFloor = str.matchAll(floorReg);
  7338. let res = [...hasFloor];
  7339. if (res.length) {
  7340. floor = Number(res[0][1]);
  7341. }
  7342. }
  7343. return { users, floor };
  7344. },
  7345. //获取帖子详情
  7346. async getPostDetail(post, body, htmlText, pageNo = 1) {
  7347. post = await this.parsePostContent(post, body, htmlText);
  7348. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  7349. },
  7350. //解析页面帖子列表
  7351. parsePagePostList(list, box) {
  7352. list.forEach((itemDom) => {
  7353. let item = window.clone(window.initPost);
  7354. let item_title = itemDom.querySelector(".item_title");
  7355. itemDom.classList.add("post-item");
  7356. if (!item_title)
  7357. return;
  7358. let a = item_title.querySelector("a");
  7359. let { href, id } = functions.parseA(a);
  7360. item.id = Number(id);
  7361. a.href = item.href = href;
  7362. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  7363. itemDom.classList.add(`id_${id}`);
  7364. itemDom.dataset["href"] = href;
  7365. itemDom.dataset["id"] = id;
  7366. window.postList.push(item);
  7367. if (![PageType.Member].includes(window.pageType)) {
  7368. let headerWrap = $(`
  7369. <div class="new-item">
  7370. <div class="left">
  7371. <div class="top">
  7372. <div class="r">
  7373. <div class="small fade"></div>
  7374. <div class="small fade"></div>
  7375. </div>
  7376. </div>
  7377. <div class="bottom"></div>
  7378. </div>
  7379. <div class="right"></div>
  7380. </div>`);
  7381. headerWrap.find(".bottom").append(item_title);
  7382. headerWrap.find(".right").append(itemDom.querySelector(".count_livid"));
  7383. headerWrap.find(".top").prepend(itemDom.querySelector("td:first-child a"));
  7384. let info = itemDom.querySelector("td:nth-child(3)");
  7385. if (window.pageType === PageType.Node)
  7386. ;
  7387. if ([PageType.Changes, PageType.Home].includes(window.pageType)) {
  7388. let s1 = info.querySelector("span:first-child");
  7389. let t = headerWrap.find(".top .r div:first");
  7390. t.append(s1.querySelector("strong"));
  7391. t.append(` `);
  7392. t.append(s1.querySelector("a"));
  7393. }
  7394. let b = headerWrap.find(".top .r div:last");
  7395. b.append(info.querySelector("span:last-child").innerHTML);
  7396. itemDom.append(headerWrap[0]);
  7397. itemDom.querySelector("table").remove();
  7398. }
  7399. });
  7400. const setF = (res) => {
  7401. var _a;
  7402. let rIndex = window.postList.findIndex((w) => w.id === res.id);
  7403. if (rIndex > -1) {
  7404. window.postList[rIndex] = Object.assign(window.postList[rIndex], res);
  7405. }
  7406. let itemDom = box.querySelector(`.id_${res.id}`);
  7407. itemDom.classList.add("preview");
  7408. if (res.content_rendered) {
  7409. let a = document.createElement("a");
  7410. a.href = res.href;
  7411. a.classList.add("post-content");
  7412. let div = document.createElement("div");
  7413. div.innerHTML = res.content_rendered;
  7414. a.append(div);
  7415. itemDom.append(a);
  7416. if (div.clientHeight < 300) {
  7417. a.classList.add("show-all");
  7418. } else {
  7419. let showMore = document.createElement("div");
  7420. showMore.classList.add("show-more");
  7421. showMore.innerHTML = "显示更多/收起";
  7422. showMore.onclick = function(e2) {
  7423. e2.stopPropagation();
  7424. a.classList.toggle("show-all");
  7425. };
  7426. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  7427. }
  7428. }
  7429. functions.cbChecker({ type: "syncList" });
  7430. };
  7431. if (window.config.viewType === "card") {
  7432. let cacheDataStr = localStorage.getItem("cacheData");
  7433. let cacheData = [];
  7434. if (cacheDataStr) {
  7435. cacheData = JSON.parse(cacheDataStr);
  7436. let now = Date.now();
  7437. cacheData = cacheData.filter((v) => {
  7438. return v.created > now / 1e3 - 60 * 60 * 24 * 3;
  7439. });
  7440. }
  7441. let fetchIndex = 0;
  7442. for (let i = 0; i < window.postList.length; i++) {
  7443. let item = window.postList[i];
  7444. let rItem = cacheData.find((w) => w.id === item.id);
  7445. if (rItem) {
  7446. rItem.href = item.href;
  7447. setF(rItem);
  7448. } else {
  7449. fetchIndex++;
  7450. setTimeout(() => {
  7451. $.get(item.url).then((v) => {
  7452. let res = v[0];
  7453. res.href = item.href;
  7454. cacheData.push(res);
  7455. localStorage.setItem("cacheData", JSON.stringify(cacheData));
  7456. setF(res);
  7457. });
  7458. }, fetchIndex < 4 ? 0 : (fetchIndex - 4) * 1e3);
  7459. }
  7460. }
  7461. } else {
  7462. functions.cbChecker({ type: "syncData" });
  7463. }
  7464. },
  7465. //创建记事本子条目
  7466. async createNoteItem(itemName) {
  7467. return;
  7468. },
  7469. //编辑记事本子条目
  7470. async editNoteItem(val, id) {
  7471. return;
  7472. },
  7473. //标签操作
  7474. async saveTags(val) {
  7475. return;
  7476. },
  7477. //已读楼层操作
  7478. async saveReadList(val) {
  7479. return;
  7480. },
  7481. //imgur图片删除hash操作
  7482. async saveImgurList(val) {
  7483. return;
  7484. }
  7485. };
  7486. window.vals = {};
  7487. window.functions = {
  7488. clickAvatar(prex) {
  7489. let menu = $(`${prex}#menu-body`);
  7490. if (menu.css("--show-dropdown") === "block") {
  7491. menu.css("--show-dropdown", "none");
  7492. } else {
  7493. menu.css("--show-dropdown", "block");
  7494. }
  7495. }
  7496. };
  7497. function initStyle() {
  7498. let style2 = `
  7499. }
  7500. `;
  7501. let addStyle2 = document.createElement("style");
  7502. addStyle2.rel = "stylesheet";
  7503. addStyle2.type = "text/css";
  7504. addStyle2.innerHTML = style2;
  7505. window.document.head.append(addStyle2);
  7506. }
  7507. function qianDao() {
  7508. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  7509. if (window.pageType === PageType.Home) {
  7510. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  7511. if (qiandao) {
  7512. qianDao_(qiandao, timeNow);
  7513. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  7514. window.win().doc.getElementById("gift_v2excellent").click();
  7515. localStorage.setItem("menu_clockInTime", timeNow);
  7516. console.info("[V2EX - 超级增强] 自动签到完成!");
  7517. } else {
  7518. console.info("[V2EX - 超级增强] 自动签到完成!");
  7519. }
  7520. } else {
  7521. let timeOld = localStorage.getItem("menu_clockInTime");
  7522. if (!timeOld || timeOld != timeNow) {
  7523. qianDaoStatus_(timeNow);
  7524. } else {
  7525. console.info("[V2EX - 超级增强] 自动签到完成!");
  7526. }
  7527. }
  7528. }
  7529. function qianDao_(qiandao, timeNow) {
  7530. let url = window.baseUrl + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  7531. console.log("url", url);
  7532. $.get(url).then((r2) => {
  7533. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7534. let html = $(bodyText[0]);
  7535. if (html.find("li.fa.fa-ok-sign").length) {
  7536. html = html.find("#Main").text().match(/已连续登录 (\d+?) 天/)[0];
  7537. localStorage.setItem("menu_clockInTime", timeNow);
  7538. console.info("[V2EX - 超级增强] 自动签到完成!");
  7539. if (qiandao) {
  7540. qiandao.textContent = `自动签到完成!${html}`;
  7541. qiandao.href = "javascript:void(0);";
  7542. }
  7543. } else {
  7544. _GM_notification({
  7545. text: "自动签到失败!请关闭其他插件或脚本。\n如果连续几天都签到失败,请联系作者解决!",
  7546. timeout: 4e3,
  7547. onclick() {
  7548. functions.feedback();
  7549. }
  7550. });
  7551. console.warn("[V2EX 增强] 自动签到失败!请关闭其他插件或脚本。如果连续几天都签到失败,请联系作者解决!");
  7552. if (qiandao)
  7553. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  7554. }
  7555. });
  7556. }
  7557. function qianDaoStatus_(timeNow) {
  7558. $.get(window.baseUrl + "/mission/daily").then((r2) => {
  7559. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7560. let html = $(bodyText[0]);
  7561. if (html.find('input[value^="领取"]').length) {
  7562. qianDao_(null, timeNow);
  7563. } else {
  7564. console.info("[V2EX 增强] 已经签过到了。");
  7565. localStorage.setItem("menu_clockInTime", timeNow);
  7566. }
  7567. });
  7568. }
  7569. async function initNoteData() {
  7570. return;
  7571. }
  7572. function initConfig() {
  7573. return new Promise((resolve) => {
  7574. let configStr = localStorage.getItem("v2ex-config");
  7575. if (configStr) {
  7576. let configObj = JSON.parse(configStr);
  7577. configObj = configObj[window.user.username ?? "default"];
  7578. if (configObj) {
  7579. window.config = Object.assign(window.config, configObj);
  7580. }
  7581. }
  7582. resolve(window.config);
  7583. });
  7584. }
  7585. function addSettingText() {
  7586. let setting = $(`<a href="/script-setting" class="top">脚本管理</a>`);
  7587. $("#menu-body .cell:first").append(setting);
  7588. }
  7589. async function init() {
  7590. window.addEventListener("error", (e2) => {
  7591. let dom = e2.target;
  7592. let originImgUrl = dom.getAttribute("data-originurl");
  7593. if (originImgUrl) {
  7594. let a = document.createElement("a");
  7595. a.href = originImgUrl;
  7596. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  7597. a.innerText = originImgUrl;
  7598. dom.parentNode.replaceChild(a, dom);
  7599. }
  7600. }, true);
  7601. if (window.isNight) {
  7602. document.documentElement.classList.add("dark");
  7603. }
  7604. let { pageData, pageType } = functions.checkPageType();
  7605. window.pageType = pageType;
  7606. window.pageData = pageData;
  7607. addSettingText();
  7608. functions.initMonkeyMenu();
  7609. let s = $(`
  7610. <div class="slide">
  7611. <div class="slide-list">
  7612. <div class="slide-item page0"></div>
  7613. <div class="slide-item page1">
  7614. <div class="post-wrapper"></div>
  7615. <div class="setting-wrapper"></div>
  7616. </div>
  7617. <div class="slide-item page2">
  7618. <div class="setting-wrapper2"></div>
  7619. </div>
  7620. </div>
  7621. </div>`);
  7622. $("body").append(s);
  7623. $("body").children().slice(0, 4).each(function() {
  7624. $(".page0").append(this);
  7625. });
  7626. $(".post-wrapper").append($("#site-header").clone());
  7627. let top2 = $("#menu-body .cell:first .top:first");
  7628. if (top2.length && ["个人主页", "Profile"].includes(top2.text())) {
  7629. window.user.username = top2.attr("href").replace("/member/", "");
  7630. window.user.avatar = $("#menu-entry .avatar").attr("src");
  7631. }
  7632. initConfig().then(async (r2) => {
  7633. initStyle();
  7634. try {
  7635. if (window.config.autoSignin && window.user.username) {
  7636. qianDao();
  7637. }
  7638. } catch (e2) {
  7639. console.log("签到失败");
  7640. }
  7641. if (window.user.username) {
  7642. initNoteData();
  7643. }
  7644. let box;
  7645. let list;
  7646. let first;
  7647. let last;
  7648. switch (window.pageType) {
  7649. case PageType.Node:
  7650. box = document.querySelectorAll("#Wrapper .box");
  7651. box[1].style.background = "unset";
  7652. box[1].style.borderBottom = "none";
  7653. box[1].style["border-radius"] = "0";
  7654. box[1].style["box-shadow"] = "none";
  7655. first = $(box[1]).children().first();
  7656. first.addClass("cell post-item");
  7657. if (window.config.viewType === "card")
  7658. first[0].classList.add("preview");
  7659. last = $(box[1]).children().last();
  7660. last.addClass("cell post-item");
  7661. if (window.config.viewType === "card")
  7662. last[0].classList.add("preview");
  7663. list = box[1].querySelectorAll(".cell");
  7664. box[0].before($section);
  7665. window.parse.parsePagePostList(list, box[1]);
  7666. break;
  7667. case PageType.Home:
  7668. box = document.querySelector("#Wrapper .box");
  7669. let headerWrap = $('<div class="cell post-item"></div>');
  7670. if (window.config.viewType === "card")
  7671. headerWrap[0].classList.add("preview");
  7672. $(box).prepend(headerWrap);
  7673. $(box).children().slice(1, 3).each(function() {
  7674. headerWrap.append(this);
  7675. });
  7676. last = $(box).children().last();
  7677. last.addClass("cell post-item");
  7678. if (window.config.viewType === "card")
  7679. last[0].classList.add("preview");
  7680. box.style.background = "unset";
  7681. box.style["border-radius"] = "0";
  7682. box.style["box-shadow"] = "none";
  7683. list = box.querySelectorAll(".item");
  7684. list[0].before($section);
  7685. window.parse.parsePagePostList(list, box);
  7686. break;
  7687. case PageType.Changes:
  7688. box = document.querySelector("#Wrapper .box");
  7689. box.style.background = "unset";
  7690. box.style["border-radius"] = "0";
  7691. box.style["box-shadow"] = "none";
  7692. first = $(box).children().first();
  7693. first.addClass("cell post-item");
  7694. if (window.config.viewType === "card")
  7695. first[0].classList.add("preview");
  7696. last = $(box).children().last();
  7697. last.addClass("cell post-item");
  7698. if (window.config.viewType === "card")
  7699. last[0].classList.add("preview");
  7700. list = box.querySelectorAll(".item");
  7701. list[0].before($section);
  7702. window.parse.parsePagePostList(list, box);
  7703. break;
  7704. case PageType.Post:
  7705. box = document.querySelector("#Wrapper .box");
  7706. box.after($section);
  7707. let r22 = await functions.checkPostReplies(window.pageData.id, false);
  7708. if (r22) {
  7709. window.stopMe = true;
  7710. functions.cbChecker({ type: "syncData" });
  7711. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,脚本已停止解析楼中楼" });
  7712. return;
  7713. }
  7714. let post = functions.clone(window.initPost);
  7715. post.id = window.pageData.id;
  7716. let body = $(document.body);
  7717. let htmlText = document.documentElement.outerHTML;
  7718. window.parse.parsePostContent(
  7719. post,
  7720. body,
  7721. htmlText
  7722. ).then(async (res) => {
  7723. await functions.cbChecker({ type: "postContent", value: res });
  7724. await window.parse.parseOp(res);
  7725. });
  7726. window.parse.getPostAllReplies(
  7727. post,
  7728. body,
  7729. htmlText,
  7730. window.pageData.pageNo
  7731. ).then(async (res1) => {
  7732. await functions.cbChecker({ type: "postReplies", value: res1 });
  7733. });
  7734. break;
  7735. case PageType.Member:
  7736. box = document.querySelectorAll("#Wrapper .box");
  7737. window.targetUserName = box[0].querySelector("h1").textContent;
  7738. if (window.config.openTag) {
  7739. box[0].style.borderBottom = "none";
  7740. box[0].style["border-bottom-left-radius"] = "0";
  7741. box[0].style["border-bottom-right-radius"] = "0";
  7742. }
  7743. list = box[2].querySelectorAll(".cell");
  7744. box[0].after($section);
  7745. window.parse.parsePagePostList(list, box[2]);
  7746. break;
  7747. default:
  7748. window.stopMe = true;
  7749. functions.cbChecker({ type: "syncData" });
  7750. console.error("未知页面");
  7751. break;
  7752. }
  7753. });
  7754. }
  7755. window.canParseV2exPage = !window.location.search.includes("script");
  7756. if (window.canParseV2exPage) {
  7757. init();
  7758. } else {
  7759. let box = document.querySelector("#Wrapper #Main .box");
  7760. box.after($section);
  7761. window.stopMe = true;
  7762. functions.cbChecker({ type: "syncData" });
  7763. if (window.location.search.includes("script=0")) {
  7764. functions.cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  7765. }
  7766. if (window.location.search.includes("script=1")) {
  7767. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  7768. }
  7769. }
  7770. }
  7771. if (isMobile) {
  7772. console.log("V2EX 移动端");
  7773. (function() {
  7774. if (/eruda=1/.test(location.href) || localStorage.getItem("active-eruda")) {
  7775. let src = "//cdn.jsdelivr.net/npm/eruda@3.0.1";
  7776. console.log(1);
  7777. let s = document.createElement("script");
  7778. s.src = src;
  7779. s.onload = () => {
  7780. let s1 = document.createElement("script");
  7781. s1.innerText = `eruda.init();`;
  7782. document.body.append(s1);
  7783. };
  7784. document.body.append(s);
  7785. }
  7786. })();
  7787. run();
  7788. let vueApp = vue.createApp(App);
  7789. vueApp.config.unwrapInjectedRef = true;
  7790. vueApp.mount($section);
  7791. }
  7792.  
  7793. })(Vue);