V2EX - 超级增强

V2EX最现代、最好用、功能最完整的脚本。本脚本日活1300,V2EX Polish日活320,V2EX 增强日活1500,统计于2023/9/6日,数据来源:打开脚本详情,点上面的“统计数据”查看

当前为 2023-09-06 提交的版本,查看 最新版本

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