V2EX - 超级增强

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

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

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

QingJ © 2025

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