V2EX - 超级增强

楼中楼回复(支持感谢数排序)、自动签到、快捷回复图片和表情、列表预览内容、点击帖子弹框展示详情、对用户打标签、回复上下文、记录上次阅读位置、自定义背景、使用 SOV2EX 搜索、正文超长自动折叠、划词 base64 解码、一键@所有人,@管理员、操作按钮(感谢、收藏、回复、隐藏)异步请求、支持黑暗模式

当前为 2023-07-11 提交的版本,查看 最新版本

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