V2EX - 超级增强

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

目前為 2023-08-15 提交的版本,檢視 最新版本

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