V2Next

楼中楼、简洁模式、高赞回复排序、查看回复上下文、发送图片和表情、UI美化、base64 解码等功能

当前为 2024-01-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name V2Next
  3. // @namespace http://tampermonkey.net/
  4. // @version 7.8.8
  5. // @author zyronon
  6. // @description 楼中楼、简洁模式、高赞回复排序、查看回复上下文、发送图片和表情、UI美化、base64 解码等功能
  7. // @license GPL License
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=v2ex.com
  9. // @match https://v2ex.com/
  10. // @match https://v2ex.com/?tab=*
  11. // @match https://v2ex.com/t/*
  12. // @match https://v2ex.com/recent*
  13. // @match https://v2ex.com/go/*
  14. // @match https://v2ex.com/member/*
  15. // @match https://*.v2ex.com/
  16. // @match https://*.v2ex.com/?tab=*
  17. // @match https://*.v2ex.com/t/*
  18. // @match https://*.v2ex.com/recent*
  19. // @match https://*.v2ex.com/go/*
  20. // @match https://*.v2ex.com/member/*
  21. // @require https://cdn.jsdelivr.net/npm/vue@3.2.47/dist/vue.global.prod.js
  22. // @grant GM_notification
  23. // @grant GM_openInTab
  24. // @grant GM_registerMenuCommand
  25. // ==/UserScript==
  26.  
  27. (r=>{const o=document.createElement("style");o.dataset.source="vite-plugin-monkey",o.textContent=r,document.head.append(o)})(' .v-enter-active,.v-leave-active{transition:opacity .3s ease}.v-enter-from,.v-leave-to{opacity:0}.username{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num{font-weight:700;color:var(--color-font-8)}.op{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove{display:inline}.my-tag .remove{cursor:pointer;margin-left:.5rem;display:none}.add-tag{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html,body{font-size:62.5%}::-webkit-scrollbar{width:1rem;height:1rem}::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex{display:flex;align-items:center;justify-content:space-between}.flex-end{justify-content:flex-end}.flex-center{justify-content:center}.p1{padding:1rem}.p2{padding:2rem}.p0{padding:0!important}.post-author{display:flex;align-items:center;position:relative;color:#ccc!important}.post-author>.username{font-size:1.2rem}a{text-decoration:none;cursor:pointer}a:hover{text-decoration:underline}.tool{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg{width:1.6rem!important;height:1.6rem!important}.tool:hover{background:var(--color-third-bg)}.tool.no-hover{cursor:default}.tool.no-hover:hover{background:unset!important}.tool.disabled{cursor:not-allowed}.tool.disabled:hover{background:unset!important}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node:hover{text-decoration:none;background:#e2e2e2}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-cell{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal{position:fixed;z-index: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}.modal .mask{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio:first-child{border-left:none}.radio-group2 .active{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm{position:relative;display:inline-flex;justify-content:center}input{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input:hover{border:1px solid var(--color-input-border-hover)}input:focus{border:1px solid var(--color-active)}.danger{color:red!important}.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-1374316c],.v-leave-active[data-v-1374316c]{transition:opacity .3s ease}.v-enter-from[data-v-1374316c],.v-leave-to[data-v-1374316c]{opacity:0}.username[data-v-1374316c]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-1374316c]{font-weight:700;color:var(--color-font-8)}.op[data-v-1374316c]{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-1374316c]{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-1374316c]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-1374316c]{display:inline}.my-tag .remove[data-v-1374316c]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-1374316c]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-1374316c]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-1374316c]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-1374316c]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-1374316c],body[data-v-1374316c]{font-size:62.5%}[data-v-1374316c]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-1374316c]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-1374316c]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-1374316c]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-1374316c]{justify-content:flex-end}.flex-center[data-v-1374316c]{justify-content:center}.p1[data-v-1374316c]{padding:1rem}.p2[data-v-1374316c]{padding:2rem}.p0[data-v-1374316c]{padding:0!important}.post-author[data-v-1374316c]{display:flex;align-items:center;position:relative;color:#ccc!important}.post-author>.username[data-v-1374316c]{font-size:1.2rem}a[data-v-1374316c]{text-decoration:none;cursor:pointer}a[data-v-1374316c]:hover{text-decoration:underline}.tool[data-v-1374316c]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-1374316c]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-1374316c]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-1374316c]{cursor:default}.tool.no-hover[data-v-1374316c]:hover{background:unset!important}.tool.disabled[data-v-1374316c]{cursor:not-allowed}.tool.disabled[data-v-1374316c]:hover{background:unset!important}.my-node[data-v-1374316c]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-1374316c]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-1374316c]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-1374316c]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-1374316c]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-1374316c]{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-1374316c]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-1374316c]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-1374316c]{position:relative}.modal .mask[data-v-1374316c]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-1374316c]{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-1374316c]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-1374316c]:first-child{border-left:none}.radio-group2 .active[data-v-1374316c]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-1374316c]{position:relative;display:inline-flex;justify-content:center}input[data-v-1374316c]{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-1374316c]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-1374316c]:focus{border:1px solid var(--color-active)}.danger[data-v-1374316c]{color:red!important}.switch[data-v-1374316c]{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-1374316c]{background:var(--color-active)}.switch.active[data-v-1374316c]:before{right:.2rem}.switch[data-v-1374316c]:before{position:absolute;content:" ";transition:all .3s;right:calc(100% - 2rem);width:1.8rem;height:1.8rem;background:white;border-radius:50%}.setting-modal .modal-root[data-v-f54c7085]{z-index:9;background:var(--color-main-bg);border-radius:1.6rem;font-size:1.4rem;overflow:hidden;color:var(--color-font-pure)}.setting-modal .modal-root .modal-header[data-v-f54c7085]{padding:2.4rem;display:flex;justify-content:space-between}.setting-modal .modal-root .modal-header .title[data-v-f54c7085]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header i[data-v-f54c7085]{cursor:pointer;font-size:2.2rem}.setting-modal .modal-root .body[data-v-f54c7085]{width:45vw;height:70vh;display:flex}.setting-modal .modal-root .body .left[data-v-f54c7085]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-size:1.8rem}.setting-modal .modal-root .body .left .tabs[data-v-f54c7085]{padding:1rem 2rem;display:flex;flex-direction:column;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab[data-v-f54c7085]{cursor:pointer;padding:1rem 1.5rem;border-radius:.8rem;display:flex;align-items:center;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab.active[data-v-f54c7085]{background:var(--color-item-bg)}.setting-modal .modal-root .body .modal-content[data-v-f54c7085]{background:var(--color-second-bg);flex:1;height:100%;box-sizing:border-box;padding:1rem 1rem 1rem 2rem;border-radius:1.6rem;display:flex}.setting-modal .modal-root .body .modal-content .scroll[data-v-f54c7085]{flex:1;padding-right:1rem;overflow:auto}.setting-modal .modal-root .body .modal-content .scroll .row[data-v-f54c7085]{min-height:5rem;display:flex;justify-content:space-between;align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper[data-v-f54c7085]{height:3rem;flex:1;display:flex;justify-content:flex-end;align-items:center;gap:var(--space)}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper span[data-v-f54c7085]{text-align:right;font-size:1.4rem;color:gray}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key[data-v-f54c7085]{align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key input[data-v-f54c7085]{width:15rem;box-sizing:border-box;margin-right:1rem;height:2.8rem;outline:none;font-size:1.6rem;border:1px solid gray;border-radius:.3rem;padding:0 .5rem;background:var(--color-second-bg);color:var(--color-font-1)}.setting-modal .modal-root .body .modal-content .scroll .row .main-title[data-v-f54c7085]{font-size:2.2rem;font-weight:700;color:var(--color-font-8)}.setting-modal .modal-root .body .modal-content .scroll .row .item-title[data-v-f54c7085]{font-size:1.8rem}.setting-modal .modal-root .body .modal-content .scroll .desc[data-v-f54c7085]{margin-bottom:1rem;font-size:1.4rem;text-align:left;color:var(--color-font)}.setting-modal .modal-root .body .modal-content .scroll .project-desc[data-v-f54c7085]{text-align:start;font-size:1.6rem;padding-bottom:10rem}.setting-modal .modal-root .body .modal-content .scroll .line[data-v-f54c7085]{border-bottom:1px solid #c4c3c3}.loading[data-v-2697baa2]{border:2px solid;border-color:var(--color-loading-2) var(--color-loading-1) var(--color-loading-1) var(--color-loading-1);border-radius:100%;animation:circle-2697baa2 infinite 1s linear;width:2rem;height:2rem}.loading.small[data-v-2697baa2]{width:1.2rem;height:1.2rem}.loading.large[data-v-2697baa2]{width:3rem;height:3rem}@keyframes circle-2697baa2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.base-button[data-v-5a7d79ba]{cursor:pointer;border-radius:.6rem;padding:0 1.5rem;display:inline-flex;align-items:center;justify-content:center;transition:all .3s;height:3.6rem;line-height:1;position:relative}.base-button .loading[data-v-5a7d79ba]{position:absolute}.base-button.disabled[data-v-5a7d79ba]{opacity:.6;cursor:not-allowed;user-select:none}.base-button.small[data-v-5a7d79ba]{height:3rem}.base-button.small>span[data-v-5a7d79ba]{font-size:1.3rem}.base-button.large[data-v-5a7d79ba]{height:5rem;font-size:1.8rem;padding:0 2.2rem}.base-button.large>span[data-v-5a7d79ba]{font-size:1.8rem}.base-button[data-v-5a7d79ba]:hover:not(.link){opacity:.7}.base-button.primary[data-v-5a7d79ba]{background:var(--color-active)}.base-button.primary>span[data-v-5a7d79ba]{color:#fff}.base-button.gary[data-v-5a7d79ba]{background:#4b5563}.base-button.link[data-v-5a7d79ba]{border-radius:0;border-bottom:2px solid transparent}.base-button.link>span[data-v-5a7d79ba]{color:var(--color-font-8)}.base-button.link[data-v-5a7d79ba]:hover{border-bottom:2px solid var(--color-font-8)}.base-button.active[data-v-5a7d79ba]{opacity:.4}.key-notice[data-v-5a7d79ba]{margin-left:1rem;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:#fff}.key-notice .key[data-v-5a7d79ba]{transform:scale(.8)}.pop-confirm-content[data-v-05424197]{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:999}.pop-confirm-content .text[data-v-05424197]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-05424197]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.Author[data-v-bfcb8fd8]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative}.Author.expand[data-v-bfcb8fd8]{margin-bottom:0}.Author .Author-left[data-v-bfcb8fd8]{display:flex;align-items:center;max-width:65%;word-break:break-all}.Author .Author-left .username[data-v-bfcb8fd8]{font-size:1.4rem;margin-right:1rem}.Author .Author-left .expand-icon[data-v-bfcb8fd8]{cursor:pointer;margin-right:.8rem;width:2rem;height:2rem;transform:rotate(90deg)}.Author .Author-left .avatar[data-v-bfcb8fd8]{margin-right:1rem;display:flex}.Author .Author-left .avatar img[data-v-bfcb8fd8]{width:2.8rem;height:2.8rem;border-radius:.4rem}.Author .Author-left .texts[data-v-bfcb8fd8]{flex:1}.Author .Author-left .op[data-v-bfcb8fd8]{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-bfcb8fd8]{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-bfcb8fd8]{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:hover .add-tag[data-v-bfcb8fd8]{display:inline-block}.Author .Author-right[data-v-bfcb8fd8]{position:absolute;right:0;display:flex;align-items:center}.Author .Author-right .toolbar[data-v-bfcb8fd8]{display:flex;align-items:center;color:var(--color-gray);opacity:0;font-weight:700;gap:1rem}.Author .Author-right .toolbar[data-v-bfcb8fd8]:hover{opacity:1}.post-editor-wrapper[data-v-931c2ee8]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s;color:var(--color-font)}.post-editor-wrapper.reply-post .post-editor[data-v-931c2ee8]{border:1px solid var(--color-line)}.post-editor-wrapper.reply-post.isFocus .post-editor[data-v-931c2ee8]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment[data-v-931c2ee8]{border-radius:var(--box-border-radius);overflow:hidden;border:1px solid var(--color-line)}.post-editor-wrapper.reply-comment.isFocus[data-v-931c2ee8]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment .toolbar[data-v-931c2ee8]{background:var(--color-editor-toolbar)}.post-editor-wrapper .post-editor[data-v-931c2ee8]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent}.post-editor-wrapper .toolbar[data-v-931c2ee8]{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-931c2ee8]{display:flex;gap:1rem}.post-editor-wrapper .toolbar .left svg[data-v-931c2ee8]{cursor:pointer}.post-editor-wrapper .toolbar .left .upload input[data-v-931c2ee8]{cursor:pointer;position:absolute;width:20px;height:20px;opacity:0}.post-editor-wrapper .toolbar span[data-v-931c2ee8]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-931c2ee8]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent;position:absolute;top:0;z-index:-100}.post-editor-wrapper .emoticon-pack[data-v-931c2ee8]{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-931c2ee8]{cursor:pointer;position:absolute;right:2rem;font-size:2rem;color:#e2e2e2}.post-editor-wrapper .emoticon-pack .list[data-v-931c2ee8]{margin:1rem 0}.post-editor-wrapper .emoticon-pack img[data-v-931c2ee8]{cursor:pointer;width:3rem;height:3rem;padding:.5rem}.post-editor-wrapper .emoticon-pack span[data-v-931c2ee8]{display:inline-block;cursor:pointer;font-size:2.3rem;padding:.5rem}.v-enter-active[data-v-8ffbfeb2],.v-leave-active[data-v-8ffbfeb2]{transition:opacity .3s ease}.v-enter-from[data-v-8ffbfeb2],.v-leave-to[data-v-8ffbfeb2]{opacity:0}.username[data-v-8ffbfeb2]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-8ffbfeb2]{font-weight:700;color:var(--color-font-8)}.op[data-v-8ffbfeb2]{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-8ffbfeb2]{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-8ffbfeb2]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-8ffbfeb2]{display:inline}.my-tag .remove[data-v-8ffbfeb2]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-8ffbfeb2]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-8ffbfeb2]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-8ffbfeb2]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-8ffbfeb2]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-8ffbfeb2],body[data-v-8ffbfeb2]{font-size:62.5%}[data-v-8ffbfeb2]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-8ffbfeb2]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-8ffbfeb2]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-8ffbfeb2]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-8ffbfeb2]{justify-content:flex-end}.flex-center[data-v-8ffbfeb2]{justify-content:center}.p1[data-v-8ffbfeb2]{padding:1rem}.p2[data-v-8ffbfeb2]{padding:2rem}.p0[data-v-8ffbfeb2]{padding:0!important}.post-author[data-v-8ffbfeb2]{display:flex;align-items:center;position:relative;color:#ccc!important}.post-author>.username[data-v-8ffbfeb2]{font-size:1.2rem}a[data-v-8ffbfeb2]{text-decoration:none;cursor:pointer}a[data-v-8ffbfeb2]:hover{text-decoration:underline}.tool[data-v-8ffbfeb2]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-8ffbfeb2]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-8ffbfeb2]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-8ffbfeb2]{cursor:default}.tool.no-hover[data-v-8ffbfeb2]:hover{background:unset!important}.tool.disabled[data-v-8ffbfeb2]{cursor:not-allowed}.tool.disabled[data-v-8ffbfeb2]:hover{background:unset!important}.my-node[data-v-8ffbfeb2]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-8ffbfeb2]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-8ffbfeb2]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-8ffbfeb2]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-8ffbfeb2]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-8ffbfeb2]{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-8ffbfeb2]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-8ffbfeb2]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-8ffbfeb2]{position:relative}.modal .mask[data-v-8ffbfeb2]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-8ffbfeb2]{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-8ffbfeb2]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-8ffbfeb2]:first-child{border-left:none}.radio-group2 .active[data-v-8ffbfeb2]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-8ffbfeb2]{position:relative;display:inline-flex;justify-content:center}input[data-v-8ffbfeb2]{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-8ffbfeb2]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-8ffbfeb2]:focus{border:1px solid var(--color-active)}.danger[data-v-8ffbfeb2]{color:red!important}.html-wrapper[data-v-8ffbfeb2]{position:relative}.html-wrapper .mask[data-v-8ffbfeb2]{max-height:90rem;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 80%,transparent)}.html-wrapper .expand[data-v-8ffbfeb2]{position:absolute;z-index:1;bottom:2rem;padding:.2rem 1.5rem;border-radius:2rem;border:1px solid gray;background:white;color:gray;left:50%;transform:translate(-50%);cursor:pointer}.comment[data-v-e3812959]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-e3812959]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-e3812959]{background:rgba(255,255,0,.3)!important}.comment.isSimple .avatar[data-v-e3812959],.comment.isSimple .expand-line[data-v-e3812959]{display:none}.comment.isSimple .simple-wrapper[data-v-e3812959]{padding-left:2.8rem}.comment.isSimple .w[data-v-e3812959]{padding-left:0!important;padding-top:.5rem}.comment .comment-content-w .more[data-v-e3812959]{text-align:center;margin:2rem 0}.comment .comment-content[data-v-e3812959]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-e3812959]{cursor:pointer;margin-top:.6rem;width:2.8rem;min-width:2.8rem;position:relative}.comment .comment-content .expand-line[data-v-e3812959]:after{position:absolute;left:50%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .expand-line[data-v-e3812959]:hover:after{border-right:2px solid var(--color-active)}.comment .comment-content .right[data-v-e3812959]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-e3812959]{padding-left:1rem}.comment .comment-content .right .w .post-editor-wrapper[data-v-e3812959]{margin-top:1rem}.wrong-wrapper[data-v-e3812959]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper span[data-v-e3812959]{cursor:pointer}.wrong-wrapper .del-line[data-v-e3812959]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-e3812959]{margin-left:.5rem}.wrong-wrapper .warning[data-v-e3812959]{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-d838dec6]{border-top:1px solid var(--color-line);height:3.8rem;padding-left:.6rem;display:flex;align-items:center;color:var(--color-gray);font-size:1.2rem;font-weight:700;gap:1rem}.comment[data-v-67756941]{width:100%;box-sizing:border-box;display:flex;gap:1rem;padding:1rem;border-bottom:1px solid var(--color-line)}.comment.isSimple .avatar[data-v-67756941]{display:none}.comment.isSimple .reply_content[data-v-67756941]{margin-top:.5rem!important}.comment .avatar[data-v-67756941]{display:flex}.comment .avatar img[data-v-67756941]{width:3.8rem;height:3.8rem;border-radius:.3rem}.comment .comment-body[data-v-67756941]{flex:1;display:flex;flex-direction:column}.comment .comment-body .texts[data-v-67756941]{display:flex;align-items:center}.comment .comment-body .reply_content[data-v-67756941]{margin-top:1rem;max-width:calc(100% - 5rem)}.comment .isRight[data-v-67756941]{align-items:flex-end}.comment .isRight .op[data-v-67756941],.comment .isRight .mod[data-v-67756941],.comment .isRight .username[data-v-67756941]{margin:0 0 0 1rem}.comment .Author-right[data-v-67756941]{display:flex;flex-direction:column;align-items:center}.comment .Author-right .floor[data-v-67756941]{margin-left:0}.comment .Author-right .jump[data-v-67756941]{color:#929596;margin-top:.4rem;font-size:1.4rem}.comment .point[data-v-67756941]{margin:0 .5rem;font-size:1.4rem;display:flex;gap:.5rem;align-items:center;font-weight:700;color:#000}.sticky{position:sticky;bottom:-2px;z-index:2;background:var(--box-background-hover-color)!important}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.v-enter-active[data-v-7251c320],.v-leave-active[data-v-7251c320]{transition:opacity .3s ease}.v-enter-from[data-v-7251c320],.v-leave-to[data-v-7251c320]{opacity:0}.username[data-v-7251c320]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-7251c320]{font-weight:700;color:var(--color-font-8)}.op[data-v-7251c320]{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-7251c320]{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-7251c320]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-7251c320]{display:inline}.my-tag .remove[data-v-7251c320]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-7251c320]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-7251c320]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-7251c320]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-7251c320]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-7251c320],body[data-v-7251c320]{font-size:62.5%}[data-v-7251c320]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-7251c320]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-7251c320]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-7251c320]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-7251c320]{justify-content:flex-end}.flex-center[data-v-7251c320]{justify-content:center}.p1[data-v-7251c320]{padding:1rem}.p2[data-v-7251c320]{padding:2rem}.p0[data-v-7251c320]{padding:0!important}.post-author[data-v-7251c320]{display:flex;align-items:center;position:relative;color:#ccc!important}.post-author>.username[data-v-7251c320]{font-size:1.2rem}a[data-v-7251c320]{text-decoration:none;cursor:pointer}a[data-v-7251c320]:hover{text-decoration:underline}.tool[data-v-7251c320]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-7251c320]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-7251c320]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-7251c320]{cursor:default}.tool.no-hover[data-v-7251c320]:hover{background:unset!important}.tool.disabled[data-v-7251c320]{cursor:not-allowed}.tool.disabled[data-v-7251c320]:hover{background:unset!important}.my-node[data-v-7251c320]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-7251c320]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-7251c320]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-7251c320]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-7251c320]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-7251c320]{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-7251c320]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-7251c320]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-7251c320]{position:relative}.modal .mask[data-v-7251c320]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-7251c320]{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-7251c320]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-7251c320]:first-child{border-left:none}.radio-group2 .active[data-v-7251c320]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-7251c320]{position:relative;display:inline-flex;justify-content:center}input[data-v-7251c320]{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-7251c320]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-7251c320]:focus{border:1px solid var(--color-active)}.danger[data-v-7251c320]{color:red!important}.Post[data-v-7251c320]{position:unset!important;background:transparent!important;overflow:unset!important}.Post .main[data-v-7251c320]{background:transparent!important;padding:unset!important;width:100%!important}.Post .close-btn[data-v-7251c320]{display:none}.post-detail[data-v-7251c320]{text-align:start;position:fixed;z-index:99;left:0;right:0;bottom:0;top:0;background:rgba(46,47,48,.8);overflow:auto;font-size:1.4rem;display:flex;justify-content:center;flex-wrap:wrap}.post-detail[data-v-7251c320] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-7251c320] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .main[data-v-7251c320]{display:flex;justify-content:flex-end;padding:3rem 8rem 15rem;background:var(--color-main-bg);position:relative;outline:none}.post-detail .main .main-wrapper[data-v-7251c320]{width:77rem;padding-bottom:2rem;display:flex;flex-direction:column;align-items:center;position:relative}.post-detail .main .main-wrapper .post-wrapper .header:hover .add-tag[data-v-7251c320]{display:inline-block}.post-detail .main .main-wrapper .loading-wrapper[data-v-7251c320]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .main .main-wrapper #no-comments-yet[data-v-7251c320]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin-bottom:2rem;box-sizing:border-box}.post-detail .main .relationReply[data-v-7251c320]{position:fixed;width:25vw;top:6.5rem;bottom:15rem;z-index:100;transform:translate(calc(100% + 2rem));font-size:2rem;overflow:hidden}.post-detail .main .relationReply .my-cell[data-v-7251c320]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .main .relationReply .comments[data-v-7251c320]{max-height:calc(100% - 4.2rem);overflow:auto;background:var(--color-second-bg);border-radius:0 0 var(--box-border-radius) var(--box-border-radius)}.post-detail .main .call-list[data-v-7251c320]{z-index:9;position:absolute;top:12rem;border:1px solid var(--color-main-bg);background:var(--color-call-list-bg);box-shadow:0 5px 15px #0000001a;overflow:auto;max-height:30rem;border-radius:var(--box-border-radius);min-width:8rem;box-sizing:content-box}.post-detail .main .call-list .call-item[data-v-7251c320]{border-top:1px solid var(--color-main-bg);height:3rem;display:flex;padding:0 1rem;align-items:center;cursor:pointer;font-size:14px;box-sizing:border-box}.post-detail .main .call-list .call-item .select[data-v-7251c320],.post-detail .main .call-list .call-item[data-v-7251c320]:hover,.post-detail .main .call-list .call-item.select[data-v-7251c320]{background:var(--color-main-bg);text-decoration:none}.post-detail .main .call-list .call-item[data-v-7251c320]:nth-child(1){border-top:1px solid transparent}@media screen and (max-width: 1500px){.post-detail .main-wrapper[data-v-7251c320]{width:65vw!important}}@media screen and (max-width: 1280px){.post-detail .main-wrapper[data-v-7251c320]{width:75vw!important}}.post-detail .scroll-top[data-v-7251c320]{position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.5rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg)}.post-detail .scroll-to[data-v-7251c320]{position:fixed;border-radius:.6rem;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.5rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);bottom:15rem;display:flex;flex-direction:column}.post-detail .scroll-to input[data-v-7251c320]{height:2.6rem;width:3.6rem;font-size:1.4rem;text-align:center;color:gray}.post-detail .read-notice[data-v-7251c320]{display:flex;align-items:center;color:gray}.post-detail .read-notice .jump[data-v-7251c320]{background:var(--color-third-bg);color:gray;padding:.3rem 1rem;border-radius:.4rem;margin:0 1rem;cursor:pointer}.post-detail .close-btn[data-v-7251c320]{color:#b6b6b6;cursor:pointer;position:fixed;top:3rem;transform:translate(4rem);font-size:2rem}.post-detail .top-reply[data-v-7251c320]{color:var(--color-font-3);cursor:pointer;font-size:2rem;display:flex}.post-detail .top-reply i[data-v-7251c320]{padding:0 1rem}.base64_tooltip[data-v-f56506e5]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:var(--color-third-bg);min-height:2.2rem;max-width:20rem;padding:1rem;position:fixed;z-index:9998;display:flex;align-items:center;border-radius:.5rem;cursor:pointer;line-break:anywhere;font-size:1.4rem;color:var(--color-font-8)}.base64_tooltip svg[data-v-f56506e5]{margin-left:1rem;min-width:1.8rem}.base64_tooltip[data-v-f56506e5] .base-button{margin-left:1rem;margin-top:1rem}.msg[data-v-defce7f2]{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-defce7f2]{background:var(--color-active)}.msg.warning .left[data-v-defce7f2]{background:#c8c002}.msg.error .left[data-v-defce7f2]{background:red}.msg .left[data-v-defce7f2]{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-defce7f2]{margin:0 .3rem;cursor:pointer}.msg .right[data-v-defce7f2]{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.tag-modal .wrapper[data-v-2bb75acc]{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-2bb75acc]{font-weight:700}.tag-modal .wrapper .btns[data-v-2bb75acc]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.msgs[data-v-95974c3e]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.tag-modal .wrapper[data-v-dd7fcedd]{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:50vw;height:70vh;overflow:auto}.tag-modal .wrapper .title[data-v-dd7fcedd]{font-weight:700}.tag-modal .wrapper .btns[data-v-dd7fcedd]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.target-user-tags[data-v-a95e25c7]{background:var(--color-second-bg);color:var(--color-font);word-break:break-all;text-align:start;box-shadow:0 2px 3px #0000001a;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.target-user-tags .add-tag[data-v-a95e25c7]{display:inline-block} ');
  28.  
  29. (function (vue) {
  30. 'use strict';
  31.  
  32. var PageType = /* @__PURE__ */ ((PageType2) => {
  33. PageType2["Home"] = "Home";
  34. PageType2["Node"] = "Node";
  35. PageType2["Post"] = "Post";
  36. PageType2["Member"] = "Member";
  37. return PageType2;
  38. })(PageType || {});
  39. var CommentDisplayType = /* @__PURE__ */ ((CommentDisplayType2) => {
  40. CommentDisplayType2[CommentDisplayType2["FloorInFloor"] = 0] = "FloorInFloor";
  41. CommentDisplayType2[CommentDisplayType2["FloorInFloorNoCallUser"] = 4] = "FloorInFloorNoCallUser";
  42. CommentDisplayType2[CommentDisplayType2["FloorInFloorNested"] = 5] = "FloorInFloorNested";
  43. CommentDisplayType2[CommentDisplayType2["Like"] = 1] = "Like";
  44. CommentDisplayType2[CommentDisplayType2["V2exOrigin"] = 2] = "V2exOrigin";
  45. CommentDisplayType2[CommentDisplayType2["OnlyOp"] = 3] = "OnlyOp";
  46. return CommentDisplayType2;
  47. })(CommentDisplayType || {});
  48. const MAX_REPLY_LIMIT = 300;
  49. const _sfc_main$j = {
  50. name: "Tooltip",
  51. props: {
  52. title: {
  53. type: String,
  54. default() {
  55. return "";
  56. }
  57. },
  58. disabled: {
  59. type: Boolean,
  60. default() {
  61. return false;
  62. }
  63. }
  64. },
  65. data() {
  66. return {
  67. show: false
  68. };
  69. },
  70. methods: {
  71. showPop(e2) {
  72. if (this.disabled)
  73. return;
  74. if (!this.title)
  75. return;
  76. e2.stopPropagation();
  77. let rect = e2.target.getBoundingClientRect();
  78. this.show = true;
  79. vue.nextTick(() => {
  80. var _a, _b;
  81. let tip = (_b = (_a = this.$refs) == null ? void 0 : _a.tip) == null ? void 0 : _b.getBoundingClientRect();
  82. if (!tip)
  83. return;
  84. if (rect.top < 50) {
  85. this.$refs.tip.style.top = rect.top + rect.height + 10 + "px";
  86. } else {
  87. this.$refs.tip.style.top = rect.top - tip.height - 10 + "px";
  88. }
  89. let tipWidth = tip.width;
  90. let rectWidth = rect.width;
  91. this.$refs.tip.style.left = rect.left - (tipWidth - rectWidth) / 2 + "px";
  92. });
  93. }
  94. },
  95. render() {
  96. let Vnode = this.$slots.default()[0];
  97. return vue.createVNode(vue.Fragment, null, [this.show && this.title && vue.createVNode(vue.Teleport, {
  98. "to": "body"
  99. }, {
  100. default: () => [vue.createVNode(vue.Transition, {
  101. "name": "fade"
  102. }, {
  103. default: () => [vue.createVNode("div", {
  104. "ref": "tip",
  105. "className": "tip"
  106. }, [this.title])]
  107. })]
  108. }), vue.createVNode(Vnode, {
  109. "onClick": () => this.show = false,
  110. "onmouseenter": (e2) => this.showPop(e2),
  111. "onmouseleave": () => this.show = false
  112. }, null)]);
  113. }
  114. };
  115. const _export_sfc = (sfc, props) => {
  116. const target = sfc.__vccOpts || sfc;
  117. for (const [key, val] of props) {
  118. target[key] = val;
  119. }
  120. return target;
  121. };
  122. const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-ee672411"]]);
  123. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  124. __name: "BaseSwitch",
  125. props: {
  126. modelValue: { type: Boolean }
  127. },
  128. setup(__props, { emit }) {
  129. return (_ctx, _cache) => {
  130. return vue.openBlock(), vue.createElementBlock("div", {
  131. class: vue.normalizeClass(["switch", { active: __props.modelValue }]),
  132. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", !__props.modelValue))
  133. }, null, 2);
  134. };
  135. }
  136. });
  137. const BaseSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-1374316c"]]);
  138. const _sfc_main$h = {
  139. name: "Setting",
  140. components: {
  141. BaseSwitch,
  142. Tooltip
  143. },
  144. inject: ["isNight"],
  145. props: {
  146. modelValue: {
  147. type: Object,
  148. default() {
  149. return {};
  150. }
  151. },
  152. show: {
  153. type: Boolean,
  154. default() {
  155. return false;
  156. }
  157. }
  158. },
  159. data() {
  160. return {
  161. tabIndex: 0,
  162. config: window.clone(this.modelValue)
  163. };
  164. },
  165. computed: {
  166. windowConst() {
  167. return window.const;
  168. },
  169. CommentDisplayType() {
  170. return CommentDisplayType;
  171. },
  172. isNew() {
  173. return this.config.version < window.currentVersion;
  174. }
  175. },
  176. watch: {
  177. config: {
  178. handler(n2) {
  179. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  180. if (n2.topReplyLoveMinCount < 0) {
  181. n2.topReplyLoveMinCount = 1;
  182. }
  183. this.$emit("update:modelValue", n2);
  184. },
  185. deep: true
  186. }
  187. },
  188. methods: {
  189. close() {
  190. this.config.version = window.currentVersion;
  191. this.$emit("update:show", false);
  192. }
  193. }
  194. };
  195. const _withScopeId$b = (n2) => (vue.pushScopeId("data-v-f54c7085"), n2 = n2(), vue.popScopeId(), n2);
  196. const _hoisted_1$g = {
  197. key: 0,
  198. class: "setting-modal modal"
  199. };
  200. const _hoisted_2$f = { class: "modal-root" };
  201. const _hoisted_3$b = { class: "modal-header" };
  202. const _hoisted_4$b = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 脚本设置 ", -1));
  203. const _hoisted_5$8 = { class: "body" };
  204. const _hoisted_6$8 = { class: "left" };
  205. const _hoisted_7$7 = { class: "tabs" };
  206. const _hoisted_8$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("span", null, "列表设置", -1));
  207. const _hoisted_9$6 = [
  208. _hoisted_8$6
  209. ];
  210. const _hoisted_10$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("span", null, "帖子设置", -1));
  211. const _hoisted_11$6 = [
  212. _hoisted_10$6
  213. ];
  214. const _hoisted_12$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("span", null, "其他设置", -1));
  215. const _hoisted_13$6 = [
  216. _hoisted_12$6
  217. ];
  218. const _hoisted_14$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("span", null, "关于脚本", -1));
  219. const _hoisted_15$6 = [
  220. _hoisted_14$6
  221. ];
  222. const _hoisted_16$6 = { class: "modal-content" };
  223. const _hoisted_17$5 = { class: "scroll" };
  224. const _hoisted_18$5 = { key: 0 };
  225. const _hoisted_19$4 = { class: "row" };
  226. const _hoisted_20$4 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  227. const _hoisted_21$4 = { class: "wrapper" };
  228. const _hoisted_22$3 = { class: "radio-group2" };
  229. const _hoisted_23$3 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  230. const _hoisted_24$2 = { class: "row" };
  231. const _hoisted_25$3 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表hover时显示预览按钮", -1));
  232. const _hoisted_26$2 = { class: "wrapper" };
  233. const _hoisted_27$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  234. const _hoisted_28$1 = { class: "row" };
  235. const _hoisted_29$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子弹框显示", -1));
  236. const _hoisted_30$1 = { class: "wrapper" };
  237. const _hoisted_31$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此选项后,帖子始终会以弹框的方式显示。优先级大于“新标签页打开链接” ", -1));
  238. const _hoisted_32$1 = { class: "row" };
  239. const _hoisted_33$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  240. const _hoisted_34$1 = { class: "wrapper" };
  241. const _hoisted_35$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  242. const _hoisted_36$1 = { key: 1 };
  243. const _hoisted_37$1 = { class: "row" };
  244. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示回复展示方式", -1));
  245. const _hoisted_39$1 = { class: "wrapper" };
  246. const _hoisted_40$1 = { class: "row" };
  247. const _hoisted_41$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  248. const _hoisted_42$1 = { class: "wrapper" };
  249. const _hoisted_43$1 = { class: "radio-group2" };
  250. const _hoisted_44$1 = { class: "row" };
  251. const _hoisted_45$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "单独打开帖子时默认显示楼中楼", -1));
  252. const _hoisted_46$1 = { class: "wrapper" };
  253. const _hoisted_47$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 单独打开这种地址 https://v2ex.com/t/xxxx 时,是否默认显示楼中楼 ", -1));
  254. const _hoisted_48$1 = { class: "row" };
  255. const _hoisted_49$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "点击左右两侧透明处关闭帖子详情弹框", -1));
  256. const _hoisted_50$1 = { class: "wrapper" };
  257. const _hoisted_51$1 = { class: "row" };
  258. const _hoisted_52$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  259. const _hoisted_53$1 = { class: "wrapper" };
  260. const _hoisted_54$1 = { class: "row" };
  261. const _hoisted_55$1 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子宽度", -1));
  262. const _hoisted_56 = { class: "wrapper" };
  263. const _hoisted_57 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  264. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则默认宽度为77rem。接受合法的width值: "),
  265. /* @__PURE__ */ vue.createElementVNode("a", {
  266. href: "https://vue3js.cn/interview/css/em_px_rem_vh_vw.html#%E4%BA%8C%E3%80%81%E5%8D%95%E4%BD%8D",
  267. target: "_blank"
  268. }, "rem、px、vw、vh(点此查看)"),
  269. /* @__PURE__ */ vue.createTextVNode("。 vw代表屏幕百分比,如想要屏幕的66%,请填写66vw ")
  270. ], -1));
  271. const _hoisted_58 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 提示:此项设置以后,单独打开详情页时会出现帖子突然变宽(窄)的问题,暂时无解 ", -1));
  272. const _hoisted_59 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  273. const _hoisted_60 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  274. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  275. ], -1));
  276. const _hoisted_61 = { class: "row" };
  277. const _hoisted_62 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  278. const _hoisted_63 = { class: "wrapper" };
  279. const _hoisted_64 = { class: "row" };
  280. const _hoisted_65 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  281. const _hoisted_66 = { class: "wrapper" };
  282. const _hoisted_67 = { class: "row" };
  283. const _hoisted_68 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  284. const _hoisted_69 = { class: "wrapper" };
  285. const _hoisted_70 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  286. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "记忆阅读")
  287. ], -1));
  288. const _hoisted_71 = { class: "row" };
  289. const _hoisted_72 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "记录上次阅读楼层(误差1层左右):", -1));
  290. const _hoisted_73 = { class: "wrapper" };
  291. const _hoisted_74 = { class: "row" };
  292. const _hoisted_75 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开帖子自动跳转到上次阅读楼层", -1));
  293. const _hoisted_76 = { class: "wrapper" };
  294. const _hoisted_77 = { key: 2 };
  295. const _hoisted_78 = { class: "row" };
  296. const _hoisted_79 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  297. const _hoisted_80 = { class: "wrapper" };
  298. const _hoisted_81 = { class: "row" };
  299. const _hoisted_82 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  300. const _hoisted_83 = { class: "wrapper" };
  301. const _hoisted_84 = { class: "row" };
  302. const _hoisted_85 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  303. const _hoisted_86 = { class: "wrapper" };
  304. const _hoisted_87 = { class: "row" };
  305. const _hoisted_88 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自定义背景", -1));
  306. const _hoisted_89 = { class: "wrapper" };
  307. const _hoisted_90 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  308. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则背景颜色默认为 #e2e2e2。接受一个合法的css color值:例如"),
  309. /* @__PURE__ */ vue.createElementVNode("a", {
  310. href: "https://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value",
  311. target: "_blank"
  312. }, "red、#ffffff、rgb(222,222,22)(点此查看)"),
  313. /* @__PURE__ */ vue.createTextVNode("等等。 ")
  314. ], -1));
  315. const _hoisted_91 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  316. const _hoisted_92 = { class: "row" };
  317. const _hoisted_93 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  318. const _hoisted_94 = { class: "wrapper" };
  319. const _hoisted_95 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录(不可用),无法查看账号收藏了 ", -1));
  320. const _hoisted_96 = { key: 3 };
  321. const _hoisted_97 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h1", null, "V2EX Next", -1));
  322. const _hoisted_98 = { class: "project-desc" };
  323. const _hoisted_99 = ["href"];
  324. const _hoisted_100 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("b", null, "请帮我点一个Star,您的Star是对我最大的鼓励", -1));
  325. const _hoisted_101 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h2", null, "为什么选择这个,而不是其他?", -1));
  326. const _hoisted_102 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h3", null, "其他脚本:", -1));
  327. const _hoisted_103 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h3", null, "本脚本:", -1));
  328. const _hoisted_104 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("b", null, "最好用的楼中楼、查看回复上下文、高赞回复、简洁模式等特色功能。", -1));
  329. const _hoisted_105 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h2", null, "特色功能", -1));
  330. const _hoisted_106 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("ul", null, [
  331. /* @__PURE__ */ vue.createElementVNode("li", null, [
  332. /* @__PURE__ */ vue.createTextVNode("楼中楼 "),
  333. /* @__PURE__ */ vue.createElementVNode("ol", null, [
  334. /* @__PURE__ */ vue.createElementVNode("li", null, "可按高赞排序显示"),
  335. /* @__PURE__ */ vue.createElementVNode("li", null, "可只看楼主")
  336. ])
  337. ]),
  338. /* @__PURE__ */ vue.createElementVNode("li", null, "简洁模式"),
  339. /* @__PURE__ */ vue.createElementVNode("li", null, "查看回复上下文"),
  340. /* @__PURE__ */ vue.createElementVNode("li", null, "高赞回复")
  341. ], -1));
  342. const _hoisted_107 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h2", null, "增强(辅助)功能", -1));
  343. const _hoisted_108 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("ul", null, [
  344. /* @__PURE__ */ vue.createElementVNode("li", null, "预览帖子正文"),
  345. /* @__PURE__ */ vue.createElementVNode("li", null, "弹框显示帖子正文和回复"),
  346. /* @__PURE__ */ vue.createElementVNode("li", null, "帖子显示OP注册(不可用)时间"),
  347. /* @__PURE__ */ vue.createElementVNode("li", null, "链接自动转图片"),
  348. /* @__PURE__ */ vue.createElementVNode("li", null, "快捷发送贴吧表情、emoji、图片"),
  349. /* @__PURE__ */ vue.createElementVNode("li", null, "新标签页打开链接,默认打开,可单独关闭"),
  350. /* @__PURE__ */ vue.createElementVNode("li", null, "对用户打标签"),
  351. /* @__PURE__ */ vue.createElementVNode("li", null, "划词 base64 解码,支持解码中文"),
  352. /* @__PURE__ */ vue.createElementVNode("li", null, "一键@所有人,@管理员:回复时,可一键@所有人和@管理员"),
  353. /* @__PURE__ */ vue.createElementVNode("li", null, "自适应屏幕宽度,支持黑暗模式"),
  354. /* @__PURE__ */ vue.createElementVNode("li", null, "记忆上次阅读位置"),
  355. /* @__PURE__ */ vue.createElementVNode("li", null, "按钮异步请求:操作按钮(感谢、收藏、回复、隐藏)异步请求,不会刷新页面"),
  356. /* @__PURE__ */ vue.createElementVNode("li", null, "收藏时提醒添加到浏览器书签,防止账号被封无法查看收藏"),
  357. /* @__PURE__ */ vue.createElementVNode("li", null, "自动签到"),
  358. /* @__PURE__ */ vue.createElementVNode("li", null, "正文超长自动折叠")
  359. ], -1));
  360. const _hoisted_109 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("h2", null, "如何帮助我", -1));
  361. const _hoisted_110 = ["href"];
  362. const _hoisted_111 = ["href"];
  363. const _hoisted_112 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("div", null, [
  364. /* @__PURE__ */ vue.createTextVNode(" 更新日志:"),
  365. /* @__PURE__ */ vue.createElementVNode("a", {
  366. href: "https://gf.qytechs.cn/zh-CN/scripts/458024/versions",
  367. target: "_blank"
  368. }, "https://gf.qytechs.cn/zh-CN/scripts/458024/versions")
  369. ], -1));
  370. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  371. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  372. const _component_Tooltip = vue.resolveComponent("Tooltip");
  373. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  374. default: vue.withCtx(() => [
  375. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  376. vue.createElementVNode("div", {
  377. class: "mask",
  378. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  379. }),
  380. vue.createElementVNode("div", _hoisted_2$f, [
  381. vue.createElementVNode("div", _hoisted_3$b, [
  382. _hoisted_4$b,
  383. vue.createElementVNode("i", {
  384. class: "fa fa-times",
  385. onClick: _cache[1] || (_cache[1] = (...args) => $options.close && $options.close(...args))
  386. })
  387. ]),
  388. vue.createElementVNode("div", _hoisted_5$8, [
  389. vue.createElementVNode("div", _hoisted_6$8, [
  390. vue.createElementVNode("div", _hoisted_7$7, [
  391. vue.createElementVNode("div", {
  392. class: vue.normalizeClass(["tab", $data.tabIndex === 0 && "active"]),
  393. onClick: _cache[2] || (_cache[2] = ($event) => $data.tabIndex = 0)
  394. }, _hoisted_9$6, 2),
  395. vue.createElementVNode("div", {
  396. class: vue.normalizeClass(["tab", $data.tabIndex === 1 && "active"]),
  397. onClick: _cache[3] || (_cache[3] = ($event) => $data.tabIndex = 1)
  398. }, _hoisted_11$6, 2),
  399. vue.createElementVNode("div", {
  400. class: vue.normalizeClass(["tab", $data.tabIndex === 2 && "active"]),
  401. onClick: _cache[4] || (_cache[4] = ($event) => $data.tabIndex = 2)
  402. }, _hoisted_13$6, 2),
  403. vue.createElementVNode("div", {
  404. class: vue.normalizeClass(["tab", $data.tabIndex === 3 && "active"]),
  405. onClick: _cache[5] || (_cache[5] = ($event) => $data.tabIndex = 3)
  406. }, _hoisted_15$6, 2)
  407. ])
  408. ]),
  409. vue.createElementVNode("div", _hoisted_16$6, [
  410. vue.createElementVNode("div", _hoisted_17$5, [
  411. $data.tabIndex === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$5, [
  412. vue.createElementVNode("div", _hoisted_19$4, [
  413. _hoisted_20$4,
  414. vue.createElementVNode("div", _hoisted_21$4, [
  415. vue.createElementVNode("div", _hoisted_22$3, [
  416. vue.createElementVNode("div", {
  417. class: vue.normalizeClass(["radio", $data.config.viewType === "simple" ? "active" : ""]),
  418. onClick: _cache[6] || (_cache[6] = ($event) => $data.config.viewType = "simple")
  419. }, "简洁 ", 2),
  420. vue.createElementVNode("div", {
  421. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  422. onClick: _cache[7] || (_cache[7] = ($event) => $data.config.viewType = "table")
  423. }, "表格 ", 2),
  424. vue.createElementVNode("div", {
  425. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  426. onClick: _cache[8] || (_cache[8] = ($event) => $data.config.viewType = "card")
  427. }, "卡片 ", 2)
  428. ])
  429. ])
  430. ]),
  431. _hoisted_23$3,
  432. vue.createElementVNode("div", _hoisted_24$2, [
  433. _hoisted_25$3,
  434. vue.createElementVNode("div", _hoisted_26$2, [
  435. vue.createVNode(_component_BaseSwitch, {
  436. modelValue: $data.config.showPreviewBtn,
  437. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.showPreviewBtn = $event)
  438. }, null, 8, ["modelValue"])
  439. ])
  440. ]),
  441. _hoisted_27$1,
  442. vue.createElementVNode("div", _hoisted_28$1, [
  443. _hoisted_29$1,
  444. vue.createElementVNode("div", _hoisted_30$1, [
  445. vue.createVNode(_component_BaseSwitch, {
  446. modelValue: $data.config.clickPostItemOpenDetail,
  447. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  448. }, null, 8, ["modelValue"])
  449. ])
  450. ]),
  451. _hoisted_31$1,
  452. vue.createElementVNode("div", _hoisted_32$1, [
  453. _hoisted_33$1,
  454. vue.createElementVNode("div", _hoisted_34$1, [
  455. vue.createVNode(_component_BaseSwitch, {
  456. modelValue: $data.config.newTabOpen,
  457. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.newTabOpen = $event)
  458. }, null, 8, ["modelValue"])
  459. ])
  460. ]),
  461. _hoisted_35$1
  462. ])) : vue.createCommentVNode("", true),
  463. $data.tabIndex === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_36$1, [
  464. vue.createElementVNode("div", _hoisted_37$1, [
  465. _hoisted_38$1,
  466. vue.createElementVNode("div", _hoisted_39$1, [
  467. vue.createVNode(_component_BaseSwitch, {
  468. modelValue: $data.config.showToolbar,
  469. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.config.showToolbar = $event)
  470. }, null, 8, ["modelValue"])
  471. ])
  472. ]),
  473. vue.createElementVNode("div", _hoisted_40$1, [
  474. _hoisted_41$1,
  475. vue.createElementVNode("div", _hoisted_42$1, [
  476. vue.createElementVNode("div", _hoisted_43$1, [
  477. vue.createVNode(_component_Tooltip, { title: "不隐藏@用户" }, {
  478. default: vue.withCtx(() => [
  479. vue.createElementVNode("div", {
  480. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.FloorInFloor ? "active" : ""]),
  481. onClick: _cache[13] || (_cache[13] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.FloorInFloor)
  482. }, "楼中楼(@) ", 2)
  483. ]),
  484. _: 1
  485. }),
  486. vue.createVNode(_component_Tooltip, { title: "隐藏第一个@用户,双击内容可显示原文" }, {
  487. default: vue.withCtx(() => [
  488. vue.createElementVNode("div", {
  489. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser ? "active" : ""]),
  490. onClick: _cache[14] || (_cache[14] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.FloorInFloorNoCallUser)
  491. }, " 楼中楼 ", 2)
  492. ]),
  493. _: 1
  494. }),
  495. vue.createVNode(_component_Tooltip, { title: "重复显示楼中楼的回复" }, {
  496. default: vue.withCtx(() => [
  497. vue.createElementVNode("div", {
  498. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNested ? "active" : ""]),
  499. onClick: _cache[15] || (_cache[15] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.FloorInFloorNested)
  500. }, " 冗余楼中楼 ", 2)
  501. ]),
  502. _: 1
  503. }),
  504. vue.createElementVNode("div", {
  505. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.Like ? "active" : ""]),
  506. onClick: _cache[16] || (_cache[16] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.Like)
  507. }, "感谢 ", 2),
  508. vue.createElementVNode("div", {
  509. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.OnlyOp ? "active" : ""]),
  510. onClick: _cache[17] || (_cache[17] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.OnlyOp)
  511. }, "只看楼主 ", 2),
  512. vue.createElementVNode("div", {
  513. class: vue.normalizeClass(["radio", $data.config.commentDisplayType === $options.CommentDisplayType.V2exOrigin ? "active" : ""]),
  514. onClick: _cache[18] || (_cache[18] = ($event) => $data.config.commentDisplayType = $options.CommentDisplayType.V2exOrigin)
  515. }, "V2原版 ", 2)
  516. ])
  517. ])
  518. ]),
  519. vue.createElementVNode("div", _hoisted_44$1, [
  520. _hoisted_45$1,
  521. vue.createElementVNode("div", _hoisted_46$1, [
  522. vue.createVNode(_component_BaseSwitch, {
  523. modelValue: $data.config.autoOpenDetail,
  524. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.config.autoOpenDetail = $event)
  525. }, null, 8, ["modelValue"])
  526. ])
  527. ]),
  528. _hoisted_47$1,
  529. vue.createElementVNode("div", _hoisted_48$1, [
  530. _hoisted_49$1,
  531. vue.createElementVNode("div", _hoisted_50$1, [
  532. vue.createVNode(_component_BaseSwitch, {
  533. modelValue: $data.config.closePostDetailBySpace,
  534. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => $data.config.closePostDetailBySpace = $event)
  535. }, null, 8, ["modelValue"])
  536. ])
  537. ]),
  538. vue.createElementVNode("div", _hoisted_51$1, [
  539. _hoisted_52$1,
  540. vue.createElementVNode("div", _hoisted_53$1, [
  541. vue.createVNode(_component_BaseSwitch, {
  542. modelValue: $data.config.contentAutoCollapse,
  543. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => $data.config.contentAutoCollapse = $event)
  544. }, null, 8, ["modelValue"])
  545. ])
  546. ]),
  547. vue.createElementVNode("div", _hoisted_54$1, [
  548. _hoisted_55$1,
  549. vue.createElementVNode("div", _hoisted_56, [
  550. vue.withDirectives(vue.createElementVNode("input", {
  551. type: "text",
  552. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.config.postWidth = $event)
  553. }, null, 512), [
  554. [vue.vModelText, $data.config.postWidth]
  555. ])
  556. ])
  557. ]),
  558. _hoisted_57,
  559. _hoisted_58,
  560. _hoisted_59,
  561. _hoisted_60,
  562. vue.createElementVNode("div", _hoisted_61, [
  563. _hoisted_62,
  564. vue.createElementVNode("div", _hoisted_63, [
  565. vue.createVNode(_component_BaseSwitch, {
  566. modelValue: $data.config.showTopReply,
  567. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $data.config.showTopReply = $event)
  568. }, null, 8, ["modelValue"])
  569. ])
  570. ]),
  571. vue.createElementVNode("div", _hoisted_64, [
  572. _hoisted_65,
  573. vue.createElementVNode("div", _hoisted_66, [
  574. vue.withDirectives(vue.createElementVNode("input", {
  575. type: "number",
  576. min: "1",
  577. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => $data.config.topReplyCount = $event)
  578. }, null, 512), [
  579. [vue.vModelText, $data.config.topReplyCount]
  580. ])
  581. ])
  582. ]),
  583. vue.createElementVNode("div", _hoisted_67, [
  584. _hoisted_68,
  585. vue.createElementVNode("div", _hoisted_69, [
  586. vue.withDirectives(vue.createElementVNode("input", {
  587. type: "number",
  588. min: "1",
  589. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => $data.config.topReplyLoveMinCount = $event)
  590. }, null, 512), [
  591. [vue.vModelText, $data.config.topReplyLoveMinCount]
  592. ])
  593. ])
  594. ]),
  595. _hoisted_70,
  596. vue.createElementVNode("div", _hoisted_71, [
  597. _hoisted_72,
  598. vue.createElementVNode("div", _hoisted_73, [
  599. vue.createVNode(_component_BaseSwitch, {
  600. "model-value": $data.config.rememberLastReadFloor,
  601. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => {
  602. $data.config.rememberLastReadFloor = !$data.config.rememberLastReadFloor;
  603. $data.config.autoJumpLastReadFloor = false;
  604. })
  605. }, null, 8, ["model-value"])
  606. ])
  607. ]),
  608. vue.createElementVNode("div", _hoisted_74, [
  609. _hoisted_75,
  610. vue.createElementVNode("div", _hoisted_76, [
  611. vue.createVNode(_component_BaseSwitch, {
  612. modelValue: $data.config.autoJumpLastReadFloor,
  613. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => $data.config.autoJumpLastReadFloor = $event)
  614. }, null, 8, ["modelValue"])
  615. ])
  616. ])
  617. ])) : vue.createCommentVNode("", true),
  618. $data.tabIndex === 2 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_77, [
  619. vue.createElementVNode("div", _hoisted_78, [
  620. _hoisted_79,
  621. vue.createElementVNode("div", _hoisted_80, [
  622. vue.createVNode(_component_BaseSwitch, {
  623. modelValue: $data.config.openTag,
  624. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => $data.config.openTag = $event)
  625. }, null, 8, ["modelValue"])
  626. ])
  627. ]),
  628. vue.createElementVNode("div", _hoisted_81, [
  629. _hoisted_82,
  630. vue.createElementVNode("div", _hoisted_83, [
  631. vue.createVNode(_component_BaseSwitch, {
  632. modelValue: $data.config.base64,
  633. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => $data.config.base64 = $event)
  634. }, null, 8, ["modelValue"])
  635. ])
  636. ]),
  637. vue.createElementVNode("div", _hoisted_84, [
  638. _hoisted_85,
  639. vue.createElementVNode("div", _hoisted_86, [
  640. vue.createVNode(_component_BaseSwitch, {
  641. modelValue: $data.config.autoSignin,
  642. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => $data.config.autoSignin = $event)
  643. }, null, 8, ["modelValue"])
  644. ])
  645. ]),
  646. vue.createElementVNode("div", _hoisted_87, [
  647. _hoisted_88,
  648. vue.createElementVNode("div", _hoisted_89, [
  649. vue.withDirectives(vue.createElementVNode("input", {
  650. type: "text",
  651. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => $data.config.customBgColor = $event)
  652. }, null, 512), [
  653. [vue.vModelText, $data.config.customBgColor]
  654. ])
  655. ])
  656. ]),
  657. _hoisted_90,
  658. _hoisted_91,
  659. vue.createElementVNode("div", _hoisted_92, [
  660. _hoisted_93,
  661. vue.createElementVNode("div", _hoisted_94, [
  662. vue.createVNode(_component_BaseSwitch, {
  663. modelValue: $data.config.collectBrowserNotice,
  664. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => $data.config.collectBrowserNotice = $event)
  665. }, null, 8, ["modelValue"])
  666. ])
  667. ]),
  668. _hoisted_95
  669. ])) : vue.createCommentVNode("", true),
  670. $data.tabIndex === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_96, [
  671. _hoisted_97,
  672. vue.createElementVNode("div", _hoisted_98, [
  673. vue.createElementVNode("div", null, [
  674. vue.createTextVNode(" 本项目完全开源,项目地址:"),
  675. vue.createElementVNode("a", {
  676. href: $options.windowConst.git,
  677. target: "_blank"
  678. }, vue.toDisplayString($options.windowConst.git), 9, _hoisted_99),
  679. vue.createTextVNode(",目前由我一个人维护,如果您觉得好用,"),
  680. _hoisted_100
  681. ]),
  682. vue.createElementVNode("div", null, [
  683. _hoisted_101,
  684. _hoisted_102,
  685. vue.createTextVNode(" 大多只是对V2EX修修补补、美化UI,在使用体验上依旧是10年前的网站,太多脚本年久失修无人维护。楼中楼只能解析当前页,如果有多页回复,楼中楼就会前言不搭后语莫名其妙的 "),
  686. _hoisted_103,
  687. _hoisted_104,
  688. vue.createTextVNode(" 对V2EX进行了整体改造,如预览、点赞、回复、屏蔽等等都走异步请求,使用体验上已和现代网站无异,同时也集成了市面上常见的增强(辅助)功能, "),
  689. _hoisted_105,
  690. _hoisted_106,
  691. _hoisted_107,
  692. _hoisted_108,
  693. _hoisted_109,
  694. vue.createTextVNode(" 这个项目花了我很多精力,如果对您有用: 点个 "),
  695. vue.createElementVNode("a", {
  696. href: $options.windowConst.git
  697. }, "Star ⭐️", 8, _hoisted_110),
  698. vue.createTextVNode(" 或分享给他人,让更多的人知道我的存在。 "),
  699. vue.createElementVNode("div", null, [
  700. vue.createTextVNode("提供反馈,帮助我改进,以持续完善脚本。在 "),
  701. vue.createElementVNode("a", {
  702. href: $options.windowConst.issue
  703. }, "这里", 8, _hoisted_111),
  704. vue.createTextVNode(" 提出。")
  705. ]),
  706. _hoisted_112
  707. ])
  708. ])
  709. ])) : vue.createCommentVNode("", true)
  710. ])
  711. ])
  712. ])
  713. ])
  714. ])) : vue.createCommentVNode("", true)
  715. ]),
  716. _: 1
  717. });
  718. }
  719. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$8], ["__scopeId", "data-v-f54c7085"]]);
  720. const eventBus = {
  721. eventMap: /* @__PURE__ */ new Map(),
  722. on(eventType, cb) {
  723. let cbs = this.eventMap.get(eventType);
  724. if (cbs) {
  725. cbs.push(cb);
  726. } else {
  727. cbs = [cb];
  728. }
  729. this.eventMap.set(eventType, cbs);
  730. },
  731. emit(eventType, val) {
  732. let cbs = this.eventMap.get(eventType);
  733. if (cbs) {
  734. cbs.map((cb) => cb(val));
  735. }
  736. },
  737. off(eventType) {
  738. let cbs = this.eventMap.has(eventType);
  739. if (cbs) {
  740. this.eventMap.delete(eventType);
  741. }
  742. },
  743. clear() {
  744. this.eventMap = /* @__PURE__ */ new Map();
  745. }
  746. };
  747. const CMD = {
  748. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  749. SHOW_MSG: "SHOW_MSG",
  750. SET_CALL: "SET_CALL",
  751. SHOW_CALL: "SHOW_CALL",
  752. REFRESH_ONCE: "REFRESH_ONCE",
  753. ADD_REPLY: "ADD_REPLY",
  754. IGNORE: "IGNORE",
  755. MERGE: "MERGE",
  756. REMOVE: "REMOVE",
  757. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  758. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  759. ADD_TAG: "ADD_TAG",
  760. REMOVE_TAG: "REMOVE_TAG",
  761. RELATION_REPLY: "RELATION_REPLY",
  762. JUMP: "JUMP",
  763. ADD_READ: "ADD_READ"
  764. };
  765. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  766. __name: "BaseLoading",
  767. props: {
  768. size: { default: "normal" }
  769. },
  770. setup(__props) {
  771. return (_ctx, _cache) => {
  772. return vue.openBlock(), vue.createElementBlock("div", {
  773. class: vue.normalizeClass(["loading", [__props.size]])
  774. }, null, 2);
  775. };
  776. }
  777. });
  778. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-2697baa2"]]);
  779. const _hoisted_1$f = {
  780. key: 1,
  781. class: "key-notice"
  782. };
  783. const _hoisted_2$e = { class: "key" };
  784. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  785. __name: "BaseButton",
  786. props: {
  787. keyboard: null,
  788. active: { type: Boolean },
  789. disabled: { type: Boolean },
  790. loading: { type: Boolean },
  791. size: { default: "normal" },
  792. type: { default: "primary" }
  793. },
  794. emits: ["click"],
  795. setup(__props) {
  796. return (_ctx, _cache) => {
  797. return vue.openBlock(), vue.createBlock(Tooltip, {
  798. disabled: !__props.keyboard,
  799. title: `快捷键: ${__props.keyboard}`
  800. }, {
  801. default: vue.withCtx(() => [
  802. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  803. onClick: _cache[0] || (_cache[0] = (e2) => !__props.disabled && !__props.loading && _ctx.$emit("click", e2)),
  804. class: [
  805. __props.active && "active",
  806. __props.size,
  807. __props.type,
  808. (__props.disabled || __props.loading) && "disabled",
  809. !__props.disabled && "hvr-grow"
  810. ]
  811. }), [
  812. vue.createElementVNode("span", {
  813. style: vue.normalizeStyle({ opacity: __props.loading ? 0 : 1 })
  814. }, [
  815. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  816. ], 4),
  817. __props.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  818. key: 0,
  819. size: "small"
  820. })) : vue.createCommentVNode("", true),
  821. __props.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
  822. vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(__props.keyboard), 1)
  823. ])) : vue.createCommentVNode("", true)
  824. ], 16)
  825. ]),
  826. _: 3
  827. }, 8, ["disabled", "title"]);
  828. };
  829. }
  830. });
  831. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-5a7d79ba"]]);
  832. const _sfc_main$e = {
  833. name: "PopConfirm",
  834. components: { BaseButton },
  835. props: {
  836. title: {
  837. type: String,
  838. default() {
  839. return "";
  840. }
  841. },
  842. disabled: {
  843. type: Boolean,
  844. default() {
  845. return false;
  846. }
  847. }
  848. },
  849. data() {
  850. return {
  851. show: false
  852. };
  853. },
  854. methods: {
  855. showPop(e2) {
  856. if (this.disabled)
  857. return;
  858. let rect = e2.target.getBoundingClientRect();
  859. this.show = true;
  860. vue.nextTick(() => {
  861. this.$refs.tip.style.top = rect.top + "px";
  862. this.$refs.tip.style.left = rect.left + rect.width / 2 - 50 + "px";
  863. });
  864. },
  865. confirm() {
  866. this.show = false;
  867. this.$emit("confirm");
  868. }
  869. }
  870. };
  871. const _hoisted_1$e = { class: "pop-confirm" };
  872. const _hoisted_2$d = {
  873. key: 0,
  874. ref: "tip",
  875. class: "pop-confirm-content"
  876. };
  877. const _hoisted_3$a = { class: "text" };
  878. const _hoisted_4$a = { class: "options" };
  879. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  880. const _component_BaseButton = vue.resolveComponent("BaseButton");
  881. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
  882. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  883. vue.createVNode(vue.Transition, null, {
  884. default: vue.withCtx(() => [
  885. $data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
  886. vue.createElementVNode("div", _hoisted_3$a, vue.toDisplayString($props.title), 1),
  887. vue.createElementVNode("div", _hoisted_4$a, [
  888. vue.createVNode(_component_BaseButton, {
  889. type: "link",
  890. size: "small",
  891. onClick: _cache[0] || (_cache[0] = ($event) => $data.show = false)
  892. }, {
  893. default: vue.withCtx(() => [
  894. vue.createTextVNode("取消")
  895. ]),
  896. _: 1
  897. }),
  898. vue.createVNode(_component_BaseButton, {
  899. size: "small",
  900. onClick: $options.confirm
  901. }, {
  902. default: vue.withCtx(() => [
  903. vue.createTextVNode("确认")
  904. ]),
  905. _: 1
  906. }, 8, ["onClick"])
  907. ])
  908. ], 512)) : vue.createCommentVNode("", true)
  909. ]),
  910. _: 1
  911. })
  912. ])),
  913. vue.createElementVNode("span", {
  914. onClick: _cache[1] || (_cache[1] = (...args) => $options.showPop && $options.showPop(...args))
  915. }, [
  916. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  917. ])
  918. ]);
  919. }
  920. const PopConfirm = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$7], ["__scopeId", "data-v-05424197"]]);
  921. const loveColor = "rgb(224,42,42)";
  922. const _sfc_main$d = {
  923. name: "Point",
  924. components: { PopConfirm },
  925. inject: ["post", "isLogin"],
  926. props: {
  927. item: {
  928. type: Object,
  929. default() {
  930. return {};
  931. }
  932. },
  933. full: {
  934. type: Boolean,
  935. default() {
  936. return true;
  937. }
  938. },
  939. apiUrl: ""
  940. },
  941. computed: {
  942. disabled() {
  943. return this.item.username === window.user.username || this.item.isThanked || !this.isLogin;
  944. }
  945. },
  946. methods: {
  947. getColor() {
  948. if (this.item.isThanked)
  949. return loveColor;
  950. return this.full ? loveColor : "#929596";
  951. },
  952. getIsFull() {
  953. if (this.item.isThanked)
  954. return loveColor;
  955. return this.full ? loveColor : "none";
  956. },
  957. thankError() {
  958. if (this.item.username === window.user.username) {
  959. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  960. }
  961. if (this.item.isThanked) {
  962. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  963. }
  964. if (!this.isLogin) {
  965. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  966. }
  967. },
  968. async thank() {
  969. this.$emit("addThank");
  970. let url = `${window.baseUrl}/thank/${this.apiUrl}?once=${this.post.once}`;
  971. $.post(url).then((res) => {
  972. if (!res.success) {
  973. this.$emit("recallThank");
  974. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  975. }
  976. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  977. }, (err) => {
  978. this.$emit("recallThank");
  979. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  980. eventBus.emit(CMD.REFRESH_ONCE);
  981. });
  982. }
  983. }
  984. };
  985. const _hoisted_1$d = {
  986. viewBox: "0 0 48 48",
  987. fill: "none",
  988. xmlns: "http://www.w3.org/2000/svg"
  989. };
  990. const _hoisted_2$c = ["fill", "stroke"];
  991. const _hoisted_3$9 = {
  992. key: 0,
  993. class: "link-num"
  994. };
  995. const _hoisted_4$9 = { key: 1 };
  996. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  997. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  998. return vue.openBlock(), vue.createBlock(_component_PopConfirm, {
  999. disabled: $options.disabled,
  1000. title: `确认花费 10 个铜币向 @${$props.item.username} 的这条回复发送感谢?`,
  1001. onConfirm: $options.thank
  1002. }, {
  1003. default: vue.withCtx(() => [
  1004. vue.createElementVNode("div", {
  1005. class: vue.normalizeClass(["tool", $options.disabled ? "disabled" : ""]),
  1006. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  1007. }, [
  1008. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, [
  1009. vue.createElementVNode("path", {
  1010. d: "M15 8C8.92487 8 4 12.9249 4 19C4 30 17 40 24 42.3262C31 40 44 30 44 19C44 12.9249 39.0751 8 33 8C29.2797 8 25.9907 9.8469 24 12.6738C22.0093 9.8469 18.7203 8 15 8Z",
  1011. fill: $options.getIsFull(),
  1012. stroke: $options.getColor(),
  1013. "stroke-width": "2",
  1014. "stroke-linecap": "round",
  1015. "stroke-linejoin": "round"
  1016. }, null, 8, _hoisted_2$c)
  1017. ])),
  1018. $props.item.thankCount ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$9, vue.toDisplayString($props.item.thankCount), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$9, "感谢"))
  1019. ], 2)
  1020. ]),
  1021. _: 1
  1022. }, 8, ["disabled", "title", "onConfirm"]);
  1023. }
  1024. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$6]]);
  1025. const _sfc_main$c = {
  1026. name: "Author",
  1027. components: { PopConfirm, Point },
  1028. inject: ["isLogin", "tags", "config", "isNight"],
  1029. props: {
  1030. modelValue: false,
  1031. comment: {
  1032. type: Object,
  1033. default() {
  1034. return {};
  1035. }
  1036. },
  1037. type: {
  1038. type: String,
  1039. default() {
  1040. return "list";
  1041. }
  1042. }
  1043. },
  1044. computed: {
  1045. isDev() {
  1046. return false;
  1047. },
  1048. pointInfo() {
  1049. return {
  1050. isThanked: this.comment.isThanked,
  1051. thankCount: this.comment.thankCount,
  1052. username: this.comment.username
  1053. };
  1054. },
  1055. myTags() {
  1056. return this.tags[this.comment.username] ?? [];
  1057. },
  1058. context() {
  1059. return this.comment.replyUsers.length;
  1060. }
  1061. },
  1062. methods: {
  1063. jump() {
  1064. eventBus.emit(CMD.JUMP, this.comment.floor);
  1065. },
  1066. showRelationReply() {
  1067. if (!this.comment.replyUsers.length) {
  1068. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  1069. return;
  1070. }
  1071. eventBus.emit(CMD.RELATION_REPLY, {
  1072. left: this.comment.replyUsers,
  1073. right: this.comment.username,
  1074. rightFloor: this.comment.floor
  1075. });
  1076. },
  1077. addTag() {
  1078. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  1079. },
  1080. removeTag(tag) {
  1081. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  1082. },
  1083. checkIsLogin(emitName = "") {
  1084. if (!this.isLogin) {
  1085. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  1086. return false;
  1087. }
  1088. this.$emit(emitName);
  1089. return true;
  1090. },
  1091. addThank() {
  1092. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  1093. },
  1094. recallThank() {
  1095. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  1096. }
  1097. }
  1098. };
  1099. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-bfcb8fd8"), n2 = n2(), vue.popScopeId(), n2);
  1100. const _hoisted_1$c = { class: "Author-left" };
  1101. const _hoisted_2$b = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1102. d: "M22 42H6V26",
  1103. stroke: "#177EC9",
  1104. "stroke-width": "4",
  1105. "stroke-linecap": "round",
  1106. "stroke-linejoin": "round"
  1107. }, null, -1));
  1108. const _hoisted_3$8 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1109. d: "M26 6H42V22",
  1110. stroke: "#177EC9",
  1111. "stroke-width": "4",
  1112. "stroke-linecap": "round",
  1113. "stroke-linejoin": "round"
  1114. }, null, -1));
  1115. const _hoisted_4$8 = [
  1116. _hoisted_2$b,
  1117. _hoisted_3$8
  1118. ];
  1119. const _hoisted_5$7 = ["href"];
  1120. const _hoisted_6$7 = ["src"];
  1121. const _hoisted_7$6 = { class: "texts" };
  1122. const _hoisted_8$5 = ["href"];
  1123. const _hoisted_9$5 = {
  1124. key: 0,
  1125. class: "op"
  1126. };
  1127. const _hoisted_10$5 = {
  1128. key: 1,
  1129. class: "dup"
  1130. };
  1131. const _hoisted_11$5 = {
  1132. key: 2,
  1133. class: "mod"
  1134. };
  1135. const _hoisted_12$5 = { class: "ago" };
  1136. const _hoisted_13$5 = { class: "my-tag" };
  1137. const _hoisted_14$5 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  1138. const _hoisted_15$5 = ["onClick"];
  1139. const _hoisted_16$5 = { class: "Author-right" };
  1140. const _hoisted_17$4 = {
  1141. key: 0,
  1142. class: "toolbar"
  1143. };
  1144. const _hoisted_18$4 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "tool" }, [
  1145. /* @__PURE__ */ vue.createElementVNode("span", null, "隐藏")
  1146. ], -1));
  1147. const _hoisted_19$3 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  1148. const _hoisted_20$3 = [
  1149. _hoisted_19$3
  1150. ];
  1151. const _hoisted_21$3 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  1152. const _hoisted_22$2 = [
  1153. _hoisted_21$3
  1154. ];
  1155. const _hoisted_23$2 = /* @__PURE__ */ vue.createStaticVNode('<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-bfcb8fd8><path d="M4 6H44V36H29L24 41L19 36H4V6Z" fill="none" stroke="#929596" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-bfcb8fd8></path><path d="M23 21H25.0025" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-bfcb8fd8></path><path d="M33.001 21H34.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-bfcb8fd8></path><path d="M13.001 21H14.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-bfcb8fd8></path></svg><span data-v-bfcb8fd8>回复</span>', 2);
  1156. const _hoisted_25$2 = [
  1157. _hoisted_23$2
  1158. ];
  1159. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  1160. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  1161. const _component_Point = vue.resolveComponent("Point");
  1162. return vue.openBlock(), vue.createElementBlock("div", {
  1163. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  1164. }, [
  1165. vue.createElementVNode("div", _hoisted_1$c, [
  1166. !$props.modelValue ? (vue.openBlock(), vue.createElementBlock("svg", {
  1167. key: 0,
  1168. class: "expand-icon",
  1169. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", true)),
  1170. width: "24",
  1171. height: "24",
  1172. viewBox: "0 0 48 48",
  1173. fill: "none",
  1174. xmlns: "http://www.w3.org/2000/svg"
  1175. }, _hoisted_4$8)) : vue.createCommentVNode("", true),
  1176. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  1177. key: 1,
  1178. class: "avatar",
  1179. href: `/member/${$props.comment.username}`
  1180. }, [
  1181. vue.createElementVNode("img", {
  1182. src: $props.comment.avatar,
  1183. alt: ""
  1184. }, null, 8, _hoisted_6$7)
  1185. ], 8, _hoisted_5$7)) : vue.createCommentVNode("", true),
  1186. vue.createElementVNode("span", _hoisted_7$6, [
  1187. vue.createElementVNode("strong", null, [
  1188. vue.createElementVNode("a", {
  1189. href: `/member/${$props.comment.username}`,
  1190. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  1191. }, vue.toDisplayString($props.comment.username), 11, _hoisted_8$5)
  1192. ]),
  1193. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$5, "OP")) : vue.createCommentVNode("", true),
  1194. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$5, "DUP")) : vue.createCommentVNode("", true),
  1195. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$5, "MOD")) : vue.createCommentVNode("", true),
  1196. vue.createElementVNode("span", _hoisted_12$5, vue.toDisplayString($props.comment.date), 1),
  1197. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  1198. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  1199. return vue.openBlock(), vue.createElementBlock("span", _hoisted_13$5, [
  1200. _hoisted_14$5,
  1201. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  1202. vue.createElementVNode("i", {
  1203. class: "fa fa-trash-o remove",
  1204. onClick: ($event) => $options.removeTag(i)
  1205. }, null, 8, _hoisted_15$5)
  1206. ]);
  1207. }), 256)),
  1208. vue.createElementVNode("span", {
  1209. class: "add-tag ago",
  1210. onClick: _cache[1] || (_cache[1] = (...args) => $options.addTag && $options.addTag(...args)),
  1211. title: "添加标签"
  1212. }, "+")
  1213. ], 64)) : vue.createCommentVNode("", true)
  1214. ])
  1215. ]),
  1216. vue.createElementVNode("div", _hoisted_16$5, [
  1217. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$4, [
  1218. vue.createVNode(_component_PopConfirm, {
  1219. title: "确认隐藏这条回复?",
  1220. onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
  1221. }, {
  1222. default: vue.withCtx(() => [
  1223. _hoisted_18$4
  1224. ]),
  1225. _: 1
  1226. }),
  1227. $options.context ? (vue.openBlock(), vue.createElementBlock("div", {
  1228. key: 0,
  1229. class: "tool",
  1230. onClick: _cache[3] || (_cache[3] = (...args) => $options.showRelationReply && $options.showRelationReply(...args))
  1231. }, _hoisted_20$3)) : vue.createCommentVNode("", true),
  1232. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  1233. key: 1,
  1234. class: "tool",
  1235. onClick: _cache[4] || (_cache[4] = (...args) => $options.jump && $options.jump(...args))
  1236. }, _hoisted_22$2)) : vue.createCommentVNode("", true),
  1237. vue.createElementVNode("div", {
  1238. class: "tool",
  1239. onClick: _cache[5] || (_cache[5] = ($event) => $options.checkIsLogin("reply"))
  1240. }, _hoisted_25$2),
  1241. vue.withDirectives(vue.createVNode(_component_Point, {
  1242. item: $options.pointInfo,
  1243. onAddThank: $options.addThank,
  1244. onRecallThank: $options.recallThank,
  1245. "api-url": "reply/" + $props.comment.id
  1246. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  1247. [vue.vShow, !$props.comment.thankCount]
  1248. ])
  1249. ])) : vue.createCommentVNode("", true),
  1250. vue.withDirectives(vue.createVNode(_component_Point, {
  1251. style: { "margin-left": "1rem" },
  1252. item: $options.pointInfo,
  1253. onAddThank: $options.addThank,
  1254. onRecallThank: $options.recallThank,
  1255. "api-url": "reply/" + $props.comment.id
  1256. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  1257. [vue.vShow, $props.comment.thankCount]
  1258. ]),
  1259. vue.createElementVNode("div", {
  1260. class: vue.normalizeClass(["floor", { isDev: $options.isDev }])
  1261. }, vue.toDisplayString($props.comment.floor), 3)
  1262. ])
  1263. ], 2);
  1264. }
  1265. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$5], ["__scopeId", "data-v-bfcb8fd8"]]);
  1266. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-931c2ee8"), n2 = n2(), vue.popScopeId(), n2);
  1267. const _hoisted_1$b = { class: "get-cursor" };
  1268. const _hoisted_2$a = ["innerHTML"];
  1269. const _hoisted_3$7 = { class: "toolbar" };
  1270. const _hoisted_4$7 = { class: "left" };
  1271. const _hoisted_5$6 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1272. 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",
  1273. fill: "none",
  1274. stroke: "#929596",
  1275. "stroke-width": "2",
  1276. "stroke-linejoin": "round"
  1277. }, null, -1));
  1278. const _hoisted_6$6 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1279. d: "M24 35C29 35 31 31 31 31H17C17 31 19 35 24 35Z",
  1280. stroke: "#929596",
  1281. "stroke-width": "2",
  1282. "stroke-linecap": "round",
  1283. "stroke-linejoin": "round"
  1284. }, null, -1));
  1285. const _hoisted_7$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1286. d: "M31 18V22",
  1287. stroke: "#929596",
  1288. "stroke-width": "2",
  1289. "stroke-linecap": "round",
  1290. "stroke-linejoin": "round"
  1291. }, null, -1));
  1292. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("path", {
  1293. d: "M17 18V22",
  1294. stroke: "#929596",
  1295. "stroke-width": "2",
  1296. "stroke-linecap": "round",
  1297. "stroke-linejoin": "round"
  1298. }, null, -1));
  1299. const _hoisted_9$4 = [
  1300. _hoisted_5$6,
  1301. _hoisted_6$6,
  1302. _hoisted_7$5,
  1303. _hoisted_8$4
  1304. ];
  1305. const _hoisted_10$4 = { class: "upload" };
  1306. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  1307. width: "20",
  1308. height: "20",
  1309. viewBox: "0 0 48 48",
  1310. fill: "none",
  1311. xmlns: "http://www.w3.org/2000/svg"
  1312. }, [
  1313. /* @__PURE__ */ vue.createElementVNode("path", {
  1314. "fill-rule": "evenodd",
  1315. "clip-rule": "evenodd",
  1316. 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",
  1317. stroke: "#929596",
  1318. "stroke-width": "2",
  1319. "stroke-linecap": "round",
  1320. "stroke-linejoin": "round"
  1321. }),
  1322. /* @__PURE__ */ vue.createElementVNode("path", {
  1323. "fill-rule": "evenodd",
  1324. "clip-rule": "evenodd",
  1325. 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",
  1326. stroke: "#929596",
  1327. "stroke-width": "2",
  1328. "stroke-linecap": "round",
  1329. "stroke-linejoin": "round"
  1330. }),
  1331. /* @__PURE__ */ vue.createElementVNode("path", {
  1332. d: "M15 24L20 28L26 21L43 34V38C43 39.1046 42.1046 40 41 40H7C5.89543 40 5 39.1046 5 38V34L15 24Z",
  1333. fill: "none",
  1334. stroke: "#929596",
  1335. "stroke-width": "2",
  1336. "stroke-linejoin": "round"
  1337. })
  1338. ], -1));
  1339. const _hoisted_12$4 = {
  1340. key: 0,
  1341. style: { "color": "black", "font-size": "1.4rem" }
  1342. };
  1343. const _hoisted_13$4 = { class: "right" };
  1344. const _hoisted_14$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典表情", -1));
  1345. const _hoisted_15$4 = { class: "list" };
  1346. const _hoisted_16$4 = ["src", "onClick"];
  1347. const _hoisted_17$3 = { class: "emoji" };
  1348. const _hoisted_18$3 = { class: "title" };
  1349. const _hoisted_19$2 = { class: "list" };
  1350. const _hoisted_20$2 = ["onClick"];
  1351. const _sfc_main$b = {
  1352. __name: "PostEditor",
  1353. props: {
  1354. replyUser: null,
  1355. replyFloor: null,
  1356. useType: {
  1357. type: String,
  1358. default() {
  1359. return "reply-comment";
  1360. }
  1361. }
  1362. },
  1363. emits: ["close"],
  1364. setup(__props, { expose, emit: emits }) {
  1365. const props = __props;
  1366. const { replyUser, replyFloor, useType } = props;
  1367. const replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  1368. const post = vue.inject("post");
  1369. const show = vue.inject("show");
  1370. const isNight = vue.inject("isNight");
  1371. vue.inject("pageType");
  1372. const allReplyUsers = vue.inject("allReplyUsers");
  1373. let isFocus = vue.ref(false);
  1374. const loading = vue.ref(false);
  1375. const uploadLoading = vue.ref(false);
  1376. const isShowEmoticons = vue.ref(false);
  1377. const editorId = vue.ref("editorId_" + Date.now());
  1378. const content = vue.ref(replyInfo);
  1379. const txtRef = vue.ref(null);
  1380. const cursorRef = vue.ref(null);
  1381. const emoticonsRef = vue.ref(null);
  1382. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  1383. const emojiEmoticons = [
  1384. {
  1385. title: "小黄脸",
  1386. list: [
  1387. "😀",
  1388. "😁",
  1389. "😂",
  1390. "🤣",
  1391. "😅",
  1392. "😊",
  1393. "😋",
  1394. "😘",
  1395. "🥰",
  1396. "😗",
  1397. "🤩",
  1398. "🤔",
  1399. "🤨",
  1400. "😐",
  1401. "😑",
  1402. "🙄",
  1403. "😏",
  1404. "😪",
  1405. "😫",
  1406. "🥱",
  1407. "😜",
  1408. "😒",
  1409. "😔",
  1410. "😨",
  1411. "😰",
  1412. "😱",
  1413. "🥵",
  1414. "😡",
  1415. "🥳",
  1416. "🥺",
  1417. "🤭",
  1418. "🧐",
  1419. "😎",
  1420. "🤓",
  1421. "😭",
  1422. "🤑",
  1423. "🤮"
  1424. ]
  1425. },
  1426. {
  1427. title: "手势",
  1428. list: [
  1429. "🙋",
  1430. "🙎",
  1431. "🙅",
  1432. "🙇",
  1433. "🤷",
  1434. "🤏",
  1435. "👉",
  1436. "✌️",
  1437. "🤘",
  1438. "🤙",
  1439. "👌",
  1440. "🤌",
  1441. "👍",
  1442. "👎",
  1443. "👋",
  1444. "🤝",
  1445. "🙏",
  1446. "👏"
  1447. ]
  1448. },
  1449. {
  1450. title: "庆祝",
  1451. list: ["✨", "🎉", "🎊"]
  1452. },
  1453. {
  1454. title: "其他",
  1455. list: ["👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶", "🐒", "🙈", "🙉", "🙊", "🐵"]
  1456. }
  1457. ];
  1458. const classicsEmoticons = [
  1459. {
  1460. name: "[狗头]",
  1461. low: "https://i.imgur.com/io2SM1h.png",
  1462. high: "https://i.imgur.com/0icl60r.png"
  1463. },
  1464. {
  1465. name: "[马]",
  1466. low: "https://i.imgur.com/8EKZv7I.png",
  1467. high: "https://i.imgur.com/ANFUX52.png"
  1468. },
  1469. {
  1470. name: "[不高兴]",
  1471. low: "https://i.imgur.com/huX6coX.png",
  1472. high: "https://i.imgur.com/N7JEuvc.png"
  1473. },
  1474. {
  1475. name: "[呵呵]",
  1476. low: "https://i.imgur.com/RvoLAbX.png",
  1477. high: "https://i.imgur.com/xSzIqrK.png"
  1478. },
  1479. {
  1480. name: "[真棒]",
  1481. low: "https://i.imgur.com/xr1UOz1.png",
  1482. high: "https://i.imgur.com/w8YEw9Q.png"
  1483. },
  1484. {
  1485. name: "[鄙视]",
  1486. low: "https://i.imgur.com/u6jlqVq.png",
  1487. high: "https://i.imgur.com/8JFNANq.png"
  1488. },
  1489. {
  1490. name: "[疑问]",
  1491. low: "https://i.imgur.com/F29pmQ6.png",
  1492. high: "https://i.imgur.com/EbbTQAR.png"
  1493. },
  1494. {
  1495. name: "[吐舌]",
  1496. low: "https://i.imgur.com/InmIzl9.png",
  1497. high: "https://i.imgur.com/Ovj56Cd.png"
  1498. },
  1499. // {
  1500. // name: '[嘲笑]',
  1501. // low: 'https://i.imgur.com/BaWcsMR.png',
  1502. // high: 'https://i.imgur.com/0OGfJw4.png'
  1503. // },
  1504. // {
  1505. // name: '[滑稽]',
  1506. // low: 'https://i.imgur.com/lmbN0yI.png',
  1507. // high: 'https://i.imgur.com/Pc0wH85.png'
  1508. // },
  1509. {
  1510. name: "[笑眼]",
  1511. low: "https://i.imgur.com/ZveiiGy.png",
  1512. high: "https://i.imgur.com/PI1CfEr.png"
  1513. },
  1514. {
  1515. name: "[狂汗]",
  1516. low: "https://i.imgur.com/veWihk6.png",
  1517. high: "https://i.imgur.com/3LtHdQv.png"
  1518. },
  1519. {
  1520. name: "[大哭]",
  1521. low: "https://i.imgur.com/hu4oR6C.png",
  1522. high: "https://i.imgur.com/b4X9XLE.png"
  1523. },
  1524. {
  1525. name: "[喷]",
  1526. low: "https://i.imgur.com/bkw3VRr.png",
  1527. high: "https://i.imgur.com/wnZL13L.png"
  1528. },
  1529. {
  1530. name: "[苦笑]",
  1531. low: "https://i.imgur.com/VUWFktU.png",
  1532. high: "https://i.imgur.com/NAfspZ1.png"
  1533. },
  1534. {
  1535. name: "[喝酒]",
  1536. low: "https://i.imgur.com/2ZZSapE.png",
  1537. high: "https://i.imgur.com/rVbSVak.png"
  1538. },
  1539. {
  1540. name: "[吃瓜]",
  1541. low: "https://i.imgur.com/ee8Lq7H.png",
  1542. high: "https://i.imgur.com/0L26og9.png"
  1543. },
  1544. {
  1545. name: "[捂脸]",
  1546. low: "https://i.imgur.com/krir4IG.png",
  1547. high: "https://i.imgur.com/qqBqgVm.png"
  1548. },
  1549. {
  1550. name: "[呕]",
  1551. low: "https://i.imgur.com/6CUiUxv.png",
  1552. high: "https://i.imgur.com/kgdxRsG.png"
  1553. },
  1554. {
  1555. name: "[阴险]",
  1556. low: "https://i.imgur.com/MA8YqTP.png",
  1557. high: "https://i.imgur.com/e94jbaT.png"
  1558. },
  1559. {
  1560. name: "[怒]",
  1561. low: "https://i.imgur.com/n4kWfGB.png",
  1562. high: "https://i.imgur.com/iMXxNxh.png"
  1563. },
  1564. {
  1565. name: "[衰]",
  1566. low: "https://i.imgur.com/voHFDyQ.png",
  1567. high: "https://i.imgur.com/XffE6gu.png"
  1568. },
  1569. {
  1570. name: "[合十]",
  1571. low: "https://i.imgur.com/I8x3ang.png",
  1572. high: "https://i.imgur.com/T4rJVee.png"
  1573. },
  1574. {
  1575. name: "[赞]",
  1576. low: "https://i.imgur.com/lG44yUl.png",
  1577. high: "https://i.imgur.com/AoF5PLp.png"
  1578. },
  1579. {
  1580. name: "[踩]",
  1581. low: "https://i.imgur.com/cJp0uKZ.png",
  1582. high: "https://i.imgur.com/1XYGfXj.png"
  1583. },
  1584. {
  1585. name: "[爱心]",
  1586. low: "https://i.imgur.com/sLENaF5.png",
  1587. high: "https://i.imgur.com/dND56oX.png"
  1588. },
  1589. {
  1590. name: "[心碎]",
  1591. low: "https://i.imgur.com/AZxJzve.png",
  1592. high: "https://i.imgur.com/RiUsPci.png"
  1593. }
  1594. ];
  1595. const imgurClientIdPool = [
  1596. "3107b9ef8b316f3",
  1597. "442b04f26eefc8a",
  1598. "59cfebe717c09e4",
  1599. "60605aad4a62882",
  1600. "6c65ab1d3f5452a",
  1601. "83e123737849aa9",
  1602. "9311f6be1c10160",
  1603. "c4a4a563f698595",
  1604. "81be04b9e4a08ce"
  1605. ];
  1606. expose({ content, isFocus: () => isFocus.value });
  1607. const editorClass = vue.computed(() => {
  1608. return [useType, isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  1609. });
  1610. const cursorHtml = vue.computed(() => {
  1611. var _a;
  1612. if (!txtRef.value || !content.value)
  1613. return "";
  1614. let index2 = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  1615. return content.value.substring(0, index2).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  1616. });
  1617. const disabled = vue.computed(() => {
  1618. if (content.value) {
  1619. return content.value === replyInfo;
  1620. } else {
  1621. return true;
  1622. }
  1623. });
  1624. function drop(e2) {
  1625. e2.preventDefault();
  1626. upload(e2.dataTransfer.files[0]);
  1627. }
  1628. async function upload(file) {
  1629. if (!file)
  1630. return;
  1631. if (uploadLoading.value)
  1632. return;
  1633. uploadLoading.value = true;
  1634. const formData = new FormData();
  1635. formData.append("image", file);
  1636. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  1637. const clidenId = imgurClientIdPool[randomIndex];
  1638. const res = await fetch("https://api.imgur.com/3/upload", {
  1639. method: "POST",
  1640. headers: { Authorization: `Client-ID ${clidenId}` },
  1641. body: formData
  1642. });
  1643. uploadLoading.value = false;
  1644. if (res.ok) {
  1645. const resData = await res.json();
  1646. if (resData.success) {
  1647. return insert(" " + resData.data.link + " ");
  1648. }
  1649. }
  1650. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  1651. }
  1652. async function submit() {
  1653. if (disabled.value || loading.value)
  1654. return;
  1655. loading.value = true;
  1656. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  1657. let item2 = classicsEmoticons.find((v) => v.name === match);
  1658. if (item2) {
  1659. return item2.low + " ";
  1660. }
  1661. return match;
  1662. });
  1663. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  1664. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  1665. });
  1666. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  1667. let item2 = classicsEmoticons.find((v) => v.name === match);
  1668. if (item2) {
  1669. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  1670. }
  1671. return match;
  1672. });
  1673. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  1674. if (matchUsers) {
  1675. matchUsers.map((i) => {
  1676. let username = i.replace("@", "").replace(" ", "");
  1677. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  1678. });
  1679. }
  1680. show_content = show_content.replaceAll("\n", "<br/>");
  1681. console.log("show_content", show_content);
  1682. let item = {
  1683. thankCount: 0,
  1684. isThanked: false,
  1685. isOp: post.value.username === window.user.username,
  1686. isDup: false,
  1687. id: Date.now(),
  1688. username: window.user.username,
  1689. avatar: window.user.avatar,
  1690. date: "几秒前",
  1691. floor: post.value.replyCount + 1,
  1692. reply_content: show_content ?? "",
  1693. children: [],
  1694. replyUsers: replyUser ? [replyUser] : [],
  1695. replyFloor: replyFloor || -1,
  1696. level: useType === "reply-comment" ? 1 : 0
  1697. };
  1698. item.hideCallUserReplyContent = item.reply_content;
  1699. if (item.replyUsers.length === 1) {
  1700. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  1701. }
  1702. let url = `${window.baseUrl}/t/${post.value.id}`;
  1703. $.post(url, { content: submit_content, once: post.value.once }).then(
  1704. (res) => {
  1705. loading.value = false;
  1706. let r2 = res.search("你上一条回复的内容和这条相同");
  1707. if (r2 > -1)
  1708. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  1709. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  1710. if (r2 > -1)
  1711. return eventBus.emit(CMD.SHOW_MSG, {
  1712. type: "error",
  1713. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  1714. });
  1715. let r22 = res.search("创建新回复");
  1716. if (r22 > -1) {
  1717. eventBus.emit(CMD.REFRESH_ONCE, res);
  1718. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  1719. let clientWidth = window.win().document.body.clientWidth;
  1720. let windowWidth = 1200;
  1721. let left = clientWidth / 2 - windowWidth / 2;
  1722. let newWin = window.win().open("about:blank", "hello", `width=${windowWidth},height=600,left=${left},top=100`);
  1723. newWin.document.write(res);
  1724. return;
  1725. }
  1726. content.value = replyInfo;
  1727. emits("close");
  1728. eventBus.emit(CMD.REFRESH_ONCE, res);
  1729. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  1730. eventBus.emit(CMD.ADD_REPLY, item);
  1731. },
  1732. (err) => {
  1733. console.log("err", err);
  1734. loading.value = false;
  1735. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  1736. }
  1737. ).catch((r2) => {
  1738. console.log("cathc", r2);
  1739. });
  1740. }
  1741. function showEmoticons(e2) {
  1742. if (isShowEmoticons.value) {
  1743. return isShowEmoticons.value = false;
  1744. }
  1745. let rect = e2.currentTarget.getBoundingClientRect();
  1746. emoticonsRef.value.style.left = rect.left + 30 + "px";
  1747. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  1748. isShowEmoticons.value = true;
  1749. }
  1750. function off() {
  1751. eventBus.emit(CMD.SHOW_CALL, { show: false });
  1752. eventBus.off(CMD.SET_CALL);
  1753. }
  1754. function checkHeight() {
  1755. txtRef.value.style.height = 0;
  1756. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  1757. }
  1758. function insert(str) {
  1759. let cursorPos = txtRef.value.selectionStart;
  1760. let start = content.value.slice(0, cursorPos);
  1761. let end = content.value.slice(cursorPos, content.value.length);
  1762. content.value = start + str + end;
  1763. let moveCursorPos = start.length + str.length;
  1764. setTimeout(() => {
  1765. txtRef.value.focus();
  1766. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  1767. checkHeight();
  1768. });
  1769. }
  1770. function showCallPopover(text) {
  1771. let r2 = cursorRef.value.getBoundingClientRect();
  1772. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  1773. eventBus.off(CMD.SET_CALL);
  1774. eventBus.on(CMD.SET_CALL, (e2) => {
  1775. let cursorPos = txtRef.value.selectionStart;
  1776. let start = content.value.slice(0, cursorPos);
  1777. let end = content.value.slice(cursorPos, content.value.length);
  1778. let lastCallPos = start.lastIndexOf("@");
  1779. start = content.value.slice(0, lastCallPos + 1);
  1780. if (e2 === "管理员") {
  1781. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid";
  1782. }
  1783. if (e2 === "所有人") {
  1784. e2 = allReplyUsers.value.map((v, i) => {
  1785. if (i)
  1786. return "@" + v;
  1787. else
  1788. return v;
  1789. }).join(" ");
  1790. }
  1791. content.value = start + e2 + " " + end;
  1792. let moveCursorPos = start.length + e2.length + 1;
  1793. setTimeout(() => {
  1794. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  1795. checkHeight();
  1796. });
  1797. eventBus.off(CMD.SET_CALL);
  1798. });
  1799. }
  1800. function onKeydown(e2) {
  1801. let code = e2.keyCode;
  1802. switch (code) {
  1803. case 8:
  1804. if (content.value === "@") {
  1805. off();
  1806. }
  1807. break;
  1808. case 37:
  1809. case 38:
  1810. case 39:
  1811. case 40:
  1812. setTimeout(() => onInput({ data: "" }), 100);
  1813. break;
  1814. case 27:
  1815. e2.preventDefault();
  1816. e2.stopPropagation();
  1817. e2.stopImmediatePropagation();
  1818. return false;
  1819. case 13:
  1820. if (e2.ctrlKey)
  1821. submit();
  1822. if (e2.metaKey)
  1823. submit();
  1824. break;
  1825. }
  1826. }
  1827. function onInput(e2) {
  1828. let cursorPos = txtRef.value.selectionStart;
  1829. if (!content.value)
  1830. return;
  1831. if (e2.data === " ") {
  1832. return off();
  1833. }
  1834. if (e2.data === "@") {
  1835. if (content.value.length !== 1) {
  1836. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  1837. return showCallPopover("");
  1838. }
  1839. } else {
  1840. return showCallPopover("");
  1841. }
  1842. off();
  1843. } else {
  1844. let judgeStr = content.value.slice(0, cursorPos);
  1845. let lastCallPos = judgeStr.lastIndexOf("@");
  1846. if (lastCallPos === -1) {
  1847. return off();
  1848. }
  1849. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  1850. let hasSpace = callStr.includes(" ");
  1851. if (hasSpace) {
  1852. off();
  1853. } else {
  1854. if (lastCallPos === 0) {
  1855. return showCallPopover(callStr.replace("@", ""));
  1856. }
  1857. if (content.value.length !== 1) {
  1858. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  1859. return showCallPopover(callStr.replace("@", ""));
  1860. }
  1861. } else {
  1862. return showCallPopover(callStr.replace("@", ""));
  1863. }
  1864. off();
  1865. }
  1866. }
  1867. }
  1868. function onPaste(e2) {
  1869. const dataTransferItemList = e2.clipboardData.items;
  1870. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  1871. return item.type.indexOf("image") !== -1;
  1872. });
  1873. if (items.length === 0) {
  1874. return;
  1875. }
  1876. const dataTransferItem = items[0];
  1877. const blob = dataTransferItem.getAsFile();
  1878. upload(blob);
  1879. }
  1880. function onBlur() {
  1881. document.removeEventListener("paste", onPaste);
  1882. isFocus.value = false;
  1883. }
  1884. function onFocusin() {
  1885. document.addEventListener("paste", onPaste);
  1886. }
  1887. vue.watch(() => show, (n2) => {
  1888. if (n2.value)
  1889. isShowEmoticons.value = false;
  1890. }, { deep: true });
  1891. vue.onMounted(() => {
  1892. $(`.${editorId.value}`).each(function() {
  1893. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  1894. }).on("input", function() {
  1895. this.style.height = 0;
  1896. this.style.height = this.scrollHeight + "px";
  1897. });
  1898. if (useType === "reply-comment") {
  1899. txtRef.value && txtRef.value.focus();
  1900. }
  1901. });
  1902. vue.onBeforeUnmount(() => {
  1903. $(`.${editorId.value}`).off();
  1904. });
  1905. return (_ctx, _cache) => {
  1906. return vue.openBlock(), vue.createElementBlock("div", {
  1907. class: vue.normalizeClass(["post-editor-wrapper", vue.unref(editorClass)])
  1908. }, [
  1909. vue.withDirectives(vue.createElementVNode("textarea", {
  1910. class: vue.normalizeClass(["post-editor", editorId.value]),
  1911. ref_key: "txtRef",
  1912. ref: txtRef,
  1913. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  1914. onBlur,
  1915. onFocusin,
  1916. placeholder: "请尽量让自己的回复能够对别人有帮助",
  1917. onInput,
  1918. onKeydown,
  1919. onDrop: drop,
  1920. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  1921. }, null, 34), [
  1922. [vue.vModelText, content.value]
  1923. ]),
  1924. vue.createElementVNode("div", _hoisted_1$b, [
  1925. vue.createElementVNode("span", { innerHTML: vue.unref(cursorHtml) }, null, 8, _hoisted_2$a),
  1926. vue.createElementVNode("span", {
  1927. class: "cursor",
  1928. ref_key: "cursorRef",
  1929. ref: cursorRef
  1930. }, "|", 512)
  1931. ]),
  1932. vue.createElementVNode("div", _hoisted_3$7, [
  1933. vue.createElementVNode("div", _hoisted_4$7, [
  1934. (vue.openBlock(), vue.createElementBlock("svg", {
  1935. onClick: showEmoticons,
  1936. width: "20",
  1937. height: "20",
  1938. viewBox: "0 0 48 48",
  1939. fill: "none",
  1940. xmlns: "http://www.w3.org/2000/svg"
  1941. }, _hoisted_9$4)),
  1942. vue.createElementVNode("div", _hoisted_10$4, [
  1943. vue.createElementVNode("input", {
  1944. type: "file",
  1945. accept: "image/*",
  1946. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  1947. }, null, 32),
  1948. _hoisted_11$4
  1949. ]),
  1950. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12$4, "上传中.....")) : vue.createCommentVNode("", true)
  1951. ]),
  1952. vue.createElementVNode("div", _hoisted_13$4, [
  1953. vue.unref(useType) === "reply-comment" ? (vue.openBlock(), vue.createBlock(BaseButton, {
  1954. key: 0,
  1955. type: "link",
  1956. size: "small",
  1957. style: { "margin-right": "1rem", "cursor": "pointer" },
  1958. onClick: _cache[3] || (_cache[3] = ($event) => emits("close"))
  1959. }, {
  1960. default: vue.withCtx(() => [
  1961. vue.createTextVNode(" 关闭 ")
  1962. ]),
  1963. _: 1
  1964. })) : vue.createCommentVNode("", true),
  1965. vue.createVNode(BaseButton, {
  1966. size: "small",
  1967. disabled: vue.unref(disabled),
  1968. loading: loading.value,
  1969. onClick: submit
  1970. }, {
  1971. default: vue.withCtx(() => [
  1972. vue.createTextVNode("回复 ")
  1973. ]),
  1974. _: 1
  1975. }, 8, ["disabled", "loading"])
  1976. ])
  1977. ]),
  1978. vue.withDirectives(vue.createElementVNode("div", {
  1979. class: "emoticon-pack",
  1980. ref_key: "emoticonsRef",
  1981. ref: emoticonsRef
  1982. }, [
  1983. vue.createElementVNode("i", {
  1984. class: "fa fa-times",
  1985. "aria-hidden": "true",
  1986. onClick: _cache[4] || (_cache[4] = ($event) => isShowEmoticons.value = false)
  1987. }),
  1988. _hoisted_14$4,
  1989. vue.createElementVNode("div", _hoisted_15$4, [
  1990. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(classicsEmoticons, (item) => {
  1991. return vue.createElementVNode("img", {
  1992. src: item.high,
  1993. onClick: ($event) => {
  1994. insert(item.name);
  1995. isShowEmoticons.value = false;
  1996. }
  1997. }, null, 8, _hoisted_16$4);
  1998. }), 64))
  1999. ]),
  2000. vue.createElementVNode("div", _hoisted_17$3, [
  2001. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiEmoticons, (item) => {
  2002. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  2003. vue.createElementVNode("div", _hoisted_18$3, vue.toDisplayString(item.title), 1),
  2004. vue.createElementVNode("div", _hoisted_19$2, [
  2005. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  2006. return vue.openBlock(), vue.createElementBlock("span", {
  2007. onClick: ($event) => {
  2008. insert(emoji);
  2009. isShowEmoticons.value = false;
  2010. }
  2011. }, vue.toDisplayString(emoji), 9, _hoisted_20$2);
  2012. }), 256))
  2013. ])
  2014. ], 64);
  2015. }), 64))
  2016. ])
  2017. ], 512), [
  2018. [vue.vShow, isShowEmoticons.value]
  2019. ])
  2020. ], 2);
  2021. };
  2022. }
  2023. };
  2024. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-931c2ee8"]]);
  2025. const _hoisted_1$a = {
  2026. key: 0,
  2027. class: "html-wrapper"
  2028. };
  2029. const _hoisted_2$9 = ["innerHTML"];
  2030. const _sfc_main$a = {
  2031. __name: "BaseHtmlRender",
  2032. props: ["html"],
  2033. setup(__props) {
  2034. const props = __props;
  2035. const config2 = vue.inject("config");
  2036. const contentRef = vue.ref(null);
  2037. const checkHeight = 900;
  2038. const mask = vue.ref(false);
  2039. const handOpen = vue.ref(false);
  2040. function mouseup(e2) {
  2041. if (!config2.value.base64)
  2042. return;
  2043. let selectionText = window.win().getSelection().toString();
  2044. if (selectionText) {
  2045. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  2046. if (r2) {
  2047. if (r2[0].length < 4)
  2048. return;
  2049. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  2050. }
  2051. }
  2052. }
  2053. vue.watch(config2.value, (newVale) => {
  2054. if (!newVale.contentAutoCollapse) {
  2055. mask.value = false;
  2056. }
  2057. });
  2058. vue.watch([() => contentRef.value, () => props.html], () => {
  2059. if (!contentRef.value || !props.html)
  2060. return;
  2061. if (!config2.value.contentAutoCollapse)
  2062. return;
  2063. contentRef.value.querySelectorAll("img").forEach((item) => {
  2064. item.removeEventListener("load", checkContentHeight);
  2065. item.addEventListener("load", checkContentHeight);
  2066. });
  2067. checkContentHeight();
  2068. }, { immediate: true, flush: "post" });
  2069. function checkContentHeight() {
  2070. if (handOpen.value)
  2071. return;
  2072. let rect = contentRef.value.getBoundingClientRect();
  2073. mask.value = rect.height >= checkHeight;
  2074. }
  2075. return (_ctx, _cache) => {
  2076. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
  2077. vue.createElementVNode("div", {
  2078. class: vue.normalizeClass({ mask: mask.value })
  2079. }, [
  2080. vue.createElementVNode("div", {
  2081. ref_key: "contentRef",
  2082. ref: contentRef,
  2083. innerHTML: props.html,
  2084. onMouseup: mouseup
  2085. }, null, 40, _hoisted_2$9)
  2086. ], 2),
  2087. mask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  2088. key: 0,
  2089. class: "expand",
  2090. onClick: _cache[0] || (_cache[0] = ($event) => {
  2091. mask.value = false;
  2092. handOpen.value = true;
  2093. })
  2094. }, "展开")) : vue.createCommentVNode("", true)
  2095. ])) : vue.createCommentVNode("", true);
  2096. };
  2097. }
  2098. };
  2099. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-8ffbfeb2"]]);
  2100. const _sfc_main$9 = {
  2101. name: "Comment",
  2102. components: { BaseHtmlRender, Author, PostEditor, Point },
  2103. inject: ["post", "postDetailWidth", "show", "isNight", "config"],
  2104. props: {
  2105. modelValue: {
  2106. reply_content: ""
  2107. },
  2108. type: {
  2109. type: String,
  2110. default() {
  2111. return "list";
  2112. }
  2113. }
  2114. },
  2115. data() {
  2116. return {
  2117. showOrigin: false,
  2118. edit: false,
  2119. ding: false,
  2120. expand: true,
  2121. expandWrong: false,
  2122. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  2123. cssStyle: null,
  2124. floor: this.modelValue.floor
  2125. };
  2126. },
  2127. watch: {
  2128. show(e2) {
  2129. if (e2) {
  2130. this.edit = false;
  2131. }
  2132. },
  2133. postDetailWidth(n2, o) {
  2134. this.checkIsTooLong(n2);
  2135. }
  2136. },
  2137. computed: {
  2138. CommentDisplayType() {
  2139. return CommentDisplayType;
  2140. },
  2141. myClass() {
  2142. return {
  2143. isOp: this.modelValue.isOp,
  2144. isSimple: this.config.viewType === "simple",
  2145. ding: this.ding,
  2146. isLevelOne: this.modelValue.level === 0,
  2147. ["c_" + this.floor]: this.type !== "top"
  2148. };
  2149. }
  2150. },
  2151. mounted() {
  2152. this.checkIsTooLong(this.postDetailWidth);
  2153. },
  2154. methods: {
  2155. checkIsTooLong(postDetailWidth) {
  2156. if (postDetailWidth !== 0) {
  2157. let rect = this.$refs.comment.getBoundingClientRect();
  2158. let ban = postDetailWidth / 2;
  2159. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  2160. this.expand = false;
  2161. let padding = 2;
  2162. this.cssStyle = {
  2163. padding: "1rem 0",
  2164. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  2165. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  2166. background: this.isNight ? "#18222d" : "white"
  2167. };
  2168. }
  2169. }
  2170. },
  2171. //高亮一下
  2172. showDing() {
  2173. this.ding = true;
  2174. setTimeout(() => {
  2175. this.ding = false;
  2176. }, 2e3);
  2177. },
  2178. hide() {
  2179. let url = `${window.baseUrl}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;
  2180. eventBus.emit(CMD.REMOVE, this.modelValue.floor);
  2181. $.post(url).then((res) => {
  2182. eventBus.emit(CMD.REFRESH_ONCE);
  2183. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  2184. }, (err) => {
  2185. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  2186. });
  2187. },
  2188. toggle() {
  2189. this.expand = !this.expand;
  2190. },
  2191. toggleContent() {
  2192. if (this.modelValue.level === 0 && this.modelValue.replyUsers.length === 0)
  2193. return;
  2194. this.showOrigin = !this.showOrigin;
  2195. }
  2196. }
  2197. };
  2198. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-e3812959"), n2 = n2(), vue.popScopeId(), n2);
  2199. const _hoisted_1$9 = ["data-floor"];
  2200. const _hoisted_2$8 = { class: "comment-content" };
  2201. const _hoisted_3$6 = { class: "right" };
  2202. const _hoisted_4$6 = { class: "w" };
  2203. const _hoisted_5$5 = {
  2204. key: 0,
  2205. class: "wrong-wrapper"
  2206. };
  2207. const _hoisted_6$5 = ["href"];
  2208. const _hoisted_7$4 = { class: "del-line" };
  2209. const _hoisted_8$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", {
  2210. class: "fa fa-question-circle-o wrong-icon",
  2211. "aria-hidden": "true"
  2212. }, null, -1));
  2213. const _hoisted_9$3 = {
  2214. key: 0,
  2215. class: "warning"
  2216. };
  2217. const _hoisted_10$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2218. const _hoisted_11$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2219. const _hoisted_12$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2220. const _hoisted_13$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2221. const _hoisted_14$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2222. const _hoisted_15$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("a", {
  2223. href: "https://github.com/zyronon/v2ex-script/discussions/7",
  2224. target: "_blank"
  2225. }, "这里", -1));
  2226. const _hoisted_16$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("p", null, "---原文---", -1));
  2227. const _hoisted_17$2 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("p", null, "-----------", -1));
  2228. const _hoisted_18$2 = { class: "simple-wrapper" };
  2229. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  2230. const _component_Author = vue.resolveComponent("Author");
  2231. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  2232. const _component_PostEditor = vue.resolveComponent("PostEditor");
  2233. const _component_Comment = vue.resolveComponent("Comment", true);
  2234. return vue.openBlock(), vue.createElementBlock("div", {
  2235. class: vue.normalizeClass(["comment", $options.myClass]),
  2236. ref: "comment",
  2237. "data-floor": $data.floor
  2238. }, [
  2239. vue.createVNode(_component_Author, {
  2240. modelValue: $data.expand,
  2241. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  2242. comment: $props.modelValue,
  2243. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  2244. type: $props.type,
  2245. onHide: $options.hide
  2246. }, null, 8, ["modelValue", "comment", "type", "onHide"]),
  2247. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  2248. key: 0,
  2249. class: "more ago",
  2250. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  2251. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  2252. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  2253. key: 1,
  2254. class: "comment-content-w",
  2255. style: vue.normalizeStyle($data.cssStyle)
  2256. }, [
  2257. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  2258. key: 0,
  2259. class: "more ago",
  2260. onClick: _cache[3] || (_cache[3] = ($event) => $data.expand = !$data.expand)
  2261. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  2262. vue.createElementVNode("div", _hoisted_2$8, [
  2263. vue.createElementVNode("div", {
  2264. class: "left expand-line",
  2265. onClick: _cache[4] || (_cache[4] = (...args) => $options.toggle && $options.toggle(...args))
  2266. }),
  2267. vue.createElementVNode("div", _hoisted_3$6, [
  2268. vue.createElementVNode("div", _hoisted_4$6, [
  2269. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
  2270. vue.createElementVNode("span", {
  2271. onClick: _cache[5] || (_cache[5] = ($event) => $data.expandWrong = !$data.expandWrong),
  2272. title: "点击楼层号查看提示"
  2273. }, [
  2274. vue.createElementVNode("a", {
  2275. href: "/member/" + $props.modelValue.replyUsers[0]
  2276. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$5),
  2277. vue.createElementVNode("span", _hoisted_7$4, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  2278. _hoisted_8$3
  2279. ]),
  2280. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, [
  2281. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  2282. _hoisted_10$3,
  2283. vue.createTextVNode(" 原因可能有下面几种: "),
  2284. _hoisted_11$3,
  2285. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  2286. _hoisted_12$3,
  2287. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  2288. _hoisted_13$3,
  2289. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  2290. _hoisted_14$3,
  2291. vue.createTextVNode(" 四、脚本解析错误,请在"),
  2292. _hoisted_15$3,
  2293. vue.createTextVNode("反馈 ")
  2294. ])) : vue.createCommentVNode("", true)
  2295. ])) : vue.createCommentVNode("", true),
  2296. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && this.type !== "top" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  2297. $data.showOrigin ? (vue.openBlock(), vue.createElementBlock("div", {
  2298. key: 0,
  2299. onDblclick: _cache[6] || (_cache[6] = (...args) => $options.toggleContent && $options.toggleContent(...args))
  2300. }, [
  2301. _hoisted_16$3,
  2302. vue.createVNode(_component_BaseHtmlRender, {
  2303. class: "reply_content",
  2304. html: $props.modelValue.reply_content
  2305. }, null, 8, ["html"]),
  2306. _hoisted_17$2
  2307. ], 32)) : vue.createCommentVNode("", true),
  2308. vue.createVNode(_component_BaseHtmlRender, {
  2309. class: "reply_content",
  2310. onDblclick: $options.toggleContent,
  2311. html: $props.modelValue.hideCallUserReplyContent
  2312. }, null, 8, ["onDblclick", "html"])
  2313. ], 64)) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  2314. key: 2,
  2315. class: "reply_content",
  2316. html: $props.modelValue.reply_content
  2317. }, null, 8, ["html"])),
  2318. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  2319. key: 3,
  2320. onClose: _cache[7] || (_cache[7] = ($event) => $data.edit = false),
  2321. replyInfo: $data.replyInfo,
  2322. replyUser: $props.modelValue.username,
  2323. replyFloor: $props.modelValue.floor
  2324. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true)
  2325. ]),
  2326. vue.createElementVNode("div", _hoisted_18$2, [
  2327. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index2) => {
  2328. return vue.openBlock(), vue.createBlock(_component_Comment, {
  2329. modelValue: $props.modelValue.children[index2],
  2330. "onUpdate:modelValue": ($event) => $props.modelValue.children[index2] = $event,
  2331. key: index2
  2332. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  2333. }), 128))
  2334. ])
  2335. ])
  2336. ]),
  2337. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  2338. key: 1,
  2339. class: "more ago",
  2340. onClick: _cache[8] || (_cache[8] = ($event) => $data.expand = !$data.expand)
  2341. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  2342. ], 4)) : vue.createCommentVNode("", true)
  2343. ], 10, _hoisted_1$9);
  2344. }
  2345. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-e3812959"]]);
  2346. const _sfc_main$8 = {
  2347. name: "Toolbar",
  2348. components: { BaseLoading },
  2349. inject: [
  2350. "isLogin",
  2351. "post",
  2352. "pageType"
  2353. ],
  2354. data() {
  2355. return {
  2356. timer: null,
  2357. loading: false,
  2358. loading2: false,
  2359. loading3: false
  2360. };
  2361. },
  2362. methods: {
  2363. checkIsLogin(emitName = "") {
  2364. if (!this.isLogin) {
  2365. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  2366. return false;
  2367. }
  2368. this.$emit(emitName);
  2369. return true;
  2370. },
  2371. getColor(val) {
  2372. return val ? "#ff4500" : "#929596";
  2373. },
  2374. getIsFull(val) {
  2375. return val ? "#ff4500" : "none";
  2376. },
  2377. tweet() {
  2378. if (!this.checkIsLogin())
  2379. return;
  2380. let username = window.user.username;
  2381. let url = `https://twitter.com/intent/tweet?url=${window.baseUrl}/t/${this.post.id}?r=${username}&related=v2ex&text=${this.post.title}`;
  2382. window.win().open(url, "_blank", "width=550,height=370");
  2383. },
  2384. report() {
  2385. if (!this.checkIsLogin())
  2386. return;
  2387. if (!this.isLogin)
  2388. return;
  2389. if (this.post.isReport)
  2390. return;
  2391. let username = window.user.username;
  2392. let url = `https://twitter.com/share?url=${window.baseUrl}/t/${this.post.id}?r=${username}&amp;related=v2ex&amp;hashtags=apple&amp;text=${this.post.title}`;
  2393. window.win().open(url, "_blank", "width=550,height=370");
  2394. },
  2395. async toggleIgnore() {
  2396. if (!this.checkIsLogin())
  2397. return;
  2398. let url = `${window.baseUrl}/${this.post.isIgnore ? "unignore" : "ignore"}/topic/${this.post.id}?once=${this.post.once}`;
  2399. if (this.pageType === PageType.Post) {
  2400. this.loading2 = true;
  2401. let apiRes = await window.win().fetch(url);
  2402. if (apiRes.redirected) {
  2403. if (!this.post.isIgnore) {
  2404. window.win().location = window.baseUrl;
  2405. }
  2406. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  2407. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  2408. } else {
  2409. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  2410. }
  2411. this.loading2 = false;
  2412. } else {
  2413. if (this.post.isIgnore) {
  2414. this.loading2 = true;
  2415. } else {
  2416. eventBus.emit(CMD.IGNORE);
  2417. }
  2418. let apiRes = await window.win().fetch(url);
  2419. if (apiRes.redirected) {
  2420. if (this.post.isIgnore) {
  2421. eventBus.emit(CMD.REFRESH_ONCE);
  2422. }
  2423. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  2424. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  2425. } else {
  2426. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略成功,仅本次有效(接口调用失败!)" });
  2427. }
  2428. this.loading2 = false;
  2429. }
  2430. },
  2431. async toggleFavorite() {
  2432. if (!this.post.isFavorite && config.collectBrowserNotice) {
  2433. alert("请按Command/Cmd/CTRL + D添加到书签");
  2434. }
  2435. if (!this.checkIsLogin())
  2436. return;
  2437. this.loading = true;
  2438. let url = `${window.baseUrl}/${this.post.isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  2439. let apiRes = await window.win().fetch(url);
  2440. this.loading = false;
  2441. if (apiRes.redirected) {
  2442. let htmlText = await apiRes.text();
  2443. if (htmlText.search(this.post.isFavorite ? "加入收藏" : "取消收藏")) {
  2444. eventBus.emit(CMD.MERGE, { collectCount: this.post.isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  2445. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isFavorite ? "取消成功" : "收藏成功" });
  2446. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  2447. eventBus.emit(CMD.MERGE, { isFavorite: !this.post.isFavorite });
  2448. return;
  2449. }
  2450. }
  2451. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  2452. }
  2453. }
  2454. };
  2455. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-d838dec6"), n2 = n2(), vue.popScopeId(), n2);
  2456. const _hoisted_1$8 = { class: "toolbar" };
  2457. const _hoisted_2$7 = /* @__PURE__ */ vue.createStaticVNode('<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d838dec6><path d="M4 6H44V36H29L24 41L19 36H4V6Z" fill="none" stroke="#929596" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d838dec6></path><path d="M23 21H25.0025" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-d838dec6></path><path d="M33.001 21H34.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-d838dec6></path><path d="M13.001 21H14.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-d838dec6></path></svg><span data-v-d838dec6>回复</span>', 2);
  2458. const _hoisted_4$5 = [
  2459. _hoisted_2$7
  2460. ];
  2461. const _hoisted_5$4 = {
  2462. key: 1,
  2463. viewBox: "0 0 48 48",
  2464. fill: "none",
  2465. xmlns: "http://www.w3.org/2000/svg"
  2466. };
  2467. const _hoisted_6$4 = ["fill", "stroke"];
  2468. const _hoisted_7$3 = {
  2469. key: 1,
  2470. class: "tool no-hover"
  2471. };
  2472. const _hoisted_8$2 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  2473. viewBox: "0 0 48 48",
  2474. fill: "none",
  2475. xmlns: "http://www.w3.org/2000/svg"
  2476. }, [
  2477. /* @__PURE__ */ vue.createElementVNode("path", {
  2478. d: "M28 6H42V20",
  2479. stroke: "#929596",
  2480. "stroke-width": "2",
  2481. "stroke-linecap": "round",
  2482. "stroke-linejoin": "round"
  2483. }),
  2484. /* @__PURE__ */ vue.createElementVNode("path", {
  2485. d: "M42 29.4737V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9C6 7.34315 7.34315 6 9 6L18 6",
  2486. stroke: "#929596",
  2487. "stroke-width": "2",
  2488. "stroke-linecap": "round",
  2489. "stroke-linejoin": "round"
  2490. }),
  2491. /* @__PURE__ */ vue.createElementVNode("path", {
  2492. d: "M25.7998 22.1999L41.0998 6.8999",
  2493. stroke: "#929596",
  2494. "stroke-width": "2",
  2495. "stroke-linecap": "round",
  2496. "stroke-linejoin": "round"
  2497. })
  2498. ], -1));
  2499. const _hoisted_9$2 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("span", null, "Tweet", -1));
  2500. const _hoisted_10$2 = [
  2501. _hoisted_8$2,
  2502. _hoisted_9$2
  2503. ];
  2504. const _hoisted_11$2 = {
  2505. key: 1,
  2506. viewBox: "0 0 48 48",
  2507. fill: "none",
  2508. xmlns: "http://www.w3.org/2000/svg"
  2509. };
  2510. const _hoisted_12$2 = ["fill", "stroke"];
  2511. const _hoisted_13$2 = ["fill", "stroke"];
  2512. const _hoisted_14$2 = ["fill", "stroke"];
  2513. const _hoisted_15$2 = {
  2514. key: 1,
  2515. width: "19",
  2516. height: "19",
  2517. viewBox: "0 0 48 48",
  2518. fill: "none",
  2519. xmlns: "http://www.w3.org/2000/svg"
  2520. };
  2521. const _hoisted_16$2 = /* @__PURE__ */ vue.createStaticVNode('<path d="M36 35H12V21C12 14.3726 17.3726 9 24 9C30.6274 9 36 14.3726 36 21V35Z" fill="#929596" stroke="#929596" stroke-width="4" stroke-linejoin="round" data-v-d838dec6></path><path d="M8 42H40" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-d838dec6></path><path d="M4 13L7 14" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-d838dec6></path><path d="M13 3.9999L14 6.9999" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-d838dec6></path><path d="M10.0001 9.99989L7.00009 6.99989" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-d838dec6></path>', 5);
  2522. const _hoisted_21$2 = [
  2523. _hoisted_16$2
  2524. ];
  2525. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  2526. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  2527. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
  2528. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  2529. vue.createElementVNode("div", {
  2530. class: "tool",
  2531. onClick: _cache[0] || (_cache[0] = ($event) => $options.checkIsLogin("reply"))
  2532. }, _hoisted_4$5),
  2533. $options.post.once ? (vue.openBlock(), vue.createElementBlock("div", {
  2534. key: 0,
  2535. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  2536. onClick: _cache[1] || (_cache[1] = (...args) => $options.toggleFavorite && $options.toggleFavorite(...args))
  2537. }, [
  2538. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  2539. key: 0,
  2540. size: "small"
  2541. })) : (vue.openBlock(), vue.createElementBlock("svg", _hoisted_5$4, [
  2542. vue.createElementVNode("path", {
  2543. d: "M23.9986 5L17.8856 17.4776L4 19.4911L14.0589 29.3251L11.6544 43L23.9986 36.4192L36.3454 43L33.9586 29.3251L44 19.4911L30.1913 17.4776L23.9986 5Z",
  2544. fill: $options.getIsFull($options.post.isFavorite),
  2545. stroke: $options.getColor($options.post.isFavorite),
  2546. "stroke-width": "2",
  2547. "stroke-linejoin": "round"
  2548. }, null, 8, _hoisted_6$4)
  2549. ])),
  2550. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isFavorite ? "取消收藏" : "加入收藏"), 1)
  2551. ], 2)) : vue.createCommentVNode("", true),
  2552. $options.post.once && $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
  2553. vue.createElementVNode("span", null, vue.toDisplayString($options.post.collectCount + "人收藏"), 1)
  2554. ])) : vue.createCommentVNode("", true),
  2555. vue.createElementVNode("div", {
  2556. class: "tool",
  2557. onClick: _cache[2] || (_cache[2] = (...args) => $options.tweet && $options.tweet(...args))
  2558. }, _hoisted_10$2),
  2559. $options.post.once ? (vue.openBlock(), vue.createElementBlock("div", {
  2560. key: 2,
  2561. class: vue.normalizeClass(["tool", { "disabled": $data.loading2 }]),
  2562. onClick: _cache[3] || (_cache[3] = (...args) => $options.toggleIgnore && $options.toggleIgnore(...args))
  2563. }, [
  2564. $data.loading2 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  2565. key: 0,
  2566. size: "small"
  2567. })) : (vue.openBlock(), vue.createElementBlock("svg", _hoisted_11$2, [
  2568. vue.createElementVNode("path", {
  2569. fill: $options.getIsFull($options.post.isIgnore),
  2570. stroke: $options.getColor($options.post.isIgnore),
  2571. d: "M9.85786 18C6.23858 21 4 24 4 24C4 24 12.9543 36 24 36C25.3699 36 26.7076 35.8154 28 35.4921M20.0318 12.5C21.3144 12.1816 22.6414 12 24 12C35.0457 12 44 24 44 24C44 24 41.7614 27 38.1421 30",
  2572. "stroke-width": "2",
  2573. "stroke-linecap": "round",
  2574. "stroke-linejoin": "round"
  2575. }, null, 8, _hoisted_12$2),
  2576. vue.createElementVNode("path", {
  2577. fill: $options.getIsFull($options.post.isIgnore),
  2578. d: "M20.3142 20.6211C19.4981 21.5109 19 22.6972 19 23.9998C19 26.7612 21.2386 28.9998 24 28.9998C25.3627 28.9998 26.5981 28.4546 27.5 27.5705",
  2579. stroke: $options.getColor($options.post.isIgnore),
  2580. "stroke-width": "2",
  2581. "stroke-linecap": "round",
  2582. "stroke-linejoin": "round"
  2583. }, null, 8, _hoisted_13$2),
  2584. vue.createElementVNode("path", {
  2585. d: "M42 42L6 6",
  2586. fill: $options.getIsFull($options.post.isIgnore),
  2587. stroke: $options.getColor($options.post.isIgnore),
  2588. "stroke-width": "2",
  2589. "stroke-linecap": "round",
  2590. "stroke-linejoin": "round"
  2591. }, null, 8, _hoisted_14$2)
  2592. ])),
  2593. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isIgnore ? "取消忽略" : "忽略主题"), 1)
  2594. ], 2)) : vue.createCommentVNode("", true),
  2595. $options.post.once && $options.isLogin && false ? (vue.openBlock(), vue.createElementBlock("div", {
  2596. key: 3,
  2597. class: vue.normalizeClass(["tool", { "disabled": $data.loading3, "no-hover": $options.post.isLogin }]),
  2598. onClick: _cache[4] || (_cache[4] = (...args) => $options.report && $options.report(...args))
  2599. }, [
  2600. $data.loading3 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  2601. key: 0,
  2602. size: "small"
  2603. })) : (vue.openBlock(), vue.createElementBlock("svg", _hoisted_15$2, _hoisted_21$2)),
  2604. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isReport ? "你已对本主题进行了报告" : "报告这个主题"), 1)
  2605. ], 2)) : vue.createCommentVNode("", true)
  2606. ]);
  2607. }
  2608. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-d838dec6"]]);
  2609. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-67756941"), n2 = n2(), vue.popScopeId(), n2);
  2610. const _hoisted_1$7 = ["href"];
  2611. const _hoisted_2$6 = ["src"];
  2612. const _hoisted_3$5 = { class: "texts" };
  2613. const _hoisted_4$4 = {
  2614. key: 0,
  2615. class: "point"
  2616. };
  2617. const _hoisted_5$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  2618. width: "19",
  2619. height: "19",
  2620. viewBox: "0 0 48 48",
  2621. fill: "none"
  2622. }, [
  2623. /* @__PURE__ */ vue.createElementVNode("path", {
  2624. d: "M15 8C8.92487 8 4 12.9249 4 19C4 30 17 40 24 42.3262C31 40 44 30 44 19C44 12.9249 39.0751 8 33 8C29.2797 8 25.9907 9.8469 24 12.6738C22.0093 9.8469 18.7203 8 15 8Z",
  2625. fill: "#E02A2A",
  2626. stroke: "#E02A2A",
  2627. "stroke-width": "2",
  2628. "stroke-linecap": "round",
  2629. "stroke-linejoin": "round"
  2630. })
  2631. ], -1));
  2632. const _hoisted_6$3 = { class: "link-num" };
  2633. const _hoisted_7$2 = { class: "my-tag" };
  2634. const _hoisted_8$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  2635. const _hoisted_9$1 = {
  2636. key: 2,
  2637. class: "ago"
  2638. };
  2639. const _hoisted_10$1 = {
  2640. key: 3,
  2641. class: "mod"
  2642. };
  2643. const _hoisted_11$1 = {
  2644. key: 4,
  2645. class: "op"
  2646. };
  2647. const _hoisted_12$1 = ["href"];
  2648. const _hoisted_13$1 = {
  2649. key: 5,
  2650. class: "op"
  2651. };
  2652. const _hoisted_14$1 = {
  2653. key: 6,
  2654. class: "mod"
  2655. };
  2656. const _hoisted_15$1 = {
  2657. key: 7,
  2658. class: "ago"
  2659. };
  2660. const _hoisted_16$1 = { class: "my-tag" };
  2661. const _hoisted_17$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  2662. const _hoisted_18$1 = {
  2663. key: 9,
  2664. class: "point"
  2665. };
  2666. const _hoisted_19$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  2667. width: "19",
  2668. height: "19",
  2669. viewBox: "0 0 48 48",
  2670. fill: "none"
  2671. }, [
  2672. /* @__PURE__ */ vue.createElementVNode("path", {
  2673. d: "M15 8C8.92487 8 4 12.9249 4 19C4 30 17 40 24 42.3262C31 40 44 30 44 19C44 12.9249 39.0751 8 33 8C29.2797 8 25.9907 9.8469 24 12.6738C22.0093 9.8469 18.7203 8 15 8Z",
  2674. fill: "#E02A2A",
  2675. stroke: "#E02A2A",
  2676. "stroke-width": "2",
  2677. "stroke-linecap": "round",
  2678. "stroke-linejoin": "round"
  2679. })
  2680. ], -1));
  2681. const _hoisted_20$1 = { class: "link-num" };
  2682. const _hoisted_21$1 = ["href"];
  2683. const _hoisted_22$1 = ["src"];
  2684. const _hoisted_23$1 = { class: "Author-right" };
  2685. const _hoisted_24$1 = { class: "floor" };
  2686. const _hoisted_25$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  2687. const _hoisted_26$1 = [
  2688. _hoisted_25$1
  2689. ];
  2690. const _sfc_main$7 = {
  2691. __name: "SingleComment",
  2692. props: {
  2693. comment: {
  2694. reply_content: ""
  2695. },
  2696. isRight: {
  2697. type: Boolean,
  2698. default() {
  2699. return false;
  2700. }
  2701. }
  2702. },
  2703. setup(__props) {
  2704. const props = __props;
  2705. const config2 = vue.inject("config");
  2706. const isLogin = vue.inject("isLogin");
  2707. const tags = vue.inject("tags");
  2708. const myTags = vue.computed(() => {
  2709. return tags[props.comment.username] ?? [];
  2710. });
  2711. function jump() {
  2712. eventBus.emit(CMD.JUMP, props.comment.floor);
  2713. }
  2714. return (_ctx, _cache) => {
  2715. return vue.openBlock(), vue.createElementBlock("div", {
  2716. class: vue.normalizeClass(["comment", { isSimple: vue.unref(config2).viewType === "simple" }]),
  2717. ref: "comment"
  2718. }, [
  2719. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  2720. key: 0,
  2721. class: "avatar",
  2722. href: `/member/${__props.comment.username}`
  2723. }, [
  2724. vue.createElementVNode("img", {
  2725. src: __props.comment.avatar,
  2726. alt: ""
  2727. }, null, 8, _hoisted_2$6)
  2728. ], 8, _hoisted_1$7)) : vue.createCommentVNode("", true),
  2729. vue.createElementVNode("div", {
  2730. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  2731. }, [
  2732. vue.createElementVNode("div", _hoisted_3$5, [
  2733. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
  2734. _hoisted_5$3,
  2735. vue.createElementVNode("div", _hoisted_6$3, vue.toDisplayString(__props.comment.thankCount), 1)
  2736. ])) : vue.createCommentVNode("", true),
  2737. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(myTags), (i) => {
  2738. return vue.openBlock(), vue.createElementBlock("span", _hoisted_7$2, [
  2739. _hoisted_8$1,
  2740. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  2741. ]);
  2742. }), 256)) : vue.createCommentVNode("", true),
  2743. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  2744. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$1, "MOD")) : vue.createCommentVNode("", true),
  2745. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$1, "OP")) : vue.createCommentVNode("", true),
  2746. vue.createElementVNode("a", {
  2747. href: `/member/${__props.comment.username}`,
  2748. class: "username"
  2749. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_12$1),
  2750. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, "OP")) : vue.createCommentVNode("", true),
  2751. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, "MOD")) : vue.createCommentVNode("", true),
  2752. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_15$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  2753. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(vue.unref(myTags), (i) => {
  2754. return vue.openBlock(), vue.createElementBlock("span", _hoisted_16$1, [
  2755. _hoisted_17$1,
  2756. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  2757. ]);
  2758. }), 256)) : vue.createCommentVNode("", true),
  2759. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$1, [
  2760. _hoisted_19$1,
  2761. vue.createElementVNode("div", _hoisted_20$1, vue.toDisplayString(__props.comment.thankCount), 1)
  2762. ])) : vue.createCommentVNode("", true)
  2763. ]),
  2764. vue.createVNode(vue.unref(BaseHtmlRender), {
  2765. class: "reply_content",
  2766. html: __props.comment.reply_content
  2767. }, null, 8, ["html"])
  2768. ], 2),
  2769. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  2770. key: 1,
  2771. class: "avatar",
  2772. href: `/member/${__props.comment.username}`
  2773. }, [
  2774. vue.createElementVNode("img", {
  2775. src: __props.comment.avatar,
  2776. alt: ""
  2777. }, null, 8, _hoisted_22$1)
  2778. ], 8, _hoisted_21$1)) : vue.createCommentVNode("", true),
  2779. vue.createElementVNode("div", _hoisted_23$1, [
  2780. vue.createElementVNode("div", _hoisted_24$1, vue.toDisplayString(__props.comment.floor), 1),
  2781. vue.createElementVNode("div", {
  2782. class: "tool jump",
  2783. onClick: jump
  2784. }, _hoisted_26$1)
  2785. ])
  2786. ], 2);
  2787. };
  2788. }
  2789. };
  2790. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-67756941"]]);
  2791. function debounce(fn, delay, scope) {
  2792. let timer = null;
  2793. return function() {
  2794. let context = scope || this, args = arguments;
  2795. clearTimeout(timer);
  2796. timer = setTimeout(function() {
  2797. fn.apply(context, args);
  2798. timer = null;
  2799. }, delay);
  2800. };
  2801. }
  2802. const _sfc_main$6 = {
  2803. name: "detail",
  2804. components: {
  2805. SingleComment,
  2806. PopConfirm,
  2807. Comment,
  2808. PostEditor,
  2809. Point,
  2810. Toolbar,
  2811. BaseHtmlRender,
  2812. Tooltip,
  2813. BaseLoading
  2814. },
  2815. inject: ["allReplyUsers", "post", "tags", "isLogin", "config", "pageType", "isNight", "showConfig"],
  2816. provide() {
  2817. return {
  2818. postDetailWidth: vue.computed(() => this.postDetailWidth)
  2819. };
  2820. },
  2821. props: {
  2822. modelValue: {
  2823. type: Boolean,
  2824. default() {
  2825. return false;
  2826. }
  2827. },
  2828. loading: {
  2829. type: Boolean,
  2830. default() {
  2831. return false;
  2832. }
  2833. },
  2834. displayType: CommentDisplayType.FloorInFloorNoCallUser
  2835. },
  2836. data() {
  2837. return {
  2838. isSticky: false,
  2839. selectCallIndex: 0,
  2840. postDetailWidth: 0,
  2841. showCallList: false,
  2842. showRelationReply: false,
  2843. replyText: "",
  2844. callStyle: {
  2845. top: 0,
  2846. left: 0
  2847. },
  2848. targetUser: {
  2849. left: [],
  2850. right: "",
  2851. rightFloor: -1
  2852. },
  2853. debounceScroll: () => {
  2854. },
  2855. read: {
  2856. floor: 0,
  2857. total: 0
  2858. },
  2859. currentFloor: 1,
  2860. showOpTag: false
  2861. };
  2862. },
  2863. computed: {
  2864. myTags() {
  2865. return this.tags[this.post.member.username] ?? [];
  2866. },
  2867. CommentDisplayType() {
  2868. return CommentDisplayType;
  2869. },
  2870. isPost() {
  2871. return this.pageType === PageType.Post;
  2872. },
  2873. filterCallList() {
  2874. if (this.showCallList) {
  2875. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  2876. if (this.replyText)
  2877. return list.filter((i) => i.search(this.replyText) > -1);
  2878. return list;
  2879. }
  2880. return [];
  2881. },
  2882. topReply() {
  2883. return this.post.replyList.filter((v) => v.thankCount >= this.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, this.config.topReplyCount);
  2884. },
  2885. replyList() {
  2886. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  2887. return this.post.nestedReplies;
  2888. if (this.displayType === CommentDisplayType.Like) {
  2889. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  2890. }
  2891. if (this.displayType === CommentDisplayType.V2exOrigin)
  2892. return this.post.replyList;
  2893. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  2894. return this.post.nestedRedundReplies;
  2895. if (this.displayType === CommentDisplayType.OnlyOp)
  2896. return this.post.replyList.filter((v) => {
  2897. var _a;
  2898. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  2899. });
  2900. return [];
  2901. },
  2902. //关联回复
  2903. relationReply() {
  2904. if (this.targetUser.left.length && this.targetUser.right) {
  2905. return this.post.replyList.filter((v) => {
  2906. if (this.targetUser.left.includes(v.username)) {
  2907. if (v.floor > this.targetUser.rightFloor) {
  2908. if (v.replyUsers.includes(this.targetUser.right)) {
  2909. return true;
  2910. }
  2911. } else {
  2912. return true;
  2913. }
  2914. }
  2915. if (v.username === this.targetUser.right) {
  2916. for (let i = 0; i < this.targetUser.left.length; i++) {
  2917. if (v.replyUsers.includes(this.targetUser.left[i])) {
  2918. return true;
  2919. }
  2920. }
  2921. }
  2922. });
  2923. }
  2924. return [];
  2925. }
  2926. },
  2927. watch: {
  2928. "post.id"(n2, o) {
  2929. if (this.$refs["post-editor"]) {
  2930. this.$refs["post-editor"].content = "";
  2931. vue.nextTick(() => {
  2932. var _a, _b;
  2933. (_b = (_a = this.$refs) == null ? void 0 : _a.detail) == null ? void 0 : _b.scrollTo({ top: 0 });
  2934. });
  2935. }
  2936. },
  2937. "post.headerTemplate"(n2, o) {
  2938. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  2939. if (mountEl) {
  2940. this.showOpTag = true;
  2941. }
  2942. },
  2943. modelValue: {
  2944. handler(newVal) {
  2945. if (this.isPost) {
  2946. return;
  2947. }
  2948. if (newVal) {
  2949. document.body.style.overflow = "hidden";
  2950. window.history.pushState({}, 0, this.post.url);
  2951. window.document.title = this.post.title ?? "V2EX";
  2952. this.read = this.post.read;
  2953. this.currentFloor = 1;
  2954. vue.nextTick(() => {
  2955. var _a, _b;
  2956. (_b = (_a = this.$refs) == null ? void 0 : _a.main) == null ? void 0 : _b.focus();
  2957. });
  2958. } else {
  2959. this.$emit("saveReadList");
  2960. document.body.style.overflow = "unset";
  2961. this.isSticky = false;
  2962. this.showRelationReply = false;
  2963. if ((this.pageType === PageType.Home || this.pageType === PageType.Node || this.pageType === PageType.Member) && window.location.pathname !== "/") {
  2964. window.history.back();
  2965. window.document.title = "V2EX";
  2966. }
  2967. }
  2968. }
  2969. }
  2970. },
  2971. mounted() {
  2972. setTimeout(() => {
  2973. var _a;
  2974. this.postDetailWidth = ((_a = this.$refs.mainWrapper) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
  2975. });
  2976. this.debounceScroll = debounce(this.scroll, 300, false);
  2977. if (this.isLogin) {
  2978. const observer = new IntersectionObserver(
  2979. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  2980. { threshold: [1] }
  2981. );
  2982. observer.observe(this.$refs.replyBox);
  2983. window.addEventListener("keydown", this.onKeyDown);
  2984. }
  2985. eventBus.on(CMD.SHOW_CALL, (val) => {
  2986. if (val.show) {
  2987. this.showCallList = true;
  2988. this.replyText = val.text;
  2989. if (this.isPost) {
  2990. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  2991. } else {
  2992. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  2993. }
  2994. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  2995. if (this.selectCallIndex >= this.filterCallList.length) {
  2996. this.selectCallIndex = 0;
  2997. }
  2998. } else {
  2999. this.replyText = "";
  3000. this.showCallList = false;
  3001. this.selectCallIndex = 0;
  3002. }
  3003. });
  3004. eventBus.on(CMD.RELATION_REPLY, (val) => {
  3005. this.targetUser = val;
  3006. this.showRelationReply = true;
  3007. });
  3008. eventBus.on(CMD.JUMP, this.jump);
  3009. if (this.isPost) {
  3010. window.addEventListener("scroll", this.debounceScroll);
  3011. }
  3012. },
  3013. beforeUnmount() {
  3014. window.removeEventListener("keydown", this.onKeyDown);
  3015. eventBus.off(CMD.SHOW_CALL);
  3016. },
  3017. methods: {
  3018. addTag() {
  3019. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  3020. },
  3021. removeTag(tag) {
  3022. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  3023. },
  3024. scroll() {
  3025. if (!this.config.rememberLastReadFloor)
  3026. return;
  3027. let height = window.innerHeight * 0.3;
  3028. let comments = $(".comments .comment");
  3029. let forCount = 0;
  3030. for (let i = 0; i < comments.length; i++) {
  3031. forCount++;
  3032. let ins = comments[i];
  3033. let rect = ins.getBoundingClientRect();
  3034. if (rect.top > height) {
  3035. let lastReadFloor = Number(ins.dataset["floor"]);
  3036. console.log("当前阅读楼层", lastReadFloor);
  3037. eventBus.emit(CMD.ADD_READ, {
  3038. floor: lastReadFloor > 3 ? lastReadFloor : 0,
  3039. total: this.post.replyList.length
  3040. });
  3041. if (lastReadFloor > 3) {
  3042. this.read.floor = 0;
  3043. }
  3044. break;
  3045. }
  3046. }
  3047. if (forCount === comments.length) {
  3048. console.log("看到最后了");
  3049. eventBus.emit(CMD.ADD_READ, {
  3050. floor: forCount,
  3051. total: this.post.replyList.length
  3052. });
  3053. }
  3054. },
  3055. stop(e2) {
  3056. },
  3057. jump(floor) {
  3058. try {
  3059. floor = Number(floor);
  3060. } catch (e2) {
  3061. }
  3062. if (!floor)
  3063. return;
  3064. if (!this.post.replyList.length) {
  3065. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  3066. this.read.floor = 0;
  3067. return;
  3068. }
  3069. if (floor > this.post.replyList.length) {
  3070. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  3071. this.read.floor = 0;
  3072. return;
  3073. }
  3074. let comment = $(`.c_${floor}`);
  3075. if (!comment.length) {
  3076. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  3077. this.read.floor = 0;
  3078. return;
  3079. }
  3080. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  3081. comment.addClass("ding");
  3082. this.read.floor = 0;
  3083. this.currentFloor = floor + 1;
  3084. setTimeout(() => {
  3085. comment.removeClass("ding");
  3086. }, 2e3);
  3087. },
  3088. jumpLastRead(floor) {
  3089. if (this.config.autoJumpLastReadFloor) {
  3090. if (!floor)
  3091. return;
  3092. setTimeout(() => {
  3093. console.log("上次跳转", floor);
  3094. this.jump(floor);
  3095. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "已跳转到上次阅读位置" });
  3096. }, 300);
  3097. }
  3098. },
  3099. collapseTopReplyList() {
  3100. $(this.$refs.topReply).slideToggle("fast");
  3101. },
  3102. goBottom() {
  3103. this.isSticky = false;
  3104. setTimeout(() => {
  3105. if (this.isPost) {
  3106. let body = $("body , html");
  3107. let scrollHeight = body.prop("scrollHeight");
  3108. body.animate({ scrollTop: scrollHeight - 850 }, 300);
  3109. } else {
  3110. this.$refs.detail.scrollTo({ top: this.$refs.detail.scrollHeight, behavior: "smooth" });
  3111. }
  3112. });
  3113. },
  3114. close(from) {
  3115. if (this.isPost)
  3116. return;
  3117. if (from === "space") {
  3118. if (this.config.closePostDetailBySpace) {
  3119. this.$emit("update:modelValue", false);
  3120. }
  3121. } else {
  3122. this.$emit("update:modelValue", false);
  3123. }
  3124. },
  3125. setCall(e2) {
  3126. eventBus.emit(CMD.SET_CALL, e2);
  3127. this.showCallList = false;
  3128. },
  3129. onKeyDown(e2) {
  3130. if (!this.modelValue)
  3131. return;
  3132. if (!this.showCallList)
  3133. return;
  3134. let length = this.filterCallList.slice(0, 10).length;
  3135. if (e2.keyCode === 13) {
  3136. this.setCall(this.filterCallList[this.selectCallIndex]);
  3137. e2.preventDefault();
  3138. }
  3139. if (e2.keyCode === 38) {
  3140. this.selectCallIndex--;
  3141. if (this.selectCallIndex < 0) {
  3142. this.selectCallIndex = length - 1;
  3143. }
  3144. e2.preventDefault();
  3145. }
  3146. if (e2.keyCode === 40) {
  3147. this.selectCallIndex++;
  3148. if (this.selectCallIndex > length - 1) {
  3149. this.selectCallIndex = 0;
  3150. }
  3151. e2.preventDefault();
  3152. }
  3153. },
  3154. changeOption(item) {
  3155. this.$emit("update:displayType", item);
  3156. },
  3157. addThank() {
  3158. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "add" });
  3159. },
  3160. recallThank() {
  3161. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "recall" });
  3162. },
  3163. scrollTop() {
  3164. if (this.isPost) {
  3165. $("body , html").animate({ scrollTop: 0 }, 300);
  3166. } else {
  3167. this.$refs.detail.scrollTo({ top: 0, behavior: "smooth" });
  3168. }
  3169. }
  3170. }
  3171. };
  3172. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-7251c320"), n2 = n2(), vue.popScopeId(), n2);
  3173. const _hoisted_1$6 = { class: "my-box post-wrapper" };
  3174. const _hoisted_2$5 = { class: "header" };
  3175. const _hoisted_3$4 = { class: "fr" };
  3176. const _hoisted_4$3 = ["href"];
  3177. const _hoisted_5$2 = ["src", "alt"];
  3178. const _hoisted_6$2 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  3179. const _hoisted_7$1 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  3180. const _hoisted_8 = ["href"];
  3181. const _hoisted_9 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "sep10" }, null, -1));
  3182. const _hoisted_10 = ["id"];
  3183. const _hoisted_11 = ["onclick"];
  3184. const _hoisted_12 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-up" }, null, -1));
  3185. const _hoisted_13 = ["onclick"];
  3186. const _hoisted_14 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-down" }, null, -1));
  3187. const _hoisted_15 = [
  3188. _hoisted_14
  3189. ];
  3190. const _hoisted_16 = { class: "gray" };
  3191. const _hoisted_17 = ["href"];
  3192. const _hoisted_18 = ["title"];
  3193. const _hoisted_19 = { class: "my-tag" };
  3194. const _hoisted_20 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3195. const _hoisted_21 = ["onClick"];
  3196. const _hoisted_22 = {
  3197. key: 0,
  3198. class: "my-box"
  3199. };
  3200. const _hoisted_23 = { class: "my-cell flex" };
  3201. const _hoisted_24 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "" }, "高赞回复", -1));
  3202. const _hoisted_25 = { class: "top-reply" };
  3203. const _hoisted_26 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-times" }, null, -1));
  3204. const _hoisted_27 = { ref: "topReply" };
  3205. const _hoisted_28 = { class: "my-box comment-wrapper" };
  3206. const _hoisted_29 = {
  3207. key: 0,
  3208. class: "my-cell flex"
  3209. };
  3210. const _hoisted_30 = { class: "radio-group2" };
  3211. const _hoisted_31 = {
  3212. key: 0,
  3213. class: "read-notice"
  3214. };
  3215. const _hoisted_32 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上次打开:", -1));
  3216. const _hoisted_33 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-long-arrow-down" }, null, -1));
  3217. const _hoisted_34 = [
  3218. _hoisted_33
  3219. ];
  3220. const _hoisted_35 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-long-arrow-down" }, null, -1));
  3221. const _hoisted_36 = [
  3222. _hoisted_35
  3223. ];
  3224. const _hoisted_37 = { class: "my-cell flex" };
  3225. const _hoisted_38 = { key: 0 };
  3226. const _hoisted_39 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("strong", { class: "snow" }, "•", -1));
  3227. const _hoisted_40 = ["innerHTML"];
  3228. const _hoisted_41 = {
  3229. key: 0,
  3230. class: "loading-wrapper"
  3231. };
  3232. const _hoisted_42 = {
  3233. key: 1,
  3234. class: "comments"
  3235. };
  3236. const _hoisted_43 = {
  3237. key: 1,
  3238. id: "no-comments-yet"
  3239. };
  3240. const _hoisted_44 = { class: "my-cell flex" };
  3241. const _hoisted_45 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "添加一条新回复", -1));
  3242. const _hoisted_46 = { class: "notice-right gray" };
  3243. const _hoisted_47 = { class: "p1" };
  3244. const _hoisted_48 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "gray" }, "上下文", -1));
  3245. const _hoisted_49 = { class: "top-reply" };
  3246. const _hoisted_50 = ["onClick"];
  3247. const _hoisted_51 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", {
  3248. class: "fa fa-times",
  3249. "aria-hidden": "true"
  3250. }, null, -1));
  3251. const _hoisted_52 = [
  3252. _hoisted_51
  3253. ];
  3254. const _hoisted_53 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", {
  3255. class: "fa fa-long-arrow-up",
  3256. "aria-hidden": "true"
  3257. }, null, -1));
  3258. const _hoisted_54 = [
  3259. _hoisted_53
  3260. ];
  3261. const _hoisted_55 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-long-arrow-down" }, null, -1));
  3262. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  3263. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  3264. const _component_Point = vue.resolveComponent("Point");
  3265. const _component_Toolbar = vue.resolveComponent("Toolbar");
  3266. const _component_Tooltip = vue.resolveComponent("Tooltip");
  3267. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3268. const _component_Comment = vue.resolveComponent("Comment");
  3269. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  3270. const _component_PostEditor = vue.resolveComponent("PostEditor");
  3271. const _component_SingleComment = vue.resolveComponent("SingleComment");
  3272. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  3273. class: vue.normalizeClass(["post-detail", [$options.isNight ? "isNight" : "", $options.pageType]]),
  3274. ref: "detail",
  3275. onKeydown: _cache[27] || (_cache[27] = vue.withKeys(($event) => $options.close(), ["esc"])),
  3276. onScroll: _cache[28] || (_cache[28] = (...args) => $data.debounceScroll && $data.debounceScroll(...args)),
  3277. onClick: _cache[29] || (_cache[29] = ($event) => $options.close("space"))
  3278. }, [
  3279. vue.createElementVNode("div", {
  3280. ref: "main",
  3281. class: "main",
  3282. tabindex: "1",
  3283. onClick: _cache[26] || (_cache[26] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  3284. }, [
  3285. vue.createElementVNode("div", {
  3286. class: "main-wrapper",
  3287. ref: "mainWrapper",
  3288. style: vue.normalizeStyle({ width: $options.config.postWidth })
  3289. }, [
  3290. vue.createElementVNode("div", _hoisted_1$6, [
  3291. vue.createElementVNode("div", _hoisted_2$5, [
  3292. vue.createElementVNode("div", _hoisted_3$4, [
  3293. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("a", {
  3294. key: 0,
  3295. href: `/member/${$options.post.member.username}`
  3296. }, [
  3297. vue.createElementVNode("img", {
  3298. src: $options.post.member.avatar_large,
  3299. class: "avatar",
  3300. style: { "width": "73px", "height": "73px" },
  3301. border: "0",
  3302. align: "default",
  3303. alt: $options.post.member.username
  3304. }, null, 8, _hoisted_5$2)
  3305. ], 8, _hoisted_4$3)) : vue.createCommentVNode("", true)
  3306. ]),
  3307. _hoisted_6$2,
  3308. _hoisted_7$1,
  3309. vue.createElementVNode("a", {
  3310. href: $options.post.node.url
  3311. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_8),
  3312. _hoisted_9,
  3313. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1),
  3314. vue.createElementVNode("div", {
  3315. id: `topic_${$options.post.id}_votes`,
  3316. class: "votes"
  3317. }, [
  3318. vue.createElementVNode("a", {
  3319. href: "javascript:",
  3320. onclick: `upVoteTopic(${$options.post.id});`,
  3321. class: "vote"
  3322. }, [
  3323. _hoisted_12,
  3324. vue.createTextVNode("   ")
  3325. ], 8, _hoisted_11),
  3326. vue.createTextVNode("   "),
  3327. vue.createElementVNode("a", {
  3328. href: "javascript:",
  3329. onclick: `downVoteTopic(${$options.post.id});`,
  3330. class: "vote"
  3331. }, _hoisted_15, 8, _hoisted_13)
  3332. ], 8, _hoisted_10),
  3333. vue.createTextVNode("   "),
  3334. vue.createElementVNode("small", _hoisted_16, [
  3335. vue.createElementVNode("a", {
  3336. href: `/member/${$options.post.member.username}`
  3337. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_17),
  3338. vue.createTextVNode(" · "),
  3339. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  3340. vue.createElementVNode("span", {
  3341. class: vue.normalizeClass($options.post.member.isNew && "danger")
  3342. }, vue.toDisplayString($options.post.member.createDate), 3),
  3343. vue.createTextVNode(" · ")
  3344. ], 64)) : vue.createCommentVNode("", true),
  3345. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  3346. vue.createElementVNode("span", {
  3347. title: $options.post.createDate
  3348. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_18),
  3349. vue.createTextVNode(" · ")
  3350. ], 64)) : vue.createCommentVNode("", true),
  3351. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1)
  3352. ]),
  3353. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  3354. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3355. return vue.openBlock(), vue.createElementBlock("span", _hoisted_19, [
  3356. _hoisted_20,
  3357. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3358. vue.createElementVNode("i", {
  3359. class: "fa fa-trash-o remove",
  3360. onClick: ($event) => $options.removeTag(i)
  3361. }, null, 8, _hoisted_21)
  3362. ]);
  3363. }), 256)),
  3364. vue.createElementVNode("span", {
  3365. class: "add-tag ago",
  3366. onClick: _cache[0] || (_cache[0] = (...args) => $options.addTag && $options.addTag(...args)),
  3367. title: "添加标签"
  3368. }, "+")
  3369. ], 64)) : vue.createCommentVNode("", true)
  3370. ]),
  3371. vue.createVNode(_component_BaseHtmlRender, {
  3372. html: $options.post.headerTemplate
  3373. }, null, 8, ["html"]),
  3374. vue.createVNode(_component_Toolbar, {
  3375. onReply: _cache[1] || (_cache[1] = ($event) => $data.isSticky = !$data.isSticky)
  3376. }, {
  3377. default: vue.withCtx(() => [
  3378. vue.createVNode(_component_Point, {
  3379. onAddThank: $options.addThank,
  3380. onRecallThank: $options.recallThank,
  3381. full: false,
  3382. item: {
  3383. isThanked: $options.post.isThanked,
  3384. thankCount: $options.post.thankCount,
  3385. username: $options.post.username
  3386. },
  3387. "api-url": "topic/" + $options.post.id
  3388. }, null, 8, ["onAddThank", "onRecallThank", "item", "api-url"])
  3389. ]),
  3390. _: 1
  3391. })
  3392. ]),
  3393. $options.topReply.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_22, [
  3394. vue.createElementVNode("div", _hoisted_23, [
  3395. _hoisted_24,
  3396. vue.createElementVNode("div", _hoisted_25, [
  3397. vue.createVNode(_component_Tooltip, {
  3398. title: `统计点赞数大于等于${$options.config.topReplyLoveMinCount}个的回复,可在设置中调整`
  3399. }, {
  3400. default: vue.withCtx(() => [
  3401. vue.createElementVNode("i", {
  3402. class: "fa fa-info",
  3403. onClick: _cache[2] || (_cache[2] = ($event) => $options.showConfig())
  3404. })
  3405. ]),
  3406. _: 1
  3407. }, 8, ["title"]),
  3408. vue.createVNode(_component_PopConfirm, {
  3409. title: "关闭后不再默认显示,可在设置里重新打开,确认关闭?",
  3410. onConfirm: _cache[3] || (_cache[3] = ($event) => $options.config.showTopReply = false)
  3411. }, {
  3412. default: vue.withCtx(() => [
  3413. _hoisted_26
  3414. ]),
  3415. _: 1
  3416. }),
  3417. vue.createVNode(_component_Tooltip, { title: "收起高赞回复" }, {
  3418. default: vue.withCtx(() => [
  3419. vue.createElementVNode("i", {
  3420. class: "fa fa-compress",
  3421. onClick: _cache[4] || (_cache[4] = (...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args))
  3422. })
  3423. ]),
  3424. _: 1
  3425. })
  3426. ])
  3427. ]),
  3428. vue.createElementVNode("div", _hoisted_27, [
  3429. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.topReply, (item, index2) => {
  3430. return vue.openBlock(), vue.createBlock(_component_Comment, {
  3431. key: item.floor,
  3432. type: "top",
  3433. modelValue: $options.topReply[index2],
  3434. "onUpdate:modelValue": ($event) => $options.topReply[index2] = $event
  3435. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  3436. }), 128))
  3437. ], 512)
  3438. ])) : vue.createCommentVNode("", true),
  3439. vue.createElementVNode("div", _hoisted_28, [
  3440. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  3441. $options.config.showToolbar ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_29, [
  3442. vue.createElementVNode("div", _hoisted_30, [
  3443. vue.createVNode(_component_Tooltip, { title: "不隐藏@用户" }, {
  3444. default: vue.withCtx(() => [
  3445. vue.createElementVNode("div", {
  3446. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.FloorInFloor ? "active" : ""]),
  3447. onClick: _cache[5] || (_cache[5] = ($event) => $options.changeOption($options.CommentDisplayType.FloorInFloor))
  3448. }, "楼中楼(@) ", 2)
  3449. ]),
  3450. _: 1
  3451. }),
  3452. vue.createVNode(_component_Tooltip, { title: "隐藏第一个@用户,双击内容可显示原文" }, {
  3453. default: vue.withCtx(() => [
  3454. vue.createElementVNode("div", {
  3455. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.FloorInFloorNoCallUser ? "active" : ""]),
  3456. onClick: _cache[6] || (_cache[6] = ($event) => $options.changeOption($options.CommentDisplayType.FloorInFloorNoCallUser))
  3457. }, "楼中楼 ", 2)
  3458. ]),
  3459. _: 1
  3460. }),
  3461. vue.createVNode(_component_Tooltip, { title: "重复显示楼中楼的回复" }, {
  3462. default: vue.withCtx(() => [
  3463. vue.createElementVNode("div", {
  3464. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.FloorInFloorNested ? "active" : ""]),
  3465. onClick: _cache[7] || (_cache[7] = ($event) => $options.changeOption($options.CommentDisplayType.FloorInFloorNested))
  3466. }, "冗余楼中楼 ", 2)
  3467. ]),
  3468. _: 1
  3469. }),
  3470. vue.createElementVNode("div", {
  3471. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.Like ? "active" : ""]),
  3472. onClick: _cache[8] || (_cache[8] = ($event) => $options.changeOption($options.CommentDisplayType.Like))
  3473. }, "感谢 ", 2),
  3474. vue.createElementVNode("div", {
  3475. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.OnlyOp ? "active" : ""]),
  3476. onClick: _cache[9] || (_cache[9] = ($event) => $options.changeOption($options.CommentDisplayType.OnlyOp))
  3477. }, "只看楼主 ", 2),
  3478. vue.createElementVNode("div", {
  3479. class: vue.normalizeClass(["radio", $props.displayType === $options.CommentDisplayType.V2exOrigin ? "active" : ""]),
  3480. onClick: _cache[10] || (_cache[10] = ($event) => $options.changeOption($options.CommentDisplayType.V2exOrigin))
  3481. }, "V2原版 ", 2)
  3482. ]),
  3483. $data.read.floor || $data.read.total ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_31, [
  3484. _hoisted_32,
  3485. $data.read.floor ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  3486. vue.createElementVNode("span", null, [
  3487. vue.createTextVNode("阅读到"),
  3488. vue.createElementVNode("b", null, vue.toDisplayString($data.read.floor), 1),
  3489. vue.createTextVNode("楼")
  3490. ]),
  3491. vue.createElementVNode("div", {
  3492. class: "jump jump1",
  3493. onClick: _cache[11] || (_cache[11] = ($event) => $options.jump($data.read.floor))
  3494. }, _hoisted_34)
  3495. ], 64)) : vue.createCommentVNode("", true),
  3496. vue.createElementVNode("span", null, [
  3497. vue.createTextVNode("总楼层"),
  3498. vue.createElementVNode("b", null, vue.toDisplayString($data.read.total), 1)
  3499. ]),
  3500. vue.createElementVNode("div", {
  3501. class: "jump",
  3502. onClick: _cache[12] || (_cache[12] = ($event) => $options.jump($data.read.total))
  3503. }, _hoisted_36)
  3504. ])) : vue.createCommentVNode("", true)
  3505. ])) : vue.createCommentVNode("", true),
  3506. vue.createElementVNode("div", _hoisted_37, [
  3507. vue.createElementVNode("span", null, [
  3508. vue.createTextVNode(vue.toDisplayString($options.post.replyCount) + " 条回复 ", 1),
  3509. $options.post.createDate ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_38, [
  3510. vue.createTextVNode("  "),
  3511. _hoisted_39,
  3512. vue.createTextVNode("  " + vue.toDisplayString($options.post.createDate), 1)
  3513. ])) : vue.createCommentVNode("", true)
  3514. ]),
  3515. vue.createElementVNode("div", {
  3516. class: "fr",
  3517. innerHTML: $options.post.fr
  3518. }, null, 8, _hoisted_40)
  3519. ])
  3520. ], 64)) : vue.createCommentVNode("", true),
  3521. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  3522. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_41, [
  3523. vue.createVNode(_component_BaseLoading, { size: "large" })
  3524. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_42, [
  3525. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index2) => {
  3526. return vue.openBlock(), vue.createBlock(_component_Comment, {
  3527. key: item.floor,
  3528. modelValue: $options.replyList[index2],
  3529. "onUpdate:modelValue": ($event) => $options.replyList[index2] = $event
  3530. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  3531. }), 128)) : vue.createCommentVNode("", true)
  3532. ]))
  3533. ], 64)) : vue.createCommentVNode("", true)
  3534. ]),
  3535. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_43, "目前尚无回复")) : vue.createCommentVNode("", true),
  3536. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  3537. key: 2,
  3538. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  3539. ref: "replyBox"
  3540. }, [
  3541. vue.createElementVNode("div", _hoisted_44, [
  3542. _hoisted_45,
  3543. vue.createElementVNode("div", _hoisted_46, [
  3544. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  3545. key: 0,
  3546. style: { "margin-right": "2rem" },
  3547. onClick: _cache[13] || (_cache[13] = ($event) => $data.isSticky = false)
  3548. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  3549. vue.createElementVNode("a", {
  3550. onClick: _cache[14] || (_cache[14] = (...args) => $options.scrollTop && $options.scrollTop(...args))
  3551. }, "回到顶部")
  3552. ])
  3553. ]),
  3554. vue.createElementVNode("div", _hoisted_47, [
  3555. vue.createVNode(_component_PostEditor, {
  3556. onClose: $options.goBottom,
  3557. ref: "post-editor",
  3558. useType: "reply-post",
  3559. onClick: _cache[15] || (_cache[15] = ($event) => $data.isSticky = true)
  3560. }, null, 8, ["onClose"])
  3561. ])
  3562. ], 2)) : vue.createCommentVNode("", true)
  3563. ], 4),
  3564. $data.showRelationReply ? (vue.openBlock(), vue.createElementBlock("div", {
  3565. key: 0,
  3566. class: "relationReply",
  3567. onClick: _cache[19] || (_cache[19] = ($event) => $options.close("space"))
  3568. }, [
  3569. vue.createElementVNode("div", {
  3570. class: "my-cell flex",
  3571. onClick: _cache[17] || (_cache[17] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  3572. }, [
  3573. _hoisted_48,
  3574. vue.createElementVNode("div", _hoisted_49, [
  3575. vue.createElementVNode("i", {
  3576. class: "fa fa-times",
  3577. onClick: _cache[16] || (_cache[16] = ($event) => $data.showRelationReply = false)
  3578. })
  3579. ])
  3580. ]),
  3581. vue.createElementVNode("div", {
  3582. class: "comments",
  3583. onClick: _cache[18] || (_cache[18] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  3584. }, [
  3585. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.relationReply, (item, index2) => {
  3586. return vue.openBlock(), vue.createBlock(_component_SingleComment, {
  3587. "is-right": item.username === $data.targetUser.right,
  3588. key: item.floor,
  3589. comment: item
  3590. }, null, 8, ["is-right", "comment"]);
  3591. }), 128))
  3592. ])
  3593. ])) : vue.createCommentVNode("", true),
  3594. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  3595. key: 1,
  3596. class: "call-list",
  3597. style: vue.normalizeStyle($data.callStyle)
  3598. }, [
  3599. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index2) => {
  3600. return vue.openBlock(), vue.createElementBlock("div", {
  3601. class: vue.normalizeClass(["call-item", { select: index2 === $data.selectCallIndex }]),
  3602. onClick: ($event) => $options.setCall(item)
  3603. }, [
  3604. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  3605. ], 10, _hoisted_50);
  3606. }), 256))
  3607. ], 4)) : vue.createCommentVNode("", true),
  3608. $options.config.closePostDetailBySpace ? (vue.openBlock(), vue.createElementBlock("div", {
  3609. key: 2,
  3610. class: "close-btn",
  3611. onClick: _cache[20] || (_cache[20] = ($event) => $options.close("btn"))
  3612. }, _hoisted_52)) : vue.createCommentVNode("", true),
  3613. vue.createElementVNode("div", {
  3614. class: "scroll-top gray",
  3615. onClick: _cache[21] || (_cache[21] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  3616. }, _hoisted_54),
  3617. vue.createElementVNode("div", {
  3618. class: "scroll-to gray",
  3619. onClick: _cache[25] || (_cache[25] = vue.withModifiers(($event) => $options.jump($data.currentFloor), ["stop"]))
  3620. }, [
  3621. _hoisted_55,
  3622. vue.withDirectives(vue.createElementVNode("input", {
  3623. type: "text",
  3624. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.currentFloor = $event),
  3625. onClick: _cache[23] || (_cache[23] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"])),
  3626. onKeydown: _cache[24] || (_cache[24] = vue.withKeys(($event) => $options.jump($data.currentFloor), ["enter"]))
  3627. }, null, 544), [
  3628. [vue.vModelText, $data.currentFloor]
  3629. ])
  3630. ])
  3631. ], 512)
  3632. ], 34)), [
  3633. [vue.vShow, $props.modelValue]
  3634. ]);
  3635. }
  3636. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-7251c320"]]);
  3637. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-f56506e5"), n2 = n2(), vue.popScopeId(), n2);
  3638. const _hoisted_1$5 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  3639. width: "24",
  3640. height: "24",
  3641. viewBox: "0 0 48 48",
  3642. fill: "none",
  3643. xmlns: "http://www.w3.org/2000/svg"
  3644. }, [
  3645. /* @__PURE__ */ vue.createElementVNode("path", {
  3646. d: "M17 32L19.1875 27M31 32L28.8125 27M19.1875 27L24 16L28.8125 27M19.1875 27H28.8125",
  3647. stroke: "#929596",
  3648. "stroke-width": "4",
  3649. "stroke-linecap": "round",
  3650. "stroke-linejoin": "round"
  3651. }),
  3652. /* @__PURE__ */ vue.createElementVNode("path", {
  3653. d: "M43.1999 20C41.3468 10.871 33.2758 4 23.5999 4C13.9241 4 5.85308 10.871 4 20L10 18",
  3654. stroke: "#929596",
  3655. "stroke-width": "4",
  3656. "stroke-linecap": "round",
  3657. "stroke-linejoin": "round"
  3658. }),
  3659. /* @__PURE__ */ vue.createElementVNode("path", {
  3660. d: "M4 28C5.85308 37.129 13.9241 44 23.5999 44C33.2758 44 41.3468 37.129 43.1999 28L38 30",
  3661. stroke: "#929596",
  3662. "stroke-width": "4",
  3663. "stroke-linecap": "round",
  3664. "stroke-linejoin": "round"
  3665. })
  3666. ], -1));
  3667. const _hoisted_2$4 = { key: 1 };
  3668. const _sfc_main$5 = {
  3669. __name: "Base64Tooltip",
  3670. setup(__props) {
  3671. const tooltip = vue.ref(null);
  3672. const show = vue.ref(false);
  3673. const originalText = vue.ref("");
  3674. const decodeText = vue.ref("");
  3675. const styleObject = vue.reactive({
  3676. left: "-100vw",
  3677. top: "-100vh"
  3678. });
  3679. vue.onMounted(() => {
  3680. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  3681. setTimeout(() => show.value = true);
  3682. originalText.value = text;
  3683. decodeText.value = "";
  3684. styleObject.left = e2.clientX + "px";
  3685. styleObject.top = e2.clientY + 20 + "px";
  3686. });
  3687. window.addEventListener("click", (e2) => {
  3688. if (!tooltip.value)
  3689. return;
  3690. if (!tooltip.value.contains(e2.target) && show.value) {
  3691. show.value = false;
  3692. }
  3693. }, { capture: true });
  3694. const fn = () => show.value && (show.value = false);
  3695. $(".post-detail", window.win().doc).on("scroll", fn);
  3696. });
  3697. function copy() {
  3698. if (window.win().navigator.clipboard) {
  3699. window.win().navigator.clipboard.writeText(decodeText.value);
  3700. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  3701. } else {
  3702. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  3703. }
  3704. }
  3705. function base64ToArrayBuffer(base64) {
  3706. let binary_string = window.atob(base64);
  3707. let len = binary_string.length;
  3708. let bytes = new Uint8Array(len);
  3709. for (let i = 0; i < len; i++) {
  3710. bytes[i] = binary_string.charCodeAt(i);
  3711. }
  3712. return bytes.buffer;
  3713. }
  3714. function decode() {
  3715. try {
  3716. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  3717. decodeText.value = r2;
  3718. });
  3719. } catch (e2) {
  3720. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  3721. }
  3722. }
  3723. return (_ctx, _cache) => {
  3724. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  3725. class: "base64_tooltip",
  3726. style: vue.normalizeStyle(styleObject),
  3727. onClick: decode,
  3728. ref_key: "tooltip",
  3729. ref: tooltip
  3730. }, [
  3731. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  3732. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  3733. _hoisted_1$5
  3734. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, [
  3735. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  3736. vue.createVNode(BaseButton, {
  3737. class: "btn",
  3738. size: "small",
  3739. onClick: copy
  3740. }, {
  3741. default: vue.withCtx(() => [
  3742. vue.createTextVNode("点击复制")
  3743. ]),
  3744. _: 1
  3745. })
  3746. ]))
  3747. ], 4)), [
  3748. [vue.vShow, show.value]
  3749. ]);
  3750. };
  3751. }
  3752. };
  3753. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f56506e5"]]);
  3754. const _sfc_main$4 = {
  3755. name: "Msg",
  3756. props: {
  3757. type: "",
  3758. text: ""
  3759. },
  3760. created() {
  3761. setTimeout(() => {
  3762. this.$emit("close");
  3763. }, 3e3);
  3764. }
  3765. };
  3766. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-defce7f2"), n2 = n2(), vue.popScopeId(), n2);
  3767. const _hoisted_1$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  3768. width: "24",
  3769. height: "24",
  3770. viewBox: "0 0 48 48",
  3771. fill: "none",
  3772. xmlns: "http://www.w3.org/2000/svg"
  3773. }, [
  3774. /* @__PURE__ */ vue.createElementVNode("path", {
  3775. d: "M14 14L34 34",
  3776. stroke: "#ffffff",
  3777. "stroke-width": "4",
  3778. "stroke-linecap": "round",
  3779. "stroke-linejoin": "round"
  3780. }),
  3781. /* @__PURE__ */ vue.createElementVNode("path", {
  3782. d: "M14 34L34 14",
  3783. stroke: "#ffffff",
  3784. "stroke-width": "4",
  3785. "stroke-linecap": "round",
  3786. "stroke-linejoin": "round"
  3787. })
  3788. ], -1));
  3789. const _hoisted_2$3 = [
  3790. _hoisted_1$4
  3791. ];
  3792. const _hoisted_3$3 = { class: "right" };
  3793. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  3794. return vue.openBlock(), vue.createElementBlock("div", {
  3795. class: vue.normalizeClass(["msg", $props.type])
  3796. }, [
  3797. vue.createElementVNode("div", {
  3798. class: "left",
  3799. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  3800. }, _hoisted_2$3),
  3801. vue.createElementVNode("div", _hoisted_3$3, vue.toDisplayString($props.text), 1)
  3802. ], 2);
  3803. }
  3804. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-defce7f2"]]);
  3805. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-2bb75acc"), n2 = n2(), vue.popScopeId(), n2);
  3806. const _hoisted_1$3 = {
  3807. key: 0,
  3808. class: "tag-modal modal"
  3809. };
  3810. const _hoisted_2$2 = { class: "wrapper" };
  3811. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  3812. const _hoisted_4$2 = { class: "option" };
  3813. const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  3814. const _hoisted_6$1 = ["onKeydown"];
  3815. const _hoisted_7 = { class: "btns" };
  3816. const _sfc_main$3 = {
  3817. __name: "TagModal",
  3818. props: ["tags"],
  3819. emits: ["update:tags"],
  3820. setup(__props, { emit }) {
  3821. const props = __props;
  3822. const tagModal = vue.reactive({
  3823. show: false,
  3824. currentUsername: "",
  3825. tag: ""
  3826. });
  3827. const inputRef = vue.ref();
  3828. vue.onMounted(() => {
  3829. eventBus.on(CMD.ADD_TAG, (username) => {
  3830. tagModal.currentUsername = username;
  3831. tagModal.show = true;
  3832. vue.nextTick(() => {
  3833. inputRef.value.focus();
  3834. });
  3835. });
  3836. });
  3837. async function addTag() {
  3838. if (!tagModal.tag) {
  3839. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  3840. return;
  3841. }
  3842. let oldTag = window.clone(props.tags);
  3843. let tempTag = window.clone(props.tags);
  3844. let userTags = tempTag[tagModal.currentUsername] ?? [];
  3845. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  3846. if (rIndex > -1) {
  3847. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  3848. return;
  3849. } else {
  3850. userTags.push(tagModal.tag);
  3851. }
  3852. tempTag[tagModal.currentUsername] = userTags;
  3853. emit("update:tags", tempTag);
  3854. tagModal.tag = "";
  3855. tagModal.show = false;
  3856. let res = await window.parse.saveTags(tempTag);
  3857. if (!res) {
  3858. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  3859. emit("update:tags", oldTag);
  3860. }
  3861. }
  3862. return (_ctx, _cache) => {
  3863. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  3864. default: vue.withCtx(() => [
  3865. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  3866. vue.createElementVNode("div", {
  3867. class: "mask",
  3868. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  3869. }),
  3870. vue.createElementVNode("div", _hoisted_2$2, [
  3871. _hoisted_3$2,
  3872. vue.createElementVNode("div", _hoisted_4$2, [
  3873. _hoisted_5$1,
  3874. vue.createElementVNode("div", null, [
  3875. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  3876. ])
  3877. ]),
  3878. vue.withDirectives(vue.createElementVNode("input", {
  3879. type: "text",
  3880. ref_key: "inputRef",
  3881. ref: inputRef,
  3882. style: { "width": "100%" },
  3883. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  3884. onKeydown: vue.withKeys(addTag, ["enter"])
  3885. }, null, 40, _hoisted_6$1), [
  3886. [vue.vModelText, tagModal.tag]
  3887. ]),
  3888. vue.createElementVNode("div", _hoisted_7, [
  3889. vue.createVNode(BaseButton, {
  3890. type: "link",
  3891. onClick: _cache[2] || (_cache[2] = ($event) => tagModal.show = false)
  3892. }, {
  3893. default: vue.withCtx(() => [
  3894. vue.createTextVNode("取消")
  3895. ]),
  3896. _: 1
  3897. }),
  3898. vue.createVNode(BaseButton, { onClick: addTag }, {
  3899. default: vue.withCtx(() => [
  3900. vue.createTextVNode("确定")
  3901. ]),
  3902. _: 1
  3903. })
  3904. ])
  3905. ])
  3906. ])) : vue.createCommentVNode("", true)
  3907. ]),
  3908. _: 1
  3909. });
  3910. };
  3911. }
  3912. };
  3913. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-2bb75acc"]]);
  3914. const _hoisted_1$2 = { class: "msgs" };
  3915. const _sfc_main$2 = {
  3916. __name: "MsgModal",
  3917. setup(__props) {
  3918. const msgList = vue.reactive([
  3919. // {type: 'success', text: '123', id: Date.now()}
  3920. ]);
  3921. vue.onMounted(() => {
  3922. eventBus.on(CMD.SHOW_MSG, (val) => {
  3923. msgList.push({ ...val, id: Date.now() });
  3924. });
  3925. });
  3926. function removeMsg(id) {
  3927. let rIndex = msgList.findIndex((item) => item.id === id);
  3928. if (rIndex > -1) {
  3929. msgList.splice(rIndex, 1);
  3930. }
  3931. }
  3932. return (_ctx, _cache) => {
  3933. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
  3934. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  3935. return vue.openBlock(), vue.createBlock(Msg, {
  3936. key: v.id,
  3937. type: v.type,
  3938. text: v.text,
  3939. onClose: ($event) => removeMsg(v.id)
  3940. }, null, 8, ["type", "text", "onClose"]);
  3941. }), 128))
  3942. ]);
  3943. };
  3944. }
  3945. };
  3946. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-95974c3e"]]);
  3947. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  3948. function e(e2) {
  3949. console.error(e2);
  3950. }
  3951. function r(e2, t) {
  3952. let r2 = e2.substr(t, 2);
  3953. return parseInt(r2, 16);
  3954. }
  3955. function n(href, index2) {
  3956. let o = "", a = r(href, index2);
  3957. for (let i = index2 + 2; i < href.length; i += 2) {
  3958. let l = r(href, i) ^ a;
  3959. o += String.fromCharCode(l);
  3960. }
  3961. try {
  3962. o = decodeURIComponent(escape(o));
  3963. } catch (u2) {
  3964. e(u2);
  3965. }
  3966. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  3967. return d.childNodes[0].getAttribute("href") || "";
  3968. }
  3969. function decodeEmail(body) {
  3970. try {
  3971. let as = body.find(u);
  3972. as.each(function() {
  3973. try {
  3974. let o = this, a = o.parentNode, i = o.getAttribute(f);
  3975. if (i) {
  3976. let l = n(i, 0), d2 = document.createTextNode(l);
  3977. a.replaceChild(d2, o);
  3978. }
  3979. } catch (h) {
  3980. e(h);
  3981. }
  3982. });
  3983. } catch (s) {
  3984. e(s);
  3985. }
  3986. }
  3987. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-dd7fcedd"), n2 = n2(), vue.popScopeId(), n2);
  3988. const _hoisted_1$1 = {
  3989. key: 0,
  3990. class: "tag-modal modal"
  3991. };
  3992. const _hoisted_2$1 = { class: "wrapper" };
  3993. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  3994. const _hoisted_4$1 = ["innerHTML"];
  3995. const _sfc_main$1 = {
  3996. __name: "NotificationModal",
  3997. props: ["modelValue", "h"],
  3998. emits: ["update:modelValue"],
  3999. setup(__props, { emit }) {
  4000. vue.onMounted(() => {
  4001. });
  4002. return (_ctx, _cache) => {
  4003. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  4004. default: vue.withCtx(() => [
  4005. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  4006. vue.createElementVNode("div", {
  4007. class: "mask",
  4008. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => emit("update:modelValue", false), ["stop"]))
  4009. }),
  4010. vue.createElementVNode("div", _hoisted_2$1, [
  4011. _hoisted_3$1,
  4012. vue.createElementVNode("div", { innerHTML: __props.h }, null, 8, _hoisted_4$1)
  4013. ])
  4014. ])) : vue.createCommentVNode("", true)
  4015. ]),
  4016. _: 1
  4017. });
  4018. };
  4019. }
  4020. };
  4021. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-dd7fcedd"]]);
  4022. const _sfc_main = {
  4023. components: {
  4024. NotificationModal,
  4025. BaseLoading,
  4026. BaseSwitch,
  4027. MsgModal,
  4028. TagModal,
  4029. Tooltip,
  4030. Setting,
  4031. PostDetail,
  4032. Base64Tooltip,
  4033. Msg
  4034. },
  4035. provide() {
  4036. return {
  4037. isLogin: vue.computed(() => this.isLogin),
  4038. isNight: vue.computed(() => this.isNight),
  4039. pageType: vue.computed(() => this.pageType),
  4040. tags: vue.computed(() => this.tags),
  4041. show: vue.computed(() => this.show),
  4042. post: vue.computed(() => this.current),
  4043. config: vue.computed(() => this.config),
  4044. allReplyUsers: vue.computed(() => {
  4045. var _a, _b, _c;
  4046. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  4047. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  4048. }
  4049. return [];
  4050. }),
  4051. showConfig: this.showConfig
  4052. };
  4053. },
  4054. data() {
  4055. return {
  4056. loading: window.pageType === PageType.Post,
  4057. loadMore: false,
  4058. isLogin: !!window.user.username,
  4059. pageType: window.pageType,
  4060. isNight: window.isNight,
  4061. stopMe: window.stopMe,
  4062. //停止使用脚本
  4063. show: false,
  4064. current: window.clone(window.initPost),
  4065. list: [],
  4066. config: window.clone(window.config),
  4067. tags: window.user.tags,
  4068. readList: window.user.readList,
  4069. configModal: {
  4070. show: false
  4071. },
  4072. notificationModal: {
  4073. show: false,
  4074. h: ""
  4075. }
  4076. };
  4077. },
  4078. computed: {
  4079. targetUserTags() {
  4080. return this.tags[window.targetUserName] ?? [];
  4081. },
  4082. isList() {
  4083. return [PageType.Home, PageType.Node].includes(this.pageType);
  4084. },
  4085. isPost() {
  4086. return this.pageType === PageType.Post;
  4087. },
  4088. isMember() {
  4089. return this.pageType === PageType.Member;
  4090. }
  4091. },
  4092. watch: {
  4093. "current.replyList": {
  4094. handler(newVal, oldVal) {
  4095. if (newVal.length) {
  4096. this.current.replyCount = newVal.length;
  4097. let res = window.parse.createNestedList(newVal, this.current.allReplyUsers);
  4098. if (res) {
  4099. this.current.nestedReplies = res;
  4100. }
  4101. let dup_res = window.parse.createNestedRedundantList(newVal, this.current.allReplyUsers);
  4102. if (dup_res) {
  4103. this.current.nestedRedundReplies = dup_res;
  4104. }
  4105. } else {
  4106. this.current.replyCount = 0;
  4107. this.current.nestedReplies = [];
  4108. this.current.nestedRedundReplies = [];
  4109. }
  4110. if (this.list) {
  4111. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  4112. if (rIndex > -1) {
  4113. this.list[rIndex].replyCount = newVal.length;
  4114. }
  4115. }
  4116. },
  4117. deep: true
  4118. },
  4119. config: {
  4120. handler(newVal) {
  4121. let config2 = { [window.user.username ?? "default"]: newVal };
  4122. localStorage.setItem("v2ex-config", JSON.stringify(config2));
  4123. window.config = newVal;
  4124. },
  4125. deep: true
  4126. },
  4127. tags(newVal) {
  4128. window.user.tags = newVal;
  4129. },
  4130. "config.viewType"(newVal) {
  4131. if (!newVal)
  4132. return;
  4133. if (newVal === "card") {
  4134. $(".post-item").each(function() {
  4135. $(this).addClass("preview");
  4136. });
  4137. } else {
  4138. $(".post-item").each(function() {
  4139. $(this).removeClass("preview");
  4140. });
  4141. }
  4142. }
  4143. },
  4144. created() {
  4145. let that = this;
  4146. window.cb = this.winCb;
  4147. if (!window.canParseV2exPage)
  4148. return;
  4149. $(document).on("click", "a", (e2) => {
  4150. if (e2.currentTarget.getAttribute("script"))
  4151. return;
  4152. if (that.stopMe)
  4153. return true;
  4154. let { href, id, title } = window.parse.parseA(e2.currentTarget);
  4155. if (href.includes("/settings/night/toggle"))
  4156. return;
  4157. if (href.includes("/?tab="))
  4158. return;
  4159. if (href.includes("/go"))
  4160. return;
  4161. if (href === window.origin + "/#;")
  4162. return;
  4163. if (href === window.origin + "/")
  4164. return;
  4165. if (href.includes("/notifications"))
  4166. ;
  4167. if (id) {
  4168. that.clickPost(e2, id, href, title);
  4169. } else {
  4170. if (that.config.newTabOpen) {
  4171. that.stopEvent(e2);
  4172. window.parse.openNewTab(href);
  4173. }
  4174. }
  4175. });
  4176. $(document).on("click", ".post-item", function(e2) {
  4177. if (e2.currentTarget.getAttribute("script"))
  4178. return;
  4179. if (that.stopMe)
  4180. return true;
  4181. if (this.classList.contains("preview")) {
  4182. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG" && !e2.target.classList.contains("toggle")) {
  4183. console.log("点空白处", this);
  4184. let id = this.dataset["id"];
  4185. let href = this.dataset["href"];
  4186. if (id) {
  4187. that.clickPost(e2, id, href);
  4188. } else {
  4189. if (href)
  4190. location.href = href;
  4191. }
  4192. }
  4193. }
  4194. });
  4195. $(document).on("click", ".toggle", (e2) => {
  4196. if (this.stopMe)
  4197. return true;
  4198. let id = e2.currentTarget.dataset["id"];
  4199. let itemDom = window.win().query(`.id_${id}`);
  4200. if (itemDom.classList.contains("preview")) {
  4201. itemDom.classList.remove("preview");
  4202. } else {
  4203. itemDom.classList.add("preview");
  4204. }
  4205. });
  4206. window.onpopstate = (event) => {
  4207. if (event.state) {
  4208. if (!this.show)
  4209. this.show = true;
  4210. } else {
  4211. if (this.show)
  4212. this.show = false;
  4213. }
  4214. };
  4215. window.onbeforeunload = () => {
  4216. this.saveReadList();
  4217. };
  4218. this.initEvent();
  4219. },
  4220. beforeUnmount() {
  4221. eventBus.clear();
  4222. },
  4223. methods: {
  4224. stopEvent(e2) {
  4225. e2.preventDefault();
  4226. e2.stopPropagation();
  4227. },
  4228. saveReadList() {
  4229. window.parse.saveReadList(this.readList);
  4230. },
  4231. async clickPost(e2, id, href, title = "") {
  4232. if (id) {
  4233. if (this.config.clickPostItemOpenDetail) {
  4234. this.stopEvent(e2);
  4235. let index2 = this.list.findIndex((v) => v.id == id);
  4236. let postItem = this.clone(window.initPost);
  4237. if (index2 > -1) {
  4238. postItem = this.list[index2];
  4239. } else {
  4240. postItem.title = title ?? "加载中";
  4241. }
  4242. postItem.inList = index2 > -1;
  4243. if (postItem.inList) {
  4244. if (postItem.replies > MAX_REPLY_LIMIT) {
  4245. return window.parse.openNewTab(`https://www.v2ex.com/t/${id}?p=1&script=1`);
  4246. }
  4247. }
  4248. postItem.id = id;
  4249. postItem.href = href;
  4250. if (!postItem.headerTemplate) {
  4251. let template = `
  4252. <div class="cell">
  4253. <div class="topic_content">
  4254. <div class="markdown_body">
  4255. ${(postItem == null ? void 0 : postItem.content_rendered) ?? ""}
  4256. </div>
  4257. </div>
  4258. </div>
  4259. `;
  4260. postItem.headerTemplate = template;
  4261. }
  4262. this.getPostDetail(postItem);
  4263. return;
  4264. }
  4265. if (this.config.newTabOpen) {
  4266. this.stopEvent(e2);
  4267. window.parse.openNewTab(`https://www.v2ex.com/t/${id}?p=1`);
  4268. }
  4269. }
  4270. },
  4271. showPost() {
  4272. this.show = true;
  4273. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  4274. $(this).hide();
  4275. });
  4276. },
  4277. showConfig() {
  4278. this.configModal.show = true;
  4279. },
  4280. async winCb({ type, value }) {
  4281. if (type === "openSetting") {
  4282. this.showConfig();
  4283. }
  4284. if (type === "syncData") {
  4285. this.list = window.postList;
  4286. this.config = window.config;
  4287. this.stopMe = window.stopMe;
  4288. this.tags = window.user.tags;
  4289. this.readList = window.user.readList;
  4290. this.current.read = this.readList[this.current.id] ?? {};
  4291. if (this.show && this.isPost && this.current.read.floor) {
  4292. this.$refs.postDetail.read = this.current.read;
  4293. }
  4294. }
  4295. if (this.stopMe)
  4296. return;
  4297. if (type === "restorePost") {
  4298. this.show = false;
  4299. this.loading = false;
  4300. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  4301. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  4302. $(this).show();
  4303. });
  4304. }
  4305. if (type === "postContent") {
  4306. this.current = Object.assign(this.clone(this.current), this.clone(value));
  4307. if (this.config.autoOpenDetail) {
  4308. this.showPost();
  4309. }
  4310. }
  4311. if (type === "postReplies") {
  4312. this.current = Object.assign(this.clone(this.current), this.clone(value));
  4313. console.log("当前帖子", this.current);
  4314. this.loading = false;
  4315. }
  4316. if (type === "postOp") {
  4317. this.current = Object.assign(this.clone(this.current), this.clone(value));
  4318. }
  4319. },
  4320. clone(val) {
  4321. return window.clone(val);
  4322. },
  4323. initEvent() {
  4324. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  4325. console.log("CHANGE_COMMENT_THANK", val);
  4326. const { id, type } = val;
  4327. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  4328. if (currentI > -1) {
  4329. this.current.replyList[currentI].isThanked = type === "add";
  4330. if (type === "add") {
  4331. this.current.replyList[currentI].thankCount++;
  4332. } else {
  4333. this.current.replyList[currentI].thankCount--;
  4334. }
  4335. }
  4336. });
  4337. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  4338. const { id, type } = val;
  4339. this.current.isThanked = type === "add";
  4340. if (type === "add") {
  4341. this.current.thankCount++;
  4342. } else {
  4343. this.current.thankCount--;
  4344. }
  4345. let currentI = this.list.findIndex((i) => i.id === id);
  4346. if (currentI > -1) {
  4347. this.list[currentI].isThanked = type === "add";
  4348. if (type === "add") {
  4349. this.list[currentI].thankCount++;
  4350. } else {
  4351. this.list[currentI].thankCount++;
  4352. }
  4353. }
  4354. });
  4355. eventBus.on(CMD.REMOVE, (val) => {
  4356. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  4357. if (removeIndex > -1) {
  4358. this.current.replyList.splice(removeIndex, 1);
  4359. }
  4360. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  4361. if (rIndex > -1) {
  4362. this.list[rIndex] = Object.assign(this.list[rIndex], val);
  4363. }
  4364. });
  4365. eventBus.on(CMD.IGNORE, () => {
  4366. this.show = false;
  4367. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  4368. if (rIndex > -1) {
  4369. this.list.splice(rIndex, 1);
  4370. }
  4371. this.current = this.clone(window.initPost);
  4372. });
  4373. eventBus.on(CMD.MERGE, (val) => {
  4374. this.current = Object.assign(this.current, val);
  4375. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  4376. if (rIndex > -1) {
  4377. this.list[rIndex] = Object.assign(this.list[rIndex], val);
  4378. }
  4379. });
  4380. eventBus.on(CMD.ADD_READ, (val) => {
  4381. this.readList[this.current.id] = val;
  4382. });
  4383. eventBus.on(CMD.ADD_REPLY, (item) => {
  4384. this.current.replyList.push(item);
  4385. });
  4386. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  4387. if (once) {
  4388. if (typeof once === "string") {
  4389. let res = once.match(/var once = "([\d]+)";/);
  4390. if (res && res[1]) {
  4391. this.current.once = Number(res[1]);
  4392. return;
  4393. }
  4394. }
  4395. if (typeof once === "number") {
  4396. this.current.once = once;
  4397. return;
  4398. }
  4399. }
  4400. window.fetchOnce().then((r2) => {
  4401. this.current.once = r2;
  4402. });
  4403. });
  4404. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  4405. let oldTag = this.clone(this.tags);
  4406. let tags = this.tags[username] ?? [];
  4407. let rIndex = tags.findIndex((v) => v === tag);
  4408. if (rIndex > -1) {
  4409. tags.splice(rIndex, 1);
  4410. }
  4411. this.tags[username] = tags;
  4412. let res = await window.parse.saveTags(this.tags);
  4413. if (!res) {
  4414. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  4415. this.tags = oldTag;
  4416. }
  4417. });
  4418. },
  4419. async getPostDetail(post, event) {
  4420. console.log("getPostDetail");
  4421. this.current = Object.assign({}, window.initPost, post);
  4422. this.current.read = this.readList[this.current.id] ?? { floor: 0, total: 0 };
  4423. this.show = true;
  4424. if (!this.current.inList) {
  4425. this.loading = true;
  4426. let r2 = await window.parse.checkPostReplies(post.id, true);
  4427. if (r2) {
  4428. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  4429. this.loading = this.show = false;
  4430. return;
  4431. }
  4432. }
  4433. let url = window.baseUrl + "/t/" + post.id;
  4434. this.current.url = url;
  4435. let alreadyHasReply = this.current.replyList.length;
  4436. if (alreadyHasReply) {
  4437. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  4438. } else {
  4439. this.loading = true;
  4440. }
  4441. let apiRes = await window.fetch(url + "?p=1");
  4442. if (apiRes.status === 404) {
  4443. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  4444. return this.loading = false;
  4445. }
  4446. if (apiRes.status === 403) {
  4447. this.loading = false;
  4448. this.show = false;
  4449. window.parse.openNewTab(`https://www.v2ex.com/t/${post.id}?p=1&script=0`);
  4450. return;
  4451. }
  4452. if (apiRes.redirected) {
  4453. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  4454. return this.loading = false;
  4455. }
  4456. let htmlText = await apiRes.text();
  4457. let hasPermission = htmlText.search("你要查看的页面需要先登录(不可用)");
  4458. if (hasPermission > -1) {
  4459. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录(不可用)" });
  4460. return this.loading = false;
  4461. }
  4462. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  4463. let body = $(bodyText[0]);
  4464. decodeEmail(body);
  4465. this.current = await window.parse.getPostDetail(this.current, body, htmlText);
  4466. if (this.current.replyList.length) {
  4467. let index2 = this.list.findIndex((v) => v.id == post.id);
  4468. if (index2 > -1) {
  4469. this.list[index2].replyList = this.current.replyList;
  4470. this.list[index2].nestedReplies = this.current.nestedReplies;
  4471. this.list[index2].once = this.current.once;
  4472. this.list[index2].createDate = this.current.createDate;
  4473. } else {
  4474. this.list.push(this.clone(this.current));
  4475. }
  4476. }
  4477. this.loading = false;
  4478. if (!alreadyHasReply) {
  4479. vue.nextTick(() => {
  4480. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  4481. });
  4482. }
  4483. this.current = await window.parse.parseOp(this.current);
  4484. console.log("当前帖子", this.current, this.current.member.id);
  4485. },
  4486. addTargetUserTag() {
  4487. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  4488. },
  4489. removeTargetUserTag(tag) {
  4490. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  4491. }
  4492. }
  4493. };
  4494. const _withScopeId = (n2) => (vue.pushScopeId("data-v-a95e25c7"), n2 = n2(), vue.popScopeId(), n2);
  4495. const _hoisted_1 = {
  4496. key: 0,
  4497. class: "target-user-tags p1"
  4498. };
  4499. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  4500. const _hoisted_3 = { class: "my-tag" };
  4501. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4502. const _hoisted_5 = ["onClick"];
  4503. const _hoisted_6 = {
  4504. key: 1,
  4505. class: "my-box flex flex-center p2"
  4506. };
  4507. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  4508. const _component_Setting = vue.resolveComponent("Setting");
  4509. const _component_TagModal = vue.resolveComponent("TagModal");
  4510. const _component_PostDetail = vue.resolveComponent("PostDetail");
  4511. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  4512. const _component_MsgModal = vue.resolveComponent("MsgModal");
  4513. const _component_NotificationModal = vue.resolveComponent("NotificationModal");
  4514. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4515. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  4516. vue.createVNode(_component_Setting, {
  4517. modelValue: $data.config,
  4518. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  4519. show: $data.configModal.show,
  4520. "onUpdate:show": _cache[1] || (_cache[1] = ($event) => $data.configModal.show = $event)
  4521. }, null, 8, ["modelValue", "show"]),
  4522. vue.createVNode(_component_TagModal, {
  4523. tags: $data.tags,
  4524. "onUpdate:tags": _cache[2] || (_cache[2] = ($event) => $data.tags = $event)
  4525. }, null, 8, ["tags"]),
  4526. vue.createVNode(_component_PostDetail, {
  4527. modelValue: $data.show,
  4528. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.show = $event),
  4529. ref: "postDetail",
  4530. displayType: $data.config.commentDisplayType,
  4531. "onUpdate:displayType": _cache[4] || (_cache[4] = ($event) => $data.config.commentDisplayType = $event),
  4532. onSaveReadList: $options.saveReadList,
  4533. loading: $data.loading
  4534. }, null, 8, ["modelValue", "displayType", "onSaveReadList", "loading"]),
  4535. vue.createVNode(_component_Base64Tooltip),
  4536. vue.createVNode(_component_MsgModal),
  4537. vue.createVNode(_component_NotificationModal, {
  4538. modelValue: $data.notificationModal.show,
  4539. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.notificationModal.show = $event),
  4540. h: $data.notificationModal.h
  4541. }, null, 8, ["modelValue", "h"]),
  4542. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  4543. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  4544. _hoisted_2,
  4545. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  4546. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  4547. _hoisted_4,
  4548. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  4549. vue.createElementVNode("i", {
  4550. class: "fa fa-trash-o remove",
  4551. onClick: ($event) => $options.removeTargetUserTag(i)
  4552. }, null, 8, _hoisted_5)
  4553. ]);
  4554. }), 256)),
  4555. vue.createElementVNode("span", {
  4556. class: "add-tag ago",
  4557. onClick: _cache[6] || (_cache[6] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  4558. title: "添加标签"
  4559. }, "+")
  4560. ])) : vue.createCommentVNode("", true),
  4561. $options.isPost && !$data.show && $data.config.autoOpenDetail ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  4562. vue.createVNode(_component_BaseLoading, { size: "large" })
  4563. ])) : vue.createCommentVNode("", true)
  4564. ], 64)) : vue.createCommentVNode("", true)
  4565. ], 64);
  4566. }
  4567. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a95e25c7"]]);
  4568. var _GM_notification = /* @__PURE__ */ (() => typeof GM_notification != "undefined" ? GM_notification : void 0)();
  4569. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  4570. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  4571. let $section = document.createElement("section");
  4572. $section.id = "app";
  4573. function run() {
  4574. window.baseUrl = location.origin;
  4575. window.initPost = {
  4576. allReplyUsers: [],
  4577. content_rendered: "",
  4578. createDate: "",
  4579. createDateAgo: "",
  4580. fr: "",
  4581. replyList: [],
  4582. nestedReplies: [],
  4583. nestedRedundReplies: [],
  4584. username: "",
  4585. url: "",
  4586. member: {},
  4587. node: {
  4588. title: "",
  4589. url: ""
  4590. },
  4591. headerTemplate: "",
  4592. title: "",
  4593. id: "",
  4594. type: "post",
  4595. once: "",
  4596. replyCount: 0,
  4597. clickCount: 0,
  4598. thankCount: 0,
  4599. collectCount: 0,
  4600. lastReadFloor: 0,
  4601. isFavorite: false,
  4602. isIgnore: false,
  4603. isThanked: false,
  4604. isReport: false
  4605. };
  4606. window.win = function() {
  4607. return window;
  4608. };
  4609. window.win().doc = window.win().document;
  4610. window.win().query = (v) => window.win().document.querySelector(v);
  4611. window.query = (v) => window.win().document.querySelector(v);
  4612. window.clone = (val) => JSON.parse(JSON.stringify(val));
  4613. window.user = {
  4614. tagPrefix: "--用户标签--",
  4615. tags: {},
  4616. tagsId: "",
  4617. username: "",
  4618. avatar: "",
  4619. readPrefix: "--已读楼层--",
  4620. readNoteItemId: "",
  4621. readList: {},
  4622. imgurPrefix: "--imgur图片删除hash--",
  4623. imgurList: {},
  4624. imgurNoteId: ""
  4625. };
  4626. window.targetUserName = "";
  4627. window.pageType = void 0;
  4628. window.pageData = { pageNo: 1 };
  4629. window.config = {
  4630. showToolbar: true,
  4631. showPreviewBtn: true,
  4632. autoOpenDetail: true,
  4633. openTag: true,
  4634. //给用户打标签
  4635. clickPostItemOpenDetail: true,
  4636. closePostDetailBySpace: true,
  4637. //点击空白处关闭详情
  4638. contentAutoCollapse: true,
  4639. //正文超长自动折叠
  4640. viewType: "table",
  4641. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  4642. newTabOpen: false,
  4643. //新标签打开
  4644. base64: true,
  4645. //base功能
  4646. sov2ex: false,
  4647. postWidth: "",
  4648. showTopReply: true,
  4649. topReplyLoveMinCount: 3,
  4650. topReplyCount: 3,
  4651. autoJumpLastReadFloor: false,
  4652. rememberLastReadFloor: true,
  4653. autoSignin: true,
  4654. customBgColor: "",
  4655. version: 1,
  4656. collectBrowserNotice: false
  4657. };
  4658. window.const = {
  4659. git: "https://github.com/zyronon/v2ex-script",
  4660. issue: "https://github.com/zyronon/v2ex-script/issues"
  4661. };
  4662. window.currentVersion = 1;
  4663. window.isNight = $(".Night").length === 1;
  4664. window.cb = null;
  4665. window.stopMe = false;
  4666. window.postList = [];
  4667. window.parse = {
  4668. //解析帖子内容
  4669. async parsePostContent(post, body, htmlText) {
  4670. let once = htmlText.match(/var once = "([\d]+)";/);
  4671. if (once && once[1]) {
  4672. post.once = once[1];
  4673. }
  4674. post.isReport = htmlText.includes("你已对本主题进行了报告");
  4675. let main = body.find("#Main");
  4676. if (!post.title || !post.content_rendered) {
  4677. let h1 = main.find("h1");
  4678. if (h1) {
  4679. post.title = h1[0].innerText;
  4680. }
  4681. }
  4682. let as = main.find(".header > a");
  4683. if (as.length) {
  4684. console.log("as[1].innerText", as[1]);
  4685. post.node.title = as[1].innerText;
  4686. post.node.url = as[1].href;
  4687. }
  4688. let aName = main.find(".header small.gray a:nth-child(1)");
  4689. if (aName) {
  4690. post.member.username = aName[0].innerText;
  4691. }
  4692. let spanEl = main.find(".header small.gray span");
  4693. if (spanEl) {
  4694. post.createDateAgo = spanEl[0].innerText;
  4695. }
  4696. let avatarEl = main.find(".header .avatar");
  4697. console.log("avatarEl", avatarEl[0].src);
  4698. if (avatarEl) {
  4699. post.member.avatar_large = avatarEl[0].src;
  4700. }
  4701. let topic_buttons = body.find(".topic_buttons");
  4702. if (topic_buttons.length) {
  4703. let favoriteNode = topic_buttons.find(".tb:first");
  4704. if (favoriteNode.length) {
  4705. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  4706. }
  4707. let ignoreNode = topic_buttons.find(".tb:nth-child(3)");
  4708. if (ignoreNode.length) {
  4709. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  4710. }
  4711. let thankNode = topic_buttons.find("#topic_thank .tb");
  4712. if (!thankNode.length) {
  4713. post.isThanked = true;
  4714. }
  4715. let topic_stats = topic_buttons.find(".topic_stats");
  4716. if (topic_stats.length) {
  4717. let text = topic_stats[0].innerText;
  4718. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  4719. let collectCountReg = [...reg1];
  4720. if (collectCountReg.length) {
  4721. post.collectCount = Number(collectCountReg[0][1]);
  4722. }
  4723. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  4724. collectCountReg = [...reg1];
  4725. if (collectCountReg.length) {
  4726. post.collectCount = Number(collectCountReg[0][1]);
  4727. }
  4728. let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g);
  4729. let thankCountReg = [...reg2];
  4730. if (thankCountReg.length) {
  4731. post.thankCount = Number(thankCountReg[0][1]);
  4732. }
  4733. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  4734. let clickCountReg = [...reg3];
  4735. if (clickCountReg.length) {
  4736. post.clickCount = Number(clickCountReg[0][1]);
  4737. }
  4738. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  4739. clickCountReg = [...reg3];
  4740. if (clickCountReg.length) {
  4741. post.clickCount = Number(clickCountReg[0][1]);
  4742. }
  4743. }
  4744. }
  4745. let header = body.find("#Main .box").first();
  4746. let temp = header.clone();
  4747. temp.find(".topic_buttons").remove();
  4748. temp.find(".header").remove();
  4749. let html = temp.html();
  4750. html = this.checkPhotoLink2Img(html);
  4751. post.headerTemplate = html;
  4752. return post;
  4753. },
  4754. //解析OP信息
  4755. async parseOp(post) {
  4756. if (!post.member.id) {
  4757. let userRes = await fetch(window.baseUrl + "/api/members/show.json?username=" + post.member.username);
  4758. if (userRes.status === 200) {
  4759. post.member = await userRes.json();
  4760. }
  4761. }
  4762. if (post.member.id) {
  4763. let date = new Date(post.member.created * 1e3);
  4764. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  4765. date.setHours(0);
  4766. date.setMinutes(0);
  4767. date.setSeconds(0);
  4768. date.setMilliseconds(0);
  4769. let now = /* @__PURE__ */ new Date();
  4770. now.setHours(0);
  4771. now.setMinutes(0);
  4772. now.setSeconds(0);
  4773. now.setMilliseconds(0);
  4774. let d2 = now.getTime() - date.getTime();
  4775. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 7;
  4776. post.member.createDate = createStr + " 注册(不可用)";
  4777. post.member.isNew = isNew;
  4778. } else {
  4779. post.member.createDate = "用户已被注销/封禁";
  4780. post.member.isNew = true;
  4781. }
  4782. return post;
  4783. },
  4784. //获取帖子所有回复
  4785. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  4786. var _a, _b;
  4787. if (body.find("#no-comments-yet").length) {
  4788. return post;
  4789. }
  4790. let box = body.find("#Main > .box")[1];
  4791. let cells = box.querySelectorAll(".cell");
  4792. if (cells && cells.length) {
  4793. post.fr = cells[0].querySelector(".cell .fr").innerHTML;
  4794. cells = Array.from(cells);
  4795. }
  4796. let snow = cells[0].querySelector(".snow");
  4797. post.createDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  4798. let repliesMap = [];
  4799. if (cells[1].id) {
  4800. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  4801. let replyList = this.getAllReply(repliesMap);
  4802. post.replyList = replyList;
  4803. post.replyCount = replyList.length;
  4804. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  4805. let nestedList = this.createNestedList(replyList, post.allReplyUsers);
  4806. let nestedRedundantList = this.createNestedRedundantList(replyList, post.allReplyUsers);
  4807. if (nestedList)
  4808. post.nestedReplies = nestedList;
  4809. if (nestedRedundantList)
  4810. post.nestedRedundReplies = nestedRedundantList;
  4811. return post;
  4812. } else {
  4813. let promiseList = [];
  4814. return new Promise((resolve, reject) => {
  4815. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  4816. let pages = cells[1].querySelectorAll("a");
  4817. pages = Array.from(pages);
  4818. let url = window.baseUrl + "/t/" + post.id;
  4819. for (let i = 0; i < pages.length; i++) {
  4820. let currentPageNo = Number(pages[i].innerText);
  4821. if (currentPageNo == pageNo)
  4822. continue;
  4823. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  4824. }
  4825. Promise.allSettled(promiseList).then(
  4826. (results) => {
  4827. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  4828. let replyList = this.getAllReply(repliesMap);
  4829. post.replyList = replyList;
  4830. post.replyCount = replyList.length;
  4831. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  4832. let nestedList = this.createNestedList(replyList, post.allReplyUsers);
  4833. let nestedRedundantList = this.createNestedRedundantList(replyList, post.allReplyUsers);
  4834. if (nestedList)
  4835. post.nestedReplies = nestedList;
  4836. if (nestedRedundantList)
  4837. post.nestedRedundReplies = nestedRedundantList;
  4838. resolve(post);
  4839. }
  4840. );
  4841. });
  4842. }
  4843. },
  4844. //请求帖子其他页的回复
  4845. fetchPostOtherPageReplies(href, pageNo) {
  4846. return new Promise((resolve) => {
  4847. $.get(href).then((res) => {
  4848. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  4849. let box = $(s[0]).find("#Main .box")[1];
  4850. let cells = box.querySelectorAll(".cell");
  4851. cells = Array.from(cells);
  4852. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  4853. }).catch((r2) => {
  4854. if (r2.status === 403) {
  4855. cbChecker({ type: "restorePost", value: null });
  4856. }
  4857. });
  4858. });
  4859. },
  4860. //解析页面的回复
  4861. parsePageReplies(nodes) {
  4862. let replyList = [];
  4863. nodes.forEach((node, index2) => {
  4864. if (!node.id)
  4865. return;
  4866. let item = {
  4867. level: 0,
  4868. thankCount: 0,
  4869. isThanked: false,
  4870. isOp: false,
  4871. isDup: false,
  4872. id: node.id.replace("r_", "")
  4873. };
  4874. let reply_content = node.querySelector(".reply_content");
  4875. item.reply_content = this.checkPhotoLink2Img(reply_content.innerHTML);
  4876. item.reply_text = reply_content.textContent;
  4877. let { users, floor } = this.parseReplyContent(item.reply_content);
  4878. item.hideCallUserReplyContent = item.reply_content;
  4879. if (users.length === 1) {
  4880. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  4881. }
  4882. item.replyUsers = users;
  4883. item.replyFloor = floor;
  4884. let ago = node.querySelector(".ago");
  4885. item.date = ago.textContent;
  4886. let userNode = node.querySelector("strong a");
  4887. item.username = userNode.textContent;
  4888. let avatar = node.querySelector("td img");
  4889. item.avatar = avatar.src;
  4890. let no = node.querySelector(".no");
  4891. item.floor = Number(no.textContent);
  4892. let thank_area = node.querySelector(".thank_area");
  4893. if (thank_area) {
  4894. item.isThanked = thank_area.classList.contains("thanked");
  4895. }
  4896. let small = node.querySelector(".small");
  4897. if (small) {
  4898. item.thankCount = Number(small.textContent);
  4899. }
  4900. let op = node.querySelector(".op");
  4901. if (op) {
  4902. item.isOp = true;
  4903. }
  4904. let mod = node.querySelector(".mod");
  4905. if (mod) {
  4906. item.isMod = true;
  4907. }
  4908. replyList.push(item);
  4909. });
  4910. return replyList;
  4911. },
  4912. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  4913. parseReplyContent(str) {
  4914. if (!str)
  4915. return;
  4916. let users = [];
  4917. let getUsername = (userStr) => {
  4918. let endIndex = userStr.indexOf('">');
  4919. if (endIndex > -1) {
  4920. let user = userStr.substring(0, endIndex);
  4921. if (!users.find((i) => i === user)) {
  4922. users.push(user);
  4923. }
  4924. }
  4925. };
  4926. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  4927. let has = str.matchAll(userReg);
  4928. let res2 = [...has];
  4929. if (res2.length > 1) {
  4930. res2.map((item) => {
  4931. getUsername(item[1]);
  4932. });
  4933. }
  4934. if (res2.length === 1) {
  4935. getUsername(res2[0][1]);
  4936. }
  4937. let floor = -1;
  4938. if (users.length === 1) {
  4939. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  4940. let hasFloor = str.matchAll(floorReg);
  4941. let res = [...hasFloor];
  4942. if (res.length) {
  4943. floor = Number(res[0][1]);
  4944. }
  4945. }
  4946. return { users, floor };
  4947. },
  4948. //获取帖子详情
  4949. async getPostDetail(post, body, htmlText, pageNo = 1) {
  4950. post = await this.parsePostContent(post, body, htmlText);
  4951. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  4952. },
  4953. //获取所有回复
  4954. getAllReply(repliesMap = []) {
  4955. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  4956. pre = pre.concat(i.replyList);
  4957. return pre;
  4958. }, []);
  4959. },
  4960. //生成嵌套回复
  4961. createNestedList(allList = []) {
  4962. if (!allList.length)
  4963. return [];
  4964. if (Date.now() - window.win().lastCallDate < 1e3) {
  4965. return false;
  4966. }
  4967. let list = window.clone(allList);
  4968. let nestedList = [];
  4969. list.map((item, index2) => {
  4970. let startList = list.slice(0, index2);
  4971. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  4972. let endList = list.slice(index2 + 1);
  4973. if (index2 === 0) {
  4974. nestedList.push(this.findChildren(item, endList, list));
  4975. } else {
  4976. if (!item.isUse) {
  4977. let isOneLevelReply = false;
  4978. if (item.replyUsers.length) {
  4979. if (item.replyUsers.length > 1) {
  4980. isOneLevelReply = true;
  4981. } else {
  4982. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  4983. }
  4984. } else {
  4985. isOneLevelReply = true;
  4986. }
  4987. if (isOneLevelReply) {
  4988. item.level = 0;
  4989. nestedList.push(this.findChildren(item, endList, list));
  4990. }
  4991. }
  4992. }
  4993. });
  4994. return nestedList;
  4995. },
  4996. //生成嵌套冗余回复
  4997. createNestedRedundantList(allList = []) {
  4998. if (!allList.length)
  4999. return [];
  5000. if (Date.now() - window.win().lastCallDate < 1e3) {
  5001. return false;
  5002. }
  5003. let list = window.clone(allList);
  5004. let nestedList = [];
  5005. list.map((item, index2) => {
  5006. let startList = list.slice(0, index2);
  5007. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  5008. let endList = list.slice(index2 + 1);
  5009. if (index2 === 0) {
  5010. nestedList.push(this.findChildren(item, endList, list));
  5011. } else {
  5012. if (!item.isUse) {
  5013. let isOneLevelReply = false;
  5014. if (item.replyUsers.length) {
  5015. if (item.replyUsers.length > 1) {
  5016. isOneLevelReply = true;
  5017. } else {
  5018. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  5019. }
  5020. } else {
  5021. isOneLevelReply = true;
  5022. }
  5023. if (isOneLevelReply) {
  5024. item.level = 0;
  5025. nestedList.push(this.findChildren(item, endList, list));
  5026. }
  5027. } else {
  5028. let newItem = window.clone(item);
  5029. newItem.children = [];
  5030. newItem.level = 0;
  5031. newItem.isDup = true;
  5032. nestedList.push(newItem);
  5033. }
  5034. }
  5035. });
  5036. window.win().lastCallDate = Date.now();
  5037. return nestedList;
  5038. },
  5039. //查找子回复
  5040. findChildren(item, endList, all) {
  5041. var _a;
  5042. const fn = (child, endList2, parent) => {
  5043. child.level = parent.level + 1;
  5044. let rIndex = all.findIndex((v) => v.floor === child.floor);
  5045. if (rIndex > -1) {
  5046. all[rIndex].isUse = true;
  5047. }
  5048. parent.children.push(this.findChildren(child, endList2, all));
  5049. };
  5050. item.children = [];
  5051. let floorReplyList = [];
  5052. for (let i = 0; i < endList.length; i++) {
  5053. let currentItem = endList[i];
  5054. if (currentItem.isUse)
  5055. continue;
  5056. if (currentItem.replyFloor === item.floor) {
  5057. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  5058. currentItem.isUse = true;
  5059. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  5060. } else {
  5061. currentItem.isWrong = true;
  5062. }
  5063. }
  5064. }
  5065. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  5066. fn(currentItem, endList2, item);
  5067. });
  5068. let nextMeIndex = endList.findIndex((v) => {
  5069. var _a2;
  5070. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  5071. });
  5072. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  5073. for (let i = 0; i < findList.length; i++) {
  5074. let currentItem = findList[i];
  5075. if (currentItem.isUse)
  5076. continue;
  5077. if (currentItem.replyUsers.length === 1) {
  5078. if (currentItem.replyFloor !== -1) {
  5079. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  5080. continue;
  5081. }
  5082. }
  5083. let endList2 = endList.slice(i + 1);
  5084. if (currentItem.username === item.username) {
  5085. if (currentItem.replyUsers[0] === item.username) {
  5086. fn(currentItem, endList2, item);
  5087. }
  5088. break;
  5089. } else {
  5090. if (currentItem.replyUsers[0] === item.username) {
  5091. fn(currentItem, endList2, item);
  5092. }
  5093. }
  5094. } else {
  5095. if (currentItem.username === item.username)
  5096. break;
  5097. }
  5098. }
  5099. item.children = item.children.sort((a, b) => a.floor - b.floor);
  5100. return item;
  5101. },
  5102. //解析页面帖子列表
  5103. parsePagePostList(list, box) {
  5104. list.forEach((itemDom) => {
  5105. let item = window.clone(window.initPost);
  5106. let item_title = itemDom.querySelector(".item_title a");
  5107. let { href, id } = window.parse.parseA(item_title);
  5108. item.id = id;
  5109. item.href = href;
  5110. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  5111. itemDom.classList.add("post-item");
  5112. itemDom.classList.add(`id_${id}`);
  5113. itemDom.dataset["href"] = href;
  5114. itemDom.dataset["id"] = id;
  5115. window.postList.push(item);
  5116. });
  5117. Promise.allSettled(window.postList.map((item) => $.get(item.url))).then((res) => {
  5118. let ok = res.filter((r2) => r2.status === "fulfilled").map((v) => v.value[0]);
  5119. box.style.boxShadow = "unset";
  5120. box.style.background = "unset";
  5121. if (window.config.viewType === "card") {
  5122. list.forEach((itemDom) => itemDom.classList.add("preview"));
  5123. }
  5124. ok.map((postItem) => {
  5125. var _a;
  5126. if (postItem == null ? void 0 : postItem.id) {
  5127. let itemDom = box.querySelector(`.id_${postItem.id}`);
  5128. if (window.config.showPreviewBtn) {
  5129. let td = itemDom.querySelector("td:nth-child(4)");
  5130. td.style.position = "relative";
  5131. let toggle = document.createElement("div");
  5132. toggle.dataset["id"] = postItem.id;
  5133. toggle.classList.add("toggle");
  5134. toggle.innerText = "点击展开/收起";
  5135. td.append(toggle);
  5136. }
  5137. let index2 = window.postList.findIndex((v) => v.id == postItem.id);
  5138. if (index2 > -1) {
  5139. let obj = window.postList[index2];
  5140. window.postList[index2] = Object.assign({}, obj, postItem);
  5141. if (postItem.content_rendered) {
  5142. let a = document.createElement("a");
  5143. a.href = obj.href;
  5144. a.classList.add("post-content");
  5145. let div = document.createElement("div");
  5146. div.innerHTML = postItem.content_rendered;
  5147. a.append(div);
  5148. itemDom.append(a);
  5149. if (div.clientHeight < 172) {
  5150. a.classList.add("show-all");
  5151. } else {
  5152. let showMore = document.createElement("div");
  5153. showMore.classList.add("show-more");
  5154. showMore.innerHTML = "显示更多/收起";
  5155. showMore.onclick = function(e2) {
  5156. e2.stopPropagation();
  5157. a.classList.toggle("show-all");
  5158. };
  5159. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  5160. }
  5161. }
  5162. }
  5163. }
  5164. });
  5165. cbChecker({ type: "syncData" });
  5166. });
  5167. },
  5168. //解析A标签
  5169. parseA(a) {
  5170. let href = a.href;
  5171. let id;
  5172. if (href.includes("/t/")) {
  5173. id = a.pathname.substring("/t/".length);
  5174. }
  5175. return { href, id, title: a.innerText };
  5176. },
  5177. //创建记事本子条目
  5178. async createNoteItem(itemName) {
  5179. return new Promise(async (resolve) => {
  5180. let data = new FormData();
  5181. data.append("content", itemName);
  5182. data.append("parent_id", 0);
  5183. data.append("syntax", 0);
  5184. let apiRes = await window.win().fetch(`${window.baseUrl}/notes/new`, { method: "post", body: data });
  5185. console.log(apiRes);
  5186. if (apiRes.redirected && apiRes.status === 200) {
  5187. resolve(apiRes.url.substr(-5));
  5188. return;
  5189. }
  5190. resolve(null);
  5191. });
  5192. },
  5193. //编辑记事本子条目
  5194. async editNoteItem(val, id) {
  5195. let data = new FormData();
  5196. data.append("content", val);
  5197. data.append("syntax", 0);
  5198. let apiRes = await window.fetch(`${window.baseUrl}/notes/edit/${id}`, {
  5199. method: "post",
  5200. body: data
  5201. });
  5202. return apiRes.redirected && apiRes.status === 200;
  5203. },
  5204. //标签操作
  5205. async saveTags(val) {
  5206. for (const [key, value] of Object.entries(val)) {
  5207. if (!value.length)
  5208. delete val[key];
  5209. }
  5210. return await this.editNoteItem(window.user.tagPrefix + JSON.stringify(val), window.user.tagsId);
  5211. },
  5212. //已读楼层操作
  5213. async saveReadList(val) {
  5214. return await this.editNoteItem(window.user.readPrefix + JSON.stringify(val), window.user.readNoteItemId);
  5215. },
  5216. //imgur图片删除hash操作
  5217. async saveImgurList(val) {
  5218. return await this.editNoteItem(window.user.imgurPrefix + JSON.stringify(val), window.user.imgurNoteId);
  5219. },
  5220. //图片链接转Img标签
  5221. checkPhotoLink2Img(str) {
  5222. if (!str)
  5223. return;
  5224. try {
  5225. let imgWebs = [
  5226. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  5227. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  5228. ];
  5229. imgWebs.map((v, i) => {
  5230. let has = str.matchAll(v);
  5231. let res2 = [...has];
  5232. res2.map((r2) => {
  5233. let p = i === 0 ? r2[4] : r2[5];
  5234. if (p) {
  5235. let link = p.toLowerCase();
  5236. let src = p;
  5237. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  5238. } else {
  5239. src = p + ".png";
  5240. }
  5241. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  5242. }
  5243. });
  5244. });
  5245. } catch (e2) {
  5246. console.log("正则解析html里面的a标签的图片链接出错了");
  5247. }
  5248. return str;
  5249. },
  5250. //检测帖子回复长度
  5251. async checkPostReplies(id, needOpen = true) {
  5252. return new Promise(async (resolve) => {
  5253. var _a;
  5254. let showJsonUrl = `${location.origin}/api/topics/show.json?id=${id}`;
  5255. let r2 = await fetch(showJsonUrl);
  5256. if (r2) {
  5257. let res = await r2.json();
  5258. if (res) {
  5259. if (((_a = res[0]) == null ? void 0 : _a.replies) > MAX_REPLY_LIMIT) {
  5260. if (needOpen) {
  5261. window.parse.openNewTab(`https://www.v2ex.com/t/${id}?p=1&script=1`);
  5262. }
  5263. return resolve(true);
  5264. }
  5265. }
  5266. }
  5267. resolve(false);
  5268. });
  5269. },
  5270. //打开新标签页
  5271. openNewTab(href) {
  5272. _GM_openInTab(href, { active: true });
  5273. }
  5274. };
  5275. window.functions = {
  5276. feedback() {
  5277. window.parse.openNewTab(window.const.issue);
  5278. }
  5279. };
  5280. async function sleep(time) {
  5281. return new Promise((resolve) => {
  5282. setTimeout(resolve, time);
  5283. });
  5284. }
  5285. async function cbChecker(val, count = 0) {
  5286. if (window.cb) {
  5287. window.cb(val);
  5288. } else {
  5289. while (!window.cb && count < 30) {
  5290. await sleep(500);
  5291. count++;
  5292. }
  5293. window.cb && window.cb(val);
  5294. }
  5295. }
  5296. function initMonkeyMenu() {
  5297. try {
  5298. _GM_registerMenuCommand("脚本设置", () => {
  5299. cbChecker({ type: "openSetting" });
  5300. });
  5301. _GM_registerMenuCommand("仓库地址", () => {
  5302. window.parse.openNewTab(window.const.git);
  5303. });
  5304. _GM_registerMenuCommand("反馈 & 建议", window.functions.feedback);
  5305. } catch (e2) {
  5306. console.error("无法使用Tampermonkey");
  5307. }
  5308. }
  5309. function initStyle() {
  5310. let style2 = `
  5311. html, body {
  5312. font-size: 62.5%;
  5313. }
  5314.  
  5315. :root{
  5316. --box-border-radius:8px;
  5317. }
  5318. .box{
  5319. box-shadow:rgba(0, 0, 0, 0.08) 0px 4px 12px;
  5320. }
  5321. #Tabs{
  5322. border-top-left-radius: var(--box-border-radius) !important;
  5323. border-top-right-radius: var(--box-border-radius) !important;
  5324. }
  5325. #Main .cell .count_livid {
  5326. font-size: 14px;
  5327. font-weight: 500;
  5328. padding: 3px 10px;
  5329. border-radius: 5px;
  5330. }
  5331.  
  5332. #Wrapper {
  5333. height: unset !important;
  5334. width: unset !important;
  5335. }
  5336.  
  5337. #Wrapper > .content {
  5338. height: unset !important;
  5339. width: unset !important;
  5340. max-width:1100px !important;
  5341. }
  5342.  
  5343. .post-item {
  5344. background: white;
  5345. }
  5346.  
  5347. .post-item > .post-content {
  5348. height: 0;
  5349. margin-top: 0;
  5350. }
  5351.  
  5352. .post-item:hover .toggle {
  5353. display: flex;
  5354. }
  5355.  
  5356. .toggle {
  5357. position: absolute;
  5358. right: ${window.config.viewType === "simple" ? "5rem" : 0};
  5359. top: 0.5rem;
  5360. width: 9rem;
  5361. height: 100%;
  5362. display: flex;
  5363. justify-content: flex-end;
  5364. align-items: flex-end;
  5365. cursor: pointer;
  5366. font-size: 1.2rem;
  5367. color: #ccc;
  5368. display: none;
  5369. }
  5370.  
  5371. .preview {
  5372. margin: 1rem 0;
  5373. border: 1px solid transparent;
  5374. border-radius: var(--box-border-radius);
  5375. cursor: pointer;
  5376. }
  5377.  
  5378. .preview:hover {
  5379. border: 1px solid #c8c8c8;
  5380. }
  5381.  
  5382. .preview > .post-content {
  5383. height: unset !important;
  5384. margin-top: 0.5rem !important;
  5385. }
  5386.  
  5387. .preview > .post-content.show-all {
  5388. max-height: unset;
  5389. -webkit-mask-image:none;
  5390. }
  5391.  
  5392. .preview .topic-link:link {
  5393. color: black !important;
  5394. }
  5395.  
  5396. .post-content {
  5397. margin-top: 0.5rem;
  5398. display: block;
  5399. max-height: 20rem;
  5400. overflow: hidden;
  5401. text-decoration: unset !important;
  5402. line-break: anywhere;
  5403. -webkit-mask-image: linear-gradient(180deg,#000 60%,transparent);
  5404. }
  5405.  
  5406. .show-more {
  5407. display: none;
  5408. }
  5409.  
  5410. .preview > .show-more {
  5411. font-size: 1.3rem;
  5412. text-align: right;
  5413. height: 3rem;
  5414. display: flex;
  5415. align-items: center;
  5416. justify-content: center;
  5417. position: relative;
  5418. z-index: 9;
  5419. }
  5420.  
  5421. .post-content:visited {
  5422. color: #afb9c1 !important;
  5423. }
  5424.  
  5425. .post-content:link {
  5426. color: #494949;
  5427. }
  5428.  
  5429.  
  5430. .Night .post-item {
  5431. background: #18222d !important;
  5432. }
  5433.  
  5434. .Night .preview {
  5435. border: 1px solid #3b536e;
  5436. }
  5437.  
  5438. .Night .preview > .post-content:link {
  5439. color: #d1d5d9;
  5440. }
  5441.  
  5442. .Night .preview > .post-content:visited {
  5443. color: #393f4e !important;
  5444. }
  5445. .Night .preview .topic-link:link {
  5446. color: #c0dbff !important;
  5447. }
  5448. ${window.config.viewType === "simple" ? `
  5449. ${window.pageType !== PageType.Member ? `
  5450. .item table tr td:first-child{display:none;}
  5451. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  5452. .item table tr td .sep5{display:none;}
  5453. .item table tr td .topic_info{display:none;}
  5454. .item {border-bottom:none;}
  5455. .avatar,#avatar{display:none;}
  5456. ` : ""}
  5457. #Logo {background-image:url('https://i.imgur.com/i9VgUtM.png');}
  5458. .bigger a, .top:nth-last-child(5){color: transparent!important;text-shadow: #b0b0b0 0 0 6px;user-select: none;}
  5459. // .bigger a:before,.top:nth-last-child(5):before{content:'Mona Lisa';position: absolute;background: white;}
  5460. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  5461. ` : ""}
  5462.  
  5463. ${window.config.customBgColor ? `#Wrapper {
  5464. background-color: ${window.config.customBgColor} !important;
  5465. background-image: unset !important;
  5466. }` : ""}
  5467. .top{
  5468. position:relative;
  5469. }
  5470. .new:before{
  5471. content:'new';
  5472. position: absolute;
  5473. background: red;
  5474. font-size: 10px;
  5475. border-radius: 4px;
  5476. padding: 0px 2px;
  5477. color: white;
  5478. right: -9px;
  5479. top: -3px;
  5480. }
  5481. }
  5482.  
  5483. `;
  5484. let addStyle2 = document.createElement("style");
  5485. addStyle2.rel = "stylesheet";
  5486. addStyle2.type = "text/css";
  5487. addStyle2.innerHTML = style2;
  5488. window.document.head.append(addStyle2);
  5489. }
  5490. function qianDao() {
  5491. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  5492. if (window.pageType === PageType.Home) {
  5493. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  5494. if (qiandao) {
  5495. qianDao_(qiandao, timeNow);
  5496. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  5497. window.win().doc.getElementById("gift_v2excellent").click();
  5498. localStorage.setItem("menu_clockInTime", timeNow);
  5499. console.info("[V2EX - 超级增强] 自动签到完成!");
  5500. } else {
  5501. console.info("[V2EX - 超级增强] 自动签到完成!");
  5502. }
  5503. } else {
  5504. let timeOld = localStorage.getItem("menu_clockInTime");
  5505. if (!timeOld || timeOld != timeNow) {
  5506. qianDaoStatus_(timeNow);
  5507. } else {
  5508. console.info("[V2EX - 超级增强] 自动签到完成!");
  5509. }
  5510. }
  5511. }
  5512. function qianDao_(qiandao, timeNow) {
  5513. let url = window.baseUrl + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  5514. console.log("url", url);
  5515. $.get(url).then((r2) => {
  5516. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  5517. let html = $(bodyText[0]);
  5518. if (html.find("li.fa.fa-ok-sign").length) {
  5519. html = html.find("#Main").text().match(/已连续登录(不可用) (\d+?) 天/)[0];
  5520. localStorage.setItem("menu_clockInTime", timeNow);
  5521. console.info("[V2EX - 超级增强] 自动签到完成!");
  5522. if (qiandao) {
  5523. qiandao.textContent = `自动签到完成!${html}`;
  5524. qiandao.href = "javascript:void(0);";
  5525. }
  5526. } else {
  5527. _GM_notification({
  5528. text: "自动签到失败!请关闭其他插件或脚本。\n如果连续几天都签到失败,请联系作者解决!",
  5529. timeout: 4e3,
  5530. onclick() {
  5531. window.functions.feedback();
  5532. }
  5533. });
  5534. console.warn("[V2EX 增强] 自动签到失败!请关闭其他插件或脚本。如果连续几天都签到失败,请联系作者解决!");
  5535. if (qiandao)
  5536. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  5537. }
  5538. });
  5539. }
  5540. function qianDaoStatus_(timeNow) {
  5541. $.get(window.baseUrl + "/mission/daily").then((r2) => {
  5542. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  5543. let html = $(bodyText[0]);
  5544. if (html.find('input[value^="领取"]').length) {
  5545. qianDao_(null, timeNow);
  5546. } else {
  5547. console.info("[V2EX 增强] 已经签过到了。");
  5548. localStorage.setItem("menu_clockInTime", timeNow);
  5549. }
  5550. });
  5551. }
  5552. function checkPageType() {
  5553. let l = window.location;
  5554. if (l.pathname === "/") {
  5555. window.pageType = PageType.Home;
  5556. } else if (l.href.match(/.com\/?tab=/)) {
  5557. window.pageType = PageType.Home;
  5558. } else if (l.href.match(/.com\/go\//)) {
  5559. if (!l.href.includes("/links")) {
  5560. window.pageType = PageType.Node;
  5561. }
  5562. } else if (l.href.match(/.com\/recent/)) {
  5563. window.pageType = PageType.Home;
  5564. } else if (l.href.match(/.com\/member/)) {
  5565. window.pageType = PageType.Member;
  5566. } else {
  5567. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  5568. if (r2) {
  5569. window.pageType = PageType.Post;
  5570. window.pageData.id = r2[1];
  5571. if (l.search) {
  5572. let pr = l.href.match(/\?p=([\d]+)/);
  5573. if (pr)
  5574. window.pageData.pageNo = Number(pr[1]);
  5575. }
  5576. }
  5577. }
  5578. }
  5579. function getNoteItemContent(id, prefix) {
  5580. return new Promise((resolve, reject) => {
  5581. $.get(window.baseUrl + "/notes/edit/" + id).then((r2) => {
  5582. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  5583. let body = $(bodyText[0]);
  5584. let text = body.find(".note_editor").text();
  5585. if (text === prefix) {
  5586. resolve({});
  5587. } else {
  5588. let tagJson = text.substring(prefix.length);
  5589. try {
  5590. resolve(JSON.parse(tagJson));
  5591. } catch (e2) {
  5592. console.log("tage", tagJson);
  5593. resolve({});
  5594. }
  5595. }
  5596. });
  5597. });
  5598. }
  5599. async function initNoteData() {
  5600. $.get(window.baseUrl + "/notes").then(async (r2) => {
  5601. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  5602. let body = $(bodyText[0]);
  5603. let items = body.find("#Main .box .note_item_title a");
  5604. let tagItem = Array.from(items).find((v) => v.innerText.includes(window.user.tagPrefix));
  5605. if (tagItem) {
  5606. window.user.tagsId = tagItem.href.substr(-5);
  5607. window.user.tags = await getNoteItemContent(window.user.tagsId, window.user.tagPrefix);
  5608. } else {
  5609. let r22 = await window.parse.createNoteItem(window.user.tagPrefix);
  5610. r22 && (window.user.tagsId = r22);
  5611. }
  5612. let readItem = Array.from(items).find((v) => v.innerText.includes(window.user.readPrefix));
  5613. if (readItem) {
  5614. window.user.readNoteItemId = readItem.href.substr(-5);
  5615. window.user.readList = await getNoteItemContent(window.user.readNoteItemId, window.user.readPrefix);
  5616. } else {
  5617. let r22 = await window.parse.createNoteItem(window.user.readPrefix);
  5618. r22 && (window.user.readNoteItemId = r22);
  5619. }
  5620. let imgurItem = Array.from(items).find((v) => v.innerText.includes(window.user.imgurPrefix));
  5621. if (imgurItem) {
  5622. window.user.imgurNoteId = imgurItem.href.substr(-5);
  5623. window.user.imgurList = await getNoteItemContent(window.user.imgurNoteId, window.user.imgurPrefix);
  5624. } else {
  5625. let r22 = await window.parse.createNoteItem(window.user.imgurPrefix);
  5626. r22 && (window.user.imgurNoteId = r22);
  5627. }
  5628. cbChecker({ type: "syncData" });
  5629. });
  5630. }
  5631. function initConfig() {
  5632. return new Promise((resolve) => {
  5633. let configStr = window.localStorage.getItem("v2ex-config");
  5634. if (configStr) {
  5635. let configObj = JSON.parse(configStr);
  5636. configObj = configObj[window.user.username ?? "default"];
  5637. if (configObj) {
  5638. window.config = Object.assign(window.config, configObj);
  5639. }
  5640. }
  5641. resolve(window.config);
  5642. });
  5643. }
  5644. function addSettingText() {
  5645. let setting = $(`<a href="javascript:void 0;" class="top ${window.config.version < window.currentVersion ? "new" : ""}">脚本设置</a>`);
  5646. setting.on("click", function() {
  5647. this.classList.remove("new");
  5648. cbChecker({ type: "openSetting" });
  5649. });
  5650. $(".tools").prepend(setting);
  5651. }
  5652. async function init() {
  5653. window.addEventListener("error", (e2) => {
  5654. let dom = e2.target;
  5655. let originImgUrl = dom.getAttribute("data-originurl");
  5656. if (originImgUrl) {
  5657. let a = document.createElement("a");
  5658. a.href = originImgUrl;
  5659. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  5660. a.innerText = originImgUrl;
  5661. dom.parentNode.replaceChild(a, dom);
  5662. }
  5663. }, true);
  5664. if (window.isNight) {
  5665. document.documentElement.classList.add("dark");
  5666. }
  5667. checkPageType();
  5668. initMonkeyMenu();
  5669. let top2 = document.querySelector(".tools .top:nth-child(2)");
  5670. if (top2 && top2.textContent !== "注册(不可用)") {
  5671. window.user.username = top2.textContent;
  5672. window.user.avatar = $("#Rightbar .box .avatar").attr("src");
  5673. initNoteData();
  5674. }
  5675. initConfig().then((r2) => {
  5676. addSettingText();
  5677. initStyle();
  5678. try {
  5679. if (window.config.autoSignin && window.user.username) {
  5680. qianDao();
  5681. }
  5682. } catch (e2) {
  5683. console.log("签到失败");
  5684. }
  5685. if (window.user.username)
  5686. ;
  5687. });
  5688. let box;
  5689. let list;
  5690. switch (window.pageType) {
  5691. case PageType.Node:
  5692. box = window.win().doc.querySelectorAll("#Wrapper #Main .box");
  5693. let topics = box[1].querySelector("#TopicsNode");
  5694. list = topics.querySelectorAll(".cell");
  5695. list[0].before($section);
  5696. window.parse.parsePagePostList(list, box[1]);
  5697. break;
  5698. case PageType.Home:
  5699. box = document.querySelector("#Wrapper #Main .box");
  5700. list = box.querySelectorAll(".item");
  5701. list[0].before($section);
  5702. window.parse.parsePagePostList(list, box);
  5703. break;
  5704. case PageType.Post:
  5705. box = document.querySelector("#Wrapper #Main .box");
  5706. box.after($section);
  5707. let r2 = await window.parse.checkPostReplies(window.pageData.id, false);
  5708. if (r2) {
  5709. window.stopMe = true;
  5710. alert("由于回复数量较多,脚本已停止解析楼中楼");
  5711. return cbChecker({ type: "syncData" });
  5712. }
  5713. if (window.config.postWidth) {
  5714. let Main = $("#Main");
  5715. Main.css({
  5716. "width": window.config.postWidth,
  5717. margin: "unset"
  5718. });
  5719. $("#Wrapper > .content").css({
  5720. "max-width": "unset",
  5721. display: "flex",
  5722. "justify-content": "center",
  5723. gap: "20px"
  5724. });
  5725. Main.after($("#Rightbar"));
  5726. }
  5727. let post = Object.assign({}, window.clone(window.initPost), { id: window.pageData.id });
  5728. let body = $(window.win().doc.body);
  5729. let htmlText = window.win().doc.documentElement.outerHTML;
  5730. window.parse.parsePostContent(
  5731. post,
  5732. body,
  5733. htmlText
  5734. ).then(async (res) => {
  5735. await cbChecker({ type: "postContent", value: res }, 0);
  5736. let opRes = await window.parse.parseOp(res);
  5737. await cbChecker({ type: "postOp", value: opRes }, 0);
  5738. });
  5739. window.parse.getPostAllReplies(
  5740. post,
  5741. body,
  5742. htmlText,
  5743. window.pageData.pageNo
  5744. ).then(async (res) => {
  5745. await cbChecker({ type: "postReplies", value: res }, 0);
  5746. });
  5747. break;
  5748. case PageType.Member:
  5749. box = document.querySelector("#Wrapper #Main .box");
  5750. if (box) {
  5751. window.targetUserName = box.querySelector("h1").textContent;
  5752. box.after($section);
  5753. if (window.config.openTag) {
  5754. box.style.borderBottom = "none";
  5755. box.style["border-bottom-left-radius"] = "0";
  5756. box.style["border-bottom-right-radius"] = "0";
  5757. }
  5758. }
  5759. break;
  5760. default:
  5761. window.stopMe = true;
  5762. cbChecker({ type: "syncData" });
  5763. console.error("未知页面");
  5764. break;
  5765. }
  5766. }
  5767. window.canParseV2exPage = !window.location.search.includes("script");
  5768. if (window.canParseV2exPage) {
  5769. init();
  5770. } else {
  5771. window.stopMe = true;
  5772. cbChecker({ type: "syncData" });
  5773. if (window.location.search.includes("script=0")) {
  5774. alert("脚本无法查看此主题,已为您单独打开此主题");
  5775. }
  5776. if (window.location.search.includes("script=1")) {
  5777. alert("由于回复数量较多,已为您单独打开此主题并停止解析楼中楼");
  5778. }
  5779. }
  5780. }
  5781. run();
  5782. let vueApp = vue.createApp(App);
  5783. vueApp.config.unwrapInjectedRef = true;
  5784. vueApp.mount($section);
  5785.  
  5786. })(Vue);

QingJ © 2025

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