V2Next-Mobile

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

目前为 2024-01-21 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name V2Next-Mobile
  3. // @namespace http://tampermonkey.net/
  4. // @version 8.0.2
  5. // @author zyronon
  6. // @description 楼中楼、简洁模式、高赞回复排序、查看回复上下文、发送图片和表情、UI美化、base64 解码等功能
  7. // @license GPL License
  8. // @icon https://v2next.netlify.app/favicon.ico
  9. // @homepage https://github.com/zyronon/web-scripts
  10. // @homepageURL https://github.com/zyronon/web-scripts
  11. // @supportURL https://update.greasyfork.org/scripts/485356/V2Next-Mobile.user.js
  12. // @match https://v2ex.com/
  13. // @match https://v2ex.com/?tab=*
  14. // @match https://v2ex.com/t/*
  15. // @match https://v2ex.com/recent*
  16. // @match https://v2ex.com/go/*
  17. // @match https://v2ex.com/member/*
  18. // @match https://v2ex.com/changes*
  19. // @match https://*.v2ex.com/
  20. // @match https://*.v2ex.com/?tab=*
  21. // @match https://*.v2ex.com/t/*
  22. // @match https://*.v2ex.com/recent*
  23. // @match https://*.v2ex.com/go/*
  24. // @match https://*.v2ex.com/member/*
  25. // @match https://*.v2ex.com/changes*
  26. // @require http://code.jquery.com/jquery-3.7.1.min.js
  27. // @require https://cdn.jsdelivr.net/npm/vue@3.4.14/dist/vue.global.prod.js
  28. // @grant GM_addStyle
  29. // @grant GM_notification
  30. // @grant GM_openInTab
  31. // @grant GM_registerMenuCommand
  32. // ==/UserScript==
  33.  
  34. (e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const o=document.createElement("style");o.textContent=e,document.head.append(o)})(' .v-enter-active,.v-leave-active{transition:opacity .3s ease}.v-enter-from,.v-leave-to{opacity:0}.fade-in{animation:fade-in .3s}.fade-out{animation:fade-out .4s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0;display:none}}.username{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num{font-size:1.4rem;color:var(--color-font-8);color:#e02a2a}.owner{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 .remove{margin-left:.5rem;display:none}.add-tag{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar{margin-right:1rem;display:inline-flex}.base-avatar img{width:2.8rem;height:2.8rem;border-radius:.4rem}html{font-size:10px}:root{--box-border-radius: 8px}#site-header{height:4rem}#site-header #site-header-menu #menu-body{top:5rem;right:1rem}#Wrapper .cell .count_livid{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item{background:var(--box-background-color)}.post-item .new-item{display:flex;justify-content:space-between}.post-item .new-item .left .top{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small,.post-item .new-item .left a.node{font-size:1.2rem}.post-item .new-item .left .bottom{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title{font-size:1.6rem}.post-item .new-item .left .bottom a{text-decoration:none!important}.post-item .new-item .right{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote{margin-top:.5rem}.post-item .post-content p:first-child{margin-top:0}.post-item .post-content:visited{color:var(--link-visited-color)}.post-item .show-more{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link:link{color:#000!important}.preview .show-all{max-height:unset;-webkit-mask-image:none}.preview .post-content{height:unset!important}.preview .show-more{display:flex}.preview .item_title{font-weight:700}.Night .post-item{background:#18222d!important}.Night .preview{border:1px solid #3b536e}.Night .preview>.post-content:link{color:#d1d5d9}.Night .preview>.post-content:visited{color:#393f4e!important}.Night .preview .topic-link:link{color:#c0dbff!important}:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-line2: #cecece;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--space: 1rem}html.dark{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}.flex{display:flex;align-items:center;justify-content:space-between}.flex-end{justify-content:flex-end}.flex-center{justify-content:center}.p1{padding:1rem}.p2{padding:2rem}.p0{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a{text-decoration:none}.tool{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg{width:2.2rem!important;height:2.2rem!important}.tool.disabled{cursor:not-allowed}.tool span{line-height:1rem}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content{padding:.5rem}.my-cell{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option{display:flex;align-items:center;padding:.6rem 0}.modal .option>span{position:relative}.radio-group2{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio{background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio:first-child{border-left:none}.radio-group2 .active{background:var(--color-active);color:#fff}.pop-confirm{position:relative;display:inline-flex;justify-content:center}input{width:10rem;height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input:focus{border:1px solid var(--color-active)}.danger{color:red!important}.topic_content,.reply_content{font-size:1.6rem}.mask{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark{background:#000000bb}.mask.light{background:transparent}.mask.lightgray{background:rgba(0,0,0,.25)}.mask.white{background:transparent}.slide{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1{overflow:hidden!important}.page1 .post-wrapper,.page1 .setting-wrapper{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper2{background:var(--color-main-bg)}.mobile-page{font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.tip[data-v-ee672411]{position:fixed;font-size:1.6rem;z-index:9999;max-width:10rem;border-radius:.5rem;padding:1rem;color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.v-enter-active[data-v-e7c0fbef],.v-leave-active[data-v-e7c0fbef]{transition:opacity .3s ease}.v-enter-from[data-v-e7c0fbef],.v-leave-to[data-v-e7c0fbef]{opacity:0}.fade-in[data-v-e7c0fbef]{animation:fade-in-e7c0fbef .3s}.fade-out[data-v-e7c0fbef]{animation:fade-out-e7c0fbef .4s}@keyframes fade-in-e7c0fbef{0%{opacity:0}to{opacity:1}}@keyframes fade-out-e7c0fbef{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-e7c0fbef]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-e7c0fbef]{font-size:1.4rem;color:var(--color-font-8);color:#e02a2a}.owner[data-v-e7c0fbef]{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-e7c0fbef]{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-e7c0fbef]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag .remove[data-v-e7c0fbef]{margin-left:.5rem;display:none}.add-tag[data-v-e7c0fbef]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor[data-v-e7c0fbef]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-e7c0fbef]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-e7c0fbef]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-e7c0fbef]{font-size:10px}[data-v-e7c0fbef]:root{--box-border-radius: 8px}#site-header[data-v-e7c0fbef]{height:4rem}#site-header #site-header-menu #menu-body[data-v-e7c0fbef]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-e7c0fbef]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-e7c0fbef]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-e7c0fbef]{background:var(--box-background-color)}.post-item .new-item[data-v-e7c0fbef]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-e7c0fbef]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-e7c0fbef],.post-item .new-item .left a.node[data-v-e7c0fbef]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-e7c0fbef]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-e7c0fbef]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-e7c0fbef]{text-decoration:none!important}.post-item .new-item .right[data-v-e7c0fbef]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-e7c0fbef]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-e7c0fbef]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-e7c0fbef]{margin-top:.5rem}.post-item .post-content p[data-v-e7c0fbef]:first-child{margin-top:0}.post-item .post-content[data-v-e7c0fbef]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-e7c0fbef]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-e7c0fbef]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-e7c0fbef]:link{color:#000!important}.preview .show-all[data-v-e7c0fbef]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-e7c0fbef]{height:unset!important}.preview .show-more[data-v-e7c0fbef]{display:flex}.preview .item_title[data-v-e7c0fbef]{font-weight:700}.Night .post-item[data-v-e7c0fbef]{background:#18222d!important}.Night .preview[data-v-e7c0fbef]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-e7c0fbef]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-e7c0fbef]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-e7c0fbef]:link{color:#c0dbff!important}[data-v-e7c0fbef]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-line2: #cecece;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--space: 1rem}html.dark[data-v-e7c0fbef]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}.flex[data-v-e7c0fbef]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-e7c0fbef]{justify-content:flex-end}.flex-center[data-v-e7c0fbef]{justify-content:center}.p1[data-v-e7c0fbef]{padding:1rem}.p2[data-v-e7c0fbef]{padding:2rem}.p0[data-v-e7c0fbef]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-e7c0fbef]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-e7c0fbef]{text-decoration:none}.tool[data-v-e7c0fbef]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-e7c0fbef]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-e7c0fbef]{cursor:not-allowed}.tool span[data-v-e7c0fbef]{line-height:1rem}.my-node[data-v-e7c0fbef]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs[data-v-e7c0fbef]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-e7c0fbef]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-e7c0fbef]{padding:.5rem}.my-cell[data-v-e7c0fbef]{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-e7c0fbef]{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-e7c0fbef]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-e7c0fbef]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-e7c0fbef]{position:relative}.radio-group2[data-v-e7c0fbef]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-e7c0fbef]{background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-e7c0fbef]:first-child{border-left:none}.radio-group2 .active[data-v-e7c0fbef]{background:var(--color-active);color:#fff}.pop-confirm[data-v-e7c0fbef]{position:relative;display:inline-flex;justify-content:center}input[data-v-e7c0fbef]{width:10rem;height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-e7c0fbef]:focus{border:1px solid var(--color-active)}.danger[data-v-e7c0fbef]{color:red!important}.topic_content[data-v-e7c0fbef],.reply_content[data-v-e7c0fbef]{font-size:1.6rem}.mask[data-v-e7c0fbef]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-e7c0fbef]{background:#000000bb}.mask.light[data-v-e7c0fbef]{background:transparent}.mask.lightgray[data-v-e7c0fbef]{background:rgba(0,0,0,.25)}.mask.white[data-v-e7c0fbef]{background:transparent}.slide[data-v-e7c0fbef]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-e7c0fbef]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-e7c0fbef]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-e7c0fbef]{overflow:hidden!important}.page1 .post-wrapper[data-v-e7c0fbef],.page1 .setting-wrapper[data-v-e7c0fbef]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper2[data-v-e7c0fbef]{background:var(--color-main-bg)}.mobile-page[data-v-e7c0fbef]{font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-e7c0fbef]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.switch[data-v-e7c0fbef]{width:4.5rem;height:2.2rem;border-radius:2rem;position:relative;display:flex;align-items:center;background:var(--color-swtich-bg);transition:all .3s}.switch.active[data-v-e7c0fbef]{background:var(--color-active)}.switch.active[data-v-e7c0fbef]:before{right:.2rem}.switch[data-v-e7c0fbef]:before{position:absolute;content:" ";transition:all .3s;right:calc(100% - 2rem);width:1.8rem;height:1.8rem;background:white;border-radius:50%}.nav-bar[data-v-fda0acaa]{box-sizing:border-box;width:100%;height:5rem;padding:0 var(--space);display:flex;align-items:center;justify-content:center;position:relative;font-size:2rem;color:var(--color-font-pure)}.nav-bar[data-v-fda0acaa] .back-icon{left:var(--space);position:absolute}.display-type[data-v-1d327f48]{height:3rem;padding:0 .3rem;background:var(--color-main-bg);border-radius:1rem;display:flex;font-size:1.4rem;align-items:center;color:#a9a9a9}.display-type .type[data-v-1d327f48]{border-radius:.8rem;padding:0 1.3rem;height:2.5rem;align-items:center;display:flex;position:relative}.display-type .type.active[data-v-1d327f48]{background:var(--color-second-bg);color:var(--color-font-pure);box-shadow:0 0 6px 0 var(--color-tooltip-shadow)}.display-type .type-list[data-v-1d327f48]{position:absolute;background:white;right:0;top:3rem;font-size:1.4rem;box-shadow:0 0 6px 0 var(--color-tooltip-shadow);border-radius:.6rem;z-index:9;color:var(--color-font)}.display-type .type-list .item[data-v-1d327f48]{word-break:keep-all;padding:.8rem 1rem}.display-type .type-list .item.active[data-v-1d327f48]{color:var(--color-font-pure)}.display-type svg[data-v-1d327f48]{width:1.5rem}.font-size[data-v-a64ba8b8]{margin-bottom:3rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.font-size .steps[data-v-a64ba8b8]{width:100%;border-radius:10rpx;display:flex;justify-content:space-between;align-items:center;position:relative;z-index:2}.font-size .steps .step[data-v-a64ba8b8]{width:100%;font-size:20rpx;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:4.8rem;gap:1.5rem;color:gray}.font-size .steps .step .text[data-v-a64ba8b8]{font-size:1.4rem}.font-size .steps .step .point[data-v-a64ba8b8]{border-radius:50%;min-width:6px;min-height:6px;background:#adadad}.font-size .steps .step.active[data-v-a64ba8b8]{color:var(--color-font-pure)}.font-size .steps .step.active .point[data-v-a64ba8b8]{box-shadow:0 0 1px 1px #f1f1f1;background:white;transform:scale(3)}.font-size .line[data-v-a64ba8b8]{position:relative;z-index:1;margin-top:-4px;height:2px;width:76%;background:var(--color-font)}.row[data-v-402be427]{min-height:4rem;display:flex;justify-content:space-between;align-items:center}.row .wrapper[data-v-402be427]{height:3rem;flex:1;display:flex;justify-content:flex-end;align-items:center;gap:var(--space)}.row .wrapper span[data-v-402be427]{text-align:right;font-size:1.4rem;color:gray}.row .main-title[data-v-402be427]{font-size:2.2rem;font-weight:700;color:var(--color-font-8)}.row .item-title[data-v-402be427]{font-size:1.8rem;color:var(--color-font)}.desc[data-v-402be427]{margin-bottom:1rem;font-size:1.4rem;text-align:left;color:var(--color-font)}.tool>svg[data-v-b7c6664e]{width:1.8rem!important;height:1.8rem!important}.more[data-v-e92e0529]{height:1.6rem;width:2.08rem;padding:1rem .8rem 1rem 0;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.more div[data-v-e92e0529]{background:var(--color-floor-font);width:.3rem;height:.3rem;border-radius:50%}.Author[data-v-9041586a]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative}.Author.expand[data-v-9041586a]{margin-bottom:0}.Author .Author-left[data-v-9041586a]{display:flex;align-items:center;width:80%;word-break:break-all}.Author .Author-left .info[data-v-9041586a]{display:flex;flex-direction:column}.Author .Author-left .username[data-v-9041586a]{font-size:1.4rem;margin-right:1rem}.Author .Author-left .expand-icon[data-v-9041586a]{margin-right:.8rem;width:2.4rem;height:2.4rem;transform:rotate(90deg)}.Author .Author-left .texts[data-v-9041586a]{flex:1}.Author .Author-left .owner[data-v-9041586a]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.Author .Author-left .dup[data-v-9041586a]{display:inline-block;background-color:transparent;color:red;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid red;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.Author .Author-left .mod[data-v-9041586a]{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-right[data-v-9041586a]{position:absolute;right:0;display:flex;align-items:center}.loading[data-v-2697baa2]{border:2px solid;border-color:var(--color-loading-2) var(--color-loading-1) var(--color-loading-1) var(--color-loading-1);border-radius:100%;animation:circle-2697baa2 infinite 1s linear;width:2rem;height:2rem}.loading.small[data-v-2697baa2]{width:1.2rem;height:1.2rem}.loading.large[data-v-2697baa2]{width:3rem;height:3rem}@keyframes circle-2697baa2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.base-button[data-v-04f4c89d]{border-radius:.6rem;padding:0 1.5rem;display:inline-flex;align-items:center;justify-content:center;transition:all .3s;height:3.6rem;line-height:1;position:relative}.base-button .loading[data-v-04f4c89d]{position:absolute}.base-button.disabled[data-v-04f4c89d]{opacity:.6;cursor:not-allowed;-webkit-user-select:none;user-select:none}.base-button.small[data-v-04f4c89d]{height:3rem}.base-button.small>span[data-v-04f4c89d]{font-size:1.3rem}.base-button.large[data-v-04f4c89d]{height:5rem;font-size:1.8rem;padding:0 2.2rem}.base-button.large>span[data-v-04f4c89d]{font-size:1.8rem}.base-button.primary[data-v-04f4c89d]{background:var(--color-active)}.base-button.primary>span[data-v-04f4c89d]{color:#fff}.base-button.gary[data-v-04f4c89d]{background:#4b5563}.base-button.link[data-v-04f4c89d]{border-radius:0;border-bottom:2px solid transparent}.base-button.link>span[data-v-04f4c89d]{color:var(--color-font-8)}.base-button.active[data-v-04f4c89d]{opacity:.4}.key-notice[data-v-04f4c89d]{margin-left:1rem;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:#fff}.key-notice .key[data-v-04f4c89d]{transform:scale(.8)}.post-editor-wrapper[data-v-0612e02f]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s;color:var(--color-font)}.post-editor-wrapper.isFocus .post-editor[data-v-0612e02f]{border:1px solid var(--color-active)}.post-editor-wrapper .post-editor[data-v-0612e02f]{border:1px solid var(--color-line);border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.6rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure)}.post-editor-wrapper .toolbar[data-v-0612e02f]{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-0612e02f]{display:flex;gap:1rem}.post-editor-wrapper .toolbar .left .upload input[data-v-0612e02f]{position:absolute;width:20px;height:20px;opacity:0}.post-editor-wrapper .toolbar span[data-v-0612e02f]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-0612e02f]{border:1px solid var(--color-line);border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.6rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);position:absolute;top:0;z-index:-100}.post-editor-wrapper .emoticon-pack[data-v-0612e02f]{z-index:999999999;border-radius:1rem;padding:1rem;width:31rem;max-width:31rem;height:30rem;max-height:30rem;overflow:auto;background:var(--color-third-bg);border:1px solid var(--color-font-3);box-shadow:0 9px 24px -3px #0000000f,0 4px 8px -1px #0000001f;position:fixed;bottom:11rem;left:14rem}.post-editor-wrapper .emoticon-pack i[data-v-0612e02f]{position:absolute;right:2rem;font-size:2rem;color:#e2e2e2}.post-editor-wrapper .emoticon-pack .list[data-v-0612e02f]{margin:1rem 0}.post-editor-wrapper .emoticon-pack img[data-v-0612e02f]{width:3rem;height:3rem;padding:.5rem}.post-editor-wrapper .emoticon-pack span[data-v-0612e02f]{display:inline-block;font-size:2.3rem;padding:.5rem}.v-enter-active[data-v-f8165980],.v-leave-active[data-v-f8165980]{transition:opacity .3s ease}.v-enter-from[data-v-f8165980],.v-leave-to[data-v-f8165980]{opacity:0}.fade-in[data-v-f8165980]{animation:fade-in-f8165980 .3s}.fade-out[data-v-f8165980]{animation:fade-out-f8165980 .4s}@keyframes fade-in-f8165980{0%{opacity:0}to{opacity:1}}@keyframes fade-out-f8165980{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-f8165980]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-f8165980]{font-size:1.4rem;color:var(--color-font-8);color:#e02a2a}.owner[data-v-f8165980]{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-f8165980]{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-f8165980]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag .remove[data-v-f8165980]{margin-left:.5rem;display:none}.add-tag[data-v-f8165980]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor[data-v-f8165980]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-f8165980]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-f8165980]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-f8165980]{font-size:10px}[data-v-f8165980]:root{--box-border-radius: 8px}#site-header[data-v-f8165980]{height:4rem}#site-header #site-header-menu #menu-body[data-v-f8165980]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-f8165980]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-f8165980]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-f8165980]{background:var(--box-background-color)}.post-item .new-item[data-v-f8165980]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-f8165980]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-f8165980],.post-item .new-item .left a.node[data-v-f8165980]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-f8165980]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-f8165980]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-f8165980]{text-decoration:none!important}.post-item .new-item .right[data-v-f8165980]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-f8165980]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-f8165980]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-f8165980]{margin-top:.5rem}.post-item .post-content p[data-v-f8165980]:first-child{margin-top:0}.post-item .post-content[data-v-f8165980]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-f8165980]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-f8165980]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-f8165980]:link{color:#000!important}.preview .show-all[data-v-f8165980]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-f8165980]{height:unset!important}.preview .show-more[data-v-f8165980]{display:flex}.preview .item_title[data-v-f8165980]{font-weight:700}.Night .post-item[data-v-f8165980]{background:#18222d!important}.Night .preview[data-v-f8165980]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-f8165980]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-f8165980]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-f8165980]:link{color:#c0dbff!important}[data-v-f8165980]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-line2: #cecece;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--space: 1rem}html.dark[data-v-f8165980]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}.flex[data-v-f8165980]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-f8165980]{justify-content:flex-end}.flex-center[data-v-f8165980]{justify-content:center}.p1[data-v-f8165980]{padding:1rem}.p2[data-v-f8165980]{padding:2rem}.p0[data-v-f8165980]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-f8165980]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-f8165980]{text-decoration:none}.tool[data-v-f8165980]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-f8165980]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-f8165980]{cursor:not-allowed}.tool span[data-v-f8165980]{line-height:1rem}.my-node[data-v-f8165980]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs[data-v-f8165980]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-f8165980]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-f8165980]{padding:.5rem}.my-cell[data-v-f8165980]{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-f8165980]{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-f8165980]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-f8165980]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-f8165980]{position:relative}.radio-group2[data-v-f8165980]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-f8165980]{background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-f8165980]:first-child{border-left:none}.radio-group2 .active[data-v-f8165980]{background:var(--color-active);color:#fff}.pop-confirm[data-v-f8165980]{position:relative;display:inline-flex;justify-content:center}input[data-v-f8165980]{width:10rem;height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-f8165980]:focus{border:1px solid var(--color-active)}.danger[data-v-f8165980]{color:red!important}.topic_content[data-v-f8165980],.reply_content[data-v-f8165980]{font-size:1.6rem}.mask[data-v-f8165980]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-f8165980]{background:#000000bb}.mask.light[data-v-f8165980]{background:transparent}.mask.lightgray[data-v-f8165980]{background:rgba(0,0,0,.25)}.mask.white[data-v-f8165980]{background:transparent}.slide[data-v-f8165980]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-f8165980]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-f8165980]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-f8165980]{overflow:hidden!important}.page1 .post-wrapper[data-v-f8165980],.page1 .setting-wrapper[data-v-f8165980]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper2[data-v-f8165980]{background:var(--color-main-bg)}.mobile-page[data-v-f8165980]{font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-f8165980]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.html-wrapper[data-v-f8165980]{position:relative}.html-wrapper .htmlMask[data-v-f8165980]{max-height:90rem;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 80%,transparent)}.html-wrapper .expand[data-v-f8165980]{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%)}.comment[data-v-312e9541]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-312e9541]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-312e9541]{background:rgba(255,255,0,.3)!important}.comment .comment-content-w .more[data-v-312e9541]{text-align:center;margin:1rem 0}.comment .comment-content[data-v-312e9541]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-312e9541]{margin-top:.6rem;width:1.8rem;min-width:1.8rem;position:relative}.comment .comment-content .expand-line[data-v-312e9541]:after{position:absolute;left:30%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .right[data-v-312e9541]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-312e9541]{margin:.5rem 0}.wrong-wrapper[data-v-312e9541]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper .del-line[data-v-312e9541]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-312e9541]{margin-left:.5rem}.wrong-wrapper .warning[data-v-312e9541]{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-6234240d]{border-top:1px solid var(--color-line);height:4rem;padding:0 1rem;display:flex;align-items:center;color:var(--color-font);font-size:1.4rem;justify-content:space-between}.toolbar .left[data-v-6234240d],.toolbar .right[data-v-6234240d]{gap:1rem;display:flex}.toolbar .right[data-v-6234240d]{gap:.6rem}.comment[data-v-0869dab5]{width:100%;box-sizing:border-box;display:flex;gap:1rem;padding:1rem;border-bottom:1px solid var(--color-line)}.comment .base-avatar[data-v-0869dab5]{display:flex;margin-right:0}.comment .base-avatar img[data-v-0869dab5]{width:2.8rem;height:2.8rem;border-radius:.3rem}.comment .comment-body[data-v-0869dab5]{flex:1;display:flex;flex-direction:column}.comment .comment-body .texts[data-v-0869dab5]{display:flex;align-items:center}.comment .comment-body .reply_content[data-v-0869dab5]{margin-top:1rem;max-width:calc(100% - 5rem)}.comment .isRight[data-v-0869dab5]{align-items:flex-end}.comment .isRight .owner[data-v-0869dab5],.comment .isRight .mod[data-v-0869dab5],.comment .isRight .username[data-v-0869dab5]{margin:0 0 0 1rem}.comment .Author-right[data-v-0869dab5]{display:flex;flex-direction:column;align-items:center}.comment .Author-right .floor[data-v-0869dab5]{margin:0;border-radius:.5rem;background-color:var(--color-floor);padding:3px 9px}.comment .Author-right .jump[data-v-0869dab5]{color:#929596;margin-top:.4rem;font-size:1.4rem}.comment .point[data-v-0869dab5]{margin:0 1rem;display:flex;gap:.5rem;align-items:center}.comment .point svg[data-v-0869dab5]{font-size:1.6rem}.FromBottomDialog[data-v-3a54f208]{z-index:11;position:fixed;width:100%;overflow-y:auto;bottom:0;box-sizing:border-box;border-radius:var(--0013fa15);transition:all .3s;background:var(--color-four-bg)}.FromBottomDialog.no-heng-gang[data-v-3a54f208]{padding-top:0}.FromBottomDialog .heng-gang[data-v-3a54f208]{border-radius:.5rem .5rem 0 0;border-radius:var(--0013fa15);z-index:3;width:100%;position:fixed;min-height:3rem;display:flex;justify-content:center;align-items:center}.FromBottomDialog .heng-gang .gang-content[data-v-3a54f208]{background:darkgray;border-radius:2px;height:.4rem;width:3rem}.FromBottomDialog .dialog-wrapper[data-v-3a54f208]{margin-top:3rem}.wrapper .options[data-v-ce52828d]{padding:1rem 2rem 3rem;display:grid;grid-template-columns:repeat(5,1fr);justify-content:space-between;gap:2rem}.wrapper .options .item[data-v-ce52828d]{display:flex;flex-direction:column;align-items:center;color:gray;font-size:1.2rem}.wrapper .options .item.disabled[data-v-ce52828d]{opacity:.5}.wrapper .options .item.disabled svg[data-v-ce52828d]{color:gray!important}.wrapper .options .item .icon-wrap[data-v-ce52828d]{margin-bottom:.5rem;width:100%;height:15vw;display:flex;justify-content:center;align-items:center;background:var(--color-second-bg);border-radius:1rem}.wrapper .options .item .icon-wrap svg[data-v-ce52828d]{font-size:3rem}.wrapper .options .black[data-v-ce52828d]{color:var(--color-font-pure)}.wrapper .cancel[data-v-ce52828d]{border-top:1px solid var(--color-tooltip-bg);display:flex;align-items:center;justify-content:center;font-size:1.6rem;height:5rem;color:#646f81}.wrapper .options[data-v-8ef13a81]{padding:1rem 2rem 3rem;display:grid;grid-template-columns:repeat(5,1fr);justify-content:space-between;gap:2rem}.wrapper .options .item[data-v-8ef13a81]{display:flex;flex-direction:column;align-items:center;color:gray;font-size:1.2rem}.wrapper .options .item.disabled[data-v-8ef13a81]{opacity:.5}.wrapper .options .item.disabled svg[data-v-8ef13a81]{color:gray!important}.wrapper .options .item.full svg[data-v-8ef13a81]{color:#e02a2a!important}.wrapper .options .item .icon-wrap[data-v-8ef13a81]{margin-bottom:.5rem;width:100%;height:15vw;display:flex;justify-content:center;align-items:center;background:var(--color-second-bg);border-radius:1rem}.wrapper .options .item .icon-wrap svg[data-v-8ef13a81]{font-size:3rem;color:#39ae55}.wrapper .cancel[data-v-8ef13a81]{border-top:1px solid var(--color-line2);display:flex;align-items:center;justify-content:center;font-size:1.6rem;height:5rem;color:#646f81}.sticky{position:sticky;bottom:-2px;z-index:2;background:var(--box-background-hover-color)!important}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.v-enter-active[data-v-066728a9],.v-leave-active[data-v-066728a9]{transition:opacity .3s ease}.v-enter-from[data-v-066728a9],.v-leave-to[data-v-066728a9]{opacity:0}.fade-in[data-v-066728a9]{animation:fade-in-066728a9 .3s}.fade-out[data-v-066728a9]{animation:fade-out-066728a9 .4s}@keyframes fade-in-066728a9{0%{opacity:0}to{opacity:1}}@keyframes fade-out-066728a9{0%{opacity:1}to{opacity:0;display:none}}.username[data-v-066728a9]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-066728a9]{font-size:1.4rem;color:var(--color-font-8);color:#e02a2a}.owner[data-v-066728a9]{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-066728a9]{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-066728a9]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag .remove[data-v-066728a9]{margin-left:.5rem;display:none}.add-tag[data-v-066728a9]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;position:absolute;display:none}.floor[data-v-066728a9]{font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;color:var(--color-floor-font);cursor:default;margin-right:1rem}.base-avatar[data-v-066728a9]{margin-right:1rem;display:inline-flex}.base-avatar img[data-v-066728a9]{width:2.8rem;height:2.8rem;border-radius:.4rem}html[data-v-066728a9]{font-size:10px}[data-v-066728a9]:root{--box-border-radius: 8px}#site-header[data-v-066728a9]{height:4rem}#site-header #site-header-menu #menu-body[data-v-066728a9]{top:5rem;right:1rem}#Wrapper .cell .count_livid[data-v-066728a9]{font-size:14px;font-weight:700;padding:3px 10px;border-radius:5px}a[data-v-066728a9]{-webkit-tap-highlight-color:rgba(255,255,255,0);-webkit-user-select:none;-moz-user-focus:none;-moz-user-select:none}.post-item[data-v-066728a9]{background:var(--box-background-color)}.post-item .new-item[data-v-066728a9]{display:flex;justify-content:space-between}.post-item .new-item .left .top[data-v-066728a9]{display:flex;align-items:center;line-height:1.2;gap:1rem}.post-item .new-item .left .small[data-v-066728a9],.post-item .new-item .left a.node[data-v-066728a9]{font-size:1.2rem}.post-item .new-item .left .bottom[data-v-066728a9]{margin:1rem 0 .5rem}.post-item .new-item .left .bottom .item_title[data-v-066728a9]{font-size:1.6rem}.post-item .new-item .left .bottom a[data-v-066728a9]{text-decoration:none!important}.post-item .new-item .right[data-v-066728a9]{min-width:5rem;display:flex;justify-content:flex-end;align-items:center}.post-item .new-item .right .count_livid[data-v-066728a9]{font-size:1.4rem!important;margin-right:0;padding:.3rem 1rem!important;border-radius:.5rem!important}.post-item .post-content[data-v-066728a9]{display:block;max-height:30rem;overflow:hidden;line-break:anywhere;-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);height:0;color:#000;text-decoration:none!important}.post-item .post-content blockquote[data-v-066728a9]{margin-top:.5rem}.post-item .post-content p[data-v-066728a9]:first-child{margin-top:0}.post-item .post-content[data-v-066728a9]:visited{color:var(--link-visited-color)}.post-item .show-more[data-v-066728a9]{font-size:1.3rem;text-align:right;height:3rem;align-items:center;justify-content:center;position:relative;z-index:9;display:none}.preview[data-v-066728a9]{margin-bottom:.7rem;border-radius:var(--box-border-radius)}.preview .topic-link[data-v-066728a9]:link{color:#000!important}.preview .show-all[data-v-066728a9]{max-height:unset;-webkit-mask-image:none}.preview .post-content[data-v-066728a9]{height:unset!important}.preview .show-more[data-v-066728a9]{display:flex}.preview .item_title[data-v-066728a9]{font-weight:700}.Night .post-item[data-v-066728a9]{background:#18222d!important}.Night .preview[data-v-066728a9]{border:1px solid #3b536e}.Night .preview>.post-content[data-v-066728a9]:link{color:#d1d5d9}.Night .preview>.post-content[data-v-066728a9]:visited{color:#393f4e!important}.Night .preview .topic-link[data-v-066728a9]:link{color:#c0dbff!important}[data-v-066728a9]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-four-bg: #e7e9eb;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-line2: #cecece;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white;--space: 1rem}html.dark[data-v-066728a9]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-four-bg: #22303f;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}.flex[data-v-066728a9]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-066728a9]{justify-content:flex-end}.flex-center[data-v-066728a9]{justify-content:center}.p1[data-v-066728a9]{padding:1rem}.p2[data-v-066728a9]{padding:2rem}.p0[data-v-066728a9]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-066728a9]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-066728a9]{text-decoration:none}.tool[data-v-066728a9]{position:relative;display:flex;align-items:center;border-radius:.3rem;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-066728a9]{width:2.2rem!important;height:2.2rem!important}.tool.disabled[data-v-066728a9]{cursor:not-allowed}.tool span[data-v-066728a9]{line-height:1rem}.my-node[data-v-066728a9]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5}.msgs[data-v-066728a9]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-066728a9]{background:var(--box-background-color);margin-bottom:.5rem;width:100%;overflow:hidden;box-sizing:border-box;transition:background-color .3s}.my-box .box-content[data-v-066728a9]{padding:.5rem}.my-cell[data-v-066728a9]{color:var(--color-font);height:4.2rem;padding:0 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-066728a9]{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-066728a9]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-066728a9]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-066728a9]{position:relative}.radio-group2[data-v-066728a9]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-066728a9]{background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-066728a9]:first-child{border-left:none}.radio-group2 .active[data-v-066728a9]{background:var(--color-active);color:#fff}.pop-confirm[data-v-066728a9]{position:relative;display:inline-flex;justify-content:center}input[data-v-066728a9]{width:10rem;height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-066728a9]:focus{border:1px solid var(--color-active)}.danger[data-v-066728a9]{color:red!important}.topic_content[data-v-066728a9],.reply_content[data-v-066728a9]{font-size:1.6rem}.mask[data-v-066728a9]{z-index:10;position:fixed;top:0;width:100vw;height:100vh;background:#000000bb}.mask.dark[data-v-066728a9]{background:#000000bb}.mask.light[data-v-066728a9]{background:transparent}.mask.lightgray[data-v-066728a9]{background:rgba(0,0,0,.25)}.mask.white[data-v-066728a9]{background:transparent}.slide[data-v-066728a9]{flex:1;width:100vw;height:100vh;transition:height .3s;position:relative;overflow:hidden}.slide .slide-list[data-v-066728a9]{height:100%;width:100%;display:flex;position:relative;transition:transform .3s}.slide .slide-list .slide-item[data-v-066728a9]{height:100%;width:100%;flex-shrink:0;position:relative;overflow:auto}.page1[data-v-066728a9]{overflow:hidden!important}.page1 .post-wrapper[data-v-066728a9],.page1 .setting-wrapper[data-v-066728a9]{position:absolute;left:0;top:0;height:100%;width:100%;background:var(--color-main-bg);overflow:auto}.setting-wrapper2[data-v-066728a9]{background:var(--color-main-bg)}.mobile-page[data-v-066728a9]{font-size:1.8rem;display:flex;flex-direction:column}.mobile-page>.page-content[data-v-066728a9]{padding:1rem;padding-top:0;box-sizing:border-box;overflow:auto}.post-detail[data-v-066728a9]{text-align:start;background:var(--color-main-bg);font-size:1.6rem;display:flex;justify-content:center;flex-wrap:wrap;padding-bottom:10rem}.post-detail[data-v-066728a9] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-066728a9] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .nav-bar[data-v-066728a9]{position:fixed;top:0;z-index:9;height:4.6rem;display:flex;justify-content:space-between;align-items:center;padding:1rem;margin-bottom:-1px}.post-detail .nav-bar svg[data-v-066728a9]{width:2rem;height:2rem;color:var(--color-font)}.post-detail .nav-bar .left[data-v-066728a9],.post-detail .nav-bar .right[data-v-066728a9]{display:flex;align-items:center;gap:1rem}.post-detail .post-main-body .box-header[data-v-066728a9]{padding:0 .5rem}.post-detail .post-main-body .box-header h1[data-v-066728a9]{font-size:2.2rem;font-weight:700}.post-detail .post-main-body .box-header small[data-v-066728a9]{display:flex;align-items:center}.post-detail .loading-wrapper[data-v-066728a9]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .comments-header[data-v-066728a9]{width:100%;padding:0 1rem;box-sizing:border-box;background:var(--box-background-color)}.post-detail #no-comments-yet[data-v-066728a9]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin:2rem 1rem;box-sizing:border-box}.post-detail .relationReply[data-v-066728a9]{position:fixed;width:25vw;top:6.5rem;bottom:15rem;z-index:100;transform:translate(calc(100% + 2rem));font-size:2rem;overflow:hidden}.post-detail .relationReply .my-cell[data-v-066728a9]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .relationReply .comments[data-v-066728a9]{max-height:calc(100% - 4.2rem);overflow:auto;background:var(--color-second-bg);border-radius:0 0 var(--box-border-radius) var(--box-border-radius)}.post-detail .call-list[data-v-066728a9]{z-index:9;position:absolute;top:12rem;border:1px solid var(--color-main-bg);background:var(--color-call-list-bg);box-shadow:0 5px 15px #0000001a;overflow:auto;max-height:30rem;border-radius:var(--box-border-radius);min-width:8rem;box-sizing:content-box}.post-detail .call-list .call-item[data-v-066728a9]{border-top:1px solid var(--color-main-bg);height:3rem;display:flex;padding:0 1rem;align-items:center;font-size:14px;box-sizing:border-box}.post-detail .call-list .call-item .select[data-v-066728a9],.post-detail .call-list .call-item.select[data-v-066728a9]{background:var(--color-main-bg);text-decoration:none}.post-detail .call-list .call-item[data-v-066728a9]:nth-child(1){border-top:1px solid transparent}.post-detail .top-reply[data-v-066728a9]{color:var(--color-font-3);font-size:2rem;margin-right:1rem}.base64_tooltip[data-v-1988f33b]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:var(--color-third-bg);min-height:2.2rem;max-width:20rem;padding:1rem;position:fixed;z-index:9998;display:flex;align-items:center;border-radius:.5rem;line-break:anywhere;font-size:1.4rem;color:var(--color-font-8)}.base64_tooltip svg[data-v-1988f33b]{margin-left:1rem;min-width:1.8rem}.base64_tooltip[data-v-1988f33b] .base-button{margin-left:1rem;margin-top:1rem}.msg[data-v-0dcc0508]{cursor:default;margin-bottom:2rem;display:flex;font-size:1.4rem;box-sizing:border-box;border-radius:var(--box-border-radius);color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.msg.success .left[data-v-0dcc0508]{background:var(--color-active)}.msg.warning .left[data-v-0dcc0508]{background:#c8c002}.msg.error .left[data-v-0dcc0508]{background:red}.msg .left[data-v-0dcc0508]{border-radius:var(--box-border-radius) 0 0 var(--box-border-radius);display:flex;align-items:center;background:var(--color-active)}.msg .left svg[data-v-0dcc0508]{color:#fff;font-size:2.2rem;margin:0 .6rem}.msg .right[data-v-0dcc0508]{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.tag-modal .wrapper[data-v-674b86aa]{z-index:9;background:var(--color-main-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;padding:2rem 4rem;width:25rem}.tag-modal .wrapper .title[data-v-674b86aa]{font-weight:700}.tag-modal .wrapper .btns[data-v-674b86aa]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.msgs[data-v-93c4dec0]{position:fixed;margin-left:calc(50% - 40vw);width:80vw;z-index:9999;bottom:0;left:0;right:0}.tag-modal .modal-root[data-v-19a5903e]{z-index:9;background:var(--color-second-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;width:50vw;height:70vh;display:flex;flex-direction:column}.tag-modal .modal-root .modal-header[data-v-19a5903e]{padding:2.4rem;display:flex;justify-content:space-between}.tag-modal .modal-root .modal-header .title[data-v-19a5903e]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.tag-modal .modal-root .modal-header i[data-v-19a5903e]{font-size:2.2rem}.tag-modal .modal-root .modal-body[data-v-19a5903e]{padding:2rem;padding-top:0;flex:1;overflow:auto}.tag-modal .modal-root .modal-body[data-v-19a5903e] .cell{padding:2rem}.target-user-tags[data-v-b2b0badd]{background:var(--color-second-bg);color:var(--color-font);word-break:break-all;text-align:start;font-size:1.4rem;box-shadow:0 2px 3px #0000001a;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.target-user-tags .add-tag[data-v-b2b0badd]{display:inline-block}.loaded[data-v-b2b0badd]{font-size:1.4rem;display:flex;align-items:center;gap:1rem} ');
  35.  
  36. (function (vue) {
  37. 'use strict';
  38.  
  39. var PageType = /* @__PURE__ */ ((PageType2) => {
  40. PageType2["Home"] = "Home";
  41. PageType2["Node"] = "Node";
  42. PageType2["Post"] = "Post";
  43. PageType2["Member"] = "Member";
  44. PageType2["Changes"] = "Changes";
  45. return PageType2;
  46. })(PageType || {});
  47. var CommentDisplayType = /* @__PURE__ */ ((CommentDisplayType2) => {
  48. CommentDisplayType2[CommentDisplayType2["FloorInFloor"] = 0] = "FloorInFloor";
  49. CommentDisplayType2[CommentDisplayType2["FloorInFloorNoCallUser"] = 4] = "FloorInFloorNoCallUser";
  50. CommentDisplayType2[CommentDisplayType2["FloorInFloorNested"] = 5] = "FloorInFloorNested";
  51. CommentDisplayType2[CommentDisplayType2["Like"] = 1] = "Like";
  52. CommentDisplayType2[CommentDisplayType2["V2exOrigin"] = 2] = "V2exOrigin";
  53. CommentDisplayType2[CommentDisplayType2["OnlyOp"] = 3] = "OnlyOp";
  54. CommentDisplayType2[CommentDisplayType2["New"] = 6] = "New";
  55. return CommentDisplayType2;
  56. })(CommentDisplayType || {});
  57. const MAX_REPLY_LIMIT = 400;
  58. const _sfc_main$r = {
  59. name: "Tooltip",
  60. props: {
  61. title: {
  62. type: String,
  63. default() {
  64. return "";
  65. }
  66. },
  67. disabled: {
  68. type: Boolean,
  69. default() {
  70. return false;
  71. }
  72. }
  73. },
  74. data() {
  75. return {
  76. show: false
  77. };
  78. },
  79. methods: {
  80. showPop(e2) {
  81. if (this.disabled)
  82. return;
  83. if (!this.title)
  84. return;
  85. e2.stopPropagation();
  86. let rect = e2.target.getBoundingClientRect();
  87. this.show = true;
  88. vue.nextTick(() => {
  89. var _a, _b;
  90. let tip = (_b = (_a = this.$refs) == null ? void 0 : _a.tip) == null ? void 0 : _b.getBoundingClientRect();
  91. if (!tip)
  92. return;
  93. if (rect.top < 50) {
  94. this.$refs.tip.style.top = rect.top + rect.height + 10 + "px";
  95. } else {
  96. this.$refs.tip.style.top = rect.top - tip.height - 10 + "px";
  97. }
  98. let tipWidth = tip.width;
  99. let rectWidth = rect.width;
  100. this.$refs.tip.style.left = rect.left - (tipWidth - rectWidth) / 2 + "px";
  101. });
  102. }
  103. },
  104. render() {
  105. let Vnode = this.$slots.default()[0];
  106. return vue.createVNode(vue.Fragment, null, [this.show && this.title && vue.createVNode(vue.Teleport, {
  107. "to": "body"
  108. }, {
  109. default: () => [vue.createVNode(vue.Transition, {
  110. "name": "fade"
  111. }, {
  112. default: () => [vue.createVNode("div", {
  113. "ref": "tip",
  114. "className": "tip"
  115. }, [this.title])]
  116. })]
  117. }), vue.createVNode(Vnode, {
  118. "onClick": () => this.show = false,
  119. "onmouseenter": (e2) => this.showPop(e2),
  120. "onmouseleave": () => this.show = false
  121. }, null)]);
  122. }
  123. };
  124. const _export_sfc = (sfc, props) => {
  125. const target = sfc.__vccOpts || sfc;
  126. for (const [key, val] of props) {
  127. target[key] = val;
  128. }
  129. return target;
  130. };
  131. const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-ee672411"]]);
  132. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  133. __name: "BaseSwitch",
  134. props: {
  135. modelValue: { type: Boolean }
  136. },
  137. emits: ["update:modelValue"],
  138. setup(__props, { emit: __emit }) {
  139. return (_ctx, _cache) => {
  140. return vue.openBlock(), vue.createElementBlock("div", {
  141. class: vue.normalizeClass(["switch", { active: _ctx.modelValue }]),
  142. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", !_ctx.modelValue))
  143. }, null, 2);
  144. };
  145. }
  146. });
  147. const BaseSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e7c0fbef"]]);
  148. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  149. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  150. const colonSeparated = value.split(":");
  151. if (value.slice(0, 1) === "@") {
  152. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  153. return null;
  154. }
  155. provider = colonSeparated.shift().slice(1);
  156. }
  157. if (colonSeparated.length > 3 || !colonSeparated.length) {
  158. return null;
  159. }
  160. if (colonSeparated.length > 1) {
  161. const name2 = colonSeparated.pop();
  162. const prefix = colonSeparated.pop();
  163. const result = {
  164. // Allow provider without '@': "provider:prefix:name"
  165. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  166. prefix,
  167. name: name2
  168. };
  169. return validate && !validateIconName(result) ? null : result;
  170. }
  171. const name = colonSeparated[0];
  172. const dashSeparated = name.split("-");
  173. if (dashSeparated.length > 1) {
  174. const result = {
  175. provider,
  176. prefix: dashSeparated.shift(),
  177. name: dashSeparated.join("-")
  178. };
  179. return validate && !validateIconName(result) ? null : result;
  180. }
  181. if (allowSimpleName && provider === "") {
  182. const result = {
  183. provider,
  184. prefix: "",
  185. name
  186. };
  187. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  188. }
  189. return null;
  190. };
  191. const validateIconName = (icon, allowSimpleName) => {
  192. if (!icon) {
  193. return false;
  194. }
  195. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  196. };
  197. const defaultIconDimensions = Object.freeze(
  198. {
  199. left: 0,
  200. top: 0,
  201. width: 16,
  202. height: 16
  203. }
  204. );
  205. const defaultIconTransformations = Object.freeze({
  206. rotate: 0,
  207. vFlip: false,
  208. hFlip: false
  209. });
  210. const defaultIconProps = Object.freeze({
  211. ...defaultIconDimensions,
  212. ...defaultIconTransformations
  213. });
  214. const defaultExtendedIconProps = Object.freeze({
  215. ...defaultIconProps,
  216. body: "",
  217. hidden: false
  218. });
  219. function mergeIconTransformations(obj1, obj2) {
  220. const result = {};
  221. if (!obj1.hFlip !== !obj2.hFlip) {
  222. result.hFlip = true;
  223. }
  224. if (!obj1.vFlip !== !obj2.vFlip) {
  225. result.vFlip = true;
  226. }
  227. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  228. if (rotate) {
  229. result.rotate = rotate;
  230. }
  231. return result;
  232. }
  233. function mergeIconData(parent, child) {
  234. const result = mergeIconTransformations(parent, child);
  235. for (const key in defaultExtendedIconProps) {
  236. if (key in defaultIconTransformations) {
  237. if (key in parent && !(key in result)) {
  238. result[key] = defaultIconTransformations[key];
  239. }
  240. } else if (key in child) {
  241. result[key] = child[key];
  242. } else if (key in parent) {
  243. result[key] = parent[key];
  244. }
  245. }
  246. return result;
  247. }
  248. function getIconsTree(data, names) {
  249. const icons = data.icons;
  250. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  251. const resolved = /* @__PURE__ */ Object.create(null);
  252. function resolve(name) {
  253. if (icons[name]) {
  254. return resolved[name] = [];
  255. }
  256. if (!(name in resolved)) {
  257. resolved[name] = null;
  258. const parent = aliases[name] && aliases[name].parent;
  259. const value = parent && resolve(parent);
  260. if (value) {
  261. resolved[name] = [parent].concat(value);
  262. }
  263. }
  264. return resolved[name];
  265. }
  266. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  267. return resolved;
  268. }
  269. function internalGetIconData(data, name, tree) {
  270. const icons = data.icons;
  271. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  272. let currentProps = {};
  273. function parse(name2) {
  274. currentProps = mergeIconData(
  275. icons[name2] || aliases[name2],
  276. currentProps
  277. );
  278. }
  279. parse(name);
  280. tree.forEach(parse);
  281. return mergeIconData(data, currentProps);
  282. }
  283. function parseIconSet(data, callback) {
  284. const names = [];
  285. if (typeof data !== "object" || typeof data.icons !== "object") {
  286. return names;
  287. }
  288. if (data.not_found instanceof Array) {
  289. data.not_found.forEach((name) => {
  290. callback(name, null);
  291. names.push(name);
  292. });
  293. }
  294. const tree = getIconsTree(data);
  295. for (const name in tree) {
  296. const item = tree[name];
  297. if (item) {
  298. callback(name, internalGetIconData(data, name, item));
  299. names.push(name);
  300. }
  301. }
  302. return names;
  303. }
  304. const optionalPropertyDefaults = {
  305. provider: "",
  306. aliases: {},
  307. not_found: {},
  308. ...defaultIconDimensions
  309. };
  310. function checkOptionalProps(item, defaults) {
  311. for (const prop in defaults) {
  312. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  313. return false;
  314. }
  315. }
  316. return true;
  317. }
  318. function quicklyValidateIconSet(obj) {
  319. if (typeof obj !== "object" || obj === null) {
  320. return null;
  321. }
  322. const data = obj;
  323. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  324. return null;
  325. }
  326. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  327. return null;
  328. }
  329. const icons = data.icons;
  330. for (const name in icons) {
  331. const icon = icons[name];
  332. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  333. icon,
  334. defaultExtendedIconProps
  335. )) {
  336. return null;
  337. }
  338. }
  339. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  340. for (const name in aliases) {
  341. const icon = aliases[name];
  342. const parent = icon.parent;
  343. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  344. icon,
  345. defaultExtendedIconProps
  346. )) {
  347. return null;
  348. }
  349. }
  350. return data;
  351. }
  352. const dataStorage = /* @__PURE__ */ Object.create(null);
  353. function newStorage(provider, prefix) {
  354. return {
  355. provider,
  356. prefix,
  357. icons: /* @__PURE__ */ Object.create(null),
  358. missing: /* @__PURE__ */ new Set()
  359. };
  360. }
  361. function getStorage(provider, prefix) {
  362. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  363. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  364. }
  365. function addIconSet(storage2, data) {
  366. if (!quicklyValidateIconSet(data)) {
  367. return [];
  368. }
  369. return parseIconSet(data, (name, icon) => {
  370. if (icon) {
  371. storage2.icons[name] = icon;
  372. } else {
  373. storage2.missing.add(name);
  374. }
  375. });
  376. }
  377. function addIconToStorage(storage2, name, icon) {
  378. try {
  379. if (typeof icon.body === "string") {
  380. storage2.icons[name] = { ...icon };
  381. return true;
  382. }
  383. } catch (err) {
  384. }
  385. return false;
  386. }
  387. let simpleNames = false;
  388. function allowSimpleNames(allow) {
  389. if (typeof allow === "boolean") {
  390. simpleNames = allow;
  391. }
  392. return simpleNames;
  393. }
  394. function getIconData(name) {
  395. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  396. if (icon) {
  397. const storage2 = getStorage(icon.provider, icon.prefix);
  398. const iconName = icon.name;
  399. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  400. }
  401. }
  402. function addIcon(name, data) {
  403. const icon = stringToIcon(name, true, simpleNames);
  404. if (!icon) {
  405. return false;
  406. }
  407. const storage2 = getStorage(icon.provider, icon.prefix);
  408. return addIconToStorage(storage2, icon.name, data);
  409. }
  410. function addCollection(data, provider) {
  411. if (typeof data !== "object") {
  412. return false;
  413. }
  414. if (typeof provider !== "string") {
  415. provider = data.provider || "";
  416. }
  417. if (simpleNames && !provider && !data.prefix) {
  418. let added = false;
  419. if (quicklyValidateIconSet(data)) {
  420. data.prefix = "";
  421. parseIconSet(data, (name, icon) => {
  422. if (icon && addIcon(name, icon)) {
  423. added = true;
  424. }
  425. });
  426. }
  427. return added;
  428. }
  429. const prefix = data.prefix;
  430. if (!validateIconName({
  431. provider,
  432. prefix,
  433. name: "a"
  434. })) {
  435. return false;
  436. }
  437. const storage2 = getStorage(provider, prefix);
  438. return !!addIconSet(storage2, data);
  439. }
  440. const defaultIconSizeCustomisations = Object.freeze({
  441. width: null,
  442. height: null
  443. });
  444. const defaultIconCustomisations = Object.freeze({
  445. // Dimensions
  446. ...defaultIconSizeCustomisations,
  447. // Transformations
  448. ...defaultIconTransformations
  449. });
  450. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  451. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  452. function calculateSize(size, ratio, precision) {
  453. if (ratio === 1) {
  454. return size;
  455. }
  456. precision = precision || 100;
  457. if (typeof size === "number") {
  458. return Math.ceil(size * ratio * precision) / precision;
  459. }
  460. if (typeof size !== "string") {
  461. return size;
  462. }
  463. const oldParts = size.split(unitsSplit);
  464. if (oldParts === null || !oldParts.length) {
  465. return size;
  466. }
  467. const newParts = [];
  468. let code = oldParts.shift();
  469. let isNumber = unitsTest.test(code);
  470. while (true) {
  471. if (isNumber) {
  472. const num = parseFloat(code);
  473. if (isNaN(num)) {
  474. newParts.push(code);
  475. } else {
  476. newParts.push(Math.ceil(num * ratio * precision) / precision);
  477. }
  478. } else {
  479. newParts.push(code);
  480. }
  481. code = oldParts.shift();
  482. if (code === void 0) {
  483. return newParts.join("");
  484. }
  485. isNumber = !isNumber;
  486. }
  487. }
  488. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  489. function iconToSVG(icon, customisations) {
  490. const fullIcon = {
  491. ...defaultIconProps,
  492. ...icon
  493. };
  494. const fullCustomisations = {
  495. ...defaultIconCustomisations,
  496. ...customisations
  497. };
  498. const box = {
  499. left: fullIcon.left,
  500. top: fullIcon.top,
  501. width: fullIcon.width,
  502. height: fullIcon.height
  503. };
  504. let body = fullIcon.body;
  505. [fullIcon, fullCustomisations].forEach((props) => {
  506. const transformations = [];
  507. const hFlip = props.hFlip;
  508. const vFlip = props.vFlip;
  509. let rotation = props.rotate;
  510. if (hFlip) {
  511. if (vFlip) {
  512. rotation += 2;
  513. } else {
  514. transformations.push(
  515. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  516. );
  517. transformations.push("scale(-1 1)");
  518. box.top = box.left = 0;
  519. }
  520. } else if (vFlip) {
  521. transformations.push(
  522. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  523. );
  524. transformations.push("scale(1 -1)");
  525. box.top = box.left = 0;
  526. }
  527. let tempValue;
  528. if (rotation < 0) {
  529. rotation -= Math.floor(rotation / 4) * 4;
  530. }
  531. rotation = rotation % 4;
  532. switch (rotation) {
  533. case 1:
  534. tempValue = box.height / 2 + box.top;
  535. transformations.unshift(
  536. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  537. );
  538. break;
  539. case 2:
  540. transformations.unshift(
  541. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  542. );
  543. break;
  544. case 3:
  545. tempValue = box.width / 2 + box.left;
  546. transformations.unshift(
  547. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  548. );
  549. break;
  550. }
  551. if (rotation % 2 === 1) {
  552. if (box.left !== box.top) {
  553. tempValue = box.left;
  554. box.left = box.top;
  555. box.top = tempValue;
  556. }
  557. if (box.width !== box.height) {
  558. tempValue = box.width;
  559. box.width = box.height;
  560. box.height = tempValue;
  561. }
  562. }
  563. if (transformations.length) {
  564. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  565. }
  566. });
  567. const customisationsWidth = fullCustomisations.width;
  568. const customisationsHeight = fullCustomisations.height;
  569. const boxWidth = box.width;
  570. const boxHeight = box.height;
  571. let width;
  572. let height;
  573. if (customisationsWidth === null) {
  574. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  575. width = calculateSize(height, boxWidth / boxHeight);
  576. } else {
  577. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  578. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  579. }
  580. const attributes = {};
  581. const setAttr = (prop, value) => {
  582. if (!isUnsetKeyword(value)) {
  583. attributes[prop] = value.toString();
  584. }
  585. };
  586. setAttr("width", width);
  587. setAttr("height", height);
  588. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  589. return {
  590. attributes,
  591. body
  592. };
  593. }
  594. const regex = /\sid="(\S+)"/g;
  595. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  596. let counter = 0;
  597. function replaceIDs(body, prefix = randomPrefix) {
  598. const ids = [];
  599. let match;
  600. while (match = regex.exec(body)) {
  601. ids.push(match[1]);
  602. }
  603. if (!ids.length) {
  604. return body;
  605. }
  606. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  607. ids.forEach((id) => {
  608. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  609. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  610. body = body.replace(
  611. // Allowed characters before id: [#;"]
  612. // Allowed characters after id: [)"], .[a-z]
  613. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  614. "$1" + newID + suffix + "$3"
  615. );
  616. });
  617. body = body.replace(new RegExp(suffix, "g"), "");
  618. return body;
  619. }
  620. const storage = /* @__PURE__ */ Object.create(null);
  621. function setAPIModule(provider, item) {
  622. storage[provider] = item;
  623. }
  624. function getAPIModule(provider) {
  625. return storage[provider] || storage[""];
  626. }
  627. function createAPIConfig(source) {
  628. let resources;
  629. if (typeof source.resources === "string") {
  630. resources = [source.resources];
  631. } else {
  632. resources = source.resources;
  633. if (!(resources instanceof Array) || !resources.length) {
  634. return null;
  635. }
  636. }
  637. const result = {
  638. // API hosts
  639. resources,
  640. // Root path
  641. path: source.path || "/",
  642. // URL length limit
  643. maxURL: source.maxURL || 500,
  644. // Timeout before next host is used.
  645. rotate: source.rotate || 750,
  646. // Timeout before failing query.
  647. timeout: source.timeout || 5e3,
  648. // Randomise default API end point.
  649. random: source.random === true,
  650. // Start index
  651. index: source.index || 0,
  652. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  653. dataAfterTimeout: source.dataAfterTimeout !== false
  654. };
  655. return result;
  656. }
  657. const configStorage = /* @__PURE__ */ Object.create(null);
  658. const fallBackAPISources = [
  659. "https://api.simplesvg.com",
  660. "https://api.unisvg.com"
  661. ];
  662. const fallBackAPI = [];
  663. while (fallBackAPISources.length > 0) {
  664. if (fallBackAPISources.length === 1) {
  665. fallBackAPI.push(fallBackAPISources.shift());
  666. } else {
  667. if (Math.random() > 0.5) {
  668. fallBackAPI.push(fallBackAPISources.shift());
  669. } else {
  670. fallBackAPI.push(fallBackAPISources.pop());
  671. }
  672. }
  673. }
  674. configStorage[""] = createAPIConfig({
  675. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  676. });
  677. function addAPIProvider(provider, customConfig) {
  678. const config2 = createAPIConfig(customConfig);
  679. if (config2 === null) {
  680. return false;
  681. }
  682. configStorage[provider] = config2;
  683. return true;
  684. }
  685. function getAPIConfig(provider) {
  686. return configStorage[provider];
  687. }
  688. const detectFetch = () => {
  689. let callback;
  690. try {
  691. callback = fetch;
  692. if (typeof callback === "function") {
  693. return callback;
  694. }
  695. } catch (err) {
  696. }
  697. };
  698. let fetchModule = detectFetch();
  699. function calculateMaxLength(provider, prefix) {
  700. const config2 = getAPIConfig(provider);
  701. if (!config2) {
  702. return 0;
  703. }
  704. let result;
  705. if (!config2.maxURL) {
  706. result = 0;
  707. } else {
  708. let maxHostLength = 0;
  709. config2.resources.forEach((item) => {
  710. const host = item;
  711. maxHostLength = Math.max(maxHostLength, host.length);
  712. });
  713. const url = prefix + ".json?icons=";
  714. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  715. }
  716. return result;
  717. }
  718. function shouldAbort(status) {
  719. return status === 404;
  720. }
  721. const prepare = (provider, prefix, icons) => {
  722. const results = [];
  723. const maxLength = calculateMaxLength(provider, prefix);
  724. const type = "icons";
  725. let item = {
  726. type,
  727. provider,
  728. prefix,
  729. icons: []
  730. };
  731. let length = 0;
  732. icons.forEach((name, index2) => {
  733. length += name.length + 1;
  734. if (length >= maxLength && index2 > 0) {
  735. results.push(item);
  736. item = {
  737. type,
  738. provider,
  739. prefix,
  740. icons: []
  741. };
  742. length = name.length;
  743. }
  744. item.icons.push(name);
  745. });
  746. results.push(item);
  747. return results;
  748. };
  749. function getPath(provider) {
  750. if (typeof provider === "string") {
  751. const config2 = getAPIConfig(provider);
  752. if (config2) {
  753. return config2.path;
  754. }
  755. }
  756. return "/";
  757. }
  758. const send = (host, params, callback) => {
  759. if (!fetchModule) {
  760. callback("abort", 424);
  761. return;
  762. }
  763. let path = getPath(params.provider);
  764. switch (params.type) {
  765. case "icons": {
  766. const prefix = params.prefix;
  767. const icons = params.icons;
  768. const iconsList = icons.join(",");
  769. const urlParams = new URLSearchParams({
  770. icons: iconsList
  771. });
  772. path += prefix + ".json?" + urlParams.toString();
  773. break;
  774. }
  775. case "custom": {
  776. const uri = params.uri;
  777. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  778. break;
  779. }
  780. default:
  781. callback("abort", 400);
  782. return;
  783. }
  784. let defaultError = 503;
  785. fetchModule(host + path).then((response) => {
  786. const status = response.status;
  787. if (status !== 200) {
  788. setTimeout(() => {
  789. callback(shouldAbort(status) ? "abort" : "next", status);
  790. });
  791. return;
  792. }
  793. defaultError = 501;
  794. return response.json();
  795. }).then((data) => {
  796. if (typeof data !== "object" || data === null) {
  797. setTimeout(() => {
  798. if (data === 404) {
  799. callback("abort", data);
  800. } else {
  801. callback("next", defaultError);
  802. }
  803. });
  804. return;
  805. }
  806. setTimeout(() => {
  807. callback("success", data);
  808. });
  809. }).catch(() => {
  810. callback("next", defaultError);
  811. });
  812. };
  813. const fetchAPIModule = {
  814. prepare,
  815. send
  816. };
  817. function sortIcons(icons) {
  818. const result = {
  819. loaded: [],
  820. missing: [],
  821. pending: []
  822. };
  823. const storage2 = /* @__PURE__ */ Object.create(null);
  824. icons.sort((a, b) => {
  825. if (a.provider !== b.provider) {
  826. return a.provider.localeCompare(b.provider);
  827. }
  828. if (a.prefix !== b.prefix) {
  829. return a.prefix.localeCompare(b.prefix);
  830. }
  831. return a.name.localeCompare(b.name);
  832. });
  833. let lastIcon = {
  834. provider: "",
  835. prefix: "",
  836. name: ""
  837. };
  838. icons.forEach((icon) => {
  839. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  840. return;
  841. }
  842. lastIcon = icon;
  843. const provider = icon.provider;
  844. const prefix = icon.prefix;
  845. const name = icon.name;
  846. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  847. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  848. let list;
  849. if (name in localStorage2.icons) {
  850. list = result.loaded;
  851. } else if (prefix === "" || localStorage2.missing.has(name)) {
  852. list = result.missing;
  853. } else {
  854. list = result.pending;
  855. }
  856. const item = {
  857. provider,
  858. prefix,
  859. name
  860. };
  861. list.push(item);
  862. });
  863. return result;
  864. }
  865. function removeCallback(storages, id) {
  866. storages.forEach((storage2) => {
  867. const items = storage2.loaderCallbacks;
  868. if (items) {
  869. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  870. }
  871. });
  872. }
  873. function updateCallbacks(storage2) {
  874. if (!storage2.pendingCallbacksFlag) {
  875. storage2.pendingCallbacksFlag = true;
  876. setTimeout(() => {
  877. storage2.pendingCallbacksFlag = false;
  878. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  879. if (!items.length) {
  880. return;
  881. }
  882. let hasPending = false;
  883. const provider = storage2.provider;
  884. const prefix = storage2.prefix;
  885. items.forEach((item) => {
  886. const icons = item.icons;
  887. const oldLength = icons.pending.length;
  888. icons.pending = icons.pending.filter((icon) => {
  889. if (icon.prefix !== prefix) {
  890. return true;
  891. }
  892. const name = icon.name;
  893. if (storage2.icons[name]) {
  894. icons.loaded.push({
  895. provider,
  896. prefix,
  897. name
  898. });
  899. } else if (storage2.missing.has(name)) {
  900. icons.missing.push({
  901. provider,
  902. prefix,
  903. name
  904. });
  905. } else {
  906. hasPending = true;
  907. return true;
  908. }
  909. return false;
  910. });
  911. if (icons.pending.length !== oldLength) {
  912. if (!hasPending) {
  913. removeCallback([storage2], item.id);
  914. }
  915. item.callback(
  916. icons.loaded.slice(0),
  917. icons.missing.slice(0),
  918. icons.pending.slice(0),
  919. item.abort
  920. );
  921. }
  922. });
  923. });
  924. }
  925. }
  926. let idCounter = 0;
  927. function storeCallback(callback, icons, pendingSources) {
  928. const id = idCounter++;
  929. const abort = removeCallback.bind(null, pendingSources, id);
  930. if (!icons.pending.length) {
  931. return abort;
  932. }
  933. const item = {
  934. id,
  935. icons,
  936. callback,
  937. abort
  938. };
  939. pendingSources.forEach((storage2) => {
  940. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  941. });
  942. return abort;
  943. }
  944. function listToIcons(list, validate = true, simpleNames2 = false) {
  945. const result = [];
  946. list.forEach((item) => {
  947. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  948. if (icon) {
  949. result.push(icon);
  950. }
  951. });
  952. return result;
  953. }
  954. var defaultConfig = {
  955. resources: [],
  956. index: 0,
  957. timeout: 2e3,
  958. rotate: 750,
  959. random: false,
  960. dataAfterTimeout: false
  961. };
  962. function sendQuery(config2, payload, query, done) {
  963. const resourcesCount = config2.resources.length;
  964. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  965. let resources;
  966. if (config2.random) {
  967. let list = config2.resources.slice(0);
  968. resources = [];
  969. while (list.length > 1) {
  970. const nextIndex = Math.floor(Math.random() * list.length);
  971. resources.push(list[nextIndex]);
  972. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  973. }
  974. resources = resources.concat(list);
  975. } else {
  976. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  977. }
  978. const startTime = Date.now();
  979. let status = "pending";
  980. let queriesSent = 0;
  981. let lastError;
  982. let timer = null;
  983. let queue = [];
  984. let doneCallbacks = [];
  985. if (typeof done === "function") {
  986. doneCallbacks.push(done);
  987. }
  988. function resetTimer() {
  989. if (timer) {
  990. clearTimeout(timer);
  991. timer = null;
  992. }
  993. }
  994. function abort() {
  995. if (status === "pending") {
  996. status = "aborted";
  997. }
  998. resetTimer();
  999. queue.forEach((item) => {
  1000. if (item.status === "pending") {
  1001. item.status = "aborted";
  1002. }
  1003. });
  1004. queue = [];
  1005. }
  1006. function subscribe(callback, overwrite) {
  1007. if (overwrite) {
  1008. doneCallbacks = [];
  1009. }
  1010. if (typeof callback === "function") {
  1011. doneCallbacks.push(callback);
  1012. }
  1013. }
  1014. function getQueryStatus() {
  1015. return {
  1016. startTime,
  1017. payload,
  1018. status,
  1019. queriesSent,
  1020. queriesPending: queue.length,
  1021. subscribe,
  1022. abort
  1023. };
  1024. }
  1025. function failQuery() {
  1026. status = "failed";
  1027. doneCallbacks.forEach((callback) => {
  1028. callback(void 0, lastError);
  1029. });
  1030. }
  1031. function clearQueue() {
  1032. queue.forEach((item) => {
  1033. if (item.status === "pending") {
  1034. item.status = "aborted";
  1035. }
  1036. });
  1037. queue = [];
  1038. }
  1039. function moduleResponse(item, response, data) {
  1040. const isError = response !== "success";
  1041. queue = queue.filter((queued) => queued !== item);
  1042. switch (status) {
  1043. case "pending":
  1044. break;
  1045. case "failed":
  1046. if (isError || !config2.dataAfterTimeout) {
  1047. return;
  1048. }
  1049. break;
  1050. default:
  1051. return;
  1052. }
  1053. if (response === "abort") {
  1054. lastError = data;
  1055. failQuery();
  1056. return;
  1057. }
  1058. if (isError) {
  1059. lastError = data;
  1060. if (!queue.length) {
  1061. if (!resources.length) {
  1062. failQuery();
  1063. } else {
  1064. execNext();
  1065. }
  1066. }
  1067. return;
  1068. }
  1069. resetTimer();
  1070. clearQueue();
  1071. if (!config2.random) {
  1072. const index2 = config2.resources.indexOf(item.resource);
  1073. if (index2 !== -1 && index2 !== config2.index) {
  1074. config2.index = index2;
  1075. }
  1076. }
  1077. status = "completed";
  1078. doneCallbacks.forEach((callback) => {
  1079. callback(data);
  1080. });
  1081. }
  1082. function execNext() {
  1083. if (status !== "pending") {
  1084. return;
  1085. }
  1086. resetTimer();
  1087. const resource = resources.shift();
  1088. if (resource === void 0) {
  1089. if (queue.length) {
  1090. timer = setTimeout(() => {
  1091. resetTimer();
  1092. if (status === "pending") {
  1093. clearQueue();
  1094. failQuery();
  1095. }
  1096. }, config2.timeout);
  1097. return;
  1098. }
  1099. failQuery();
  1100. return;
  1101. }
  1102. const item = {
  1103. status: "pending",
  1104. resource,
  1105. callback: (status2, data) => {
  1106. moduleResponse(item, status2, data);
  1107. }
  1108. };
  1109. queue.push(item);
  1110. queriesSent++;
  1111. timer = setTimeout(execNext, config2.rotate);
  1112. query(resource, payload, item.callback);
  1113. }
  1114. setTimeout(execNext);
  1115. return getQueryStatus;
  1116. }
  1117. function initRedundancy(cfg) {
  1118. const config2 = {
  1119. ...defaultConfig,
  1120. ...cfg
  1121. };
  1122. let queries = [];
  1123. function cleanup() {
  1124. queries = queries.filter((item) => item().status === "pending");
  1125. }
  1126. function query(payload, queryCallback, doneCallback) {
  1127. const query2 = sendQuery(
  1128. config2,
  1129. payload,
  1130. queryCallback,
  1131. (data, error) => {
  1132. cleanup();
  1133. if (doneCallback) {
  1134. doneCallback(data, error);
  1135. }
  1136. }
  1137. );
  1138. queries.push(query2);
  1139. return query2;
  1140. }
  1141. function find(callback) {
  1142. return queries.find((value) => {
  1143. return callback(value);
  1144. }) || null;
  1145. }
  1146. const instance = {
  1147. query,
  1148. find,
  1149. setIndex: (index2) => {
  1150. config2.index = index2;
  1151. },
  1152. getIndex: () => config2.index,
  1153. cleanup
  1154. };
  1155. return instance;
  1156. }
  1157. function emptyCallback$1() {
  1158. }
  1159. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1160. function getRedundancyCache(provider) {
  1161. if (!redundancyCache[provider]) {
  1162. const config2 = getAPIConfig(provider);
  1163. if (!config2) {
  1164. return;
  1165. }
  1166. const redundancy = initRedundancy(config2);
  1167. const cachedReundancy = {
  1168. config: config2,
  1169. redundancy
  1170. };
  1171. redundancyCache[provider] = cachedReundancy;
  1172. }
  1173. return redundancyCache[provider];
  1174. }
  1175. function sendAPIQuery(target, query, callback) {
  1176. let redundancy;
  1177. let send2;
  1178. if (typeof target === "string") {
  1179. const api = getAPIModule(target);
  1180. if (!api) {
  1181. callback(void 0, 424);
  1182. return emptyCallback$1;
  1183. }
  1184. send2 = api.send;
  1185. const cached = getRedundancyCache(target);
  1186. if (cached) {
  1187. redundancy = cached.redundancy;
  1188. }
  1189. } else {
  1190. const config2 = createAPIConfig(target);
  1191. if (config2) {
  1192. redundancy = initRedundancy(config2);
  1193. const moduleKey = target.resources ? target.resources[0] : "";
  1194. const api = getAPIModule(moduleKey);
  1195. if (api) {
  1196. send2 = api.send;
  1197. }
  1198. }
  1199. }
  1200. if (!redundancy || !send2) {
  1201. callback(void 0, 424);
  1202. return emptyCallback$1;
  1203. }
  1204. return redundancy.query(query, send2, callback)().abort;
  1205. }
  1206. const browserCacheVersion = "iconify2";
  1207. const browserCachePrefix = "iconify";
  1208. const browserCacheCountKey = browserCachePrefix + "-count";
  1209. const browserCacheVersionKey = browserCachePrefix + "-version";
  1210. const browserStorageHour = 36e5;
  1211. const browserStorageCacheExpiration = 168;
  1212. function getStoredItem(func, key) {
  1213. try {
  1214. return func.getItem(key);
  1215. } catch (err) {
  1216. }
  1217. }
  1218. function setStoredItem(func, key, value) {
  1219. try {
  1220. func.setItem(key, value);
  1221. return true;
  1222. } catch (err) {
  1223. }
  1224. }
  1225. function removeStoredItem(func, key) {
  1226. try {
  1227. func.removeItem(key);
  1228. } catch (err) {
  1229. }
  1230. }
  1231. function setBrowserStorageItemsCount(storage2, value) {
  1232. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  1233. }
  1234. function getBrowserStorageItemsCount(storage2) {
  1235. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  1236. }
  1237. const browserStorageConfig = {
  1238. local: true,
  1239. session: true
  1240. };
  1241. const browserStorageEmptyItems = {
  1242. local: /* @__PURE__ */ new Set(),
  1243. session: /* @__PURE__ */ new Set()
  1244. };
  1245. let browserStorageStatus = false;
  1246. function setBrowserStorageStatus(status) {
  1247. browserStorageStatus = status;
  1248. }
  1249. let _window = typeof window === "undefined" ? {} : window;
  1250. function getBrowserStorage(key) {
  1251. const attr = key + "Storage";
  1252. try {
  1253. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  1254. return _window[attr];
  1255. }
  1256. } catch (err) {
  1257. }
  1258. browserStorageConfig[key] = false;
  1259. }
  1260. function iterateBrowserStorage(key, callback) {
  1261. const func = getBrowserStorage(key);
  1262. if (!func) {
  1263. return;
  1264. }
  1265. const version = getStoredItem(func, browserCacheVersionKey);
  1266. if (version !== browserCacheVersion) {
  1267. if (version) {
  1268. const total2 = getBrowserStorageItemsCount(func);
  1269. for (let i = 0; i < total2; i++) {
  1270. removeStoredItem(func, browserCachePrefix + i.toString());
  1271. }
  1272. }
  1273. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  1274. setBrowserStorageItemsCount(func, 0);
  1275. return;
  1276. }
  1277. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  1278. const parseItem = (index2) => {
  1279. const name = browserCachePrefix + index2.toString();
  1280. const item = getStoredItem(func, name);
  1281. if (typeof item !== "string") {
  1282. return;
  1283. }
  1284. try {
  1285. const data = JSON.parse(item);
  1286. if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && // Valid item: run callback
  1287. callback(data, index2)) {
  1288. return true;
  1289. }
  1290. } catch (err) {
  1291. }
  1292. removeStoredItem(func, name);
  1293. };
  1294. let total = getBrowserStorageItemsCount(func);
  1295. for (let i = total - 1; i >= 0; i--) {
  1296. if (!parseItem(i)) {
  1297. if (i === total - 1) {
  1298. total--;
  1299. setBrowserStorageItemsCount(func, total);
  1300. } else {
  1301. browserStorageEmptyItems[key].add(i);
  1302. }
  1303. }
  1304. }
  1305. }
  1306. function initBrowserStorage() {
  1307. if (browserStorageStatus) {
  1308. return;
  1309. }
  1310. setBrowserStorageStatus(true);
  1311. for (const key in browserStorageConfig) {
  1312. iterateBrowserStorage(key, (item) => {
  1313. const iconSet = item.data;
  1314. const provider = item.provider;
  1315. const prefix = iconSet.prefix;
  1316. const storage2 = getStorage(
  1317. provider,
  1318. prefix
  1319. );
  1320. if (!addIconSet(storage2, iconSet).length) {
  1321. return false;
  1322. }
  1323. const lastModified = iconSet.lastModified || -1;
  1324. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  1325. return true;
  1326. });
  1327. }
  1328. }
  1329. function updateLastModified(storage2, lastModified) {
  1330. const lastValue = storage2.lastModifiedCached;
  1331. if (
  1332. // Matches or newer
  1333. lastValue && lastValue >= lastModified
  1334. ) {
  1335. return lastValue === lastModified;
  1336. }
  1337. storage2.lastModifiedCached = lastModified;
  1338. if (lastValue) {
  1339. for (const key in browserStorageConfig) {
  1340. iterateBrowserStorage(key, (item) => {
  1341. const iconSet = item.data;
  1342. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  1343. });
  1344. }
  1345. }
  1346. return true;
  1347. }
  1348. function storeInBrowserStorage(storage2, data) {
  1349. if (!browserStorageStatus) {
  1350. initBrowserStorage();
  1351. }
  1352. function store(key) {
  1353. let func;
  1354. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  1355. return;
  1356. }
  1357. const set = browserStorageEmptyItems[key];
  1358. let index2;
  1359. if (set.size) {
  1360. set.delete(index2 = Array.from(set).shift());
  1361. } else {
  1362. index2 = getBrowserStorageItemsCount(func);
  1363. if (!setBrowserStorageItemsCount(func, index2 + 1)) {
  1364. return;
  1365. }
  1366. }
  1367. const item = {
  1368. cached: Math.floor(Date.now() / browserStorageHour),
  1369. provider: storage2.provider,
  1370. data
  1371. };
  1372. return setStoredItem(
  1373. func,
  1374. browserCachePrefix + index2.toString(),
  1375. JSON.stringify(item)
  1376. );
  1377. }
  1378. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  1379. return;
  1380. }
  1381. if (!Object.keys(data.icons).length) {
  1382. return;
  1383. }
  1384. if (data.not_found) {
  1385. data = Object.assign({}, data);
  1386. delete data.not_found;
  1387. }
  1388. if (!store("local")) {
  1389. store("session");
  1390. }
  1391. }
  1392. function emptyCallback() {
  1393. }
  1394. function loadedNewIcons(storage2) {
  1395. if (!storage2.iconsLoaderFlag) {
  1396. storage2.iconsLoaderFlag = true;
  1397. setTimeout(() => {
  1398. storage2.iconsLoaderFlag = false;
  1399. updateCallbacks(storage2);
  1400. });
  1401. }
  1402. }
  1403. function loadNewIcons(storage2, icons) {
  1404. if (!storage2.iconsToLoad) {
  1405. storage2.iconsToLoad = icons;
  1406. } else {
  1407. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  1408. }
  1409. if (!storage2.iconsQueueFlag) {
  1410. storage2.iconsQueueFlag = true;
  1411. setTimeout(() => {
  1412. storage2.iconsQueueFlag = false;
  1413. const { provider, prefix } = storage2;
  1414. const icons2 = storage2.iconsToLoad;
  1415. delete storage2.iconsToLoad;
  1416. let api;
  1417. if (!icons2 || !(api = getAPIModule(provider))) {
  1418. return;
  1419. }
  1420. const params = api.prepare(provider, prefix, icons2);
  1421. params.forEach((item) => {
  1422. sendAPIQuery(provider, item, (data) => {
  1423. if (typeof data !== "object") {
  1424. item.icons.forEach((name) => {
  1425. storage2.missing.add(name);
  1426. });
  1427. } else {
  1428. try {
  1429. const parsed = addIconSet(
  1430. storage2,
  1431. data
  1432. );
  1433. if (!parsed.length) {
  1434. return;
  1435. }
  1436. const pending = storage2.pendingIcons;
  1437. if (pending) {
  1438. parsed.forEach((name) => {
  1439. pending.delete(name);
  1440. });
  1441. }
  1442. storeInBrowserStorage(storage2, data);
  1443. } catch (err) {
  1444. console.error(err);
  1445. }
  1446. }
  1447. loadedNewIcons(storage2);
  1448. });
  1449. });
  1450. });
  1451. }
  1452. }
  1453. const loadIcons = (icons, callback) => {
  1454. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  1455. const sortedIcons = sortIcons(cleanedIcons);
  1456. if (!sortedIcons.pending.length) {
  1457. let callCallback = true;
  1458. if (callback) {
  1459. setTimeout(() => {
  1460. if (callCallback) {
  1461. callback(
  1462. sortedIcons.loaded,
  1463. sortedIcons.missing,
  1464. sortedIcons.pending,
  1465. emptyCallback
  1466. );
  1467. }
  1468. });
  1469. }
  1470. return () => {
  1471. callCallback = false;
  1472. };
  1473. }
  1474. const newIcons = /* @__PURE__ */ Object.create(null);
  1475. const sources = [];
  1476. let lastProvider, lastPrefix;
  1477. sortedIcons.pending.forEach((icon) => {
  1478. const { provider, prefix } = icon;
  1479. if (prefix === lastPrefix && provider === lastProvider) {
  1480. return;
  1481. }
  1482. lastProvider = provider;
  1483. lastPrefix = prefix;
  1484. sources.push(getStorage(provider, prefix));
  1485. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  1486. if (!providerNewIcons[prefix]) {
  1487. providerNewIcons[prefix] = [];
  1488. }
  1489. });
  1490. sortedIcons.pending.forEach((icon) => {
  1491. const { provider, prefix, name } = icon;
  1492. const storage2 = getStorage(provider, prefix);
  1493. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  1494. if (!pendingQueue.has(name)) {
  1495. pendingQueue.add(name);
  1496. newIcons[provider][prefix].push(name);
  1497. }
  1498. });
  1499. sources.forEach((storage2) => {
  1500. const { provider, prefix } = storage2;
  1501. if (newIcons[provider][prefix].length) {
  1502. loadNewIcons(storage2, newIcons[provider][prefix]);
  1503. }
  1504. });
  1505. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  1506. };
  1507. function mergeCustomisations(defaults, item) {
  1508. const result = {
  1509. ...defaults
  1510. };
  1511. for (const key in item) {
  1512. const value = item[key];
  1513. const valueType = typeof value;
  1514. if (key in defaultIconSizeCustomisations) {
  1515. if (value === null || value && (valueType === "string" || valueType === "number")) {
  1516. result[key] = value;
  1517. }
  1518. } else if (valueType === typeof result[key]) {
  1519. result[key] = key === "rotate" ? value % 4 : value;
  1520. }
  1521. }
  1522. return result;
  1523. }
  1524. const separator = /[\s,]+/;
  1525. function flipFromString(custom, flip) {
  1526. flip.split(separator).forEach((str) => {
  1527. const value = str.trim();
  1528. switch (value) {
  1529. case "horizontal":
  1530. custom.hFlip = true;
  1531. break;
  1532. case "vertical":
  1533. custom.vFlip = true;
  1534. break;
  1535. }
  1536. });
  1537. }
  1538. function rotateFromString(value, defaultValue = 0) {
  1539. const units = value.replace(/^-?[0-9.]*/, "");
  1540. function cleanup(value2) {
  1541. while (value2 < 0) {
  1542. value2 += 4;
  1543. }
  1544. return value2 % 4;
  1545. }
  1546. if (units === "") {
  1547. const num = parseInt(value);
  1548. return isNaN(num) ? 0 : cleanup(num);
  1549. } else if (units !== value) {
  1550. let split = 0;
  1551. switch (units) {
  1552. case "%":
  1553. split = 25;
  1554. break;
  1555. case "deg":
  1556. split = 90;
  1557. }
  1558. if (split) {
  1559. let num = parseFloat(value.slice(0, value.length - units.length));
  1560. if (isNaN(num)) {
  1561. return 0;
  1562. }
  1563. num = num / split;
  1564. return num % 1 === 0 ? cleanup(num) : 0;
  1565. }
  1566. }
  1567. return defaultValue;
  1568. }
  1569. function iconToHTML(body, attributes) {
  1570. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  1571. for (const attr in attributes) {
  1572. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  1573. }
  1574. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  1575. }
  1576. function encodeSVGforURL(svg) {
  1577. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  1578. }
  1579. function svgToData(svg) {
  1580. return "data:image/svg+xml," + encodeSVGforURL(svg);
  1581. }
  1582. function svgToURL(svg) {
  1583. return 'url("' + svgToData(svg) + '")';
  1584. }
  1585. const defaultExtendedIconCustomisations = {
  1586. ...defaultIconCustomisations,
  1587. inline: false
  1588. };
  1589. const svgDefaults = {
  1590. "xmlns": "http://www.w3.org/2000/svg",
  1591. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  1592. "aria-hidden": true,
  1593. "role": "img"
  1594. };
  1595. const commonProps = {
  1596. display: "inline-block"
  1597. };
  1598. const monotoneProps = {
  1599. backgroundColor: "currentColor"
  1600. };
  1601. const coloredProps = {
  1602. backgroundColor: "transparent"
  1603. };
  1604. const propsToAdd = {
  1605. Image: "var(--svg)",
  1606. Repeat: "no-repeat",
  1607. Size: "100% 100%"
  1608. };
  1609. const propsToAddTo = {
  1610. webkitMask: monotoneProps,
  1611. mask: monotoneProps,
  1612. background: coloredProps
  1613. };
  1614. for (const prefix in propsToAddTo) {
  1615. const list = propsToAddTo[prefix];
  1616. for (const prop in propsToAdd) {
  1617. list[prefix + prop] = propsToAdd[prop];
  1618. }
  1619. }
  1620. const customisationAliases = {};
  1621. ["horizontal", "vertical"].forEach((prefix) => {
  1622. const attr = prefix.slice(0, 1) + "Flip";
  1623. customisationAliases[prefix + "-flip"] = attr;
  1624. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  1625. customisationAliases[prefix + "Flip"] = attr;
  1626. });
  1627. function fixSize(value) {
  1628. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  1629. }
  1630. const render = (icon, props) => {
  1631. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  1632. const componentProps = { ...svgDefaults };
  1633. const mode = props.mode || "svg";
  1634. const style = {};
  1635. const propsStyle = props.style;
  1636. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  1637. for (let key in props) {
  1638. const value = props[key];
  1639. if (value === void 0) {
  1640. continue;
  1641. }
  1642. switch (key) {
  1643. case "icon":
  1644. case "style":
  1645. case "onLoad":
  1646. case "mode":
  1647. break;
  1648. case "inline":
  1649. case "hFlip":
  1650. case "vFlip":
  1651. customisations[key] = value === true || value === "true" || value === 1;
  1652. break;
  1653. case "flip":
  1654. if (typeof value === "string") {
  1655. flipFromString(customisations, value);
  1656. }
  1657. break;
  1658. case "color":
  1659. style.color = value;
  1660. break;
  1661. case "rotate":
  1662. if (typeof value === "string") {
  1663. customisations[key] = rotateFromString(value);
  1664. } else if (typeof value === "number") {
  1665. customisations[key] = value;
  1666. }
  1667. break;
  1668. case "ariaHidden":
  1669. case "aria-hidden":
  1670. if (value !== true && value !== "true") {
  1671. delete componentProps["aria-hidden"];
  1672. }
  1673. break;
  1674. default: {
  1675. const alias = customisationAliases[key];
  1676. if (alias) {
  1677. if (value === true || value === "true" || value === 1) {
  1678. customisations[alias] = true;
  1679. }
  1680. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  1681. componentProps[key] = value;
  1682. }
  1683. }
  1684. }
  1685. }
  1686. const item = iconToSVG(icon, customisations);
  1687. const renderAttribs = item.attributes;
  1688. if (customisations.inline) {
  1689. style.verticalAlign = "-0.125em";
  1690. }
  1691. if (mode === "svg") {
  1692. componentProps.style = {
  1693. ...style,
  1694. ...customStyle
  1695. };
  1696. Object.assign(componentProps, renderAttribs);
  1697. let localCounter = 0;
  1698. let id = props.id;
  1699. if (typeof id === "string") {
  1700. id = id.replace(/-/g, "_");
  1701. }
  1702. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  1703. return vue.h("svg", componentProps);
  1704. }
  1705. const { body, width, height } = icon;
  1706. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  1707. const html = iconToHTML(body, {
  1708. ...renderAttribs,
  1709. width: width + "",
  1710. height: height + ""
  1711. });
  1712. componentProps.style = {
  1713. ...style,
  1714. "--svg": svgToURL(html),
  1715. "width": fixSize(renderAttribs.width),
  1716. "height": fixSize(renderAttribs.height),
  1717. ...commonProps,
  1718. ...useMask ? monotoneProps : coloredProps,
  1719. ...customStyle
  1720. };
  1721. return vue.h("span", componentProps);
  1722. };
  1723. allowSimpleNames(true);
  1724. setAPIModule("", fetchAPIModule);
  1725. if (typeof document !== "undefined" && typeof window !== "undefined") {
  1726. initBrowserStorage();
  1727. const _window2 = window;
  1728. if (_window2.IconifyPreload !== void 0) {
  1729. const preload = _window2.IconifyPreload;
  1730. const err = "Invalid IconifyPreload syntax.";
  1731. if (typeof preload === "object" && preload !== null) {
  1732. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  1733. try {
  1734. if (
  1735. // Check if item is an object and not null/array
  1736. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  1737. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  1738. !addCollection(item)
  1739. ) {
  1740. console.error(err);
  1741. }
  1742. } catch (e2) {
  1743. console.error(err);
  1744. }
  1745. });
  1746. }
  1747. }
  1748. if (_window2.IconifyProviders !== void 0) {
  1749. const providers = _window2.IconifyProviders;
  1750. if (typeof providers === "object" && providers !== null) {
  1751. for (let key in providers) {
  1752. const err = "IconifyProviders[" + key + "] is invalid.";
  1753. try {
  1754. const value = providers[key];
  1755. if (typeof value !== "object" || !value || value.resources === void 0) {
  1756. continue;
  1757. }
  1758. if (!addAPIProvider(key, value)) {
  1759. console.error(err);
  1760. }
  1761. } catch (e2) {
  1762. console.error(err);
  1763. }
  1764. }
  1765. }
  1766. }
  1767. }
  1768. const emptyIcon = {
  1769. ...defaultIconProps,
  1770. body: ""
  1771. };
  1772. const Icon = vue.defineComponent({
  1773. // Do not inherit other attributes: it is handled by render()
  1774. inheritAttrs: false,
  1775. // Set initial data
  1776. data() {
  1777. return {
  1778. // Mounted status
  1779. iconMounted: false,
  1780. // Callback counter to trigger re-render
  1781. counter: 0
  1782. };
  1783. },
  1784. mounted() {
  1785. this._name = "";
  1786. this._loadingIcon = null;
  1787. this.iconMounted = true;
  1788. },
  1789. unmounted() {
  1790. this.abortLoading();
  1791. },
  1792. methods: {
  1793. abortLoading() {
  1794. if (this._loadingIcon) {
  1795. this._loadingIcon.abort();
  1796. this._loadingIcon = null;
  1797. }
  1798. },
  1799. // Get data for icon to render or null
  1800. getIcon(icon, onload) {
  1801. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  1802. this._name = "";
  1803. this.abortLoading();
  1804. return {
  1805. data: icon
  1806. };
  1807. }
  1808. let iconName;
  1809. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  1810. this.abortLoading();
  1811. return null;
  1812. }
  1813. const data = getIconData(iconName);
  1814. if (!data) {
  1815. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  1816. this.abortLoading();
  1817. this._name = "";
  1818. if (data !== null) {
  1819. this._loadingIcon = {
  1820. name: icon,
  1821. abort: loadIcons([iconName], () => {
  1822. this.counter++;
  1823. })
  1824. };
  1825. }
  1826. }
  1827. return null;
  1828. }
  1829. this.abortLoading();
  1830. if (this._name !== icon) {
  1831. this._name = icon;
  1832. if (onload) {
  1833. onload(icon);
  1834. }
  1835. }
  1836. const classes = ["iconify"];
  1837. if (iconName.prefix !== "") {
  1838. classes.push("iconify--" + iconName.prefix);
  1839. }
  1840. if (iconName.provider !== "") {
  1841. classes.push("iconify--" + iconName.provider);
  1842. }
  1843. return { data, classes };
  1844. }
  1845. },
  1846. // Render icon
  1847. render() {
  1848. this.counter;
  1849. const props = this.$attrs;
  1850. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  1851. if (!icon) {
  1852. return render(emptyIcon, props);
  1853. }
  1854. let newProps = props;
  1855. if (icon.classes) {
  1856. newProps = {
  1857. ...props,
  1858. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  1859. };
  1860. }
  1861. return render({
  1862. ...defaultIconProps,
  1863. ...icon.data
  1864. }, newProps);
  1865. }
  1866. });
  1867. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  1868. __name: "BackIcon",
  1869. setup(__props) {
  1870. return (_ctx, _cache) => {
  1871. return vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  1872. class: "back-icon",
  1873. icon: "octicon:arrow-left-24",
  1874. width: "22"
  1875. });
  1876. };
  1877. }
  1878. });
  1879. const _hoisted_1$n = { class: "nav-bar" };
  1880. const _hoisted_2$j = {
  1881. key: 0,
  1882. class: "title"
  1883. };
  1884. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  1885. __name: "NavBar",
  1886. props: {
  1887. title: {}
  1888. },
  1889. emits: ["back"],
  1890. setup(__props, { emit: __emit }) {
  1891. const emit = __emit;
  1892. return (_ctx, _cache) => {
  1893. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
  1894. vue.createVNode(_sfc_main$p, {
  1895. onClick: _cache[0] || (_cache[0] = ($event) => emit("back"))
  1896. }),
  1897. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, vue.toDisplayString(_ctx.title), 1)) : vue.createCommentVNode("", true)
  1898. ]);
  1899. };
  1900. }
  1901. });
  1902. const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-fda0acaa"]]);
  1903. const _hoisted_1$m = { class: "display-type" };
  1904. const _hoisted_2$i = { style: { "position": "relative" } };
  1905. const _hoisted_3$f = {
  1906. key: 0,
  1907. class: "type-list"
  1908. };
  1909. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  1910. __name: "BaseSelect",
  1911. props: {
  1912. displayType: {}
  1913. },
  1914. emits: ["update:displayType"],
  1915. setup(__props, { emit: __emit }) {
  1916. const props = __props;
  1917. const emit = __emit;
  1918. let state = vue.reactive({
  1919. showChangeDisplayType: false,
  1920. lastDisplayType: null
  1921. });
  1922. function changeOption(item) {
  1923. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1924. state.lastDisplayType = props.displayType;
  1925. }
  1926. emit("update:displayType", item);
  1927. state.showChangeDisplayType = false;
  1928. }
  1929. function clickDisplayType() {
  1930. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1931. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  1932. }
  1933. state.showChangeDisplayType = !state.showChangeDisplayType;
  1934. }
  1935. const currentDisplayType = vue.computed(() => {
  1936. let judge = props.displayType;
  1937. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  1938. judge = state.lastDisplayType;
  1939. }
  1940. switch (judge) {
  1941. case CommentDisplayType.FloorInFloorNoCallUser:
  1942. return "楼中楼";
  1943. case CommentDisplayType.FloorInFloor:
  1944. return "楼中楼(@)";
  1945. case CommentDisplayType.FloorInFloorNested:
  1946. return "冗余楼中楼";
  1947. case CommentDisplayType.V2exOrigin:
  1948. return "V2原版";
  1949. case CommentDisplayType.OnlyOp:
  1950. return "只看楼主";
  1951. default:
  1952. return "楼中楼";
  1953. }
  1954. });
  1955. return (_ctx, _cache) => {
  1956. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
  1957. vue.createElementVNode("div", {
  1958. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  1959. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  1960. }, "最热 ", 2),
  1961. vue.createElementVNode("div", _hoisted_2$i, [
  1962. vue.createElementVNode("div", {
  1963. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  1964. onClick: clickDisplayType
  1965. }, [
  1966. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  1967. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  1968. ], 2),
  1969. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$f, [
  1970. vue.createElementVNode("div", {
  1971. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  1972. onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  1973. }, "楼中楼 ", 2),
  1974. vue.createElementVNode("div", {
  1975. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  1976. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  1977. }, "楼中楼(@) ", 2),
  1978. vue.createElementVNode("div", {
  1979. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  1980. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  1981. }, "冗余楼中楼 ", 2),
  1982. vue.createElementVNode("div", {
  1983. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  1984. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  1985. }, "只看楼主 ", 2),
  1986. vue.createElementVNode("div", {
  1987. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  1988. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  1989. }, "V2原版 ", 2)
  1990. ])) : vue.createCommentVNode("", true)
  1991. ])
  1992. ]);
  1993. };
  1994. }
  1995. });
  1996. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-1d327f48"]]);
  1997. const eventBus = {
  1998. eventMap: /* @__PURE__ */ new Map(),
  1999. on(eventType, cb) {
  2000. let cbs = this.eventMap.get(eventType);
  2001. if (cbs) {
  2002. cbs.push(cb);
  2003. } else {
  2004. cbs = [cb];
  2005. }
  2006. this.eventMap.set(eventType, cbs);
  2007. },
  2008. emit(eventType, val) {
  2009. let cbs = this.eventMap.get(eventType);
  2010. if (cbs) {
  2011. cbs.map((cb) => cb(val));
  2012. }
  2013. },
  2014. off(eventType) {
  2015. let cbs = this.eventMap.has(eventType);
  2016. if (cbs) {
  2017. this.eventMap.delete(eventType);
  2018. }
  2019. },
  2020. clear() {
  2021. this.eventMap = /* @__PURE__ */ new Map();
  2022. }
  2023. };
  2024. const CMD = {
  2025. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  2026. SHOW_MSG: "SHOW_MSG",
  2027. SET_CALL: "SET_CALL",
  2028. SHOW_CALL: "SHOW_CALL",
  2029. REFRESH_ONCE: "REFRESH_ONCE",
  2030. ADD_REPLY: "ADD_REPLY",
  2031. IGNORE: "IGNORE",
  2032. MERGE: "MERGE",
  2033. MERGE_CONFIG: "MERGE_CONFIG",
  2034. REMOVE: "REMOVE",
  2035. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  2036. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  2037. ADD_TAG: "ADD_TAG",
  2038. REMOVE_TAG: "REMOVE_TAG",
  2039. RELATION_REPLY: "RELATION_REPLY",
  2040. JUMP: "JUMP",
  2041. ADD_READ: "ADD_READ",
  2042. REFRESH_POST: "REFRESH_POST",
  2043. SHOW_COMMENT_OPTIONS: "SHOW_COMMENT_OPTIONS",
  2044. SHOW_EDITOR: "COMMENT_REPLY"
  2045. };
  2046. const _withScopeId$e = (n2) => (vue.pushScopeId("data-v-a64ba8b8"), n2 = n2(), vue.popScopeId(), n2);
  2047. const _hoisted_1$l = { class: "font-size" };
  2048. const _hoisted_2$h = { class: "steps" };
  2049. const _hoisted_3$e = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2050. class: "text",
  2051. style: { "font-size": "1.2rem" }
  2052. }, "小", -1));
  2053. const _hoisted_4$d = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2054. const _hoisted_5$b = [
  2055. _hoisted_3$e,
  2056. _hoisted_4$d
  2057. ];
  2058. const _hoisted_6$a = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "text" }, "标准", -1));
  2059. const _hoisted_7$9 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2060. const _hoisted_8$9 = [
  2061. _hoisted_6$a,
  2062. _hoisted_7$9
  2063. ];
  2064. const _hoisted_9$9 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2065. class: "text",
  2066. style: { "font-size": "1.8rem" }
  2067. }, "大", -1));
  2068. const _hoisted_10$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2069. const _hoisted_11$8 = [
  2070. _hoisted_9$9,
  2071. _hoisted_10$8
  2072. ];
  2073. const _hoisted_12$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", {
  2074. class: "text",
  2075. style: { "font-size": "2.2rem" }
  2076. }, "特大", -1));
  2077. const _hoisted_13$8 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "point" }, null, -1));
  2078. const _hoisted_14$7 = [
  2079. _hoisted_12$8,
  2080. _hoisted_13$8
  2081. ];
  2082. const _hoisted_15$7 = /* @__PURE__ */ _withScopeId$e(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "line" }, null, -1));
  2083. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  2084. __name: "FontSizeType",
  2085. setup(__props) {
  2086. const config2 = vue.inject("config");
  2087. return (_ctx, _cache) => {
  2088. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
  2089. vue.createElementVNode("div", _hoisted_2$h, [
  2090. vue.createElementVNode("div", {
  2091. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "small" && "active"]]),
  2092. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "small" }))
  2093. }, _hoisted_5$b, 2),
  2094. vue.createElementVNode("div", {
  2095. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "normal" && "active"]]),
  2096. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "normal" }))
  2097. }, _hoisted_8$9, 2),
  2098. vue.createElementVNode("div", {
  2099. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "large" && "active"]]),
  2100. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "large" }))
  2101. }, _hoisted_11$8, 2),
  2102. vue.createElementVNode("div", {
  2103. class: vue.normalizeClass(["step", [vue.unref(config2).fontSizeType === "big-large" && "active"]]),
  2104. onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(eventBus).emit(vue.unref(CMD).MERGE_CONFIG, { fontSizeType: "big-large" }))
  2105. }, _hoisted_14$7, 2)
  2106. ]),
  2107. _hoisted_15$7
  2108. ]);
  2109. };
  2110. }
  2111. });
  2112. const FontSizeType = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-a64ba8b8"]]);
  2113. const _sfc_main$l = {
  2114. name: "Setting",
  2115. components: {
  2116. FontSizeType,
  2117. BaseSelect,
  2118. NavBar,
  2119. BaseSwitch,
  2120. Tooltip,
  2121. Icon
  2122. },
  2123. emits: ["back"],
  2124. props: {
  2125. modelValue: {
  2126. type: Object,
  2127. default() {
  2128. return {};
  2129. }
  2130. },
  2131. show: {
  2132. type: Boolean,
  2133. default() {
  2134. return false;
  2135. }
  2136. },
  2137. to: {
  2138. type: String,
  2139. default() {
  2140. return "";
  2141. }
  2142. }
  2143. },
  2144. data() {
  2145. return {
  2146. activeEruda: !!localStorage.getItem("active-eruda"),
  2147. config: window.clone(this.modelValue)
  2148. };
  2149. },
  2150. computed: {
  2151. CommentDisplayType() {
  2152. return CommentDisplayType;
  2153. },
  2154. isNew() {
  2155. return this.config.version < window.currentVersion;
  2156. }
  2157. },
  2158. watch: {
  2159. config: {
  2160. handler(n2) {
  2161. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  2162. if (n2.topReplyLoveMinCount < 0) {
  2163. n2.topReplyLoveMinCount = 1;
  2164. }
  2165. this.$emit("update:modelValue", n2);
  2166. },
  2167. deep: true
  2168. },
  2169. activeEruda(n2) {
  2170. if (n2) {
  2171. localStorage.setItem("active-eruda", 1);
  2172. } else {
  2173. localStorage.setItem("active-eruda", "");
  2174. }
  2175. }
  2176. }
  2177. };
  2178. const _withScopeId$d = (n2) => (vue.pushScopeId("data-v-402be427"), n2 = n2(), vue.popScopeId(), n2);
  2179. const _hoisted_1$k = { class: "mobile-page" };
  2180. const _hoisted_2$g = { class: "page-content" };
  2181. const _hoisted_3$d = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2182. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "列表设置")
  2183. ], -1));
  2184. const _hoisted_4$c = { class: "row" };
  2185. const _hoisted_5$a = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  2186. const _hoisted_6$9 = { class: "wrapper" };
  2187. const _hoisted_7$8 = { class: "radio-group2" };
  2188. const _hoisted_8$8 = { class: "row" };
  2189. const _hoisted_9$8 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子弹框显示", -1));
  2190. const _hoisted_10$7 = { class: "wrapper" };
  2191. const _hoisted_11$7 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此选项后,帖子始终会以弹框的方式显示。优先级大于“新标签页打开链接” ", -1));
  2192. const _hoisted_12$7 = { class: "row" };
  2193. const _hoisted_13$7 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  2194. const _hoisted_14$6 = { class: "wrapper" };
  2195. const _hoisted_15$6 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  2196. const _hoisted_16$6 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2197. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "主题设置")
  2198. ], -1));
  2199. const _hoisted_17$3 = { class: "row" };
  2200. const _hoisted_18$3 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  2201. const _hoisted_19$3 = { class: "wrapper" };
  2202. const _hoisted_20$3 = { class: "row" };
  2203. const _hoisted_21$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  2204. const _hoisted_22$2 = { class: "wrapper" };
  2205. const _hoisted_23$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2206. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  2207. ], -1));
  2208. const _hoisted_24$2 = { class: "row" };
  2209. const _hoisted_25$2 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  2210. const _hoisted_26$1 = { class: "wrapper" };
  2211. const _hoisted_27$1 = { class: "row" };
  2212. const _hoisted_28$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  2213. const _hoisted_29$1 = { class: "wrapper" };
  2214. const _hoisted_30$1 = { class: "row" };
  2215. const _hoisted_31$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  2216. const _hoisted_32$1 = { class: "wrapper" };
  2217. const _hoisted_33$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2218. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "记忆阅读")
  2219. ], -1));
  2220. const _hoisted_34$1 = { class: "row" };
  2221. const _hoisted_35$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "记录上次阅读楼层(误差1层左右):", -1));
  2222. const _hoisted_36$1 = { class: "wrapper" };
  2223. const _hoisted_37$1 = { class: "row" };
  2224. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开帖子自动跳转到上次阅读楼层", -1));
  2225. const _hoisted_39$1 = { class: "wrapper" };
  2226. const _hoisted_40 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2227. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "其他设置")
  2228. ], -1));
  2229. const _hoisted_41 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2230. /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "字体设置")
  2231. ], -1));
  2232. const _hoisted_42 = { class: "row" };
  2233. const _hoisted_43 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  2234. const _hoisted_44 = { class: "wrapper" };
  2235. const _hoisted_45 = { class: "row" };
  2236. const _hoisted_46 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  2237. const _hoisted_47 = { class: "wrapper" };
  2238. const _hoisted_48 = { class: "row" };
  2239. const _hoisted_49 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  2240. const _hoisted_50 = { class: "wrapper" };
  2241. const _hoisted_51 = { class: "row" };
  2242. const _hoisted_52 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  2243. const _hoisted_53 = { class: "wrapper" };
  2244. const _hoisted_54 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录,无法查看账号收藏了 ", -1));
  2245. const _hoisted_55 = { class: "row" };
  2246. const _hoisted_56 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "调试模式", -1));
  2247. const _hoisted_57 = { class: "wrapper" };
  2248. const _hoisted_58 = /* @__PURE__ */ _withScopeId$d(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此项会显示调试控制台,刷新页面生效 ", -1));
  2249. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2250. const _component_NavBar = vue.resolveComponent("NavBar");
  2251. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  2252. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  2253. const _component_font_size_type = vue.resolveComponent("font-size-type");
  2254. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: $props.to }, [
  2255. vue.createElementVNode("div", _hoisted_1$k, [
  2256. vue.createVNode(_component_NavBar, {
  2257. title: "设置",
  2258. onBack: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("back"))
  2259. }),
  2260. vue.createElementVNode("div", _hoisted_2$g, [
  2261. _hoisted_3$d,
  2262. vue.createElementVNode("div", _hoisted_4$c, [
  2263. _hoisted_5$a,
  2264. vue.createElementVNode("div", _hoisted_6$9, [
  2265. vue.createElementVNode("div", _hoisted_7$8, [
  2266. vue.createElementVNode("div", {
  2267. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  2268. onClick: _cache[1] || (_cache[1] = ($event) => $data.config.viewType = "table")
  2269. }, "表格 ", 2),
  2270. vue.createElementVNode("div", {
  2271. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  2272. onClick: _cache[2] || (_cache[2] = ($event) => $data.config.viewType = "card")
  2273. }, "卡片 ", 2)
  2274. ])
  2275. ])
  2276. ]),
  2277. vue.createElementVNode("div", _hoisted_8$8, [
  2278. _hoisted_9$8,
  2279. vue.createElementVNode("div", _hoisted_10$7, [
  2280. vue.createVNode(_component_BaseSwitch, {
  2281. modelValue: $data.config.clickPostItemOpenDetail,
  2282. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  2283. }, null, 8, ["modelValue"])
  2284. ])
  2285. ]),
  2286. _hoisted_11$7,
  2287. vue.createElementVNode("div", _hoisted_12$7, [
  2288. _hoisted_13$7,
  2289. vue.createElementVNode("div", _hoisted_14$6, [
  2290. vue.createVNode(_component_BaseSwitch, {
  2291. modelValue: $data.config.newTabOpen,
  2292. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.config.newTabOpen = $event)
  2293. }, null, 8, ["modelValue"])
  2294. ])
  2295. ]),
  2296. _hoisted_15$6,
  2297. _hoisted_16$6,
  2298. vue.createElementVNode("div", _hoisted_17$3, [
  2299. _hoisted_18$3,
  2300. vue.createElementVNode("div", _hoisted_19$3, [
  2301. vue.createVNode(_component_BaseSelect, {
  2302. "display-type": $data.config.commentDisplayType,
  2303. "onUpdate:displayType": _cache[5] || (_cache[5] = ($event) => $data.config.commentDisplayType = $event)
  2304. }, null, 8, ["display-type"])
  2305. ])
  2306. ]),
  2307. vue.createElementVNode("div", _hoisted_20$3, [
  2308. _hoisted_21$2,
  2309. vue.createElementVNode("div", _hoisted_22$2, [
  2310. vue.createVNode(_component_BaseSwitch, {
  2311. modelValue: $data.config.contentAutoCollapse,
  2312. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.config.contentAutoCollapse = $event)
  2313. }, null, 8, ["modelValue"])
  2314. ])
  2315. ]),
  2316. _hoisted_23$2,
  2317. vue.createElementVNode("div", _hoisted_24$2, [
  2318. _hoisted_25$2,
  2319. vue.createElementVNode("div", _hoisted_26$1, [
  2320. vue.createVNode(_component_BaseSwitch, {
  2321. modelValue: $data.config.showTopReply,
  2322. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.config.showTopReply = $event)
  2323. }, null, 8, ["modelValue"])
  2324. ])
  2325. ]),
  2326. vue.createElementVNode("div", _hoisted_27$1, [
  2327. _hoisted_28$1,
  2328. vue.createElementVNode("div", _hoisted_29$1, [
  2329. vue.withDirectives(vue.createElementVNode("input", {
  2330. type: "number",
  2331. min: "1",
  2332. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.topReplyCount = $event)
  2333. }, null, 512), [
  2334. [vue.vModelText, $data.config.topReplyCount]
  2335. ])
  2336. ])
  2337. ]),
  2338. vue.createElementVNode("div", _hoisted_30$1, [
  2339. _hoisted_31$1,
  2340. vue.createElementVNode("div", _hoisted_32$1, [
  2341. vue.withDirectives(vue.createElementVNode("input", {
  2342. type: "number",
  2343. min: "1",
  2344. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.topReplyLoveMinCount = $event)
  2345. }, null, 512), [
  2346. [vue.vModelText, $data.config.topReplyLoveMinCount]
  2347. ])
  2348. ])
  2349. ]),
  2350. _hoisted_33$1,
  2351. vue.createElementVNode("div", _hoisted_34$1, [
  2352. _hoisted_35$1,
  2353. vue.createElementVNode("div", _hoisted_36$1, [
  2354. vue.createVNode(_component_BaseSwitch, {
  2355. "model-value": $data.config.rememberLastReadFloor,
  2356. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => {
  2357. $data.config.rememberLastReadFloor = !$data.config.rememberLastReadFloor;
  2358. $data.config.autoJumpLastReadFloor = false;
  2359. })
  2360. }, null, 8, ["model-value"])
  2361. ])
  2362. ]),
  2363. vue.createElementVNode("div", _hoisted_37$1, [
  2364. _hoisted_38$1,
  2365. vue.createElementVNode("div", _hoisted_39$1, [
  2366. vue.createVNode(_component_BaseSwitch, {
  2367. modelValue: $data.config.autoJumpLastReadFloor,
  2368. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.autoJumpLastReadFloor = $event)
  2369. }, null, 8, ["modelValue"])
  2370. ])
  2371. ]),
  2372. _hoisted_40,
  2373. _hoisted_41,
  2374. vue.createVNode(_component_font_size_type),
  2375. vue.createElementVNode("div", _hoisted_42, [
  2376. _hoisted_43,
  2377. vue.createElementVNode("div", _hoisted_44, [
  2378. vue.createVNode(_component_BaseSwitch, {
  2379. modelValue: $data.config.openTag,
  2380. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.config.openTag = $event)
  2381. }, null, 8, ["modelValue"])
  2382. ])
  2383. ]),
  2384. vue.createElementVNode("div", _hoisted_45, [
  2385. _hoisted_46,
  2386. vue.createElementVNode("div", _hoisted_47, [
  2387. vue.createVNode(_component_BaseSwitch, {
  2388. modelValue: $data.config.base64,
  2389. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.base64 = $event)
  2390. }, null, 8, ["modelValue"])
  2391. ])
  2392. ]),
  2393. vue.createElementVNode("div", _hoisted_48, [
  2394. _hoisted_49,
  2395. vue.createElementVNode("div", _hoisted_50, [
  2396. vue.createVNode(_component_BaseSwitch, {
  2397. modelValue: $data.config.autoSignin,
  2398. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.autoSignin = $event)
  2399. }, null, 8, ["modelValue"])
  2400. ])
  2401. ]),
  2402. vue.createElementVNode("div", _hoisted_51, [
  2403. _hoisted_52,
  2404. vue.createElementVNode("div", _hoisted_53, [
  2405. vue.createVNode(_component_BaseSwitch, {
  2406. modelValue: $data.config.collectBrowserNotice,
  2407. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.collectBrowserNotice = $event)
  2408. }, null, 8, ["modelValue"])
  2409. ])
  2410. ]),
  2411. _hoisted_54,
  2412. vue.createElementVNode("div", _hoisted_55, [
  2413. _hoisted_56,
  2414. vue.createElementVNode("div", _hoisted_57, [
  2415. vue.createVNode(_component_BaseSwitch, {
  2416. modelValue: $data.activeEruda,
  2417. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.activeEruda = $event)
  2418. }, null, 8, ["modelValue"])
  2419. ])
  2420. ]),
  2421. _hoisted_58
  2422. ])
  2423. ])
  2424. ], 8, ["to"]);
  2425. }
  2426. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$9], ["__scopeId", "data-v-402be427"]]);
  2427. const _sfc_main$k = {
  2428. name: "Point",
  2429. components: { Icon },
  2430. inject: ["post", "isLogin"],
  2431. props: {
  2432. item: {
  2433. type: Object,
  2434. default() {
  2435. return {};
  2436. }
  2437. },
  2438. full: {
  2439. type: Boolean,
  2440. default() {
  2441. return true;
  2442. }
  2443. },
  2444. apiUrl: ""
  2445. },
  2446. methods: {
  2447. thankError() {
  2448. if (!this.isLogin) {
  2449. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  2450. }
  2451. if (this.item.username === window.user.username) {
  2452. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  2453. }
  2454. if (this.item.isThanked) {
  2455. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  2456. }
  2457. this.thank();
  2458. },
  2459. async thank() {
  2460. this.$emit("addThank");
  2461. let url = `${window.baseUrl}/thank/${this.apiUrl}?once=${this.post.once}`;
  2462. $.post(url).then((res) => {
  2463. if (!res.success) {
  2464. this.$emit("recallThank");
  2465. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  2466. }
  2467. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  2468. }, (err) => {
  2469. this.$emit("recallThank");
  2470. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  2471. eventBus.emit(CMD.REFRESH_ONCE);
  2472. });
  2473. }
  2474. }
  2475. };
  2476. const _hoisted_1$j = {
  2477. key: 2,
  2478. class: "link-num"
  2479. };
  2480. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2481. const _component_Icon = vue.resolveComponent("Icon");
  2482. return vue.openBlock(), vue.createElementBlock("div", {
  2483. class: "tool",
  2484. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  2485. }, [
  2486. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  2487. key: 0,
  2488. color: "red",
  2489. icon: "icon-park-solid:like"
  2490. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  2491. key: 1,
  2492. color: "rgb(224,42,42)",
  2493. icon: "icon-park-outline:like"
  2494. })),
  2495. $props.item.thankCount ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, vue.toDisplayString($props.item.thankCount), 1)) : vue.createCommentVNode("", true)
  2496. ]);
  2497. }
  2498. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$8], ["__scopeId", "data-v-b7c6664e"]]);
  2499. const _sfc_main$j = {};
  2500. const _withScopeId$c = (n2) => (vue.pushScopeId("data-v-e92e0529"), n2 = n2(), vue.popScopeId(), n2);
  2501. const _hoisted_1$i = { class: "more" };
  2502. const _hoisted_2$f = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2503. const _hoisted_3$c = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2504. const _hoisted_4$b = /* @__PURE__ */ _withScopeId$c(() => /* @__PURE__ */ vue.createElementVNode("div", null, null, -1));
  2505. const _hoisted_5$9 = [
  2506. _hoisted_2$f,
  2507. _hoisted_3$c,
  2508. _hoisted_4$b
  2509. ];
  2510. function _sfc_render$7(_ctx, _cache) {
  2511. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, _hoisted_5$9);
  2512. }
  2513. const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$7], ["__scopeId", "data-v-e92e0529"]]);
  2514. const _sfc_main$i = {
  2515. name: "Author",
  2516. components: { MoreIcon, Point, Icon },
  2517. inject: ["isLogin", "tags", "config", "isNight"],
  2518. props: {
  2519. modelValue: false,
  2520. comment: {
  2521. type: Object,
  2522. default() {
  2523. return {};
  2524. }
  2525. },
  2526. type: {
  2527. type: String,
  2528. default() {
  2529. return "list";
  2530. }
  2531. }
  2532. },
  2533. computed: {
  2534. eventBus() {
  2535. return eventBus;
  2536. },
  2537. CMD() {
  2538. return CMD;
  2539. },
  2540. pointInfo() {
  2541. return {
  2542. isThanked: this.comment.isThanked,
  2543. thankCount: this.comment.thankCount,
  2544. username: this.comment.username
  2545. };
  2546. },
  2547. myTags() {
  2548. return this.tags[this.comment.username] ?? [];
  2549. }
  2550. },
  2551. methods: {
  2552. addTag() {
  2553. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  2554. },
  2555. removeTag(tag) {
  2556. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  2557. },
  2558. checkIsLogin(emitName = "") {
  2559. if (!this.isLogin) {
  2560. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  2561. return false;
  2562. }
  2563. this.$emit(emitName);
  2564. return true;
  2565. },
  2566. addThank() {
  2567. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  2568. },
  2569. recallThank() {
  2570. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  2571. }
  2572. }
  2573. };
  2574. const _withScopeId$b = (n2) => (vue.pushScopeId("data-v-9041586a"), n2 = n2(), vue.popScopeId(), n2);
  2575. const _hoisted_1$h = { class: "Author-left" };
  2576. const _hoisted_2$e = ["href"];
  2577. const _hoisted_3$b = ["src"];
  2578. const _hoisted_4$a = { class: "info" };
  2579. const _hoisted_5$8 = { class: "top" };
  2580. const _hoisted_6$8 = { class: "texts" };
  2581. const _hoisted_7$7 = ["href"];
  2582. const _hoisted_8$7 = {
  2583. key: 0,
  2584. class: "owner"
  2585. };
  2586. const _hoisted_9$7 = {
  2587. key: 1,
  2588. class: "dup"
  2589. };
  2590. const _hoisted_10$6 = {
  2591. key: 2,
  2592. class: "mod"
  2593. };
  2594. const _hoisted_11$6 = { class: "my-tag" };
  2595. const _hoisted_12$6 = /* @__PURE__ */ _withScopeId$b(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  2596. const _hoisted_13$6 = ["onClick"];
  2597. const _hoisted_14$5 = { class: "floor" };
  2598. const _hoisted_15$5 = { class: "ago" };
  2599. const _hoisted_16$5 = { class: "Author-right" };
  2600. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  2601. const _component_Icon = vue.resolveComponent("Icon");
  2602. const _component_Point = vue.resolveComponent("Point");
  2603. const _component_MoreIcon = vue.resolveComponent("MoreIcon");
  2604. return vue.openBlock(), vue.createElementBlock("div", {
  2605. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  2606. }, [
  2607. vue.createElementVNode("div", _hoisted_1$h, [
  2608. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  2609. key: 0,
  2610. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", true)),
  2611. color: "#177EC9",
  2612. class: "expand-icon",
  2613. icon: "gravity-ui:chevrons-expand-up-right"
  2614. })) : vue.createCommentVNode("", true),
  2615. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  2616. key: 1,
  2617. class: "base-avatar",
  2618. href: `/member/${$props.comment.username}`
  2619. }, [
  2620. vue.createElementVNode("img", {
  2621. src: $props.comment.avatar,
  2622. alt: ""
  2623. }, null, 8, _hoisted_3$b)
  2624. ], 8, _hoisted_2$e)) : vue.createCommentVNode("", true),
  2625. vue.createElementVNode("div", _hoisted_4$a, [
  2626. vue.createElementVNode("div", _hoisted_5$8, [
  2627. vue.createElementVNode("span", _hoisted_6$8, [
  2628. vue.createElementVNode("strong", null, [
  2629. vue.createElementVNode("a", {
  2630. href: `/member/${$props.comment.username}`,
  2631. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  2632. }, vue.toDisplayString($props.comment.username), 11, _hoisted_7$7)
  2633. ]),
  2634. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$7, "OP")) : vue.createCommentVNode("", true),
  2635. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$7, "DUP")) : vue.createCommentVNode("", true),
  2636. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$6, "MOD")) : vue.createCommentVNode("", true),
  2637. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  2638. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  2639. return vue.openBlock(), vue.createElementBlock("span", _hoisted_11$6, [
  2640. _hoisted_12$6,
  2641. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  2642. vue.createElementVNode("i", {
  2643. class: "fa fa-trash-o remove",
  2644. onClick: ($event) => $options.removeTag(i)
  2645. }, null, 8, _hoisted_13$6)
  2646. ]);
  2647. }), 256)),
  2648. vue.createElementVNode("span", {
  2649. class: "add-tag ago",
  2650. onClick: _cache[1] || (_cache[1] = (...args) => $options.addTag && $options.addTag(...args)),
  2651. title: "添加标签"
  2652. }, "+")
  2653. ], 64)) : vue.createCommentVNode("", true)
  2654. ])
  2655. ]),
  2656. vue.createElementVNode("div", null, [
  2657. vue.createElementVNode("span", _hoisted_14$5, vue.toDisplayString($props.comment.floor) + "楼", 1),
  2658. vue.createElementVNode("span", _hoisted_15$5, vue.toDisplayString($props.comment.date), 1)
  2659. ])
  2660. ])
  2661. ]),
  2662. vue.createElementVNode("div", _hoisted_16$5, [
  2663. vue.withDirectives(vue.createVNode(_component_Point, {
  2664. item: $options.pointInfo,
  2665. onAddThank: $options.addThank,
  2666. onRecallThank: $options.recallThank,
  2667. "api-url": "reply/" + $props.comment.id
  2668. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  2669. [vue.vShow, $props.comment.thankCount]
  2670. ]),
  2671. vue.createVNode(_component_MoreIcon, {
  2672. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => $options.eventBus.emit($options.CMD.SHOW_COMMENT_OPTIONS, { ...$props.comment, top: $props.type === "top" }), ["stop"]))
  2673. })
  2674. ])
  2675. ], 2);
  2676. }
  2677. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$6], ["__scopeId", "data-v-9041586a"]]);
  2678. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  2679. __name: "BaseLoading",
  2680. props: {
  2681. size: { default: "normal" }
  2682. },
  2683. setup(__props) {
  2684. return (_ctx, _cache) => {
  2685. return vue.openBlock(), vue.createElementBlock("div", {
  2686. class: vue.normalizeClass(["loading", [_ctx.size]])
  2687. }, null, 2);
  2688. };
  2689. }
  2690. });
  2691. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-2697baa2"]]);
  2692. const _hoisted_1$g = {
  2693. key: 1,
  2694. class: "key-notice"
  2695. };
  2696. const _hoisted_2$d = { class: "key" };
  2697. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  2698. __name: "BaseButton",
  2699. props: {
  2700. keyboard: {},
  2701. active: { type: Boolean },
  2702. disabled: { type: Boolean },
  2703. loading: { type: Boolean },
  2704. size: { default: "normal" },
  2705. type: { default: "primary" }
  2706. },
  2707. emits: ["click"],
  2708. setup(__props) {
  2709. return (_ctx, _cache) => {
  2710. return vue.openBlock(), vue.createBlock(Tooltip, {
  2711. disabled: !_ctx.keyboard,
  2712. title: `快捷键: ${_ctx.keyboard}`
  2713. }, {
  2714. default: vue.withCtx(() => [
  2715. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  2716. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  2717. class: [
  2718. _ctx.active && "active",
  2719. _ctx.size,
  2720. _ctx.type,
  2721. (_ctx.disabled || _ctx.loading) && "disabled",
  2722. !_ctx.disabled && "hvr-grow"
  2723. ]
  2724. }), [
  2725. vue.createElementVNode("span", {
  2726. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  2727. }, [
  2728. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2729. ], 4),
  2730. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  2731. key: 0,
  2732. size: "small"
  2733. })) : vue.createCommentVNode("", true),
  2734. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  2735. vue.createElementVNode("span", _hoisted_2$d, vue.toDisplayString(_ctx.keyboard), 1)
  2736. ])) : vue.createCommentVNode("", true)
  2737. ], 16)
  2738. ]),
  2739. _: 3
  2740. }, 8, ["disabled", "title"]);
  2741. };
  2742. }
  2743. });
  2744. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-04f4c89d"]]);
  2745. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-0612e02f"), n2 = n2(), vue.popScopeId(), n2);
  2746. const _hoisted_1$f = { class: "get-cursor" };
  2747. const _hoisted_2$c = ["innerHTML"];
  2748. const _hoisted_3$a = { class: "toolbar" };
  2749. const _hoisted_4$9 = { class: "left" };
  2750. const _hoisted_5$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  2751. 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",
  2752. fill: "none",
  2753. stroke: "#929596",
  2754. "stroke-width": "2",
  2755. "stroke-linejoin": "round"
  2756. }, null, -1));
  2757. const _hoisted_6$7 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  2758. d: "M24 35C29 35 31 31 31 31H17C17 31 19 35 24 35Z",
  2759. stroke: "#929596",
  2760. "stroke-width": "2",
  2761. "stroke-linecap": "round",
  2762. "stroke-linejoin": "round"
  2763. }, null, -1));
  2764. const _hoisted_7$6 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  2765. d: "M31 18V22",
  2766. stroke: "#929596",
  2767. "stroke-width": "2",
  2768. "stroke-linecap": "round",
  2769. "stroke-linejoin": "round"
  2770. }, null, -1));
  2771. const _hoisted_8$6 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("path", {
  2772. d: "M17 18V22",
  2773. stroke: "#929596",
  2774. "stroke-width": "2",
  2775. "stroke-linecap": "round",
  2776. "stroke-linejoin": "round"
  2777. }, null, -1));
  2778. const _hoisted_9$6 = [
  2779. _hoisted_5$7,
  2780. _hoisted_6$7,
  2781. _hoisted_7$6,
  2782. _hoisted_8$6
  2783. ];
  2784. const _hoisted_10$5 = { class: "upload" };
  2785. const _hoisted_11$5 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  2786. width: "20",
  2787. height: "20",
  2788. viewBox: "0 0 48 48",
  2789. fill: "none",
  2790. xmlns: "http://www.w3.org/2000/svg"
  2791. }, [
  2792. /* @__PURE__ */ vue.createElementVNode("path", {
  2793. "fill-rule": "evenodd",
  2794. "clip-rule": "evenodd",
  2795. 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",
  2796. stroke: "#929596",
  2797. "stroke-width": "2",
  2798. "stroke-linecap": "round",
  2799. "stroke-linejoin": "round"
  2800. }),
  2801. /* @__PURE__ */ vue.createElementVNode("path", {
  2802. "fill-rule": "evenodd",
  2803. "clip-rule": "evenodd",
  2804. 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",
  2805. stroke: "#929596",
  2806. "stroke-width": "2",
  2807. "stroke-linecap": "round",
  2808. "stroke-linejoin": "round"
  2809. }),
  2810. /* @__PURE__ */ vue.createElementVNode("path", {
  2811. d: "M15 24L20 28L26 21L43 34V38C43 39.1046 42.1046 40 41 40H7C5.89543 40 5 39.1046 5 38V34L15 24Z",
  2812. fill: "none",
  2813. stroke: "#929596",
  2814. "stroke-width": "2",
  2815. "stroke-linejoin": "round"
  2816. })
  2817. ], -1));
  2818. const _hoisted_12$5 = {
  2819. key: 0,
  2820. style: { "color": "black", "font-size": "1.4rem" }
  2821. };
  2822. const _hoisted_13$5 = { class: "right" };
  2823. const _hoisted_14$4 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典表情", -1));
  2824. const _hoisted_15$4 = { class: "list" };
  2825. const _hoisted_16$4 = ["src", "onClick"];
  2826. const _hoisted_17$2 = { class: "emoji" };
  2827. const _hoisted_18$2 = { class: "title" };
  2828. const _hoisted_19$2 = { class: "list" };
  2829. const _hoisted_20$2 = ["onClick"];
  2830. const _sfc_main$f = {
  2831. __name: "PostEditor",
  2832. props: {
  2833. replyUser: null,
  2834. replyFloor: null,
  2835. useType: {
  2836. type: String,
  2837. default() {
  2838. return "reply-comment";
  2839. }
  2840. }
  2841. },
  2842. emits: ["close"],
  2843. setup(__props, { expose: __expose, emit: __emit }) {
  2844. let props = __props;
  2845. let { replyUser, replyFloor, useType } = props;
  2846. let replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  2847. const emits = __emit;
  2848. const post = vue.inject("post");
  2849. const show = vue.inject("show");
  2850. const isNight = vue.inject("isNight");
  2851. const allReplyUsers = vue.inject("allReplyUsers");
  2852. let isFocus = vue.ref(false);
  2853. const loading = vue.ref(false);
  2854. const uploadLoading = vue.ref(false);
  2855. const isShowEmoticons = vue.ref(false);
  2856. const editorId = vue.ref("editorId_" + Date.now());
  2857. const content = vue.ref(replyInfo);
  2858. const txtRef = vue.ref(null);
  2859. const cursorRef = vue.ref(null);
  2860. const emoticonsRef = vue.ref(null);
  2861. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  2862. vue.watch(props, (n2) => {
  2863. replyUser = props.replyUser;
  2864. replyFloor = props.replyFloor;
  2865. useType = props.useType;
  2866. replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  2867. content.value = replyInfo;
  2868. });
  2869. const emojiEmoticons = [
  2870. {
  2871. title: "小黄脸",
  2872. list: [
  2873. "😀",
  2874. "😁",
  2875. "😂",
  2876. "🤣",
  2877. "😅",
  2878. "😊",
  2879. "😋",
  2880. "😘",
  2881. "🥰",
  2882. "😗",
  2883. "🤩",
  2884. "🤔",
  2885. "🤨",
  2886. "😐",
  2887. "😑",
  2888. "🙄",
  2889. "😏",
  2890. "😪",
  2891. "😫",
  2892. "🥱",
  2893. "😜",
  2894. "😒",
  2895. "😔",
  2896. "😨",
  2897. "😰",
  2898. "😱",
  2899. "🥵",
  2900. "😡",
  2901. "🥳",
  2902. "🥺",
  2903. "🤭",
  2904. "🧐",
  2905. "😎",
  2906. "🤓",
  2907. "😭",
  2908. "🤑",
  2909. "🤮"
  2910. ]
  2911. },
  2912. {
  2913. title: "手势",
  2914. list: [
  2915. "🙋",
  2916. "🙎",
  2917. "🙅",
  2918. "🙇",
  2919. "🤷",
  2920. "🤏",
  2921. "👉",
  2922. "✌️",
  2923. "🤘",
  2924. "🤙",
  2925. "👌",
  2926. "🤌",
  2927. "👍",
  2928. "👎",
  2929. "👋",
  2930. "🤝",
  2931. "🙏",
  2932. "👏"
  2933. ]
  2934. },
  2935. {
  2936. title: "庆祝",
  2937. list: ["✨", "🎉", "🎊"]
  2938. },
  2939. {
  2940. title: "其他",
  2941. list: ["👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶", "🐒", "🙈", "🙉", "🙊", "🐵"]
  2942. }
  2943. ];
  2944. const classicsEmoticons = [
  2945. {
  2946. name: "[狗头]",
  2947. low: "https://i.imgur.com/io2SM1h.png",
  2948. high: "https://i.imgur.com/0icl60r.png"
  2949. },
  2950. {
  2951. name: "[马]",
  2952. low: "https://i.imgur.com/8EKZv7I.png",
  2953. high: "https://i.imgur.com/ANFUX52.png"
  2954. },
  2955. {
  2956. name: "[不高兴]",
  2957. low: "https://i.imgur.com/huX6coX.png",
  2958. high: "https://i.imgur.com/N7JEuvc.png"
  2959. },
  2960. {
  2961. name: "[呵呵]",
  2962. low: "https://i.imgur.com/RvoLAbX.png",
  2963. high: "https://i.imgur.com/xSzIqrK.png"
  2964. },
  2965. {
  2966. name: "[真棒]",
  2967. low: "https://i.imgur.com/xr1UOz1.png",
  2968. high: "https://i.imgur.com/w8YEw9Q.png"
  2969. },
  2970. {
  2971. name: "[鄙视]",
  2972. low: "https://i.imgur.com/u6jlqVq.png",
  2973. high: "https://i.imgur.com/8JFNANq.png"
  2974. },
  2975. {
  2976. name: "[疑问]",
  2977. low: "https://i.imgur.com/F29pmQ6.png",
  2978. high: "https://i.imgur.com/EbbTQAR.png"
  2979. },
  2980. {
  2981. name: "[吐舌]",
  2982. low: "https://i.imgur.com/InmIzl9.png",
  2983. high: "https://i.imgur.com/Ovj56Cd.png"
  2984. },
  2985. // {
  2986. // name: '[嘲笑]',
  2987. // low: 'https://i.imgur.com/BaWcsMR.png',
  2988. // high: 'https://i.imgur.com/0OGfJw4.png'
  2989. // },
  2990. // {
  2991. // name: '[滑稽]',
  2992. // low: 'https://i.imgur.com/lmbN0yI.png',
  2993. // high: 'https://i.imgur.com/Pc0wH85.png'
  2994. // },
  2995. {
  2996. name: "[笑眼]",
  2997. low: "https://i.imgur.com/ZveiiGy.png",
  2998. high: "https://i.imgur.com/PI1CfEr.png"
  2999. },
  3000. {
  3001. name: "[狂汗]",
  3002. low: "https://i.imgur.com/veWihk6.png",
  3003. high: "https://i.imgur.com/3LtHdQv.png"
  3004. },
  3005. {
  3006. name: "[大哭]",
  3007. low: "https://i.imgur.com/hu4oR6C.png",
  3008. high: "https://i.imgur.com/b4X9XLE.png"
  3009. },
  3010. {
  3011. name: "[喷]",
  3012. low: "https://i.imgur.com/bkw3VRr.png",
  3013. high: "https://i.imgur.com/wnZL13L.png"
  3014. },
  3015. {
  3016. name: "[苦笑]",
  3017. low: "https://i.imgur.com/VUWFktU.png",
  3018. high: "https://i.imgur.com/NAfspZ1.png"
  3019. },
  3020. {
  3021. name: "[喝酒]",
  3022. low: "https://i.imgur.com/2ZZSapE.png",
  3023. high: "https://i.imgur.com/rVbSVak.png"
  3024. },
  3025. {
  3026. name: "[吃瓜]",
  3027. low: "https://i.imgur.com/ee8Lq7H.png",
  3028. high: "https://i.imgur.com/0L26og9.png"
  3029. },
  3030. {
  3031. name: "[捂脸]",
  3032. low: "https://i.imgur.com/krir4IG.png",
  3033. high: "https://i.imgur.com/qqBqgVm.png"
  3034. },
  3035. {
  3036. name: "[呕]",
  3037. low: "https://i.imgur.com/6CUiUxv.png",
  3038. high: "https://i.imgur.com/kgdxRsG.png"
  3039. },
  3040. {
  3041. name: "[阴险]",
  3042. low: "https://i.imgur.com/MA8YqTP.png",
  3043. high: "https://i.imgur.com/e94jbaT.png"
  3044. },
  3045. {
  3046. name: "[怒]",
  3047. low: "https://i.imgur.com/n4kWfGB.png",
  3048. high: "https://i.imgur.com/iMXxNxh.png"
  3049. },
  3050. {
  3051. name: "[衰]",
  3052. low: "https://i.imgur.com/voHFDyQ.png",
  3053. high: "https://i.imgur.com/XffE6gu.png"
  3054. },
  3055. {
  3056. name: "[合十]",
  3057. low: "https://i.imgur.com/I8x3ang.png",
  3058. high: "https://i.imgur.com/T4rJVee.png"
  3059. },
  3060. {
  3061. name: "[赞]",
  3062. low: "https://i.imgur.com/lG44yUl.png",
  3063. high: "https://i.imgur.com/AoF5PLp.png"
  3064. },
  3065. {
  3066. name: "[踩]",
  3067. low: "https://i.imgur.com/cJp0uKZ.png",
  3068. high: "https://i.imgur.com/1XYGfXj.png"
  3069. },
  3070. {
  3071. name: "[爱心]",
  3072. low: "https://i.imgur.com/sLENaF5.png",
  3073. high: "https://i.imgur.com/dND56oX.png"
  3074. },
  3075. {
  3076. name: "[心碎]",
  3077. low: "https://i.imgur.com/AZxJzve.png",
  3078. high: "https://i.imgur.com/RiUsPci.png"
  3079. }
  3080. ];
  3081. const imgurClientIdPool = [
  3082. "3107b9ef8b316f3",
  3083. "442b04f26eefc8a",
  3084. "59cfebe717c09e4",
  3085. "60605aad4a62882",
  3086. "6c65ab1d3f5452a",
  3087. "83e123737849aa9",
  3088. "9311f6be1c10160",
  3089. "c4a4a563f698595",
  3090. "81be04b9e4a08ce"
  3091. ];
  3092. const editorClass = vue.computed(() => {
  3093. return [isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  3094. });
  3095. const cursorHtml = vue.computed(() => {
  3096. var _a;
  3097. if (!txtRef.value || !content.value)
  3098. return "";
  3099. let index2 = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  3100. return content.value.substring(0, index2).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  3101. });
  3102. const disabled = vue.computed(() => {
  3103. if (content.value) {
  3104. return content.value === replyInfo;
  3105. } else {
  3106. return true;
  3107. }
  3108. });
  3109. function focus() {
  3110. txtRef.value.focus();
  3111. }
  3112. __expose({ content, focus });
  3113. function drop(e2) {
  3114. e2.preventDefault();
  3115. upload(e2.dataTransfer.files[0]);
  3116. }
  3117. async function upload(file) {
  3118. if (!file)
  3119. return;
  3120. if (uploadLoading.value)
  3121. return;
  3122. uploadLoading.value = true;
  3123. const formData = new FormData();
  3124. formData.append("image", file);
  3125. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  3126. const clidenId = imgurClientIdPool[randomIndex];
  3127. const res = await fetch("https://api.imgur.com/3/upload", {
  3128. method: "POST",
  3129. headers: { Authorization: `Client-ID ${clidenId}` },
  3130. body: formData
  3131. });
  3132. uploadLoading.value = false;
  3133. if (res.ok) {
  3134. const resData = await res.json();
  3135. if (resData.success) {
  3136. return insert(" " + resData.data.link + " ");
  3137. }
  3138. }
  3139. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  3140. }
  3141. async function submit() {
  3142. if (disabled.value || loading.value)
  3143. return;
  3144. loading.value = true;
  3145. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  3146. let item2 = classicsEmoticons.find((v) => v.name === match);
  3147. if (item2) {
  3148. return item2.low + " ";
  3149. }
  3150. return match;
  3151. });
  3152. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  3153. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  3154. });
  3155. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  3156. let item2 = classicsEmoticons.find((v) => v.name === match);
  3157. if (item2) {
  3158. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  3159. }
  3160. return match;
  3161. });
  3162. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  3163. if (matchUsers) {
  3164. matchUsers.map((i) => {
  3165. let username = i.replace("@", "").replace(" ", "");
  3166. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  3167. });
  3168. }
  3169. show_content = show_content.replaceAll("\n", "<br/>");
  3170. let item = {
  3171. thankCount: 0,
  3172. isThanked: false,
  3173. isOp: post.value.username === window.user.username,
  3174. isDup: false,
  3175. id: Date.now(),
  3176. username: window.user.username,
  3177. avatar: window.user.avatar,
  3178. date: "几秒前",
  3179. floor: post.value.replyCount + 1,
  3180. reply_content: show_content ?? "",
  3181. children: [],
  3182. replyUsers: replyUser ? [replyUser] : [],
  3183. replyFloor: replyFloor || -1,
  3184. level: useType === "reply-comment" ? 1 : 0
  3185. };
  3186. item.hideCallUserReplyContent = item.reply_content;
  3187. if (item.replyUsers.length === 1) {
  3188. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  3189. }
  3190. console.log("回复", item);
  3191. let url = `${window.baseUrl}/t/${post.value.id}`;
  3192. $.post(url, { content: submit_content, once: post.value.once }).then(
  3193. // $.post(url, {content: submit_content, once: 123}).then(
  3194. (res) => {
  3195. loading.value = false;
  3196. let r2 = res.search("你上一条回复的内容和这条相同");
  3197. if (r2 > -1)
  3198. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  3199. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  3200. if (r2 > -1)
  3201. return eventBus.emit(CMD.SHOW_MSG, {
  3202. type: "error",
  3203. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  3204. });
  3205. let r22 = res.search("创建新回复");
  3206. if (r22 > -1) {
  3207. eventBus.emit(CMD.REFRESH_ONCE, res);
  3208. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  3209. let clientWidth = window.document.body.clientWidth;
  3210. let windowWidth = 1200;
  3211. let left = clientWidth / 2 - windowWidth / 2;
  3212. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  3213. newWin.document.write(res);
  3214. let loop = setInterval(function() {
  3215. if (newWin.closed) {
  3216. clearInterval(loop);
  3217. eventBus.emit(CMD.REFRESH_POST);
  3218. }
  3219. }, 1e3);
  3220. return;
  3221. }
  3222. content.value = replyInfo;
  3223. emits("close");
  3224. eventBus.emit(CMD.REFRESH_ONCE, res);
  3225. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  3226. eventBus.emit(CMD.ADD_REPLY, item);
  3227. },
  3228. (err) => {
  3229. console.log("err", err);
  3230. loading.value = false;
  3231. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  3232. }
  3233. ).catch((r2) => {
  3234. console.log("catch", r2);
  3235. });
  3236. }
  3237. function showEmoticons(e2) {
  3238. if (isShowEmoticons.value) {
  3239. return isShowEmoticons.value = false;
  3240. }
  3241. let rect = e2.currentTarget.getBoundingClientRect();
  3242. emoticonsRef.value.style.left = rect.left + 30 + "px";
  3243. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  3244. isShowEmoticons.value = true;
  3245. }
  3246. function off() {
  3247. eventBus.emit(CMD.SHOW_CALL, { show: false });
  3248. eventBus.off(CMD.SET_CALL);
  3249. }
  3250. function checkHeight2() {
  3251. txtRef.value.style.height = 0;
  3252. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  3253. }
  3254. function insert(str) {
  3255. let cursorPos = txtRef.value.selectionStart;
  3256. let start = content.value.slice(0, cursorPos);
  3257. let end = content.value.slice(cursorPos, content.value.length);
  3258. content.value = start + str + end;
  3259. let moveCursorPos = start.length + str.length;
  3260. setTimeout(() => {
  3261. txtRef.value.focus();
  3262. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3263. checkHeight2();
  3264. });
  3265. }
  3266. function showCallPopover(text) {
  3267. let r2 = cursorRef.value.getBoundingClientRect();
  3268. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  3269. eventBus.off(CMD.SET_CALL);
  3270. eventBus.on(CMD.SET_CALL, (e2) => {
  3271. let cursorPos = txtRef.value.selectionStart;
  3272. let start = content.value.slice(0, cursorPos);
  3273. let end = content.value.slice(cursorPos, content.value.length);
  3274. let lastCallPos = start.lastIndexOf("@");
  3275. start = content.value.slice(0, lastCallPos + 1);
  3276. if (e2 === "管理员") {
  3277. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid";
  3278. }
  3279. if (e2 === "所有人") {
  3280. e2 = allReplyUsers.value.map((v, i) => {
  3281. if (i)
  3282. return "@" + v;
  3283. else
  3284. return v;
  3285. }).join(" ");
  3286. }
  3287. content.value = start + e2 + " " + end;
  3288. let moveCursorPos = start.length + e2.length + 1;
  3289. setTimeout(() => {
  3290. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3291. checkHeight2();
  3292. });
  3293. eventBus.off(CMD.SET_CALL);
  3294. });
  3295. }
  3296. function onKeydown(e2) {
  3297. let code = e2.keyCode;
  3298. switch (code) {
  3299. case 8:
  3300. if (content.value === "@") {
  3301. off();
  3302. }
  3303. break;
  3304. case 37:
  3305. case 38:
  3306. case 39:
  3307. case 40:
  3308. setTimeout(() => onInput({ data: "" }), 100);
  3309. break;
  3310. case 27:
  3311. e2.preventDefault();
  3312. e2.stopPropagation();
  3313. e2.stopImmediatePropagation();
  3314. return false;
  3315. case 13:
  3316. if (e2.ctrlKey)
  3317. submit();
  3318. if (e2.metaKey)
  3319. submit();
  3320. break;
  3321. }
  3322. }
  3323. function onInput(e2) {
  3324. let cursorPos = txtRef.value.selectionStart;
  3325. if (!content.value)
  3326. return;
  3327. if (e2.data === " ") {
  3328. return off();
  3329. }
  3330. if (e2.data === "@") {
  3331. if (content.value.length !== 1) {
  3332. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  3333. return showCallPopover("");
  3334. }
  3335. } else {
  3336. return showCallPopover("");
  3337. }
  3338. off();
  3339. } else {
  3340. let judgeStr = content.value.slice(0, cursorPos);
  3341. let lastCallPos = judgeStr.lastIndexOf("@");
  3342. if (lastCallPos === -1) {
  3343. return off();
  3344. }
  3345. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  3346. let hasSpace = callStr.includes(" ");
  3347. if (hasSpace) {
  3348. off();
  3349. } else {
  3350. if (lastCallPos === 0) {
  3351. return showCallPopover(callStr.replace("@", ""));
  3352. }
  3353. if (content.value.length !== 1) {
  3354. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  3355. return showCallPopover(callStr.replace("@", ""));
  3356. }
  3357. } else {
  3358. return showCallPopover(callStr.replace("@", ""));
  3359. }
  3360. off();
  3361. }
  3362. }
  3363. }
  3364. function onPaste(e2) {
  3365. const dataTransferItemList = e2.clipboardData.items;
  3366. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  3367. return item.type.indexOf("image") !== -1;
  3368. });
  3369. if (items.length === 0) {
  3370. return;
  3371. }
  3372. const dataTransferItem = items[0];
  3373. const blob = dataTransferItem.getAsFile();
  3374. upload(blob);
  3375. }
  3376. function onBlur() {
  3377. document.removeEventListener("paste", onPaste);
  3378. isFocus.value = false;
  3379. }
  3380. function onFocusin() {
  3381. document.addEventListener("paste", onPaste);
  3382. }
  3383. vue.watch(() => show, (n2) => {
  3384. if (n2.value)
  3385. isShowEmoticons.value = false;
  3386. }, { deep: true });
  3387. vue.onMounted(() => {
  3388. $(`.${editorId.value}`).each(function() {
  3389. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  3390. }).on("input", function() {
  3391. this.style.height = 0;
  3392. this.style.height = this.scrollHeight + "px";
  3393. });
  3394. });
  3395. return (_ctx, _cache) => {
  3396. return vue.openBlock(), vue.createElementBlock("div", {
  3397. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  3398. }, [
  3399. vue.withDirectives(vue.createElementVNode("textarea", {
  3400. class: vue.normalizeClass(["post-editor", editorId.value]),
  3401. ref_key: "txtRef",
  3402. ref: txtRef,
  3403. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  3404. onBlur,
  3405. onFocusin,
  3406. placeholder: "请尽量让自己的回复能够对别人有帮助",
  3407. onInput,
  3408. onKeydown,
  3409. onDrop: drop,
  3410. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  3411. }, null, 34), [
  3412. [vue.vModelText, content.value]
  3413. ]),
  3414. vue.createElementVNode("div", _hoisted_1$f, [
  3415. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$c),
  3416. vue.createElementVNode("span", {
  3417. class: "cursor",
  3418. ref_key: "cursorRef",
  3419. ref: cursorRef
  3420. }, "|", 512)
  3421. ]),
  3422. vue.createElementVNode("div", _hoisted_3$a, [
  3423. vue.createElementVNode("div", _hoisted_4$9, [
  3424. (vue.openBlock(), vue.createElementBlock("svg", {
  3425. onClick: showEmoticons,
  3426. width: "20",
  3427. height: "20",
  3428. viewBox: "0 0 48 48",
  3429. fill: "none",
  3430. xmlns: "http://www.w3.org/2000/svg"
  3431. }, _hoisted_9$6)),
  3432. vue.createElementVNode("div", _hoisted_10$5, [
  3433. vue.createElementVNode("input", {
  3434. type: "file",
  3435. accept: "image/*",
  3436. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  3437. }, null, 32),
  3438. _hoisted_11$5
  3439. ]),
  3440. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12$5, "上传中.....")) : vue.createCommentVNode("", true)
  3441. ]),
  3442. vue.createElementVNode("div", _hoisted_13$5, [
  3443. vue.createVNode(BaseButton, {
  3444. size: "small",
  3445. disabled: disabled.value,
  3446. loading: loading.value,
  3447. onClick: submit
  3448. }, {
  3449. default: vue.withCtx(() => [
  3450. vue.createTextVNode("回复 ")
  3451. ]),
  3452. _: 1
  3453. }, 8, ["disabled", "loading"])
  3454. ])
  3455. ]),
  3456. vue.withDirectives(vue.createElementVNode("div", {
  3457. class: "emoticon-pack",
  3458. ref_key: "emoticonsRef",
  3459. ref: emoticonsRef
  3460. }, [
  3461. vue.createElementVNode("i", {
  3462. class: "fa fa-times",
  3463. "aria-hidden": "true",
  3464. onClick: _cache[3] || (_cache[3] = ($event) => isShowEmoticons.value = false)
  3465. }),
  3466. _hoisted_14$4,
  3467. vue.createElementVNode("div", _hoisted_15$4, [
  3468. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(classicsEmoticons, (item) => {
  3469. return vue.createElementVNode("img", {
  3470. src: item.high,
  3471. onClick: ($event) => {
  3472. insert(item.name);
  3473. isShowEmoticons.value = false;
  3474. }
  3475. }, null, 8, _hoisted_16$4);
  3476. }), 64))
  3477. ]),
  3478. vue.createElementVNode("div", _hoisted_17$2, [
  3479. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiEmoticons, (item) => {
  3480. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  3481. vue.createElementVNode("div", _hoisted_18$2, vue.toDisplayString(item.title), 1),
  3482. vue.createElementVNode("div", _hoisted_19$2, [
  3483. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  3484. return vue.openBlock(), vue.createElementBlock("span", {
  3485. onClick: ($event) => {
  3486. insert(emoji);
  3487. isShowEmoticons.value = false;
  3488. }
  3489. }, vue.toDisplayString(emoji), 9, _hoisted_20$2);
  3490. }), 256))
  3491. ])
  3492. ], 64);
  3493. }), 64))
  3494. ])
  3495. ], 512), [
  3496. [vue.vShow, isShowEmoticons.value]
  3497. ])
  3498. ], 2);
  3499. };
  3500. }
  3501. };
  3502. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0612e02f"]]);
  3503. const _hoisted_1$e = {
  3504. key: 0,
  3505. class: "html-wrapper"
  3506. };
  3507. const _hoisted_2$b = ["innerHTML"];
  3508. const checkHeight = 900;
  3509. const _sfc_main$e = {
  3510. __name: "BaseHtmlRender",
  3511. props: ["html"],
  3512. setup(__props) {
  3513. const config2 = vue.inject("config");
  3514. const props = __props;
  3515. const contentRef = vue.ref(null);
  3516. const htmlMask = vue.ref(false);
  3517. const handOpen = vue.ref(false);
  3518. function mouseup(e2) {
  3519. if (!config2.value.base64)
  3520. return;
  3521. let selectionText = window.win().getSelection().toString();
  3522. if (selectionText) {
  3523. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  3524. if (r2) {
  3525. if (r2[0].length < 4)
  3526. return;
  3527. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  3528. }
  3529. }
  3530. }
  3531. vue.watch(config2.value, (newVale) => {
  3532. if (!newVale.contentAutoCollapse) {
  3533. htmlMask.value = false;
  3534. }
  3535. });
  3536. vue.watch([() => contentRef.value, () => props.html], () => {
  3537. if (!contentRef.value || !props.html)
  3538. return;
  3539. if (!config2.value.contentAutoCollapse)
  3540. return;
  3541. contentRef.value.querySelectorAll("img").forEach((item) => {
  3542. item.removeEventListener("load", checkContentHeight);
  3543. item.addEventListener("load", checkContentHeight);
  3544. });
  3545. checkContentHeight();
  3546. }, { immediate: true, flush: "post" });
  3547. function checkContentHeight() {
  3548. if (handOpen.value)
  3549. return;
  3550. let rect = contentRef.value.getBoundingClientRect();
  3551. htmlMask.value = rect.height >= checkHeight;
  3552. }
  3553. return (_ctx, _cache) => {
  3554. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
  3555. vue.createElementVNode("div", {
  3556. class: vue.normalizeClass({ htmlMask: htmlMask.value })
  3557. }, [
  3558. vue.createElementVNode("div", {
  3559. ref_key: "contentRef",
  3560. ref: contentRef,
  3561. innerHTML: props.html,
  3562. onMouseup: mouseup
  3563. }, null, 40, _hoisted_2$b)
  3564. ], 2),
  3565. htmlMask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  3566. key: 0,
  3567. class: "expand",
  3568. onClick: _cache[0] || (_cache[0] = ($event) => {
  3569. htmlMask.value = false;
  3570. handOpen.value = true;
  3571. })
  3572. }, "展开")) : vue.createCommentVNode("", true)
  3573. ])) : vue.createCommentVNode("", true);
  3574. };
  3575. }
  3576. };
  3577. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-f8165980"]]);
  3578. const _sfc_main$d = {
  3579. name: "Comment",
  3580. components: { MoreIcon, BaseHtmlRender, Author, PostEditor, Point },
  3581. inject: ["post", "show", "isNight", "config"],
  3582. props: {
  3583. modelValue: {
  3584. reply_content: ""
  3585. },
  3586. type: {
  3587. type: String,
  3588. default() {
  3589. return "list";
  3590. }
  3591. }
  3592. },
  3593. data() {
  3594. return {
  3595. edit: false,
  3596. ding: false,
  3597. expand: true,
  3598. expandWrong: false,
  3599. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  3600. cssStyle: null,
  3601. floor: this.modelValue.floor
  3602. };
  3603. },
  3604. watch: {
  3605. show(e2) {
  3606. if (e2) {
  3607. this.edit = false;
  3608. }
  3609. },
  3610. postDetailWidth(n2, o) {
  3611. this.checkIsTooLong(n2);
  3612. }
  3613. },
  3614. computed: {
  3615. eventBus() {
  3616. return eventBus;
  3617. },
  3618. CMD() {
  3619. return CMD;
  3620. },
  3621. CommentDisplayType() {
  3622. return CommentDisplayType;
  3623. },
  3624. myClass() {
  3625. return {
  3626. isOp: this.modelValue.isOp,
  3627. ding: this.ding,
  3628. isLevelOne: this.modelValue.level === 0,
  3629. ["c_" + this.floor]: this.type !== "top"
  3630. };
  3631. }
  3632. },
  3633. mounted() {
  3634. this.checkIsTooLong();
  3635. },
  3636. methods: {
  3637. checkIsTooLong() {
  3638. let rect = this.$refs.comment.getBoundingClientRect();
  3639. let postDetailWidth = document.body.clientWidth;
  3640. let ban = postDetailWidth / 2;
  3641. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  3642. this.expand = false;
  3643. let padding = 2;
  3644. this.cssStyle = {
  3645. padding: "1rem 0",
  3646. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  3647. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  3648. background: this.isNight ? "#18222d" : "white"
  3649. };
  3650. }
  3651. },
  3652. //高亮一下
  3653. showDing() {
  3654. this.ding = true;
  3655. setTimeout(() => {
  3656. this.ding = false;
  3657. }, 2e3);
  3658. },
  3659. toggle() {
  3660. this.expand = !this.expand;
  3661. }
  3662. }
  3663. };
  3664. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-312e9541"), n2 = n2(), vue.popScopeId(), n2);
  3665. const _hoisted_1$d = ["data-floor"];
  3666. const _hoisted_2$a = { class: "comment-content" };
  3667. const _hoisted_3$9 = { class: "right" };
  3668. const _hoisted_4$8 = { class: "w" };
  3669. const _hoisted_5$6 = {
  3670. key: 0,
  3671. class: "wrong-wrapper"
  3672. };
  3673. const _hoisted_6$6 = ["href"];
  3674. const _hoisted_7$5 = { class: "del-line" };
  3675. const _hoisted_8$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("i", {
  3676. class: "fa fa-question-circle-o wrong-icon",
  3677. "aria-hidden": "true"
  3678. }, null, -1));
  3679. const _hoisted_9$5 = {
  3680. key: 0,
  3681. class: "warning"
  3682. };
  3683. const _hoisted_10$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  3684. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  3685. const _hoisted_12$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  3686. const _hoisted_13$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  3687. const _hoisted_14$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  3688. const _hoisted_15$3 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("a", {
  3689. href: "https://github.com/zyronon/web-scripts/issues",
  3690. target: "_blank"
  3691. }, "这里", -1));
  3692. const _hoisted_16$3 = { class: "simple-wrapper" };
  3693. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  3694. const _component_Author = vue.resolveComponent("Author");
  3695. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  3696. const _component_Comment = vue.resolveComponent("Comment", true);
  3697. return vue.openBlock(), vue.createElementBlock("div", {
  3698. class: vue.normalizeClass(["comment", $options.myClass]),
  3699. ref: "comment",
  3700. "data-floor": $data.floor
  3701. }, [
  3702. vue.createVNode(_component_Author, {
  3703. modelValue: $data.expand,
  3704. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  3705. comment: $props.modelValue,
  3706. type: $props.type
  3707. }, null, 8, ["modelValue", "comment", "type"]),
  3708. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  3709. key: 0,
  3710. class: "more ago",
  3711. onClick: _cache[1] || (_cache[1] = ($event) => $data.expand = !$data.expand)
  3712. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  3713. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  3714. key: 1,
  3715. class: "comment-content-w",
  3716. style: vue.normalizeStyle($data.cssStyle)
  3717. }, [
  3718. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  3719. key: 0,
  3720. class: "more ago",
  3721. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  3722. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  3723. vue.createElementVNode("div", _hoisted_2$a, [
  3724. vue.createElementVNode("div", {
  3725. class: "left expand-line",
  3726. onClick: _cache[3] || (_cache[3] = (...args) => $options.toggle && $options.toggle(...args))
  3727. }),
  3728. vue.createElementVNode("div", _hoisted_3$9, [
  3729. vue.createElementVNode("div", _hoisted_4$8, [
  3730. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$6, [
  3731. vue.createElementVNode("span", {
  3732. onClick: _cache[4] || (_cache[4] = ($event) => $data.expandWrong = !$data.expandWrong),
  3733. title: "点击楼层号查看提示"
  3734. }, [
  3735. vue.createElementVNode("a", {
  3736. href: "/member/" + $props.modelValue.replyUsers[0]
  3737. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$6),
  3738. vue.createElementVNode("span", _hoisted_7$5, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  3739. _hoisted_8$5
  3740. ]),
  3741. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$5, [
  3742. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  3743. _hoisted_10$4,
  3744. vue.createTextVNode(" 原因可能有下面几种: "),
  3745. _hoisted_11$4,
  3746. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  3747. _hoisted_12$4,
  3748. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  3749. _hoisted_13$4,
  3750. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  3751. _hoisted_14$3,
  3752. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  3753. _hoisted_15$3,
  3754. vue.createTextVNode("反馈 ")
  3755. ])) : vue.createCommentVNode("", true)
  3756. ])) : vue.createCommentVNode("", true),
  3757. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && this.type !== "top" ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  3758. key: 1,
  3759. class: "reply_content",
  3760. html: $props.modelValue.hideCallUserReplyContent
  3761. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  3762. key: 2,
  3763. class: "reply_content",
  3764. html: $props.modelValue.reply_content
  3765. }, null, 8, ["html"]))
  3766. ]),
  3767. vue.createElementVNode("div", _hoisted_16$3, [
  3768. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index2) => {
  3769. return vue.openBlock(), vue.createBlock(_component_Comment, {
  3770. modelValue: $props.modelValue.children[index2],
  3771. "onUpdate:modelValue": ($event) => $props.modelValue.children[index2] = $event,
  3772. key: index2
  3773. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  3774. }), 128))
  3775. ])
  3776. ])
  3777. ]),
  3778. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  3779. key: 1,
  3780. class: "more ago",
  3781. onClick: _cache[5] || (_cache[5] = ($event) => $data.expand = !$data.expand)
  3782. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  3783. ], 4)) : vue.createCommentVNode("", true)
  3784. ], 10, _hoisted_1$d);
  3785. }
  3786. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5], ["__scopeId", "data-v-312e9541"]]);
  3787. const _sfc_main$c = {
  3788. name: "Toolbar",
  3789. components: { Icon, BaseLoading },
  3790. inject: [
  3791. "isLogin",
  3792. "post",
  3793. "pageType"
  3794. ],
  3795. data() {
  3796. return {
  3797. timer: null,
  3798. loading: false,
  3799. loading3: false
  3800. };
  3801. },
  3802. methods: {
  3803. checkIsLogin(emitName = "") {
  3804. if (!this.isLogin) {
  3805. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3806. return false;
  3807. }
  3808. this.$emit(emitName);
  3809. return true;
  3810. },
  3811. async toggleFavorite() {
  3812. if (config.collectBrowserNotice) {
  3813. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记添加到书签哦" });
  3814. }
  3815. if (!this.checkIsLogin())
  3816. return;
  3817. let isFavorite = this.post.isFavorite;
  3818. let url = `${window.baseUrl}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  3819. this.loading = true;
  3820. let apiRes = await fetch(url);
  3821. this.loading = false;
  3822. if (apiRes.redirected) {
  3823. let htmlText = await apiRes.text();
  3824. if (htmlText.search(this.post.isFavorite ? "加入收藏" : "取消收藏")) {
  3825. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  3826. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  3827. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  3828. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  3829. return;
  3830. }
  3831. }
  3832. eventBus.emit(CMD.REFRESH_ONCE);
  3833. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  3834. }
  3835. }
  3836. };
  3837. const _hoisted_1$c = { class: "toolbar" };
  3838. const _hoisted_2$9 = { class: "left" };
  3839. const _hoisted_3$8 = { class: "right" };
  3840. const _hoisted_4$7 = { key: 2 };
  3841. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  3842. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  3843. const _component_Icon = vue.resolveComponent("Icon");
  3844. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
  3845. vue.createElementVNode("div", _hoisted_2$9, [
  3846. vue.createElementVNode("div", null, vue.toDisplayString($options.post.createDate.substring(0, 16)), 1)
  3847. ]),
  3848. vue.createElementVNode("div", _hoisted_3$8, [
  3849. vue.createElementVNode("div", {
  3850. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  3851. onClick: _cache[0] || (_cache[0] = (...args) => $options.toggleFavorite && $options.toggleFavorite(...args))
  3852. }, [
  3853. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  3854. key: 0,
  3855. size: "small"
  3856. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  3857. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3858. key: 0,
  3859. color: "rgb(224,42,42)",
  3860. icon: "iconoir:star-solid"
  3861. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  3862. key: 1,
  3863. icon: "iconoir:star"
  3864. }))
  3865. ], 64)),
  3866. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$7, vue.toDisplayString($options.post.collectCount), 1)) : vue.createCommentVNode("", true)
  3867. ], 2),
  3868. vue.createElementVNode("div", {
  3869. class: "tool",
  3870. onClick: _cache[1] || (_cache[1] = ($event) => $options.checkIsLogin("reply"))
  3871. }, [
  3872. vue.createVNode(_component_Icon, { icon: "mynaui:message" })
  3873. ])
  3874. ])
  3875. ]);
  3876. }
  3877. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$4], ["__scopeId", "data-v-6234240d"]]);
  3878. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-0869dab5"), n2 = n2(), vue.popScopeId(), n2);
  3879. const _hoisted_1$b = {
  3880. class: "comment",
  3881. ref: "comment"
  3882. };
  3883. const _hoisted_2$8 = ["href"];
  3884. const _hoisted_3$7 = ["src"];
  3885. const _hoisted_4$6 = { class: "texts" };
  3886. const _hoisted_5$5 = {
  3887. key: 0,
  3888. class: "point"
  3889. };
  3890. const _hoisted_6$5 = { class: "link-num" };
  3891. const _hoisted_7$4 = { class: "my-tag" };
  3892. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3893. const _hoisted_9$4 = {
  3894. key: 2,
  3895. class: "ago"
  3896. };
  3897. const _hoisted_10$3 = {
  3898. key: 3,
  3899. class: "mod"
  3900. };
  3901. const _hoisted_11$3 = {
  3902. key: 4,
  3903. class: "owner"
  3904. };
  3905. const _hoisted_12$3 = ["href"];
  3906. const _hoisted_13$3 = {
  3907. key: 5,
  3908. class: "owner"
  3909. };
  3910. const _hoisted_14$2 = {
  3911. key: 6,
  3912. class: "mod"
  3913. };
  3914. const _hoisted_15$2 = {
  3915. key: 7,
  3916. class: "ago"
  3917. };
  3918. const _hoisted_16$2 = { class: "my-tag" };
  3919. const _hoisted_17$1 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3920. const _hoisted_18$1 = {
  3921. key: 9,
  3922. class: "point"
  3923. };
  3924. const _hoisted_19$1 = { class: "link-num" };
  3925. const _hoisted_20$1 = ["href"];
  3926. const _hoisted_21$1 = ["src"];
  3927. const _hoisted_22$1 = { class: "Author-right" };
  3928. const _hoisted_23$1 = { class: "floor" };
  3929. const _hoisted_24$1 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  3930. const _hoisted_25$1 = [
  3931. _hoisted_24$1
  3932. ];
  3933. const _sfc_main$b = {
  3934. __name: "SingleComment",
  3935. props: {
  3936. comment: {
  3937. reply_content: ""
  3938. },
  3939. isRight: {
  3940. type: Boolean,
  3941. default() {
  3942. return false;
  3943. }
  3944. }
  3945. },
  3946. setup(__props) {
  3947. const config2 = vue.inject("config");
  3948. const isLogin = vue.inject("isLogin");
  3949. const tags = vue.inject("tags");
  3950. const props = __props;
  3951. const myTags = vue.computed(() => {
  3952. return tags[props.comment.username] ?? [];
  3953. });
  3954. function jump() {
  3955. eventBus.emit(CMD.JUMP, props.comment.floor);
  3956. }
  3957. return (_ctx, _cache) => {
  3958. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
  3959. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  3960. key: 0,
  3961. class: "base-avatar",
  3962. href: `/member/${__props.comment.username}`
  3963. }, [
  3964. vue.createElementVNode("img", {
  3965. src: __props.comment.avatar,
  3966. alt: ""
  3967. }, null, 8, _hoisted_3$7)
  3968. ], 8, _hoisted_2$8)) : vue.createCommentVNode("", true),
  3969. vue.createElementVNode("div", {
  3970. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  3971. }, [
  3972. vue.createElementVNode("div", _hoisted_4$6, [
  3973. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
  3974. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  3975. key: 0,
  3976. color: "red",
  3977. icon: "icon-park-solid:like"
  3978. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  3979. key: 1,
  3980. color: "rgb(224,42,42)",
  3981. icon: "icon-park-outline:like"
  3982. })),
  3983. vue.createElementVNode("div", _hoisted_6$5, vue.toDisplayString(__props.comment.thankCount), 1)
  3984. ])) : vue.createCommentVNode("", true),
  3985. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  3986. return vue.openBlock(), vue.createElementBlock("span", _hoisted_7$4, [
  3987. _hoisted_8$4,
  3988. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  3989. ]);
  3990. }), 256)) : vue.createCommentVNode("", true),
  3991. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9$4, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  3992. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$3, "MOD")) : vue.createCommentVNode("", true),
  3993. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$3, "OP")) : vue.createCommentVNode("", true),
  3994. vue.createElementVNode("a", {
  3995. href: `/member/${__props.comment.username}`,
  3996. class: "username"
  3997. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_12$3),
  3998. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$3, "OP")) : vue.createCommentVNode("", true),
  3999. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$2, "MOD")) : vue.createCommentVNode("", true),
  4000. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_15$2, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4001. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  4002. return vue.openBlock(), vue.createElementBlock("span", _hoisted_16$2, [
  4003. _hoisted_17$1,
  4004. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4005. ]);
  4006. }), 256)) : vue.createCommentVNode("", true),
  4007. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$1, [
  4008. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4009. key: 0,
  4010. color: "red",
  4011. icon: "icon-park-solid:like"
  4012. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4013. key: 1,
  4014. color: "rgb(224,42,42)",
  4015. icon: "icon-park-outline:like"
  4016. })),
  4017. vue.createElementVNode("div", _hoisted_19$1, vue.toDisplayString(__props.comment.thankCount), 1)
  4018. ])) : vue.createCommentVNode("", true)
  4019. ]),
  4020. vue.createVNode(BaseHtmlRender, {
  4021. class: "reply_content",
  4022. html: __props.comment.reply_content
  4023. }, null, 8, ["html"])
  4024. ], 2),
  4025. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4026. key: 1,
  4027. class: "base-avatar",
  4028. href: `/member/${__props.comment.username}`
  4029. }, [
  4030. vue.createElementVNode("img", {
  4031. src: __props.comment.avatar,
  4032. alt: ""
  4033. }, null, 8, _hoisted_21$1)
  4034. ], 8, _hoisted_20$1)) : vue.createCommentVNode("", true),
  4035. vue.createElementVNode("div", _hoisted_22$1, [
  4036. vue.createElementVNode("div", _hoisted_23$1, vue.toDisplayString(__props.comment.floor) + "楼", 1),
  4037. vue.createElementVNode("div", {
  4038. class: "tool jump",
  4039. onClick: jump
  4040. }, _hoisted_25$1)
  4041. ])
  4042. ], 512);
  4043. };
  4044. }
  4045. };
  4046. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0869dab5"]]);
  4047. function debounce(fn, delay, scope) {
  4048. let timer = null;
  4049. return function() {
  4050. let context = scope || this, args = arguments;
  4051. clearTimeout(timer);
  4052. timer = setTimeout(function() {
  4053. fn.apply(context, args);
  4054. timer = null;
  4055. }, delay);
  4056. };
  4057. }
  4058. async function copy(text) {
  4059. if (navigator.clipboard) {
  4060. await navigator.clipboard.writeText(text);
  4061. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  4062. return true;
  4063. } else {
  4064. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  4065. }
  4066. }
  4067. const _sfc_main$a = {
  4068. name: "FromBottomDialog",
  4069. props: {
  4070. modelValue: {
  4071. type: Boolean,
  4072. default: false
  4073. },
  4074. mode: {
  4075. type: String,
  4076. // default: 'dark'
  4077. default: "light"
  4078. // default: 'white'
  4079. },
  4080. maskMode: {
  4081. type: String,
  4082. default: "dark"
  4083. },
  4084. height: {
  4085. type: String,
  4086. default: "70vh"
  4087. },
  4088. showHengGang: {
  4089. type: Boolean,
  4090. default: true
  4091. },
  4092. pageId: {
  4093. type: String,
  4094. default: null,
  4095. required: true
  4096. },
  4097. borderRadius: {
  4098. type: String,
  4099. default: "1rem 1rem 0 0"
  4100. },
  4101. tag: {
  4102. type: String,
  4103. default: ""
  4104. }
  4105. },
  4106. watch: {
  4107. modelValue(newVal) {
  4108. let page = document.getElementById(this.pageId);
  4109. if (newVal) {
  4110. page.style.overflow = "hidden";
  4111. this.scroll = page.scrollTop;
  4112. let mask = $(`<div class="mask fade-in ${this.maskMode}"></div>`);
  4113. mask.on("click", (e2) => {
  4114. this.hide(false);
  4115. });
  4116. page.appendChild(mask[0]);
  4117. } else {
  4118. page.style.overflow = "unset";
  4119. let mask = $(".mask");
  4120. mask.removeClass("fade-in");
  4121. mask.addClass("fade-out");
  4122. setTimeout(() => {
  4123. mask.remove();
  4124. }, 250);
  4125. }
  4126. }
  4127. },
  4128. data() {
  4129. return {
  4130. scroll: 0,
  4131. startLocationY: 0,
  4132. moveYDistance: 0,
  4133. startTime: 0,
  4134. pagePosition: null
  4135. };
  4136. },
  4137. computed: {},
  4138. created() {
  4139. },
  4140. methods: {
  4141. beforeEnter(el) {
  4142. el.style["transition-duration"] = `250ms`;
  4143. el.style["transform"] = `translate3d(0,${this.height},0)`;
  4144. },
  4145. enter(el, done) {
  4146. setTimeout(() => {
  4147. el.style["transform"] = `translate3d(0,0,0)`;
  4148. }, 0);
  4149. setTimeout(() => {
  4150. el.style["transform"] = `none`;
  4151. done();
  4152. }, 250);
  4153. },
  4154. afterEnter() {
  4155. },
  4156. beforeLeave(el) {
  4157. el.style["transition-duration"] = `250ms`;
  4158. el.style["transform"] = `translate3d(0,0,0)`;
  4159. },
  4160. leave(el, done) {
  4161. let maxHeight = $(".FromBottomDialog").css("max-height");
  4162. el.style["transform"] = `translate3d(0,${maxHeight},0)`;
  4163. setTimeout(done, 250);
  4164. },
  4165. afterLeave() {
  4166. },
  4167. hide(val = false) {
  4168. this.$emit("update:modelValue", val);
  4169. this.$emit("cancel");
  4170. },
  4171. start(e2) {
  4172. if (this.$refs.dialog.scrollTop !== 0)
  4173. return;
  4174. this.startLocationY = e2.touches[0].pageY;
  4175. this.startTime = Date.now();
  4176. this.$refs.dialog.style["transition-duration"] = `0ms`;
  4177. },
  4178. move(e2) {
  4179. if (this.$refs.dialog.scrollTop !== 0)
  4180. return;
  4181. this.moveYDistance = e2.touches[0].pageY - this.startLocationY;
  4182. if (this.moveYDistance > 0) {
  4183. this.$refs.dialog.style["transform"] = `translate3d(0,${this.moveYDistance}px,0)`;
  4184. }
  4185. },
  4186. end(e2) {
  4187. if (Date.now() - this.startTime < 150 && Math.abs(this.moveYDistance) < 30) {
  4188. return;
  4189. }
  4190. if (this.$refs.dialog.scrollTop !== 0)
  4191. return;
  4192. let clientHeight = this.$refs.dialog.clientHeight;
  4193. this.$refs.dialog.style["transition-duration"] = `250ms`;
  4194. if (Math.abs(this.moveYDistance) > clientHeight / 2) {
  4195. this.$refs.dialog.style["transform"] = `translate3d(0,${clientHeight}px,0)`;
  4196. setTimeout(this.hide, 250);
  4197. } else {
  4198. this.$refs.dialog.style["transform"] = `translate3d(0,0,0)`;
  4199. setTimeout(() => {
  4200. if (this.$refs.dialog) {
  4201. this.$refs.dialog.style["transform"] = `none`;
  4202. }
  4203. }, 250);
  4204. }
  4205. this.moveYDistance = 0;
  4206. }
  4207. }
  4208. };
  4209. const __injectCSSVars__ = () => {
  4210. vue.useCssVars((_ctx) => ({
  4211. "0013fa15": _ctx.borderRadius
  4212. }));
  4213. };
  4214. const __setup__ = _sfc_main$a.setup;
  4215. _sfc_main$a.setup = __setup__ ? (props, ctx) => {
  4216. __injectCSSVars__();
  4217. return __setup__(props, ctx);
  4218. } : __injectCSSVars__;
  4219. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-3a54f208"), n2 = n2(), vue.popScopeId(), n2);
  4220. const _hoisted_1$a = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "gang-content" }, null, -1));
  4221. const _hoisted_2$7 = [
  4222. _hoisted_1$a
  4223. ];
  4224. const _hoisted_3$6 = { class: "dialog-wrapper" };
  4225. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4226. return vue.openBlock(), vue.createBlock(vue.Transition, {
  4227. onBeforeEnter: $options.beforeEnter,
  4228. onEnter: $options.enter,
  4229. onAfterEnter: $options.afterEnter,
  4230. onBeforeLeave: $options.beforeLeave,
  4231. onLeave: $options.leave,
  4232. onAfterLeave: $options.afterLeave,
  4233. css: false
  4234. }, {
  4235. default: vue.withCtx(() => [
  4236. $props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", {
  4237. key: 0,
  4238. ref: "dialog",
  4239. class: vue.normalizeClass(["FromBottomDialog", [$props.mode, $props.showHengGang ? "" : "no-heng-gang"]]),
  4240. style: vue.normalizeStyle({ "max-height": $props.height }),
  4241. onTouchstart: _cache[0] || (_cache[0] = (...args) => $options.start && $options.start(...args)),
  4242. onTouchmove: _cache[1] || (_cache[1] = (...args) => $options.move && $options.move(...args)),
  4243. onTouchend: _cache[2] || (_cache[2] = (...args) => $options.end && $options.end(...args))
  4244. }, [
  4245. vue.renderSlot(_ctx.$slots, "header", {}, void 0, true),
  4246. $props.showHengGang ? (vue.openBlock(), vue.createElementBlock("div", {
  4247. key: 0,
  4248. class: vue.normalizeClass(["heng-gang", $props.mode])
  4249. }, _hoisted_2$7, 2)) : vue.createCommentVNode("", true),
  4250. vue.createElementVNode("div", _hoisted_3$6, [
  4251. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  4252. ])
  4253. ], 38)) : vue.createCommentVNode("", true)
  4254. ]),
  4255. _: 3
  4256. }, 8, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"]);
  4257. }
  4258. const FromBottomDialog = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$3], ["__scopeId", "data-v-3a54f208"]]);
  4259. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-ce52828d"), n2 = n2(), vue.popScopeId(), n2);
  4260. const _hoisted_1$9 = { class: "wrapper" };
  4261. const _hoisted_2$6 = { class: "options" };
  4262. const _hoisted_3$5 = { class: "icon-wrap" };
  4263. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "分享", -1));
  4264. const _hoisted_5$4 = { class: "icon-wrap" };
  4265. const _hoisted_6$4 = { class: "icon-wrap" };
  4266. const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4267. const _hoisted_8$3 = { class: "icon-wrap" };
  4268. const _hoisted_9$3 = { class: "icon-wrap" };
  4269. const _hoisted_10$2 = { class: "icon-wrap" };
  4270. const _hoisted_11$2 = { class: "icon-wrap" };
  4271. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制链接", -1));
  4272. const _hoisted_13$2 = { class: "icon-wrap" };
  4273. const _hoisted_14$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制内容", -1));
  4274. const _hoisted_15$1 = { class: "icon-wrap" };
  4275. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("span", null, "刷新", -1));
  4276. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  4277. __name: "PostOptions",
  4278. props: {
  4279. modelValue: { type: Boolean },
  4280. post: {}
  4281. },
  4282. emits: ["close", "reply", "refresh", "merge", "update:modelValue"],
  4283. setup(__props, { emit: __emit }) {
  4284. let state = vue.reactive({
  4285. timer: null,
  4286. loading: false,
  4287. loading1: false,
  4288. loading2: false,
  4289. loading3: false,
  4290. loading4: false
  4291. });
  4292. const props = __props;
  4293. const emit = __emit;
  4294. const isLogin = vue.inject("isLogin");
  4295. const pageType = vue.inject("pageType");
  4296. const config2 = vue.inject("config");
  4297. function close() {
  4298. emit("close");
  4299. emit("update:modelValue", false);
  4300. }
  4301. function checkIsLogin() {
  4302. if (!isLogin.value) {
  4303. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4304. return false;
  4305. }
  4306. return true;
  4307. }
  4308. async function copyLink() {
  4309. let text = props.post.url;
  4310. if (await copy(text)) {
  4311. close();
  4312. }
  4313. }
  4314. async function copyContent() {
  4315. let text = props.post.headerTemplate;
  4316. text = $(`<div>${text}</div>`).text();
  4317. if (await copy(text)) {
  4318. close();
  4319. }
  4320. }
  4321. function share() {
  4322. var _a;
  4323. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4324. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${props.post.id}?r=${username}&related=v2ex&text=${props.post.title}`;
  4325. window.open(url, "_blank");
  4326. close();
  4327. }
  4328. function reply() {
  4329. if (!checkIsLogin())
  4330. return;
  4331. emit("reply");
  4332. close();
  4333. }
  4334. async function toggleIgnore() {
  4335. if (!checkIsLogin())
  4336. return;
  4337. if (state.loading2)
  4338. return;
  4339. let isIgnore = props.post.isIgnore;
  4340. let url = `${location.origin}/${isIgnore ? "unignore" : "ignore"}/topic/${props.post.id}?once=${props.post.once}`;
  4341. state.loading2 = true;
  4342. let apiRes = await fetch(url);
  4343. state.loading2 = false;
  4344. if (apiRes.redirected) {
  4345. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isIgnore ? "取消成功" : "忽略成功" });
  4346. } else {
  4347. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4348. }
  4349. if (isIgnore) {
  4350. eventBus.emit(CMD.MERGE, { isIgnore: !isIgnore });
  4351. } else {
  4352. if (pageType.value === PageType.Post) {
  4353. location.href = location.origin;
  4354. } else {
  4355. eventBus.emit(CMD.IGNORE);
  4356. }
  4357. }
  4358. eventBus.emit(CMD.REFRESH_ONCE);
  4359. close();
  4360. }
  4361. async function toggleFavorite() {
  4362. if (config2.value.collectBrowserNotice) {
  4363. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记添加到书签哦" });
  4364. }
  4365. if (!checkIsLogin())
  4366. return;
  4367. if (state.loading)
  4368. return;
  4369. let isFavorite = props.post.isFavorite;
  4370. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${props.post.id}?once=${props.post.once}`;
  4371. state.loading = true;
  4372. let apiRes = await fetch(url);
  4373. state.loading = false;
  4374. if (apiRes.redirected) {
  4375. let htmlText = await apiRes.text();
  4376. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4377. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4378. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? props.post.collectCount - 1 : props.post.collectCount + 1 });
  4379. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4380. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4381. return close();
  4382. }
  4383. }
  4384. eventBus.emit(CMD.REFRESH_ONCE);
  4385. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4386. }
  4387. async function report() {
  4388. if (!checkIsLogin())
  4389. return;
  4390. if (!isLogin.value)
  4391. return;
  4392. if (state.loading1)
  4393. return;
  4394. let isReport = props.post.isReport;
  4395. if (isReport) {
  4396. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4397. return;
  4398. }
  4399. let url = `${location.origin}/report/topic/${props.post.id}?once=${props.post.once}`;
  4400. state.loading1 = true;
  4401. let apiRes = await fetch(url);
  4402. state.loading1 = false;
  4403. if (apiRes.redirected) {
  4404. let htmlText = await apiRes.text();
  4405. if (htmlText.search("你已对本主题进行了报告")) {
  4406. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4407. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4408. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4409. return close();
  4410. }
  4411. }
  4412. eventBus.emit(CMD.REFRESH_ONCE);
  4413. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4414. }
  4415. async function thank() {
  4416. if (!isLogin.value) {
  4417. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4418. }
  4419. if (props.post.username === window.user.username) {
  4420. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  4421. }
  4422. let isThanked = props.post.isThanked;
  4423. if (isThanked) {
  4424. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  4425. }
  4426. if (state.loading4)
  4427. return;
  4428. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4429. let url = `${location.origin}/thank/reply/${props.post.id}?once=${props.post.once}`;
  4430. state.loading4 = true;
  4431. await fetch(url);
  4432. state.loading4 = false;
  4433. $.post(url).then((res) => {
  4434. if (!res.success) {
  4435. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4436. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  4437. }
  4438. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  4439. }, (err) => {
  4440. state.loading4 = false;
  4441. eventBus.emit(CMD.MERGE, { isThanked: !isThanked });
  4442. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  4443. eventBus.emit(CMD.REFRESH_ONCE);
  4444. });
  4445. close();
  4446. }
  4447. return (_ctx, _cache) => {
  4448. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  4449. "page-id": "post-detail",
  4450. height: "40rem",
  4451. "model-value": _ctx.modelValue,
  4452. onCancel: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", false))
  4453. }, {
  4454. default: vue.withCtx(() => [
  4455. vue.createElementVNode("div", _hoisted_1$9, [
  4456. vue.createElementVNode("div", _hoisted_2$6, [
  4457. vue.createElementVNode("div", {
  4458. class: "item",
  4459. onClick: share
  4460. }, [
  4461. vue.createElementVNode("div", _hoisted_3$5, [
  4462. vue.createVNode(vue.unref(Icon), {
  4463. color: "rgb(57,174,85)",
  4464. icon: "ph:share-fat-fill"
  4465. })
  4466. ]),
  4467. _hoisted_4$5
  4468. ]),
  4469. vue.createElementVNode("div", {
  4470. class: "item",
  4471. onClick: toggleIgnore
  4472. }, [
  4473. vue.createElementVNode("div", _hoisted_5$4, [
  4474. vue.unref(state).loading2 ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4475. _ctx.post.isIgnore ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4476. key: 0,
  4477. color: "rgb(224,42,42)",
  4478. icon: "mdi:eye-off-outline"
  4479. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4480. key: 1,
  4481. color: "rgb(57,174,85)",
  4482. icon: "mdi:eye-outline"
  4483. }))
  4484. ], 64))
  4485. ]),
  4486. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isIgnore ? "取消" : "") + "忽略", 1)
  4487. ]),
  4488. vue.createElementVNode("div", {
  4489. class: "item",
  4490. onClick: reply
  4491. }, [
  4492. vue.createElementVNode("div", _hoisted_6$4, [
  4493. vue.createVNode(vue.unref(Icon), {
  4494. color: "rgb(57,174,85)",
  4495. icon: "mynaui:message"
  4496. })
  4497. ]),
  4498. _hoisted_7$3
  4499. ]),
  4500. vue.createElementVNode("div", {
  4501. class: "item",
  4502. onClick: thank
  4503. }, [
  4504. vue.createElementVNode("div", _hoisted_8$3, [
  4505. _ctx.post.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4506. key: 0,
  4507. icon: "flat-color-icons:like"
  4508. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4509. key: 1,
  4510. color: "rgb(57,174,85)",
  4511. icon: "icon-park-outline:like"
  4512. }))
  4513. ]),
  4514. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isThanked ? "已" : "") + "感谢", 1)
  4515. ]),
  4516. vue.createElementVNode("div", {
  4517. class: "item",
  4518. onClick: toggleFavorite
  4519. }, [
  4520. vue.createElementVNode("div", _hoisted_9$3, [
  4521. vue.unref(state).loading ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4522. _ctx.post.isFavorite ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4523. key: 0,
  4524. color: "rgb(224,42,42)",
  4525. icon: "iconoir:star-solid"
  4526. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4527. key: 1,
  4528. color: "rgb(57,174,85)",
  4529. icon: "iconoir:star"
  4530. }))
  4531. ], 64))
  4532. ]),
  4533. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isFavorite ? "取消" : "") + "收藏", 1)
  4534. ]),
  4535. vue.createElementVNode("div", {
  4536. class: vue.normalizeClass(["item", [_ctx.post.isReport && "disabled"]]),
  4537. onClick: report
  4538. }, [
  4539. vue.createElementVNode("div", _hoisted_10$2, [
  4540. vue.unref(state).loading1 ? (vue.openBlock(), vue.createBlock(BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4541. key: 1,
  4542. class: "black",
  4543. icon: "solar:danger-triangle-outline"
  4544. }))
  4545. ]),
  4546. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.post.isReport ? "已报告" : "报告问题"), 1)
  4547. ], 2),
  4548. vue.createElementVNode("div", {
  4549. class: "item",
  4550. onClick: copyLink
  4551. }, [
  4552. vue.createElementVNode("div", _hoisted_11$2, [
  4553. vue.createVNode(vue.unref(Icon), {
  4554. class: "black",
  4555. icon: "solar:link-broken"
  4556. })
  4557. ]),
  4558. _hoisted_12$2
  4559. ]),
  4560. vue.createElementVNode("div", {
  4561. class: "item",
  4562. onClick: copyContent
  4563. }, [
  4564. vue.createElementVNode("div", _hoisted_13$2, [
  4565. vue.createVNode(vue.unref(Icon), {
  4566. class: "black",
  4567. icon: "octicon:copy-24"
  4568. })
  4569. ]),
  4570. _hoisted_14$1
  4571. ]),
  4572. vue.createElementVNode("div", {
  4573. class: "item",
  4574. onClick: _cache[0] || (_cache[0] = ($event) => (emit("refresh"), close()))
  4575. }, [
  4576. vue.createElementVNode("div", _hoisted_15$1, [
  4577. vue.createVNode(vue.unref(Icon), {
  4578. class: "black",
  4579. icon: "ion:refresh"
  4580. })
  4581. ]),
  4582. _hoisted_16$1
  4583. ])
  4584. ]),
  4585. vue.createVNode(FontSizeType),
  4586. vue.createElementVNode("div", {
  4587. class: "cancel",
  4588. onClick: close
  4589. }, "取消")
  4590. ])
  4591. ]),
  4592. _: 1
  4593. }, 8, ["model-value"]);
  4594. };
  4595. }
  4596. });
  4597. const PostOptions = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ce52828d"]]);
  4598. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-8ef13a81"), n2 = n2(), vue.popScopeId(), n2);
  4599. const _hoisted_1$8 = { class: "wrapper" };
  4600. const _hoisted_2$5 = { class: "options" };
  4601. const _hoisted_3$4 = { class: "icon-wrap" };
  4602. const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "忽略", -1));
  4603. const _hoisted_5$3 = { class: "icon-wrap" };
  4604. const _hoisted_6$3 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "复制", -1));
  4605. const _hoisted_7$2 = { class: "icon-wrap" };
  4606. const _hoisted_8$2 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  4607. const _hoisted_9$2 = { class: "icon-wrap" };
  4608. const _hoisted_10$1 = { class: "icon-wrap" };
  4609. const _hoisted_11$1 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4610. const _hoisted_12$1 = { class: "icon-wrap" };
  4611. const _hoisted_13$1 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  4612. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  4613. __name: "CommentOptions",
  4614. props: {
  4615. modelValue: { type: Boolean },
  4616. comment: {},
  4617. post: {}
  4618. },
  4619. emits: ["close", "reply", "merge", "update:modelValue"],
  4620. setup(__props, { emit: __emit }) {
  4621. const props = __props;
  4622. const emit = __emit;
  4623. const config2 = vue.inject("config");
  4624. const isLogin = vue.inject("isLogin");
  4625. function close() {
  4626. emit("close");
  4627. emit("update:modelValue", false);
  4628. }
  4629. function checkIsLogin() {
  4630. if (!isLogin.value) {
  4631. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4632. return false;
  4633. }
  4634. return true;
  4635. }
  4636. async function handleCopy() {
  4637. let text = props.comment.reply_content;
  4638. if (config2.value.commentDisplayType === CommentDisplayType.FloorInFloorNoCallUser) {
  4639. text = props.comment.hideCallUserReplyContent;
  4640. }
  4641. text = $(`<div>${text}</div>`).text();
  4642. if (await copy(text)) {
  4643. close();
  4644. }
  4645. }
  4646. async function hide() {
  4647. if (!checkIsLogin())
  4648. return;
  4649. let url = `${window.baseUrl}/ignore/reply/${props.comment.id}?once=${props.post.once}`;
  4650. eventBus.emit(CMD.REMOVE, props.comment.floor);
  4651. close();
  4652. $.post(url).then((res) => {
  4653. eventBus.emit(CMD.REFRESH_ONCE);
  4654. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  4655. }, (err) => {
  4656. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  4657. });
  4658. }
  4659. function jump() {
  4660. eventBus.emit(CMD.JUMP, props.comment.floor);
  4661. close();
  4662. }
  4663. function showRelationReply() {
  4664. if (!props.comment.replyUsers.length) {
  4665. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  4666. return;
  4667. }
  4668. eventBus.emit(CMD.RELATION_REPLY, {
  4669. left: props.comment.replyUsers,
  4670. right: props.comment.username,
  4671. rightFloor: props.comment.floor
  4672. });
  4673. close();
  4674. }
  4675. function recallThank() {
  4676. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: props.comment.id, type: "recall" });
  4677. }
  4678. function thank() {
  4679. if (!checkIsLogin())
  4680. return;
  4681. if (props.comment.username === window.user.username) {
  4682. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  4683. }
  4684. if (props.comment.isThanked) {
  4685. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  4686. }
  4687. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: props.comment.id, type: "add" });
  4688. let url = `${window.baseUrl}/thank/reply/${props.comment.id}?once=${props.post.once}`;
  4689. $.post(url).then((res) => {
  4690. if (!res.success) {
  4691. recallThank();
  4692. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  4693. }
  4694. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  4695. }, (err) => {
  4696. recallThank();
  4697. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  4698. eventBus.emit(CMD.REFRESH_ONCE);
  4699. });
  4700. close();
  4701. }
  4702. return (_ctx, _cache) => {
  4703. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  4704. "page-id": "post-detail",
  4705. height: "40rem",
  4706. "model-value": _ctx.modelValue,
  4707. onCancel: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", false))
  4708. }, {
  4709. default: vue.withCtx(() => [
  4710. vue.createElementVNode("div", _hoisted_1$8, [
  4711. vue.createElementVNode("div", _hoisted_2$5, [
  4712. vue.createElementVNode("div", {
  4713. class: "item",
  4714. onClick: hide
  4715. }, [
  4716. vue.createElementVNode("div", _hoisted_3$4, [
  4717. vue.createVNode(vue.unref(Icon), { icon: "solar:forbidden-circle-outline" })
  4718. ]),
  4719. _hoisted_4$4
  4720. ]),
  4721. vue.createElementVNode("div", {
  4722. class: "item",
  4723. onClick: handleCopy
  4724. }, [
  4725. vue.createElementVNode("div", _hoisted_5$3, [
  4726. vue.createVNode(vue.unref(Icon), { icon: "octicon:copy-24" })
  4727. ]),
  4728. _hoisted_6$3
  4729. ]),
  4730. vue.createElementVNode("div", {
  4731. class: vue.normalizeClass(["item", [!_ctx.comment.replyUsers.length && "disabled"]]),
  4732. onClick: showRelationReply
  4733. }, [
  4734. vue.createElementVNode("div", _hoisted_7$2, [
  4735. vue.createVNode(vue.unref(Icon), { icon: "iconoir:page-search" })
  4736. ]),
  4737. _hoisted_8$2
  4738. ], 2),
  4739. vue.createElementVNode("div", {
  4740. class: vue.normalizeClass(["item", [_ctx.comment.isThanked && "full"]]),
  4741. onClick: thank
  4742. }, [
  4743. vue.createElementVNode("div", _hoisted_9$2, [
  4744. _ctx.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4745. key: 0,
  4746. icon: "icon-park-solid:like"
  4747. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4748. key: 1,
  4749. icon: "icon-park-outline:like"
  4750. }))
  4751. ]),
  4752. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.comment.isThanked ? "已" : "") + "感谢", 1)
  4753. ], 2),
  4754. vue.createElementVNode("div", {
  4755. class: "item",
  4756. onClick: _cache[0] || (_cache[0] = ($event) => emit("reply"))
  4757. }, [
  4758. vue.createElementVNode("div", _hoisted_10$1, [
  4759. vue.createVNode(vue.unref(Icon), { icon: "mynaui:message" })
  4760. ]),
  4761. _hoisted_11$1
  4762. ]),
  4763. _ctx.comment.top ? (vue.openBlock(), vue.createElementBlock("div", {
  4764. key: 0,
  4765. class: "item",
  4766. onClick: jump
  4767. }, [
  4768. vue.createElementVNode("div", _hoisted_12$1, [
  4769. vue.createVNode(vue.unref(Icon), { icon: "icon-park-outline:to-bottom" })
  4770. ]),
  4771. _hoisted_13$1
  4772. ])) : vue.createCommentVNode("", true)
  4773. ]),
  4774. vue.createElementVNode("div", {
  4775. class: "cancel",
  4776. onClick: close
  4777. }, "取消")
  4778. ])
  4779. ]),
  4780. _: 1
  4781. }, 8, ["model-value"]);
  4782. };
  4783. }
  4784. });
  4785. const CommentOptions = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-8ef13a81"]]);
  4786. const _hoisted_1$7 = { class: "comments" };
  4787. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  4788. __name: "RelationReply",
  4789. props: {
  4790. modelValue: { type: Boolean },
  4791. relationReply: {},
  4792. targetUser: {},
  4793. post: {}
  4794. },
  4795. emits: ["close", "reply", "merge", "update:modelValue"],
  4796. setup(__props, { emit: __emit }) {
  4797. const emit = __emit;
  4798. vue.inject("config");
  4799. vue.inject("isLogin");
  4800. return (_ctx, _cache) => {
  4801. return vue.openBlock(), vue.createBlock(FromBottomDialog, {
  4802. "page-id": "post-detail",
  4803. height: "70vh",
  4804. "model-value": _ctx.modelValue,
  4805. onCancel: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", false))
  4806. }, {
  4807. default: vue.withCtx(() => [
  4808. vue.createElementVNode("div", _hoisted_1$7, [
  4809. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.relationReply, (item, index2) => {
  4810. return vue.openBlock(), vue.createBlock(SingleComment, {
  4811. "is-right": item.username === _ctx.targetUser.right,
  4812. key: item.floor,
  4813. comment: item
  4814. }, null, 8, ["is-right", "comment"]);
  4815. }), 128))
  4816. ])
  4817. ]),
  4818. _: 1
  4819. }, 8, ["model-value"]);
  4820. };
  4821. }
  4822. });
  4823. const _sfc_main$6 = {
  4824. name: "detail",
  4825. emits: ["saveReadList", "refresh"],
  4826. components: {
  4827. BackIcon: _sfc_main$p,
  4828. BaseSelect,
  4829. RelationReply: _sfc_main$7,
  4830. CommentOptions,
  4831. FromBottomDialog,
  4832. PostOptions,
  4833. MoreIcon,
  4834. BaseButton,
  4835. SingleComment,
  4836. Comment,
  4837. PostEditor,
  4838. Point,
  4839. Toolbar,
  4840. BaseHtmlRender,
  4841. Tooltip,
  4842. BaseLoading,
  4843. Icon
  4844. },
  4845. inject: ["allReplyUsers", "user", "post", "tags", "isLogin", "config", "pageType", "isNight"],
  4846. props: {
  4847. modelValue: {
  4848. type: Boolean,
  4849. default() {
  4850. return false;
  4851. }
  4852. },
  4853. loading: {
  4854. type: Boolean,
  4855. default() {
  4856. return false;
  4857. }
  4858. },
  4859. refreshLoading: {
  4860. type: Boolean,
  4861. default() {
  4862. return false;
  4863. }
  4864. },
  4865. displayType: CommentDisplayType.FloorInFloorNoCallUser
  4866. },
  4867. data() {
  4868. return {
  4869. isSticky: false,
  4870. showPostOptions: false,
  4871. showCommentOptions: false,
  4872. selectCallIndex: 0,
  4873. showCallList: false,
  4874. showRelationReply: false,
  4875. replyText: "",
  4876. callStyle: {
  4877. top: 0,
  4878. left: 0
  4879. },
  4880. targetUser: {
  4881. left: [],
  4882. right: "",
  4883. rightFloor: -1
  4884. },
  4885. debounceScroll: () => {
  4886. },
  4887. read: {
  4888. floor: 0,
  4889. total: 0
  4890. },
  4891. currentFloor: "",
  4892. showOpTag: false,
  4893. currentComment: null
  4894. };
  4895. },
  4896. computed: {
  4897. eventBus() {
  4898. return eventBus;
  4899. },
  4900. CMD() {
  4901. return CMD;
  4902. },
  4903. replyUser() {
  4904. if (this.currentComment)
  4905. return this.currentComment.username;
  4906. return null;
  4907. },
  4908. replyFloor() {
  4909. if (this.currentComment)
  4910. return this.currentComment.floor;
  4911. return null;
  4912. },
  4913. isMy() {
  4914. return this.post.member.username === window.user.username;
  4915. },
  4916. myTags() {
  4917. return this.tags[this.post.member.username] ?? [];
  4918. },
  4919. CommentDisplayType() {
  4920. return CommentDisplayType;
  4921. },
  4922. isPost() {
  4923. return this.pageType === PageType.Post;
  4924. },
  4925. filterCallList() {
  4926. if (this.showCallList) {
  4927. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  4928. if (this.replyText)
  4929. return list.filter((i) => i.search(this.replyText) > -1);
  4930. return list;
  4931. }
  4932. return [];
  4933. },
  4934. topReply() {
  4935. return this.post.replyList.filter((v) => v.thankCount >= this.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, this.config.topReplyCount);
  4936. },
  4937. replyList() {
  4938. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  4939. return this.post.nestedReplies;
  4940. if (this.displayType === CommentDisplayType.Like) {
  4941. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  4942. }
  4943. if (this.displayType === CommentDisplayType.V2exOrigin)
  4944. return this.post.replyList;
  4945. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  4946. return this.post.nestedRedundReplies;
  4947. if (this.displayType === CommentDisplayType.OnlyOp)
  4948. return this.post.replyList.filter((v) => {
  4949. var _a;
  4950. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  4951. });
  4952. return [];
  4953. },
  4954. //关联回复
  4955. relationReply() {
  4956. if (this.targetUser.left.length && this.targetUser.right) {
  4957. return this.post.replyList.filter((v) => {
  4958. if (this.targetUser.left.includes(v.username)) {
  4959. if (v.floor > this.targetUser.rightFloor) {
  4960. if (v.replyUsers.includes(this.targetUser.right)) {
  4961. return true;
  4962. }
  4963. } else {
  4964. return true;
  4965. }
  4966. }
  4967. if (v.username === this.targetUser.right) {
  4968. for (let i = 0; i < this.targetUser.left.length; i++) {
  4969. if (v.replyUsers.includes(this.targetUser.left[i])) {
  4970. return true;
  4971. }
  4972. }
  4973. }
  4974. });
  4975. }
  4976. return [];
  4977. }
  4978. },
  4979. watch: {
  4980. "post.id"(n2, o) {
  4981. if (this.$refs["post-editor"]) {
  4982. this.$refs["post-editor"].content = "";
  4983. vue.nextTick(() => {
  4984. this.scrollTop();
  4985. });
  4986. }
  4987. },
  4988. "post.headerTemplate"(n2, o) {
  4989. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  4990. if (mountEl) {
  4991. this.showOpTag = true;
  4992. }
  4993. },
  4994. modelValue: {
  4995. handler(newVal) {
  4996. if (this.isPost) {
  4997. return;
  4998. }
  4999. if (newVal) {
  5000. if (!window.history.state) {
  5001. window.history.pushState({}, 0, this.post.href);
  5002. }
  5003. this.read = this.post.read;
  5004. this.currentFloor = "";
  5005. vue.nextTick(() => {
  5006. window.document.title = this.post.title ?? "V2EX";
  5007. });
  5008. } else {
  5009. this.$emit("saveReadList");
  5010. window.document.title = "V2EX";
  5011. this.isSticky = false;
  5012. this.showRelationReply = false;
  5013. if (window.history.state) {
  5014. window.history.back();
  5015. }
  5016. }
  5017. }
  5018. }
  5019. },
  5020. mounted() {
  5021. this.debounceScroll = debounce(this.scroll, 300, false);
  5022. if (this.isLogin) {
  5023. const observer = new IntersectionObserver(
  5024. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  5025. { threshold: [1] }
  5026. );
  5027. observer.observe(this.$refs.replyBox);
  5028. window.addEventListener("keydown", this.onKeyDown);
  5029. }
  5030. eventBus.on(CMD.SHOW_CALL, (val) => {
  5031. if (val.show) {
  5032. this.showCallList = true;
  5033. this.replyText = val.text;
  5034. if (this.isPost) {
  5035. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  5036. } else {
  5037. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  5038. }
  5039. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  5040. if (this.selectCallIndex >= this.filterCallList.length) {
  5041. this.selectCallIndex = 0;
  5042. }
  5043. } else {
  5044. this.replyText = "";
  5045. this.showCallList = false;
  5046. this.selectCallIndex = 0;
  5047. }
  5048. });
  5049. eventBus.on(CMD.RELATION_REPLY, (val) => {
  5050. this.targetUser = val;
  5051. this.showRelationReply = true;
  5052. });
  5053. eventBus.on(CMD.JUMP, this.jump);
  5054. if (this.isPost) {
  5055. window.addEventListener("scroll", this.debounceScroll);
  5056. }
  5057. eventBus.on(CMD.SHOW_COMMENT_OPTIONS, (comment) => {
  5058. this.currentComment = comment;
  5059. this.showCommentOptions = true;
  5060. });
  5061. eventBus.on(CMD.SHOW_EDITOR, (comment) => {
  5062. this.currentComment = comment;
  5063. this.isSticky = true;
  5064. setTimeout(() => {
  5065. var _a;
  5066. (_a = this.$refs["post-editor"]) == null ? void 0 : _a.focus();
  5067. }, 300);
  5068. });
  5069. },
  5070. beforeUnmount() {
  5071. window.removeEventListener("keydown", this.onKeyDown);
  5072. eventBus.off(CMD.SHOW_CALL);
  5073. },
  5074. methods: {
  5075. clickAvatar() {
  5076. window.functions.clickAvatar(".post-wrapper ");
  5077. },
  5078. addTag() {
  5079. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  5080. },
  5081. removeTag(tag) {
  5082. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  5083. },
  5084. scroll() {
  5085. if (!this.config.rememberLastReadFloor)
  5086. return;
  5087. let height = window.innerHeight * 0.3;
  5088. let comments = $(".comments .comment");
  5089. let forCount = 0;
  5090. for (let i = 0; i < comments.length; i++) {
  5091. forCount++;
  5092. let ins = comments[i];
  5093. let rect = ins.getBoundingClientRect();
  5094. if (rect.top > height) {
  5095. let lastReadFloor = Number(ins.dataset["floor"]);
  5096. console.log("当前阅读楼层", lastReadFloor);
  5097. eventBus.emit(CMD.ADD_READ, {
  5098. floor: lastReadFloor > 3 ? lastReadFloor : 0,
  5099. total: this.post.replyList.length
  5100. });
  5101. if (lastReadFloor > 3) {
  5102. this.read.floor = 0;
  5103. }
  5104. break;
  5105. }
  5106. }
  5107. if (forCount === comments.length) {
  5108. console.log("看到最后了");
  5109. eventBus.emit(CMD.ADD_READ, {
  5110. floor: forCount,
  5111. total: this.post.replyList.length
  5112. });
  5113. }
  5114. },
  5115. jump(floor) {
  5116. let lastItem = this.replyList[this.replyList.length - 1];
  5117. if (floor === "") {
  5118. floor = lastItem.floor;
  5119. } else {
  5120. try {
  5121. floor = Number(floor);
  5122. } catch (e2) {
  5123. floor = lastItem.floor;
  5124. }
  5125. if (floor === 0) {
  5126. floor = 1;
  5127. }
  5128. if (floor > lastItem.floor)
  5129. floor = lastItem.floor;
  5130. }
  5131. if (!this.post.replyList.length) {
  5132. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  5133. this.read.floor = 0;
  5134. return;
  5135. }
  5136. if (floor > this.post.replyList.length) {
  5137. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5138. this.read.floor = 0;
  5139. return;
  5140. }
  5141. let comment = $(`.c_${floor}`);
  5142. if (!comment.length) {
  5143. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5144. this.read.floor = 0;
  5145. return;
  5146. }
  5147. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  5148. comment.addClass("ding");
  5149. this.read.floor = 0;
  5150. this.currentFloor = floor + 1;
  5151. setTimeout(() => {
  5152. comment.removeClass("ding");
  5153. }, 2e3);
  5154. },
  5155. jumpLastRead(floor) {
  5156. if (this.config.autoJumpLastReadFloor) {
  5157. if (!floor)
  5158. return;
  5159. setTimeout(() => {
  5160. console.log("上次跳转", floor);
  5161. this.jump(floor);
  5162. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "已跳转到上次阅读位置" });
  5163. }, 300);
  5164. }
  5165. },
  5166. collapseTopReplyList() {
  5167. $(this.$refs.topReply).slideToggle("fast");
  5168. },
  5169. goBottom() {
  5170. this.isSticky = false;
  5171. setTimeout(() => {
  5172. let postWrapper = document.querySelector(".post-wrapper");
  5173. postWrapper.scrollTo({ top: this.$refs["detail"].clientHeight, behavior: "smooth" });
  5174. });
  5175. },
  5176. close() {
  5177. this.$emit("update:modelValue", false);
  5178. },
  5179. setCall(e2) {
  5180. eventBus.emit(CMD.SET_CALL, e2);
  5181. this.showCallList = false;
  5182. },
  5183. onKeyDown(e2) {
  5184. if (!this.modelValue)
  5185. return;
  5186. if (!this.showCallList)
  5187. return;
  5188. let length = this.filterCallList.slice(0, 10).length;
  5189. if (e2.keyCode === 13) {
  5190. this.setCall(this.filterCallList[this.selectCallIndex]);
  5191. e2.preventDefault();
  5192. }
  5193. if (e2.keyCode === 38) {
  5194. this.selectCallIndex--;
  5195. if (this.selectCallIndex < 0) {
  5196. this.selectCallIndex = length - 1;
  5197. }
  5198. e2.preventDefault();
  5199. }
  5200. if (e2.keyCode === 40) {
  5201. this.selectCallIndex++;
  5202. if (this.selectCallIndex > length - 1) {
  5203. this.selectCallIndex = 0;
  5204. }
  5205. e2.preventDefault();
  5206. }
  5207. },
  5208. scrollTop() {
  5209. document.querySelector(".post-wrapper").scrollTo({ top: 0, behavior: "smooth" });
  5210. }
  5211. }
  5212. };
  5213. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-066728a9"), n2 = n2(), vue.popScopeId(), n2);
  5214. const _hoisted_1$6 = { class: "left" };
  5215. const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5216. const _hoisted_3$3 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5217. const _hoisted_4$3 = ["href"];
  5218. const _hoisted_5$2 = { class: "right" };
  5219. const _hoisted_6$2 = ["src"];
  5220. const _hoisted_7$1 = { class: "my-box post-main-body" };
  5221. const _hoisted_8$1 = { class: "box-content" };
  5222. const _hoisted_9$1 = { class: "box-header" };
  5223. const _hoisted_10 = { class: "gray" };
  5224. const _hoisted_11 = ["href"];
  5225. const _hoisted_12 = ["src"];
  5226. const _hoisted_13 = { class: "info" };
  5227. const _hoisted_14 = { class: "top" };
  5228. const _hoisted_15 = ["href"];
  5229. const _hoisted_16 = {
  5230. key: 0,
  5231. class: "center"
  5232. };
  5233. const _hoisted_17 = { class: "my-tag" };
  5234. const _hoisted_18 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5235. const _hoisted_19 = ["onClick"];
  5236. const _hoisted_20 = { class: "bottom" };
  5237. const _hoisted_21 = ["title"];
  5238. const _hoisted_22 = ["href"];
  5239. const _hoisted_23 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-info-circle" }, null, -1));
  5240. const _hoisted_24 = [
  5241. _hoisted_23
  5242. ];
  5243. const _hoisted_25 = ["href"];
  5244. const _hoisted_26 = {
  5245. key: 0,
  5246. class: "my-box"
  5247. };
  5248. const _hoisted_27 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "" }, "高赞回复", -1));
  5249. const _hoisted_28 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "top-reply" }, [
  5250. /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-compress" })
  5251. ], -1));
  5252. const _hoisted_29 = [
  5253. _hoisted_27,
  5254. _hoisted_28
  5255. ];
  5256. const _hoisted_30 = { ref: "topReply" };
  5257. const _hoisted_31 = {
  5258. key: 1,
  5259. class: "my-cell flex comments-header"
  5260. };
  5261. const _hoisted_32 = {
  5262. key: 2,
  5263. class: "my-box comment-wrapper"
  5264. };
  5265. const _hoisted_33 = {
  5266. key: 0,
  5267. class: "loading-wrapper"
  5268. };
  5269. const _hoisted_34 = {
  5270. key: 1,
  5271. class: "comments"
  5272. };
  5273. const _hoisted_35 = {
  5274. key: 3,
  5275. id: "no-comments-yet"
  5276. };
  5277. const _hoisted_36 = { class: "my-cell flex" };
  5278. const _hoisted_37 = { class: "notice-right gray" };
  5279. const _hoisted_38 = { class: "p1" };
  5280. const _hoisted_39 = ["onClick"];
  5281. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5282. const _component_BackIcon = vue.resolveComponent("BackIcon");
  5283. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5284. const _component_MoreIcon = vue.resolveComponent("MoreIcon");
  5285. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5286. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5287. const _component_Comment = vue.resolveComponent("Comment");
  5288. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5289. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5290. const _component_post_options = vue.resolveComponent("post-options");
  5291. const _component_comment_options = vue.resolveComponent("comment-options");
  5292. const _component_relation_reply = vue.resolveComponent("relation-reply");
  5293. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: ".post-wrapper" }, [
  5294. vue.createElementVNode("div", {
  5295. class: vue.normalizeClass(["post-detail", [
  5296. $options.isNight ? "isNight" : "",
  5297. $options.pageType
  5298. ]]),
  5299. ref: "detail",
  5300. id: "post-detail",
  5301. onScroll: _cache[20] || (_cache[20] = (...args) => $data.debounceScroll && $data.debounceScroll(...args))
  5302. }, [
  5303. vue.createElementVNode("div", {
  5304. class: "my-box nav-bar",
  5305. onDblclick: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  5306. }, [
  5307. vue.createElementVNode("div", _hoisted_1$6, [
  5308. !$options.isPost ? (vue.openBlock(), vue.createBlock(_component_BackIcon, {
  5309. key: 0,
  5310. onClick: vue.withModifiers($options.close, ["stop"])
  5311. }, null, 8, ["onClick"])) : vue.createCommentVNode("", true),
  5312. $options.isPost ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5313. _hoisted_2$4,
  5314. _hoisted_3$3
  5315. ], 64)) : vue.createCommentVNode("", true),
  5316. vue.createElementVNode("a", {
  5317. href: $options.post.node.url
  5318. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_4$3)
  5319. ]),
  5320. vue.createElementVNode("div", _hoisted_5$2, [
  5321. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : vue.createCommentVNode("", true),
  5322. vue.createVNode(_component_MoreIcon, {
  5323. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => $data.showPostOptions = true, ["stop"]))
  5324. }),
  5325. $options.user.avatar ? (vue.openBlock(), vue.createElementBlock("img", {
  5326. key: 1,
  5327. onClick: _cache[1] || (_cache[1] = (...args) => $options.clickAvatar && $options.clickAvatar(...args)),
  5328. style: { "margin-right": "0" },
  5329. class: "avatar mobile",
  5330. src: $options.user.avatar
  5331. }, null, 8, _hoisted_6$2)) : vue.createCommentVNode("", true)
  5332. ])
  5333. ], 32),
  5334. vue.createElementVNode("div", _hoisted_7$1, [
  5335. vue.createElementVNode("div", _hoisted_8$1, [
  5336. vue.createElementVNode("div", _hoisted_9$1, [
  5337. vue.createElementVNode("small", _hoisted_10, [
  5338. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("a", {
  5339. key: 0,
  5340. class: "base-avatar",
  5341. href: `/member/${$options.post.member.username}`
  5342. }, [
  5343. vue.createElementVNode("img", {
  5344. src: $options.post.member.avatar_large
  5345. }, null, 8, _hoisted_12)
  5346. ], 8, _hoisted_11)) : vue.createCommentVNode("", true),
  5347. vue.createElementVNode("div", _hoisted_13, [
  5348. vue.createElementVNode("div", _hoisted_14, [
  5349. vue.createElementVNode("a", {
  5350. href: `/member/${$options.post.member.username}`
  5351. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_15),
  5352. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5353. vue.createTextVNode(" · "),
  5354. vue.createElementVNode("span", {
  5355. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5356. }, vue.toDisplayString($options.post.member.createDate), 3)
  5357. ], 64)) : vue.createCommentVNode("", true)
  5358. ]),
  5359. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
  5360. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5361. return vue.openBlock(), vue.createElementBlock("span", _hoisted_17, [
  5362. _hoisted_18,
  5363. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5364. vue.createElementVNode("i", {
  5365. class: "fa fa-trash-o remove",
  5366. onClick: ($event) => $options.removeTag(i)
  5367. }, null, 8, _hoisted_19)
  5368. ]);
  5369. }), 256)),
  5370. vue.createElementVNode("span", {
  5371. class: "add-tag ago",
  5372. onClick: _cache[3] || (_cache[3] = (...args) => $options.addTag && $options.addTag(...args)),
  5373. title: "添加标签"
  5374. }, "+")
  5375. ])) : vue.createCommentVNode("", true),
  5376. vue.createElementVNode("div", _hoisted_20, [
  5377. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5378. vue.createElementVNode("span", {
  5379. title: $options.post.createDate
  5380. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_21),
  5381. vue.createTextVNode(" · ")
  5382. ], 64)) : vue.createCommentVNode("", true),
  5383. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5384. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5385. vue.createTextVNode("   "),
  5386. vue.createElementVNode("a", {
  5387. href: `/t/${$options.post.id}/info`
  5388. }, _hoisted_24, 8, _hoisted_22),
  5389. vue.createTextVNode("   "),
  5390. vue.createElementVNode("a", {
  5391. href: `/append/topic/${$options.post.id}`,
  5392. class: "op"
  5393. }, "APPEND", 8, _hoisted_25)
  5394. ], 64)) : vue.createCommentVNode("", true)
  5395. ])
  5396. ])
  5397. ]),
  5398. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1)
  5399. ]),
  5400. vue.createVNode(_component_BaseHtmlRender, {
  5401. html: $options.post.headerTemplate
  5402. }, null, 8, ["html"])
  5403. ]),
  5404. vue.createVNode(_component_Toolbar, {
  5405. onReply: _cache[4] || (_cache[4] = ($event) => {
  5406. $data.isSticky = !$data.isSticky;
  5407. $data.currentComment = null;
  5408. })
  5409. })
  5410. ]),
  5411. $options.topReply.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_26, [
  5412. vue.createElementVNode("div", {
  5413. class: "my-cell flex",
  5414. onClick: _cache[5] || (_cache[5] = (...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args))
  5415. }, _hoisted_29),
  5416. vue.createElementVNode("div", _hoisted_30, [
  5417. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.topReply, (item, index2) => {
  5418. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5419. key: item.floor,
  5420. type: "top",
  5421. modelValue: $options.topReply[index2],
  5422. "onUpdate:modelValue": ($event) => $options.topReply[index2] = $event
  5423. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5424. }), 128))
  5425. ], 512)
  5426. ])) : vue.createCommentVNode("", true),
  5427. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_31, [
  5428. vue.createElementVNode("span", null, vue.toDisplayString($options.post.replyCount) + " 条回复", 1),
  5429. vue.createVNode(_component_BaseSelect, {
  5430. "display-type": $props.displayType,
  5431. "onUpdate:displayType": _cache[6] || (_cache[6] = (e2) => _ctx.$emit("update:displayType", e2))
  5432. }, null, 8, ["display-type"])
  5433. ])) : vue.createCommentVNode("", true),
  5434. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_32, [
  5435. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_33, [
  5436. vue.createVNode(_component_BaseLoading, { size: "large" })
  5437. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_34, [
  5438. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index2) => {
  5439. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5440. key: item.floor,
  5441. modelValue: $options.replyList[index2],
  5442. "onUpdate:modelValue": ($event) => $options.replyList[index2] = $event
  5443. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5444. }), 128)) : vue.createCommentVNode("", true)
  5445. ]))
  5446. ])) : vue.createCommentVNode("", true),
  5447. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_35, "目前尚无回复")) : vue.createCommentVNode("", true),
  5448. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  5449. key: 4,
  5450. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  5451. ref: "replyBox"
  5452. }, [
  5453. vue.createElementVNode("div", _hoisted_36, [
  5454. vue.createElementVNode("span", null, vue.toDisplayString($data.currentComment ? `回复${$data.currentComment.floor}楼` : "回复主题"), 1),
  5455. vue.createElementVNode("div", _hoisted_37, [
  5456. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  5457. key: 0,
  5458. style: { "margin-right": "2rem" },
  5459. onClick: _cache[7] || (_cache[7] = ($event) => {
  5460. $data.isSticky = false;
  5461. $data.currentComment = null;
  5462. })
  5463. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  5464. vue.createElementVNode("a", {
  5465. onClick: _cache[8] || (_cache[8] = (...args) => $options.scrollTop && $options.scrollTop(...args))
  5466. }, "回到顶部")
  5467. ])
  5468. ]),
  5469. vue.createElementVNode("div", _hoisted_38, [
  5470. vue.createVNode(_component_PostEditor, {
  5471. onClose: $options.goBottom,
  5472. ref: "post-editor",
  5473. useType: $data.currentComment ? "reply-comment" : "reply-post",
  5474. replyUser: $options.replyUser,
  5475. replyFloor: $options.replyFloor,
  5476. onClick: _cache[9] || (_cache[9] = ($event) => $data.isSticky = true)
  5477. }, null, 8, ["onClose", "useType", "replyUser", "replyFloor"])
  5478. ])
  5479. ], 2)) : vue.createCommentVNode("", true),
  5480. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  5481. key: 5,
  5482. class: "call-list",
  5483. style: vue.normalizeStyle($data.callStyle)
  5484. }, [
  5485. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index2) => {
  5486. return vue.openBlock(), vue.createElementBlock("div", {
  5487. class: vue.normalizeClass(["call-item", { select: index2 === $data.selectCallIndex }]),
  5488. onClick: ($event) => $options.setCall(item)
  5489. }, [
  5490. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  5491. ], 10, _hoisted_39);
  5492. }), 256))
  5493. ], 4)) : vue.createCommentVNode("", true),
  5494. vue.createVNode(_component_post_options, {
  5495. onMerge: _cache[10] || (_cache[10] = (val) => {
  5496. $options.post = Object.assign($options.post, val);
  5497. console.log("va", val, $options.post);
  5498. }),
  5499. post: $options.post,
  5500. onReply: _cache[11] || (_cache[11] = ($event) => ($options.eventBus.emit($options.CMD.SHOW_EDITOR, null), $data.showPostOptions = false)),
  5501. onRefresh: _cache[12] || (_cache[12] = ($event) => _ctx.$emit("refresh")),
  5502. modelValue: $data.showPostOptions,
  5503. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.showPostOptions = $event)
  5504. }, null, 8, ["post", "modelValue"]),
  5505. vue.createVNode(_component_comment_options, {
  5506. onMerge: _cache[14] || (_cache[14] = (val) => $data.currentComment = Object.assign($data.currentComment, val)),
  5507. onRecallThank: _cache[15] || (_cache[15] = ($event) => $data.currentComment.isThanked = false),
  5508. post: $options.post,
  5509. comment: $data.currentComment,
  5510. onClose: _cache[16] || (_cache[16] = ($event) => $data.currentComment = null),
  5511. onReply: _cache[17] || (_cache[17] = ($event) => ($options.eventBus.emit($options.CMD.SHOW_EDITOR, $data.currentComment), $data.showCommentOptions = false)),
  5512. modelValue: $data.showCommentOptions,
  5513. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.showCommentOptions = $event)
  5514. }, null, 8, ["post", "comment", "modelValue"]),
  5515. vue.createVNode(_component_relation_reply, {
  5516. post: $options.post,
  5517. "relation-reply": $options.relationReply,
  5518. modelValue: $data.showRelationReply,
  5519. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.showRelationReply = $event),
  5520. "target-user": $data.targetUser
  5521. }, null, 8, ["post", "relation-reply", "modelValue", "target-user"])
  5522. ], 34)
  5523. ]);
  5524. }
  5525. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-066728a9"]]);
  5526. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-1988f33b"), n2 = n2(), vue.popScopeId(), n2);
  5527. const _hoisted_1$5 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("svg", {
  5528. width: "24",
  5529. height: "24",
  5530. viewBox: "0 0 48 48",
  5531. fill: "none",
  5532. xmlns: "http://www.w3.org/2000/svg"
  5533. }, [
  5534. /* @__PURE__ */ vue.createElementVNode("path", {
  5535. d: "M17 32L19.1875 27M31 32L28.8125 27M19.1875 27L24 16L28.8125 27M19.1875 27H28.8125",
  5536. stroke: "#929596",
  5537. "stroke-width": "4",
  5538. "stroke-linecap": "round",
  5539. "stroke-linejoin": "round"
  5540. }),
  5541. /* @__PURE__ */ vue.createElementVNode("path", {
  5542. d: "M43.1999 20C41.3468 10.871 33.2758 4 23.5999 4C13.9241 4 5.85308 10.871 4 20L10 18",
  5543. stroke: "#929596",
  5544. "stroke-width": "4",
  5545. "stroke-linecap": "round",
  5546. "stroke-linejoin": "round"
  5547. }),
  5548. /* @__PURE__ */ vue.createElementVNode("path", {
  5549. d: "M4 28C5.85308 37.129 13.9241 44 23.5999 44C33.2758 44 41.3468 37.129 43.1999 28L38 30",
  5550. stroke: "#929596",
  5551. "stroke-width": "4",
  5552. "stroke-linecap": "round",
  5553. "stroke-linejoin": "round"
  5554. })
  5555. ], -1));
  5556. const _hoisted_2$3 = { key: 1 };
  5557. const _sfc_main$5 = {
  5558. __name: "Base64Tooltip",
  5559. setup(__props) {
  5560. const tooltip = vue.ref(null);
  5561. const show = vue.ref(false);
  5562. const originalText = vue.ref("");
  5563. const decodeText = vue.ref("");
  5564. const styleObject = vue.reactive({
  5565. left: "-100vw",
  5566. top: "-100vh"
  5567. });
  5568. vue.onMounted(() => {
  5569. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  5570. setTimeout(() => show.value = true);
  5571. originalText.value = text;
  5572. decodeText.value = "";
  5573. styleObject.left = e2.clientX + "px";
  5574. styleObject.top = e2.clientY + 20 + "px";
  5575. });
  5576. window.addEventListener("click", (e2) => {
  5577. if (!tooltip.value)
  5578. return;
  5579. if (!tooltip.value.contains(e2.target) && show.value) {
  5580. show.value = false;
  5581. }
  5582. }, { capture: true });
  5583. const fn = () => show.value && (show.value = false);
  5584. $(".post-detail", window.win().doc).on("scroll", fn);
  5585. });
  5586. function base64ToArrayBuffer(base64) {
  5587. let binary_string = window.atob(base64);
  5588. let len = binary_string.length;
  5589. let bytes = new Uint8Array(len);
  5590. for (let i = 0; i < len; i++) {
  5591. bytes[i] = binary_string.charCodeAt(i);
  5592. }
  5593. return bytes.buffer;
  5594. }
  5595. function decode() {
  5596. try {
  5597. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  5598. decodeText.value = r2;
  5599. });
  5600. } catch (e2) {
  5601. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  5602. }
  5603. }
  5604. return (_ctx, _cache) => {
  5605. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5606. class: "base64_tooltip",
  5607. style: vue.normalizeStyle(styleObject),
  5608. onClick: decode,
  5609. ref_key: "tooltip",
  5610. ref: tooltip
  5611. }, [
  5612. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5613. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  5614. _hoisted_1$5
  5615. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
  5616. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  5617. vue.createVNode(BaseButton, {
  5618. class: "btn",
  5619. size: "small",
  5620. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(copy)(decodeText.value))
  5621. }, {
  5622. default: vue.withCtx(() => [
  5623. vue.createTextVNode("点击复制")
  5624. ]),
  5625. _: 1
  5626. })
  5627. ]))
  5628. ], 4)), [
  5629. [vue.vShow, show.value]
  5630. ]);
  5631. };
  5632. }
  5633. };
  5634. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1988f33b"]]);
  5635. const _sfc_main$4 = {
  5636. name: "Msg",
  5637. components: { Icon },
  5638. props: {
  5639. type: "",
  5640. text: ""
  5641. },
  5642. created() {
  5643. setTimeout(() => {
  5644. this.$emit("close");
  5645. }, 3e3);
  5646. }
  5647. };
  5648. const _hoisted_1$4 = { class: "right" };
  5649. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  5650. const _component_Icon = vue.resolveComponent("Icon");
  5651. return vue.openBlock(), vue.createElementBlock("div", {
  5652. class: vue.normalizeClass(["msg", $props.type])
  5653. }, [
  5654. vue.createElementVNode("div", {
  5655. class: "left",
  5656. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  5657. }, [
  5658. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  5659. ]),
  5660. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  5661. ], 2);
  5662. }
  5663. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-0dcc0508"]]);
  5664. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-674b86aa"), n2 = n2(), vue.popScopeId(), n2);
  5665. const _hoisted_1$3 = {
  5666. key: 0,
  5667. class: "tag-modal modal"
  5668. };
  5669. const _hoisted_2$2 = { class: "wrapper" };
  5670. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  5671. const _hoisted_4$2 = { class: "option" };
  5672. const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  5673. const _hoisted_6$1 = { class: "btns" };
  5674. const _sfc_main$3 = {
  5675. __name: "TagModal",
  5676. props: ["tags"],
  5677. emits: ["update:tags"],
  5678. setup(__props, { emit: __emit }) {
  5679. const tagModal = vue.reactive({
  5680. show: false,
  5681. currentUsername: "",
  5682. tag: ""
  5683. });
  5684. const props = __props;
  5685. const emit = __emit;
  5686. const inputRef = vue.ref();
  5687. vue.onMounted(() => {
  5688. eventBus.on(CMD.ADD_TAG, (username) => {
  5689. tagModal.currentUsername = username;
  5690. tagModal.show = true;
  5691. vue.nextTick(() => {
  5692. inputRef.value.focus();
  5693. });
  5694. });
  5695. });
  5696. async function addTag() {
  5697. if (!tagModal.tag) {
  5698. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  5699. return;
  5700. }
  5701. let oldTag = window.clone(props.tags);
  5702. let tempTag = window.clone(props.tags);
  5703. let userTags = tempTag[tagModal.currentUsername] ?? [];
  5704. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  5705. if (rIndex > -1) {
  5706. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  5707. return;
  5708. } else {
  5709. userTags.push(tagModal.tag);
  5710. }
  5711. tempTag[tagModal.currentUsername] = userTags;
  5712. emit("update:tags", tempTag);
  5713. tagModal.tag = "";
  5714. tagModal.show = false;
  5715. let res = await window.parse.saveTags(tempTag);
  5716. if (!res) {
  5717. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  5718. emit("update:tags", oldTag);
  5719. }
  5720. }
  5721. return (_ctx, _cache) => {
  5722. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5723. default: vue.withCtx(() => [
  5724. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  5725. vue.createElementVNode("div", {
  5726. class: "mask",
  5727. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  5728. }),
  5729. vue.createElementVNode("div", _hoisted_2$2, [
  5730. _hoisted_3$2,
  5731. vue.createElementVNode("div", _hoisted_4$2, [
  5732. _hoisted_5$1,
  5733. vue.createElementVNode("div", null, [
  5734. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  5735. ])
  5736. ]),
  5737. vue.withDirectives(vue.createElementVNode("input", {
  5738. type: "text",
  5739. ref_key: "inputRef",
  5740. ref: inputRef,
  5741. style: { "width": "100%" },
  5742. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  5743. onKeydown: vue.withKeys(addTag, ["enter"])
  5744. }, null, 544), [
  5745. [vue.vModelText, tagModal.tag]
  5746. ]),
  5747. vue.createElementVNode("div", _hoisted_6$1, [
  5748. vue.createVNode(BaseButton, {
  5749. type: "link",
  5750. onClick: _cache[2] || (_cache[2] = ($event) => tagModal.show = false)
  5751. }, {
  5752. default: vue.withCtx(() => [
  5753. vue.createTextVNode("取消")
  5754. ]),
  5755. _: 1
  5756. }),
  5757. vue.createVNode(BaseButton, { onClick: addTag }, {
  5758. default: vue.withCtx(() => [
  5759. vue.createTextVNode("确定")
  5760. ]),
  5761. _: 1
  5762. })
  5763. ])
  5764. ])
  5765. ])) : vue.createCommentVNode("", true)
  5766. ]),
  5767. _: 1
  5768. });
  5769. };
  5770. }
  5771. };
  5772. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-674b86aa"]]);
  5773. const _hoisted_1$2 = { class: "msgs" };
  5774. const _sfc_main$2 = {
  5775. __name: "MsgModal",
  5776. setup(__props) {
  5777. const msgList = vue.reactive([
  5778. // {type: 'success', text: '123', id: Date.now()}
  5779. ]);
  5780. vue.onMounted(() => {
  5781. eventBus.on(CMD.SHOW_MSG, (val) => {
  5782. msgList.push({ ...val, id: Date.now() });
  5783. });
  5784. });
  5785. function removeMsg(id) {
  5786. let rIndex = msgList.findIndex((item) => item.id === id);
  5787. if (rIndex > -1) {
  5788. msgList.splice(rIndex, 1);
  5789. }
  5790. }
  5791. return (_ctx, _cache) => {
  5792. return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  5793. vue.createElementVNode("div", _hoisted_1$2, [
  5794. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  5795. return vue.openBlock(), vue.createBlock(Msg, {
  5796. key: v.id,
  5797. type: v.type,
  5798. text: v.text,
  5799. onClose: ($event) => removeMsg(v.id)
  5800. }, null, 8, ["type", "text", "onClose"]);
  5801. }), 128))
  5802. ])
  5803. ]);
  5804. };
  5805. }
  5806. };
  5807. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-93c4dec0"]]);
  5808. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  5809. function e(e2) {
  5810. console.error(e2);
  5811. }
  5812. function r(e2, t) {
  5813. let r2 = e2.substr(t, 2);
  5814. return parseInt(r2, 16);
  5815. }
  5816. function n(href, index2) {
  5817. let o = "", a = r(href, index2);
  5818. for (let i = index2 + 2; i < href.length; i += 2) {
  5819. let l = r(href, i) ^ a;
  5820. o += String.fromCharCode(l);
  5821. }
  5822. try {
  5823. o = decodeURIComponent(escape(o));
  5824. } catch (u2) {
  5825. e(u2);
  5826. }
  5827. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  5828. return d.childNodes[0].getAttribute("href") || "";
  5829. }
  5830. function decodeEmail(body) {
  5831. try {
  5832. let as = body.find(u);
  5833. as.each(function() {
  5834. try {
  5835. let o = this, a = o.parentNode, i = o.getAttribute(f);
  5836. if (i) {
  5837. let l = n(i, 0), d2 = document.createTextNode(l);
  5838. a.replaceChild(d2, o);
  5839. }
  5840. } catch (h2) {
  5841. e(h2);
  5842. }
  5843. });
  5844. } catch (s) {
  5845. e(s);
  5846. }
  5847. }
  5848. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-19a5903e"), n2 = n2(), vue.popScopeId(), n2);
  5849. const _hoisted_1$1 = {
  5850. key: 0,
  5851. class: "tag-modal modal"
  5852. };
  5853. const _hoisted_2$1 = { class: "modal-root" };
  5854. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  5855. const _hoisted_4$1 = ["innerHTML"];
  5856. const _sfc_main$1 = {
  5857. __name: "NotificationModal",
  5858. props: ["modelValue", "h"],
  5859. emits: ["update:modelValue"],
  5860. setup(__props, { emit: __emit }) {
  5861. const emit = __emit;
  5862. vue.onMounted(() => {
  5863. });
  5864. function close() {
  5865. emit("update:modelValue", false);
  5866. }
  5867. return (_ctx, _cache) => {
  5868. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5869. default: vue.withCtx(() => [
  5870. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  5871. vue.createElementVNode("div", {
  5872. class: "mask",
  5873. onClick: vue.withModifiers(close, ["stop"])
  5874. }),
  5875. vue.createElementVNode("div", _hoisted_2$1, [
  5876. vue.createElementVNode("div", { class: "modal-header" }, [
  5877. _hoisted_3$1,
  5878. vue.createElementVNode("i", {
  5879. class: "fa fa-times",
  5880. onClick: close
  5881. })
  5882. ]),
  5883. vue.createElementVNode("div", {
  5884. innerHTML: __props.h,
  5885. class: "modal-body"
  5886. }, null, 8, _hoisted_4$1)
  5887. ])
  5888. ])) : vue.createCommentVNode("", true)
  5889. ]),
  5890. _: 1
  5891. });
  5892. };
  5893. }
  5894. };
  5895. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-19a5903e"]]);
  5896. var _GM_notification = /* @__PURE__ */ (() => typeof GM_notification != "undefined" ? GM_notification : void 0)();
  5897. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  5898. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  5899. const DefaultPost = {
  5900. allReplyUsers: [],
  5901. content_rendered: "",
  5902. createDate: "",
  5903. createDateAgo: "",
  5904. fr: "",
  5905. replyList: [],
  5906. nestedReplies: [],
  5907. nestedRedundReplies: [],
  5908. username: "",
  5909. url: "",
  5910. member: {},
  5911. node: {
  5912. title: "",
  5913. url: ""
  5914. },
  5915. headerTemplate: "",
  5916. title: "",
  5917. id: "",
  5918. type: "post",
  5919. once: "",
  5920. replyCount: 0,
  5921. clickCount: 0,
  5922. thankCount: 0,
  5923. collectCount: 0,
  5924. lastReadFloor: 0,
  5925. isFavorite: false,
  5926. isIgnore: false,
  5927. isThanked: false,
  5928. isReport: false,
  5929. inList: false
  5930. };
  5931. const DefaultUser = {
  5932. tagPrefix: "--用户标签--",
  5933. tags: {},
  5934. tagsId: "",
  5935. username: "",
  5936. avatar: "",
  5937. readPrefix: "--已读楼层--",
  5938. readNoteItemId: "",
  5939. readList: {},
  5940. imgurPrefix: "--imgur图片删除hash--",
  5941. imgurList: {},
  5942. imgurNoteId: ""
  5943. };
  5944. const DefaultConfig = {
  5945. showToolbar: true,
  5946. showPreviewBtn: true,
  5947. autoOpenDetail: true,
  5948. openTag: false,
  5949. //给用户打标签
  5950. clickPostItemOpenDetail: true,
  5951. closePostDetailBySpace: true,
  5952. //点击空白处关闭详情
  5953. contentAutoCollapse: true,
  5954. //正文超长自动折叠
  5955. viewType: "table",
  5956. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  5957. newTabOpen: false,
  5958. //新标签打开
  5959. base64: true,
  5960. //base功能
  5961. sov2ex: false,
  5962. postWidth: "",
  5963. showTopReply: true,
  5964. topReplyLoveMinCount: 3,
  5965. topReplyCount: 3,
  5966. autoJumpLastReadFloor: false,
  5967. rememberLastReadFloor: false,
  5968. autoSignin: true,
  5969. customBgColor: "",
  5970. version: 1,
  5971. collectBrowserNotice: false,
  5972. fontSizeType: "normal"
  5973. };
  5974. const functions = {
  5975. //获取所有回复
  5976. getAllReply(repliesMap = []) {
  5977. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  5978. pre = pre.concat(i.replyList);
  5979. return pre;
  5980. }, []);
  5981. },
  5982. //查找子回复
  5983. findChildren(item, endList, all) {
  5984. var _a;
  5985. const fn = (child, endList2, parent) => {
  5986. child.level = parent.level + 1;
  5987. let rIndex = all.findIndex((v) => v.floor === child.floor);
  5988. if (rIndex > -1) {
  5989. all[rIndex].isUse = true;
  5990. }
  5991. parent.children.push(this.findChildren(child, endList2, all));
  5992. };
  5993. item.children = [];
  5994. let floorReplyList = [];
  5995. for (let i = 0; i < endList.length; i++) {
  5996. let currentItem = endList[i];
  5997. if (currentItem.isUse)
  5998. continue;
  5999. if (currentItem.replyFloor === item.floor) {
  6000. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  6001. currentItem.isUse = true;
  6002. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  6003. } else {
  6004. currentItem.isWrong = true;
  6005. }
  6006. }
  6007. }
  6008. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  6009. fn(currentItem, endList2, item);
  6010. });
  6011. let nextMeIndex = endList.findIndex((v) => {
  6012. var _a2;
  6013. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  6014. });
  6015. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  6016. for (let i = 0; i < findList.length; i++) {
  6017. let currentItem = findList[i];
  6018. if (currentItem.isUse)
  6019. continue;
  6020. if (currentItem.replyUsers.length === 1) {
  6021. if (currentItem.replyFloor !== -1) {
  6022. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  6023. continue;
  6024. }
  6025. }
  6026. let endList2 = endList.slice(i + 1);
  6027. if (currentItem.username === item.username) {
  6028. if (currentItem.replyUsers[0] === item.username) {
  6029. fn(currentItem, endList2, item);
  6030. }
  6031. break;
  6032. } else {
  6033. if (currentItem.replyUsers[0] === item.username) {
  6034. fn(currentItem, endList2, item);
  6035. }
  6036. }
  6037. } else {
  6038. if (currentItem.username === item.username)
  6039. break;
  6040. }
  6041. }
  6042. item.children = item.children.sort((a, b) => a.floor - b.floor);
  6043. return item;
  6044. },
  6045. //生成嵌套回复
  6046. createNestedList(allList = []) {
  6047. if (!allList.length)
  6048. return [];
  6049. let list = window.clone(allList);
  6050. let nestedList = [];
  6051. list.map((item, index2) => {
  6052. let startList = list.slice(0, index2);
  6053. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  6054. let endList = list.slice(index2 + 1);
  6055. if (index2 === 0) {
  6056. nestedList.push(this.findChildren(item, endList, list));
  6057. } else {
  6058. if (!item.isUse) {
  6059. let isOneLevelReply = false;
  6060. if (item.replyUsers.length) {
  6061. if (item.replyUsers.length > 1) {
  6062. isOneLevelReply = true;
  6063. } else {
  6064. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  6065. }
  6066. } else {
  6067. isOneLevelReply = true;
  6068. }
  6069. if (isOneLevelReply) {
  6070. item.level = 0;
  6071. nestedList.push(this.findChildren(item, endList, list));
  6072. }
  6073. }
  6074. }
  6075. });
  6076. return nestedList;
  6077. },
  6078. //生成嵌套冗余回复
  6079. createNestedRedundantList(allList = []) {
  6080. if (!allList.length)
  6081. return [];
  6082. let list = window.clone(allList);
  6083. let nestedList = [];
  6084. list.map((item, index2) => {
  6085. let startList = list.slice(0, index2);
  6086. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  6087. let endList = list.slice(index2 + 1);
  6088. if (index2 === 0) {
  6089. nestedList.push(this.findChildren(item, endList, list));
  6090. } else {
  6091. if (!item.isUse) {
  6092. let isOneLevelReply = false;
  6093. if (item.replyUsers.length) {
  6094. if (item.replyUsers.length > 1) {
  6095. isOneLevelReply = true;
  6096. } else {
  6097. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  6098. }
  6099. } else {
  6100. isOneLevelReply = true;
  6101. }
  6102. if (isOneLevelReply) {
  6103. item.level = 0;
  6104. nestedList.push(this.findChildren(item, endList, list));
  6105. }
  6106. } else {
  6107. let newItem = window.clone(item);
  6108. newItem.children = [];
  6109. newItem.level = 0;
  6110. newItem.isDup = true;
  6111. nestedList.push(newItem);
  6112. }
  6113. }
  6114. });
  6115. return nestedList;
  6116. },
  6117. //解析A标签
  6118. parseA(a) {
  6119. let href = a.href;
  6120. let id;
  6121. if (href.includes("/t/")) {
  6122. id = a.pathname.substring("/t/".length);
  6123. }
  6124. return { href, id, title: a.innerText };
  6125. },
  6126. //图片链接转Img标签
  6127. checkPhotoLink2Img(str) {
  6128. if (!str)
  6129. return;
  6130. try {
  6131. let imgWebs = [
  6132. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  6133. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  6134. ];
  6135. imgWebs.map((v, i) => {
  6136. let has = str.matchAll(v);
  6137. let res2 = [...has];
  6138. res2.map((r2) => {
  6139. let p = i === 0 ? r2[4] : r2[5];
  6140. if (p) {
  6141. let link = p.toLowerCase();
  6142. let src = p;
  6143. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  6144. } else {
  6145. src = p + ".png";
  6146. }
  6147. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  6148. }
  6149. });
  6150. });
  6151. } catch (e2) {
  6152. console.log("正则解析html里面的a标签的图片链接出错了");
  6153. }
  6154. return str;
  6155. },
  6156. //检测帖子回复长度
  6157. async checkPostReplies(id, needOpen = true) {
  6158. return new Promise(async (resolve) => {
  6159. var _a;
  6160. let showJsonUrl = `${location.origin}/api/topics/show.json?id=${id}`;
  6161. let r2 = await fetch(showJsonUrl);
  6162. if (r2) {
  6163. let res = await r2.json();
  6164. if (res) {
  6165. if (((_a = res[0]) == null ? void 0 : _a.replies) > MAX_REPLY_LIMIT) {
  6166. if (needOpen) {
  6167. window.parse.openNewTab(`https://www.v2ex.com/t/${id}?p=1&script=1`);
  6168. }
  6169. return resolve(true);
  6170. }
  6171. }
  6172. }
  6173. resolve(false);
  6174. });
  6175. },
  6176. async sleep(time) {
  6177. return new Promise((resolve) => {
  6178. setTimeout(resolve, time);
  6179. });
  6180. },
  6181. //打开新标签页
  6182. openNewTab(href) {
  6183. _GM_openInTab(href, { active: true });
  6184. },
  6185. async cbChecker(val, count = 0) {
  6186. if (window.cb) {
  6187. window.cb(val);
  6188. } else {
  6189. while (!window.cb && count < 30) {
  6190. await functions.sleep(500);
  6191. count++;
  6192. }
  6193. window.cb && window.cb(val);
  6194. }
  6195. },
  6196. //初始化脚本菜单
  6197. initMonkeyMenu() {
  6198. try {
  6199. _GM_registerMenuCommand("脚本设置", () => {
  6200. functions.cbChecker({ type: "openSetting" });
  6201. });
  6202. _GM_registerMenuCommand("仓库地址", () => {
  6203. functions.openNewTab(window.const.git);
  6204. });
  6205. _GM_registerMenuCommand("反馈 & 建议", window.functions.feedback);
  6206. } catch (e2) {
  6207. console.error("无法使用Tampermonkey");
  6208. }
  6209. },
  6210. clone(val) {
  6211. return JSON.parse(JSON.stringify(val));
  6212. }
  6213. };
  6214. const _sfc_main = {
  6215. components: {
  6216. BaseButton,
  6217. NotificationModal,
  6218. BaseLoading,
  6219. BaseSwitch,
  6220. MsgModal,
  6221. TagModal,
  6222. Tooltip,
  6223. Setting,
  6224. PostDetail,
  6225. Base64Tooltip,
  6226. Msg
  6227. },
  6228. provide() {
  6229. return {
  6230. user: vue.computed(() => window.user),
  6231. isMobile: vue.computed(() => window.vals.isMobile),
  6232. isLogin: vue.computed(() => this.isLogin),
  6233. isNight: vue.computed(() => this.isNight),
  6234. pageType: vue.computed(() => this.pageType),
  6235. tags: vue.computed(() => this.tags),
  6236. show: vue.computed(() => this.show),
  6237. post: vue.computed(() => this.current),
  6238. config: vue.computed(() => this.config),
  6239. allReplyUsers: vue.computed(() => {
  6240. var _a, _b, _c;
  6241. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  6242. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  6243. }
  6244. return [];
  6245. })
  6246. };
  6247. },
  6248. data() {
  6249. return {
  6250. loading: window.pageType === PageType.Post,
  6251. refreshLoading: false,
  6252. loadMore: false,
  6253. isLogin: !!window.user.username,
  6254. pageType: window.pageType,
  6255. isNight: window.isNight,
  6256. stopMe: window.stopMe,
  6257. //停止使用脚本
  6258. show: false,
  6259. current: window.clone(window.initPost),
  6260. list: [],
  6261. config: window.clone(window.config),
  6262. tags: window.user.tags,
  6263. readList: window.user.readList,
  6264. notificationModal: {
  6265. show: false,
  6266. h: ""
  6267. },
  6268. step: 0
  6269. };
  6270. },
  6271. computed: {
  6272. targetUserTags() {
  6273. return this.tags[window.targetUserName] ?? [];
  6274. },
  6275. isList() {
  6276. return [PageType.Home, PageType.Node].includes(this.pageType);
  6277. },
  6278. isPost() {
  6279. return this.pageType === PageType.Post;
  6280. },
  6281. isMember() {
  6282. return this.pageType === PageType.Member;
  6283. }
  6284. },
  6285. watch: {
  6286. config: {
  6287. handler(newVal) {
  6288. let config2 = { [window.user.username ?? "default"]: newVal };
  6289. localStorage.setItem("v2ex-config", JSON.stringify(config2));
  6290. window.config = newVal;
  6291. },
  6292. deep: true
  6293. },
  6294. tags(newVal) {
  6295. window.user.tags = newVal;
  6296. },
  6297. "config.viewType"(newVal) {
  6298. if (!newVal)
  6299. return;
  6300. if (newVal === "card") {
  6301. $(".post-item").each(function() {
  6302. $(this).addClass("preview");
  6303. });
  6304. } else {
  6305. $(".post-item").each(function() {
  6306. $(this).removeClass("preview");
  6307. });
  6308. }
  6309. },
  6310. "config.fontSizeType": {
  6311. handler(newVal) {
  6312. switch (newVal) {
  6313. case "small":
  6314. return $("html").css("font-size", "8px");
  6315. case "normal":
  6316. return $("html").css("font-size", "10px");
  6317. case "large":
  6318. return $("html").css("font-size", "12px");
  6319. case "big-large":
  6320. return $("html").css("font-size", "14px");
  6321. }
  6322. },
  6323. deep: true
  6324. },
  6325. show(n2) {
  6326. if (n2)
  6327. this.step++;
  6328. else
  6329. this.step--;
  6330. this.slide("post");
  6331. }
  6332. },
  6333. created() {
  6334. let that = this;
  6335. this.initEvent();
  6336. window.cb = this.winCb;
  6337. if (!window.canParseV2exPage)
  6338. return;
  6339. document.addEventListener("click", this.clickA, true);
  6340. $(document).on("click", ".post-item", function(e2) {
  6341. if (e2.currentTarget.getAttribute("script"))
  6342. return;
  6343. if (that.stopMe)
  6344. return true;
  6345. if (this.classList.contains("preview")) {
  6346. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG") {
  6347. console.log("点空白处", this);
  6348. let id = this.dataset["id"];
  6349. let href = this.dataset["href"];
  6350. if (id) {
  6351. that.clickPost(e2, id, href);
  6352. } else {
  6353. if (href)
  6354. location.href = href;
  6355. }
  6356. }
  6357. }
  6358. });
  6359. window.onpopstate = (event) => {
  6360. if (event.state) {
  6361. if (!this.show)
  6362. this.show = true;
  6363. } else {
  6364. if (this.show)
  6365. this.show = false;
  6366. }
  6367. };
  6368. window.onbeforeunload = () => {
  6369. };
  6370. window.deleteNotification = (nId, token) => {
  6371. console.log("deleteNotification", nId, token);
  6372. let item = $("#n_" + nId);
  6373. item.slideUp("fast");
  6374. $.post({
  6375. url: "/delete/notification/" + nId + "?once=" + token,
  6376. success() {
  6377. $.get({
  6378. url: "/notifications/below/" + window.notificationBottom,
  6379. success(data, status, request) {
  6380. item.remove();
  6381. $("#notifications").append(data);
  6382. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  6383. },
  6384. error() {
  6385. item.slideDown("fast");
  6386. }
  6387. });
  6388. },
  6389. error() {
  6390. item.slideDown("fast");
  6391. }
  6392. });
  6393. };
  6394. },
  6395. beforeUnmount() {
  6396. eventBus.clear();
  6397. document.removeEventListener("click", this.clickA, true);
  6398. },
  6399. methods: {
  6400. async getUnreadMessagesCount() {
  6401. var _a, _b;
  6402. const res = await fetch(`${location.origin}/mission`);
  6403. const htmlText = await res.text();
  6404. const $page = $(htmlText);
  6405. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  6406. if (text.includes("未读提醒")) {
  6407. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  6408. if (countStr) {
  6409. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  6410. }
  6411. } else {
  6412. return 0;
  6413. }
  6414. throw new Error("无法获取未读消息数量");
  6415. },
  6416. clickA(e2) {
  6417. if (!(e2 == null ? void 0 : e2.target))
  6418. return;
  6419. if (e2.target.tagName !== "A")
  6420. return;
  6421. let that = this;
  6422. if (e2.target.getAttribute("script"))
  6423. return;
  6424. if (that.stopMe)
  6425. return true;
  6426. let { href, id, title } = functions.parseA(e2.target);
  6427. if (href.includes("/settings/night/toggle"))
  6428. return;
  6429. if (href.includes("/?tab="))
  6430. return;
  6431. if (href.includes("/go"))
  6432. return;
  6433. if (href === window.origin + "/#;")
  6434. return;
  6435. if (href === window.origin + "/")
  6436. return;
  6437. if (href === window.origin + "/recent")
  6438. return;
  6439. if (href.includes("/notifications"))
  6440. return;
  6441. if (href === window.origin + "/script-setting") {
  6442. window.functions.clickAvatar(this.show ? ".post-wrapper " : "");
  6443. this.slide("setting", this.step++);
  6444. that.stopEvent(e2);
  6445. return;
  6446. }
  6447. if (id) {
  6448. that.clickPost(e2, id, href, title);
  6449. } else {
  6450. if (that.config.newTabOpen) {
  6451. that.stopEvent(e2);
  6452. functions.openNewTab(href);
  6453. }
  6454. }
  6455. },
  6456. stopEvent(e2) {
  6457. e2.preventDefault();
  6458. e2.stopPropagation();
  6459. },
  6460. saveReadList() {
  6461. if (this.config.rememberLastReadFloor) {
  6462. window.parse.saveReadList(this.readList);
  6463. }
  6464. },
  6465. async clickPost(e2, id, href, title = "") {
  6466. if (id) {
  6467. if (this.config.clickPostItemOpenDetail) {
  6468. this.stopEvent(e2);
  6469. let index2 = this.list.findIndex((v) => v.id == id);
  6470. let postItem = this.clone(window.initPost);
  6471. if (index2 > -1) {
  6472. postItem = this.list[index2];
  6473. }
  6474. if (!postItem.title) {
  6475. postItem.title = title ?? "加载中";
  6476. }
  6477. postItem.inList = index2 > -1;
  6478. if (postItem.inList) {
  6479. if (postItem.replyCount > MAX_REPLY_LIMIT) {
  6480. return functions.openNewTab(`${location.origin}/t/${id}?p=1&script=1`);
  6481. }
  6482. }
  6483. postItem.id = id;
  6484. postItem.href = href;
  6485. if (!postItem.headerTemplate) {
  6486. let template = `
  6487. <div class="cell">
  6488. <div class="topic_content">
  6489. <div class="markdown_body">
  6490. ${(postItem == null ? void 0 : postItem.content_rendered) ?? ""}
  6491. </div>
  6492. </div>
  6493. </div>
  6494. `;
  6495. postItem.headerTemplate = template;
  6496. }
  6497. this.getPostDetail(postItem);
  6498. return;
  6499. }
  6500. if (this.config.newTabOpen) {
  6501. this.stopEvent(e2);
  6502. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`);
  6503. }
  6504. }
  6505. },
  6506. showPost() {
  6507. $(".slide-list").css("transition", `0s`);
  6508. setTimeout(() => {
  6509. $(".slide-list").css("transition", `transform .3s`);
  6510. }, 500);
  6511. this.show = true;
  6512. $("#site-header").css("margin-top", "-42px");
  6513. $(`#Wrapper .box:lt(5)`).each(function() {
  6514. $(this).hide();
  6515. });
  6516. },
  6517. slide(to = "post", v) {
  6518. if (this.step === 1) {
  6519. if (to === "post") {
  6520. $(".post-wrapper").css("z-index", 10);
  6521. $(".setting-wrapper").css("z-index", 9);
  6522. } else {
  6523. $(".post-wrapper").css("z-index", 9);
  6524. $(".setting-wrapper").css("z-index", 10);
  6525. }
  6526. }
  6527. $(".slide-list").css("transform", `translateX(-${this.step * 100}vw)`);
  6528. },
  6529. async winCb({ type, value }) {
  6530. console.log("回调的类型", type, value);
  6531. if (type === "syncData") {
  6532. this.list = window.postList;
  6533. this.config = window.config;
  6534. this.stopMe = window.stopMe;
  6535. this.tags = window.user.tags;
  6536. this.readList = window.user.readList;
  6537. this.current.read = this.readList[this.current.id] ?? {};
  6538. if (this.show && this.isPost && this.current.read.floor) {
  6539. this.$refs.postDetail.read = this.current.read;
  6540. }
  6541. }
  6542. if (type === "warningNotice") {
  6543. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  6544. }
  6545. if (this.stopMe)
  6546. return;
  6547. if (type === "restorePost") {
  6548. this.show = false;
  6549. this.loading = false;
  6550. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  6551. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6552. $(this).show();
  6553. });
  6554. }
  6555. if (type === "postContent") {
  6556. this.current = Object.assign(this.current, value);
  6557. this.current.inList = true;
  6558. this.showPost();
  6559. }
  6560. if (type === "postReplies") {
  6561. this.current = Object.assign(this.current, value);
  6562. this.list.push(this.clone(this.current));
  6563. this.loading = false;
  6564. }
  6565. },
  6566. clone(val) {
  6567. return functions.clone(val);
  6568. },
  6569. regenerateReplyList() {
  6570. if (this.current.replyList.length) {
  6571. this.current.replyCount = this.current.replyList.length;
  6572. let res = functions.createNestedList(this.current.replyList);
  6573. if (res) {
  6574. this.current.nestedReplies = res;
  6575. }
  6576. let dup_res = functions.createNestedRedundantList(this.current.replyList);
  6577. if (dup_res) {
  6578. this.current.nestedRedundReplies = dup_res;
  6579. }
  6580. } else {
  6581. this.current.replyCount = 0;
  6582. this.current.nestedReplies = [];
  6583. this.current.nestedRedundReplies = [];
  6584. }
  6585. if (this.list.length) {
  6586. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6587. if (rIndex > -1) {
  6588. this.list[rIndex] = this.clone(this.current);
  6589. }
  6590. }
  6591. },
  6592. initEvent() {
  6593. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  6594. console.log("CHANGE_COMMENT_THANK", val);
  6595. const { id, type } = val;
  6596. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  6597. if (currentI > -1) {
  6598. this.current.replyList[currentI].isThanked = type === "add";
  6599. if (type === "add") {
  6600. this.current.replyList[currentI].thankCount++;
  6601. } else {
  6602. this.current.replyList[currentI].thankCount--;
  6603. }
  6604. this.regenerateReplyList();
  6605. }
  6606. });
  6607. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  6608. const { id, type } = val;
  6609. this.current.isThanked = type === "add";
  6610. if (type === "add") {
  6611. this.current.thankCount++;
  6612. } else {
  6613. this.current.thankCount--;
  6614. }
  6615. let currentI = this.list.findIndex((i) => i.id === id);
  6616. if (currentI > -1) {
  6617. this.list[currentI].isThanked = type === "add";
  6618. if (type === "add") {
  6619. this.list[currentI].thankCount++;
  6620. } else {
  6621. this.list[currentI].thankCount++;
  6622. }
  6623. }
  6624. });
  6625. eventBus.on(CMD.REMOVE, (val) => {
  6626. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  6627. if (removeIndex > -1) {
  6628. this.current.replyList.splice(removeIndex, 1);
  6629. }
  6630. this.regenerateReplyList();
  6631. });
  6632. eventBus.on(CMD.IGNORE, () => {
  6633. this.show = false;
  6634. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6635. if (rIndex > -1) {
  6636. this.list.splice(rIndex, 1);
  6637. }
  6638. let el = document.querySelector(`.id_${this.current.id}`);
  6639. if (el)
  6640. el.remove();
  6641. this.current = this.clone(window.initPost);
  6642. });
  6643. eventBus.on(CMD.MERGE, (val) => {
  6644. this.current = Object.assign(this.current, val);
  6645. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6646. if (rIndex > -1) {
  6647. this.list[rIndex] = this.clone(this.current);
  6648. }
  6649. });
  6650. eventBus.on(CMD.MERGE_CONFIG, (val) => {
  6651. this.config = Object.assign(this.config, val);
  6652. });
  6653. eventBus.on(CMD.ADD_READ, (val) => {
  6654. this.readList[this.current.id] = val;
  6655. });
  6656. eventBus.on(CMD.ADD_REPLY, (item) => {
  6657. this.current.replyList.push(item);
  6658. this.regenerateReplyList();
  6659. });
  6660. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  6661. if (once) {
  6662. if (typeof once === "string") {
  6663. let res = once.match(/var once = "([\d]+)";/);
  6664. if (res && res[1]) {
  6665. this.current.once = Number(res[1]);
  6666. return;
  6667. }
  6668. }
  6669. if (typeof once === "number") {
  6670. this.current.once = once;
  6671. return;
  6672. }
  6673. }
  6674. window.fetchOnce().then((r2) => {
  6675. this.current.once = r2;
  6676. });
  6677. });
  6678. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  6679. let oldTag = this.clone(this.tags);
  6680. let tags = this.tags[username] ?? [];
  6681. let rIndex = tags.findIndex((v) => v === tag);
  6682. if (rIndex > -1) {
  6683. tags.splice(rIndex, 1);
  6684. }
  6685. this.tags[username] = tags;
  6686. let res = await window.parse.saveTags(this.tags);
  6687. if (!res) {
  6688. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  6689. this.tags = oldTag;
  6690. }
  6691. });
  6692. eventBus.on(CMD.REFRESH_POST, () => this.getPostDetail(this.current));
  6693. },
  6694. async getPostDetail(post) {
  6695. this.current = post;
  6696. this.current.read = this.readList[this.current.id] ?? { floor: 0, total: 0 };
  6697. this.show = true;
  6698. if (!this.current.inList) {
  6699. this.loading = true;
  6700. let r2 = await functions.checkPostReplies(post.id, true);
  6701. if (r2) {
  6702. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  6703. this.loading = this.show = false;
  6704. return;
  6705. }
  6706. }
  6707. let url = window.baseUrl + "/t/" + post.id;
  6708. this.current.url = url;
  6709. let alreadyHasReply = this.current.replyList.length;
  6710. if (alreadyHasReply) {
  6711. this.refreshLoading = true;
  6712. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  6713. } else {
  6714. this.loading = true;
  6715. }
  6716. let apiRes = await window.fetch(url + "?p=1");
  6717. if (apiRes.status === 404) {
  6718. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  6719. return this.refreshLoading = this.loading = false;
  6720. }
  6721. if (apiRes.status === 403) {
  6722. this.refreshLoading = this.show = this.loading = false;
  6723. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`);
  6724. return;
  6725. }
  6726. if (apiRes.redirected) {
  6727. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  6728. return this.refreshLoading = this.loading = false;
  6729. }
  6730. let htmlText = await apiRes.text();
  6731. let hasPermission = htmlText.search("你要查看的页面需要先登录");
  6732. if (hasPermission > -1) {
  6733. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录" });
  6734. return this.refreshLoading = this.loading = false;
  6735. }
  6736. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6737. let body = $(bodyText[0]);
  6738. decodeEmail(body);
  6739. await window.parse.getPostDetail(this.current, body, htmlText);
  6740. let index2 = this.list.findIndex((v) => v.id == this.current.id);
  6741. if (index2 > -1) {
  6742. this.list[index2] = this.clone(this.current);
  6743. } else {
  6744. this.list.push(this.clone(this.current));
  6745. }
  6746. this.refreshLoading = this.loading = false;
  6747. if (!alreadyHasReply) {
  6748. vue.nextTick(() => {
  6749. this.$refs.postDetail.jumpLastRead(this.current.read.floor);
  6750. });
  6751. }
  6752. await window.parse.parseOp(this.current);
  6753. console.log("当前帖子", this.current);
  6754. },
  6755. addTargetUserTag() {
  6756. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  6757. },
  6758. removeTargetUserTag(tag) {
  6759. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  6760. }
  6761. }
  6762. };
  6763. const _withScopeId = (n2) => (vue.pushScopeId("data-v-b2b0badd"), n2 = n2(), vue.popScopeId(), n2);
  6764. const _hoisted_1 = {
  6765. key: 0,
  6766. class: "target-user-tags p1"
  6767. };
  6768. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  6769. const _hoisted_3 = { class: "my-tag" };
  6770. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  6771. const _hoisted_5 = ["onClick"];
  6772. const _hoisted_6 = {
  6773. key: 1,
  6774. class: "my-box p2",
  6775. style: { "margin-top": "2rem" }
  6776. };
  6777. const _hoisted_7 = {
  6778. key: 0,
  6779. class: "flex flex-center"
  6780. };
  6781. const _hoisted_8 = {
  6782. key: 1,
  6783. class: "loaded"
  6784. };
  6785. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  6786. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  6787. const _component_Setting = vue.resolveComponent("Setting");
  6788. const _component_PostDetail = vue.resolveComponent("PostDetail");
  6789. const _component_TagModal = vue.resolveComponent("TagModal");
  6790. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  6791. const _component_MsgModal = vue.resolveComponent("MsgModal");
  6792. vue.resolveComponent("NotificationModal");
  6793. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  6794. const _component_BaseButton = vue.resolveComponent("BaseButton");
  6795. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  6796. vue.createVNode(_component_Setting, {
  6797. modelValue: $data.config,
  6798. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  6799. onBack: _cache[1] || (_cache[1] = ($event) => $options.slide("post", $data.step--)),
  6800. to: ".setting-wrapper"
  6801. }, null, 8, ["modelValue"]),
  6802. vue.createVNode(_component_Setting, {
  6803. modelValue: $data.config,
  6804. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.config = $event),
  6805. onBack: _cache[3] || (_cache[3] = ($event) => $options.slide("post", $data.step--)),
  6806. to: ".setting-wrapper2"
  6807. }, null, 8, ["modelValue"]),
  6808. vue.createVNode(_component_PostDetail, {
  6809. modelValue: $data.show,
  6810. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.show = $event),
  6811. ref: "postDetail",
  6812. displayType: $data.config.commentDisplayType,
  6813. "onUpdate:displayType": _cache[5] || (_cache[5] = ($event) => $data.config.commentDisplayType = $event),
  6814. onSaveReadList: $options.saveReadList,
  6815. onRefresh: _cache[6] || (_cache[6] = ($event) => $options.getPostDetail($data.current)),
  6816. loading: $data.loading,
  6817. refreshLoading: $data.refreshLoading
  6818. }, null, 8, ["modelValue", "displayType", "onSaveReadList", "loading", "refreshLoading"]),
  6819. vue.createVNode(_component_TagModal, {
  6820. tags: $data.tags,
  6821. "onUpdate:tags": _cache[7] || (_cache[7] = ($event) => $data.tags = $event)
  6822. }, null, 8, ["tags"]),
  6823. vue.createVNode(_component_Base64Tooltip),
  6824. vue.createVNode(_component_MsgModal),
  6825. vue.createCommentVNode("", true),
  6826. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  6827. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  6828. _hoisted_2,
  6829. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  6830. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  6831. _hoisted_4,
  6832. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  6833. vue.createElementVNode("i", {
  6834. class: "fa fa-trash-o remove",
  6835. onClick: ($event) => $options.removeTargetUserTag(i)
  6836. }, null, 8, _hoisted_5)
  6837. ]);
  6838. }), 256)),
  6839. vue.createElementVNode("span", {
  6840. class: "add-tag ago",
  6841. onClick: _cache[9] || (_cache[9] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  6842. title: "添加标签"
  6843. }, "+")
  6844. ])) : vue.createCommentVNode("", true),
  6845. $options.isPost && !$data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  6846. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  6847. vue.createVNode(_component_BaseLoading)
  6848. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  6849. _hoisted_9,
  6850. vue.createVNode(_component_BaseButton, {
  6851. size: "small",
  6852. onClick: $options.showPost
  6853. }, {
  6854. default: vue.withCtx(() => [
  6855. vue.createTextVNode("点击显示")
  6856. ]),
  6857. _: 1
  6858. }, 8, ["onClick"])
  6859. ]))
  6860. ])) : vue.createCommentVNode("", true)
  6861. ], 64)) : vue.createCommentVNode("", true)
  6862. ], 64);
  6863. }
  6864. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b2b0badd"]]);
  6865. let $section = document.createElement("section");
  6866. $section.id = "app";
  6867. function run() {
  6868. window.baseUrl = location.origin;
  6869. window.initPost = DefaultPost;
  6870. window.win = function() {
  6871. return window;
  6872. };
  6873. window.win().doc = window.win().document;
  6874. window.win().query = (v) => window.win().document.querySelector(v);
  6875. window.query = (v) => window.win().document.querySelector(v);
  6876. window.clone = (val) => JSON.parse(JSON.stringify(val));
  6877. window.user = DefaultUser;
  6878. window.targetUserName = "";
  6879. window.pageType = void 0;
  6880. window.pageData = { pageNo: 1 };
  6881. window.config = DefaultConfig;
  6882. window.const = {
  6883. git: "https://github.com/zyronon/v2ex-script",
  6884. issue: "https://github.com/zyronon/v2ex-script/issues"
  6885. };
  6886. window.currentVersion = 1;
  6887. window.isNight = $(".Night").length === 1;
  6888. window.cb = null;
  6889. window.stopMe = false;
  6890. window.postList = [];
  6891. window.parse = {
  6892. //解析帖子内容
  6893. async parsePostContent(post, body, htmlText) {
  6894. var _a, _b;
  6895. let once = htmlText.match(/var once = "([\d]+)";/);
  6896. if (once && once[1]) {
  6897. post.once = once[1];
  6898. }
  6899. post.isReport = htmlText.includes("你已对本主题进行了报告");
  6900. let wrapperClass = "Wrapper";
  6901. let wrapper;
  6902. let boxs;
  6903. if (body.length > 1) {
  6904. body.each(function() {
  6905. if (this.id === wrapperClass) {
  6906. wrapper = $(this);
  6907. boxs = this.querySelectorAll(".box");
  6908. }
  6909. });
  6910. } else {
  6911. wrapper = body;
  6912. boxs = body.find(`#${wrapperClass} .box`);
  6913. }
  6914. let box1 = $(boxs[0]);
  6915. let header1 = wrapper.find(".header");
  6916. if (!post.title || !post.content_rendered) {
  6917. let h1 = wrapper.find("h1");
  6918. if (h1) {
  6919. post.title = h1[0].innerText;
  6920. }
  6921. }
  6922. let as = wrapper.find(".header > a");
  6923. if (as.length) {
  6924. post.node.title = as[1].innerText;
  6925. post.node.url = as[1].href;
  6926. }
  6927. let aName = header1.find("small.gray a:nth-child(1)");
  6928. if (aName) {
  6929. post.member.username = aName[0].innerText;
  6930. }
  6931. let small = header1.find("small.gray");
  6932. if (small[0]) {
  6933. let spanEl = (_b = (_a = small[0]) == null ? void 0 : _a.lastChild) == null ? void 0 : _b.nodeValue;
  6934. if (spanEl) {
  6935. let dianIndex = spanEl.indexOf("·");
  6936. post.createDateAgo = spanEl.substring(4, dianIndex - 1);
  6937. let text = spanEl.substring(dianIndex + 1).trim();
  6938. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  6939. let clickCountReg = [...reg3];
  6940. if (clickCountReg.length) {
  6941. post.clickCount = Number(clickCountReg[0][1]);
  6942. }
  6943. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  6944. clickCountReg = [...reg3];
  6945. if (clickCountReg.length) {
  6946. post.clickCount = Number(clickCountReg[0][1]);
  6947. }
  6948. }
  6949. }
  6950. let avatarEl = header1.find(".avatar");
  6951. if (avatarEl) {
  6952. post.member.avatar_large = avatarEl[0].src;
  6953. }
  6954. let topic_buttons = box1.find(".inner .fr");
  6955. if (topic_buttons.length) {
  6956. let favoriteNode = topic_buttons.find(".op:first");
  6957. if (favoriteNode.length) {
  6958. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  6959. }
  6960. let ignoreNode = topic_buttons.find(".tb");
  6961. if (ignoreNode.length) {
  6962. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  6963. }
  6964. let thankNode = topic_buttons.find(".topic_thanked");
  6965. if (thankNode.length) {
  6966. post.isThanked = true;
  6967. }
  6968. let span = topic_buttons.find("span");
  6969. if (span.length) {
  6970. let text = span[0].innerText;
  6971. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  6972. let collectCountReg = [...reg1];
  6973. if (collectCountReg.length) {
  6974. post.collectCount = Number(collectCountReg[0][1]);
  6975. }
  6976. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  6977. collectCountReg = [...reg1];
  6978. if (collectCountReg.length) {
  6979. post.collectCount = Number(collectCountReg[0][1]);
  6980. }
  6981. }
  6982. }
  6983. let header = $(boxs[0]);
  6984. let temp = header.clone();
  6985. temp.find(".topic_buttons").remove();
  6986. temp.find(".inner").remove();
  6987. temp.find(".header").remove();
  6988. let html = temp.html();
  6989. html = functions.checkPhotoLink2Img(html);
  6990. post.headerTemplate = html;
  6991. return post;
  6992. },
  6993. //解析OP信息
  6994. async parseOp(post) {
  6995. if (!post.member.id) {
  6996. let userRes = await fetch(window.baseUrl + "/api/members/show.json?username=" + post.member.username);
  6997. if (userRes.status === 200) {
  6998. post.member = await userRes.json();
  6999. }
  7000. }
  7001. if (post.member.id) {
  7002. let date = new Date(post.member.created * 1e3);
  7003. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  7004. date.setHours(0);
  7005. date.setMinutes(0);
  7006. date.setSeconds(0);
  7007. date.setMilliseconds(0);
  7008. let now = /* @__PURE__ */ new Date();
  7009. now.setHours(0);
  7010. now.setMinutes(0);
  7011. now.setSeconds(0);
  7012. now.setMilliseconds(0);
  7013. let d2 = now.getTime() - date.getTime();
  7014. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 7;
  7015. post.member.createDate = createStr + " 注册";
  7016. post.member.isNew = isNew;
  7017. } else {
  7018. post.member.createDate = "用户已被注销/封禁";
  7019. post.member.isNew = true;
  7020. }
  7021. return post;
  7022. },
  7023. //获取帖子所有回复
  7024. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  7025. var _a, _b;
  7026. if (body.find("#no-comments-yet").length) {
  7027. return post;
  7028. }
  7029. let wrapperClass = "Wrapper";
  7030. let boxs;
  7031. let box;
  7032. if (body.length > 1) {
  7033. body.each(function() {
  7034. if (this.id === wrapperClass) {
  7035. boxs = this.querySelectorAll(".box");
  7036. box = boxs[2];
  7037. }
  7038. });
  7039. } else {
  7040. boxs = body.find(`#${wrapperClass} .box`);
  7041. box = boxs[2];
  7042. }
  7043. let cells = box.querySelectorAll(".cell");
  7044. if (cells && cells.length) {
  7045. post.fr = boxs[1].querySelector(".inner").innerHTML;
  7046. cells = Array.from(cells);
  7047. let snow = cells[0].querySelector(".snow");
  7048. post.createDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  7049. let repliesMap = [];
  7050. if (cells[1].id) {
  7051. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  7052. let replyList = functions.getAllReply(repliesMap);
  7053. post.replyList = replyList;
  7054. post.replyCount = replyList.length;
  7055. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  7056. let nestedList = functions.createNestedList(replyList);
  7057. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  7058. if (nestedList)
  7059. post.nestedReplies = nestedList;
  7060. if (nestedRedundantList)
  7061. post.nestedRedundReplies = nestedRedundantList;
  7062. return post;
  7063. } else {
  7064. let promiseList = [];
  7065. return new Promise((resolve, reject) => {
  7066. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7067. let pages = cells[1].querySelectorAll("a.page_normal");
  7068. pages = Array.from(pages);
  7069. let url = window.baseUrl + "/t/" + post.id;
  7070. for (let i = 0; i < pages.length; i++) {
  7071. let currentPageNo = Number(pages[i].innerText);
  7072. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  7073. }
  7074. Promise.allSettled(promiseList).then(
  7075. (results) => {
  7076. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  7077. let replyList = functions.getAllReply(repliesMap);
  7078. post.replyList = replyList;
  7079. post.replyCount = replyList.length;
  7080. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  7081. let nestedList = functions.createNestedList(replyList);
  7082. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  7083. if (nestedList)
  7084. post.nestedReplies = nestedList;
  7085. if (nestedRedundantList)
  7086. post.nestedRedundReplies = nestedRedundantList;
  7087. resolve(post);
  7088. }
  7089. );
  7090. });
  7091. }
  7092. }
  7093. },
  7094. //请求帖子其他页的回复
  7095. fetchPostOtherPageReplies(href, pageNo) {
  7096. return new Promise((resolve) => {
  7097. $.get(href).then((res) => {
  7098. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7099. let wrapperClass = "Wrapper";
  7100. let box;
  7101. $(s[0]).each(function() {
  7102. if (this.id === wrapperClass) {
  7103. box = this.querySelectorAll(".box")[2];
  7104. }
  7105. });
  7106. let cells = box.querySelectorAll(".cell");
  7107. cells = Array.from(cells);
  7108. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  7109. }).catch((r2) => {
  7110. if (r2.status === 403) {
  7111. functions.cbChecker({ type: "restorePost", value: null });
  7112. }
  7113. });
  7114. });
  7115. },
  7116. //解析页面的回复
  7117. parsePageReplies(nodes) {
  7118. let replyList = [];
  7119. nodes.forEach((node, index2) => {
  7120. if (!node.id)
  7121. return;
  7122. let item = {
  7123. level: 0,
  7124. thankCount: 0,
  7125. isThanked: false,
  7126. isOp: false,
  7127. isDup: false,
  7128. id: node.id.replace("r_", "")
  7129. };
  7130. let reply_content = node.querySelector(".reply_content");
  7131. item.reply_content = functions.checkPhotoLink2Img(reply_content.innerHTML);
  7132. item.reply_text = reply_content.textContent;
  7133. let { users, floor } = this.parseReplyContent(item.reply_content);
  7134. item.hideCallUserReplyContent = item.reply_content;
  7135. if (users.length === 1) {
  7136. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  7137. }
  7138. item.replyUsers = users;
  7139. item.replyFloor = floor;
  7140. let spans = node.querySelectorAll("span");
  7141. let ago = spans[1];
  7142. item.date = ago.textContent;
  7143. let userNode = node.querySelector("strong a");
  7144. item.username = userNode.textContent;
  7145. let avatar = node.querySelector("td img");
  7146. item.avatar = avatar.src;
  7147. let no = node.querySelector(".no");
  7148. item.floor = Number(no.textContent);
  7149. let thank_area = node.querySelector(".thank_area");
  7150. if (thank_area) {
  7151. item.isThanked = thank_area.classList.contains("thanked");
  7152. }
  7153. let small = spans[2];
  7154. if (small) {
  7155. item.thankCount = Number(small.textContent);
  7156. }
  7157. let op = node.querySelector(".op");
  7158. if (op) {
  7159. item.isOp = true;
  7160. }
  7161. let mod = node.querySelector(".mod");
  7162. if (mod) {
  7163. item.isMod = true;
  7164. }
  7165. replyList.push(item);
  7166. });
  7167. return replyList;
  7168. },
  7169. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  7170. parseReplyContent(str) {
  7171. if (!str)
  7172. return;
  7173. let users = [];
  7174. let getUsername = (userStr) => {
  7175. let endIndex = userStr.indexOf('">');
  7176. if (endIndex > -1) {
  7177. let user = userStr.substring(0, endIndex);
  7178. if (!users.find((i) => i === user)) {
  7179. users.push(user);
  7180. }
  7181. }
  7182. };
  7183. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  7184. let has = str.matchAll(userReg);
  7185. let res2 = [...has];
  7186. if (res2.length > 1) {
  7187. res2.map((item) => {
  7188. getUsername(item[1]);
  7189. });
  7190. }
  7191. if (res2.length === 1) {
  7192. getUsername(res2[0][1]);
  7193. }
  7194. let floor = -1;
  7195. if (users.length === 1) {
  7196. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  7197. let hasFloor = str.matchAll(floorReg);
  7198. let res = [...hasFloor];
  7199. if (res.length) {
  7200. floor = Number(res[0][1]);
  7201. }
  7202. }
  7203. return { users, floor };
  7204. },
  7205. //获取帖子详情
  7206. async getPostDetail(post, body, htmlText, pageNo = 1) {
  7207. post = await this.parsePostContent(post, body, htmlText);
  7208. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  7209. },
  7210. //解析页面帖子列表
  7211. parsePagePostList(list, box) {
  7212. list.forEach((itemDom) => {
  7213. let item = window.clone(window.initPost);
  7214. let item_title = itemDom.querySelector(".item_title");
  7215. itemDom.classList.add("post-item");
  7216. if (!item_title)
  7217. return;
  7218. let a = item_title.querySelector("a");
  7219. let { href, id } = functions.parseA(a);
  7220. item.id = id;
  7221. a.href = item.href = href;
  7222. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  7223. itemDom.classList.add(`id_${id}`);
  7224. itemDom.dataset["href"] = href;
  7225. itemDom.dataset["id"] = id;
  7226. window.postList.push(item);
  7227. if (![PageType.Member].includes(window.pageType)) {
  7228. let headerWrap = $(`
  7229. <div class="new-item">
  7230. <div class="left">
  7231. <div class="top">
  7232. <div class="r">
  7233. <div class="small fade"></div>
  7234. <div class="small fade"></div>
  7235. </div>
  7236. </div>
  7237. <div class="bottom"></div>
  7238. </div>
  7239. <div class="right"></div>
  7240. </div>`);
  7241. headerWrap.find(".bottom").append(item_title);
  7242. headerWrap.find(".right").append(itemDom.querySelector(".count_livid"));
  7243. headerWrap.find(".top").prepend(itemDom.querySelector("td:first-child a"));
  7244. let info = itemDom.querySelector("td:nth-child(3)");
  7245. if (window.pageType === PageType.Node)
  7246. ;
  7247. if ([PageType.Changes, PageType.Home].includes(window.pageType)) {
  7248. let s1 = info.querySelector("span:first-child");
  7249. let t = headerWrap.find(".top .r div:first");
  7250. t.append(s1.querySelector("strong"));
  7251. t.append(` `);
  7252. t.append(s1.querySelector("a"));
  7253. }
  7254. let b = headerWrap.find(".top .r div:last");
  7255. b.append(info.querySelector("span:last-child").innerHTML);
  7256. itemDom.append(headerWrap[0]);
  7257. itemDom.querySelector("table").remove();
  7258. }
  7259. });
  7260. Promise.allSettled(window.postList.map((item) => $.get(item.url))).then((res) => {
  7261. let ok = res.filter((r2) => r2.status === "fulfilled").map((v) => v.value[0]);
  7262. if (window.config.viewType === "card") {
  7263. list.forEach((itemDom) => itemDom.classList.add("preview"));
  7264. }
  7265. ok.map((postItem) => {
  7266. var _a;
  7267. if (postItem == null ? void 0 : postItem.id) {
  7268. let itemDom = box.querySelector(`.id_${postItem.id}`);
  7269. let index2 = window.postList.findIndex((v) => v.id == postItem.id);
  7270. if (index2 > -1) {
  7271. let obj = window.postList[index2];
  7272. postItem.replyCount = postItem.replies;
  7273. window.postList[index2] = Object.assign({}, obj, postItem);
  7274. if (postItem.content_rendered) {
  7275. let a = document.createElement("a");
  7276. a.href = obj.href;
  7277. a.classList.add("post-content");
  7278. let div = document.createElement("div");
  7279. div.innerHTML = postItem.content_rendered;
  7280. a.append(div);
  7281. itemDom.append(a);
  7282. if (div.clientHeight < 300) {
  7283. a.classList.add("show-all");
  7284. } else {
  7285. let showMore = document.createElement("div");
  7286. showMore.classList.add("show-more");
  7287. showMore.innerHTML = "显示更多/收起";
  7288. showMore.onclick = function(e2) {
  7289. e2.stopPropagation();
  7290. a.classList.toggle("show-all");
  7291. };
  7292. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  7293. }
  7294. }
  7295. }
  7296. }
  7297. });
  7298. functions.cbChecker({ type: "syncData" });
  7299. });
  7300. },
  7301. //创建记事本子条目
  7302. async createNoteItem(itemName) {
  7303. return new Promise(async (resolve) => {
  7304. let data = new FormData();
  7305. data.append("content", itemName);
  7306. data.append("parent_id", 0);
  7307. data.append("syntax", 0);
  7308. let apiRes = await window.win().fetch(`${window.baseUrl}/notes/new`, { method: "post", body: data });
  7309. if (apiRes.redirected && apiRes.status === 200) {
  7310. resolve(apiRes.url.substr(-5));
  7311. return;
  7312. }
  7313. resolve(null);
  7314. });
  7315. },
  7316. //编辑记事本子条目
  7317. async editNoteItem(val, id) {
  7318. let data = new FormData();
  7319. data.append("content", val);
  7320. data.append("syntax", 0);
  7321. let apiRes = await window.fetch(`${window.baseUrl}/notes/edit/${id}`, {
  7322. method: "post",
  7323. body: data
  7324. });
  7325. return apiRes.redirected && apiRes.status === 200;
  7326. },
  7327. //标签操作
  7328. async saveTags(val) {
  7329. for (const [key, value] of Object.entries(val)) {
  7330. if (!value.length)
  7331. delete val[key];
  7332. }
  7333. return await this.editNoteItem(window.user.tagPrefix + JSON.stringify(val), window.user.tagsId);
  7334. },
  7335. //已读楼层操作
  7336. async saveReadList(val) {
  7337. return await this.editNoteItem(window.user.readPrefix + JSON.stringify(val), window.user.readNoteItemId);
  7338. },
  7339. //imgur图片删除hash操作
  7340. async saveImgurList(val) {
  7341. return await this.editNoteItem(window.user.imgurPrefix + JSON.stringify(val), window.user.imgurNoteId);
  7342. }
  7343. };
  7344. window.vals = {
  7345. isMobile: !document.querySelector("#Rightbar")
  7346. };
  7347. window.functions = {
  7348. feedback() {
  7349. functions.openNewTab(window.const.issue);
  7350. },
  7351. clickAvatar(prex) {
  7352. let menu = $(`${prex}#menu-body`);
  7353. if (menu.css("--show-dropdown") === "block") {
  7354. menu.css("--show-dropdown", "none");
  7355. } else {
  7356. menu.css("--show-dropdown", "block");
  7357. }
  7358. }
  7359. };
  7360. function initStyle() {
  7361. let style2 = `
  7362. }
  7363. `;
  7364. let addStyle2 = document.createElement("style");
  7365. addStyle2.rel = "stylesheet";
  7366. addStyle2.type = "text/css";
  7367. addStyle2.innerHTML = style2;
  7368. window.document.head.append(addStyle2);
  7369. }
  7370. function qianDao() {
  7371. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  7372. if (window.pageType === PageType.Home) {
  7373. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  7374. if (qiandao) {
  7375. qianDao_(qiandao, timeNow);
  7376. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  7377. window.win().doc.getElementById("gift_v2excellent").click();
  7378. localStorage.setItem("menu_clockInTime", timeNow);
  7379. console.info("[V2EX - 超级增强] 自动签到完成!");
  7380. } else {
  7381. console.info("[V2EX - 超级增强] 自动签到完成!");
  7382. }
  7383. } else {
  7384. let timeOld = localStorage.getItem("menu_clockInTime");
  7385. if (!timeOld || timeOld != timeNow) {
  7386. qianDaoStatus_(timeNow);
  7387. } else {
  7388. console.info("[V2EX - 超级增强] 自动签到完成!");
  7389. }
  7390. }
  7391. }
  7392. function qianDao_(qiandao, timeNow) {
  7393. let url = window.baseUrl + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  7394. console.log("url", url);
  7395. $.get(url).then((r2) => {
  7396. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7397. let html = $(bodyText[0]);
  7398. if (html.find("li.fa.fa-ok-sign").length) {
  7399. html = html.find("#Main").text().match(/已连续登录 (\d+?) 天/)[0];
  7400. localStorage.setItem("menu_clockInTime", timeNow);
  7401. console.info("[V2EX - 超级增强] 自动签到完成!");
  7402. if (qiandao) {
  7403. qiandao.textContent = `自动签到完成!${html}`;
  7404. qiandao.href = "javascript:void(0);";
  7405. }
  7406. } else {
  7407. _GM_notification({
  7408. text: "自动签到失败!请关闭其他插件或脚本。\n如果连续几天都签到失败,请联系作者解决!",
  7409. timeout: 4e3,
  7410. onclick() {
  7411. window.functions.feedback();
  7412. }
  7413. });
  7414. console.warn("[V2EX 增强] 自动签到失败!请关闭其他插件或脚本。如果连续几天都签到失败,请联系作者解决!");
  7415. if (qiandao)
  7416. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  7417. }
  7418. });
  7419. }
  7420. function qianDaoStatus_(timeNow) {
  7421. $.get(window.baseUrl + "/mission/daily").then((r2) => {
  7422. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7423. let html = $(bodyText[0]);
  7424. if (html.find('input[value^="领取"]').length) {
  7425. qianDao_(null, timeNow);
  7426. } else {
  7427. console.info("[V2EX 增强] 已经签过到了。");
  7428. localStorage.setItem("menu_clockInTime", timeNow);
  7429. }
  7430. });
  7431. }
  7432. function checkPageType() {
  7433. let l = window.location;
  7434. if (l.pathname === "/") {
  7435. window.pageType = PageType.Home;
  7436. } else if (l.pathname === "/changes") {
  7437. window.pageType = PageType.Changes;
  7438. } else if (l.pathname === "/recent") {
  7439. window.pageType = PageType.Changes;
  7440. } else if (l.href.match(/.com\/?tab=/)) {
  7441. window.pageType = PageType.Home;
  7442. } else if (l.href.match(/.com\/go\//)) {
  7443. if (!l.href.includes("/links")) {
  7444. window.pageType = PageType.Node;
  7445. }
  7446. } else if (l.href.match(/.com\/member/)) {
  7447. window.pageType = PageType.Member;
  7448. } else {
  7449. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  7450. if (r2) {
  7451. window.pageType = PageType.Post;
  7452. window.pageData.id = r2[1];
  7453. if (l.search) {
  7454. let pr = l.href.match(/\?p=([\d]+)/);
  7455. if (pr)
  7456. window.pageData.pageNo = Number(pr[1]);
  7457. }
  7458. }
  7459. }
  7460. }
  7461. function getNoteItemContent(id, prefix) {
  7462. return new Promise((resolve, reject) => {
  7463. $.get(window.baseUrl + "/notes/edit/" + id).then((r2) => {
  7464. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7465. let body = $(bodyText[0]);
  7466. let text = body.find(".note_editor").text();
  7467. if (text === prefix) {
  7468. resolve({});
  7469. } else {
  7470. let tagJson = text.substring(prefix.length);
  7471. try {
  7472. resolve(JSON.parse(tagJson));
  7473. } catch (e2) {
  7474. console.log("tage", tagJson);
  7475. resolve({});
  7476. }
  7477. }
  7478. });
  7479. });
  7480. }
  7481. async function initNoteData() {
  7482. $.get(window.baseUrl + "/notes").then(async (r2) => {
  7483. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7484. let body = $(bodyText[0]);
  7485. let items = body.find("#Main .box .note_item_title a");
  7486. if (window.config.openTag) {
  7487. let tagItem = Array.from(items).find((v) => v.innerText.includes(window.user.tagPrefix));
  7488. if (tagItem) {
  7489. window.user.tagsId = tagItem.href.substr(-5);
  7490. window.user.tags = await getNoteItemContent(window.user.tagsId, window.user.tagPrefix);
  7491. } else {
  7492. let r22 = await window.parse.createNoteItem(window.user.tagPrefix);
  7493. r22 && (window.user.tagsId = r22);
  7494. }
  7495. }
  7496. if (window.config.rememberLastReadFloor) {
  7497. let readItem = Array.from(items).find((v) => v.innerText.includes(window.user.readPrefix));
  7498. if (readItem) {
  7499. window.user.readNoteItemId = readItem.href.substr(-5);
  7500. window.user.readList = await getNoteItemContent(window.user.readNoteItemId, window.user.readPrefix);
  7501. } else {
  7502. let r22 = await window.parse.createNoteItem(window.user.readPrefix);
  7503. r22 && (window.user.readNoteItemId = r22);
  7504. }
  7505. }
  7506. functions.cbChecker({ type: "syncData" });
  7507. });
  7508. }
  7509. function initConfig() {
  7510. return new Promise((resolve) => {
  7511. let configStr = window.localStorage.getItem("v2ex-config");
  7512. if (configStr) {
  7513. let configObj = JSON.parse(configStr);
  7514. configObj = configObj[window.user.username ?? "default"];
  7515. if (configObj) {
  7516. window.config = Object.assign(window.config, configObj);
  7517. }
  7518. }
  7519. resolve(window.config);
  7520. });
  7521. }
  7522. function addSettingText() {
  7523. let setting = $(`<a href="/script-setting" class="top">脚本设置</a>`);
  7524. $("#menu-body .cell:first").append(setting);
  7525. }
  7526. async function init() {
  7527. window.addEventListener("error", (e2) => {
  7528. let dom = e2.target;
  7529. let originImgUrl = dom.getAttribute("data-originurl");
  7530. if (originImgUrl) {
  7531. let a = document.createElement("a");
  7532. a.href = originImgUrl;
  7533. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  7534. a.innerText = originImgUrl;
  7535. dom.parentNode.replaceChild(a, dom);
  7536. }
  7537. }, true);
  7538. if (window.isNight) {
  7539. document.documentElement.classList.add("dark");
  7540. }
  7541. checkPageType();
  7542. addSettingText();
  7543. functions.initMonkeyMenu();
  7544. let s = $(`
  7545. <div class="slide">
  7546. <div class="slide-list">
  7547. <div class="slide-item page0"></div>
  7548. <div class="slide-item page1">
  7549. <div class="post-wrapper"></div>
  7550. <div class="setting-wrapper"></div>
  7551. </div>
  7552. <div class="slide-item page2">
  7553. <div class="setting-wrapper2"></div>
  7554. </div>
  7555. </div>
  7556. </div>`);
  7557. $("body").append(s);
  7558. $("body").children().slice(0, 4).each(function() {
  7559. $(".page0").append(this);
  7560. });
  7561. $(".post-wrapper").append($("#site-header").clone());
  7562. let top2 = $("#menu-body .cell:first .top:first");
  7563. if (top2.length && ["个人主页", "Profile"].includes(top2.text())) {
  7564. window.user.username = top2.attr("href").replace("/member/", "");
  7565. window.user.avatar = $("#menu-entry .avatar").attr("src");
  7566. }
  7567. initConfig().then((r2) => {
  7568. initStyle();
  7569. try {
  7570. if (window.config.autoSignin && window.user.username) {
  7571. qianDao();
  7572. }
  7573. } catch (e2) {
  7574. console.log("签到失败");
  7575. }
  7576. if (window.user.username) {
  7577. initNoteData();
  7578. }
  7579. });
  7580. let box;
  7581. let list;
  7582. let first;
  7583. let last;
  7584. switch (window.pageType) {
  7585. case PageType.Node:
  7586. box = document.querySelectorAll("#Wrapper .box");
  7587. box[1].style.background = "unset";
  7588. box[1].style.borderBottom = "none";
  7589. box[1].style["border-radius"] = "0";
  7590. box[1].style["box-shadow"] = "none";
  7591. first = $(box[1]).children().first();
  7592. first.addClass("cell post-item");
  7593. if (window.config.viewType === "card")
  7594. first[0].classList.add("preview");
  7595. last = $(box[1]).children().last();
  7596. last.addClass("cell post-item");
  7597. if (window.config.viewType === "card")
  7598. last[0].classList.add("preview");
  7599. list = box[1].querySelectorAll(".cell");
  7600. box[0].before($section);
  7601. window.parse.parsePagePostList(list, box[1]);
  7602. break;
  7603. case PageType.Home:
  7604. box = document.querySelector("#Wrapper .box");
  7605. let headerWrap = $('<div class="cell post-item"></div>');
  7606. if (window.config.viewType === "card")
  7607. headerWrap[0].classList.add("preview");
  7608. $(box).prepend(headerWrap);
  7609. $(box).children().slice(1, 3).each(function() {
  7610. headerWrap.append(this);
  7611. });
  7612. last = $(box).children().last();
  7613. last.addClass("cell post-item");
  7614. if (window.config.viewType === "card")
  7615. last[0].classList.add("preview");
  7616. box.style.background = "unset";
  7617. box.style["border-radius"] = "0";
  7618. box.style["box-shadow"] = "none";
  7619. list = box.querySelectorAll(".item");
  7620. list[0].before($section);
  7621. window.parse.parsePagePostList(list, box);
  7622. break;
  7623. case PageType.Changes:
  7624. box = document.querySelector("#Wrapper .box");
  7625. box.style.background = "unset";
  7626. box.style["border-radius"] = "0";
  7627. box.style["box-shadow"] = "none";
  7628. first = $(box).children().first();
  7629. first.addClass("cell post-item");
  7630. if (window.config.viewType === "card")
  7631. first[0].classList.add("preview");
  7632. last = $(box).children().last();
  7633. last.addClass("cell post-item");
  7634. if (window.config.viewType === "card")
  7635. last[0].classList.add("preview");
  7636. list = box.querySelectorAll(".item");
  7637. list[0].before($section);
  7638. window.parse.parsePagePostList(list, box);
  7639. break;
  7640. case PageType.Post:
  7641. box = document.querySelector("#Wrapper .box");
  7642. box.after($section);
  7643. let r2 = await functions.checkPostReplies(window.pageData.id, false);
  7644. if (r2) {
  7645. window.stopMe = true;
  7646. functions.cbChecker({ type: "syncData" });
  7647. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,脚本已停止解析楼中楼" });
  7648. return;
  7649. }
  7650. let post = functions.clone(window.initPost);
  7651. post.id = window.pageData.id;
  7652. let body = $(document.body);
  7653. let htmlText = document.documentElement.outerHTML;
  7654. window.parse.parsePostContent(
  7655. post,
  7656. body,
  7657. htmlText
  7658. ).then(async (res) => {
  7659. await functions.cbChecker({ type: "postContent", value: res });
  7660. await window.parse.parseOp(res);
  7661. });
  7662. window.parse.getPostAllReplies(
  7663. post,
  7664. body,
  7665. htmlText,
  7666. window.pageData.pageNo
  7667. ).then(async (res1) => {
  7668. await functions.cbChecker({ type: "postReplies", value: res1 });
  7669. });
  7670. break;
  7671. case PageType.Member:
  7672. box = document.querySelectorAll("#Wrapper .box");
  7673. window.targetUserName = box[0].querySelector("h1").textContent;
  7674. if (window.config.openTag) {
  7675. box[0].style.borderBottom = "none";
  7676. box[0].style["border-bottom-left-radius"] = "0";
  7677. box[0].style["border-bottom-right-radius"] = "0";
  7678. }
  7679. list = box[2].querySelectorAll(".cell");
  7680. box[0].after($section);
  7681. window.parse.parsePagePostList(list, box[2]);
  7682. break;
  7683. default:
  7684. window.stopMe = true;
  7685. functions.cbChecker({ type: "syncData" });
  7686. console.error("未知页面");
  7687. break;
  7688. }
  7689. }
  7690. window.canParseV2exPage = !window.location.search.includes("script");
  7691. if (window.canParseV2exPage) {
  7692. init();
  7693. } else {
  7694. let box = document.querySelector("#Wrapper #Main .box");
  7695. box.after($section);
  7696. window.stopMe = true;
  7697. functions.cbChecker({ type: "syncData" });
  7698. if (window.location.search.includes("script=0")) {
  7699. functions.cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  7700. }
  7701. if (window.location.search.includes("script=1")) {
  7702. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  7703. }
  7704. }
  7705. }
  7706. (function() {
  7707. if (/eruda=1/.test(location.href) || localStorage.getItem("active-eruda")) {
  7708. let src = "//cdn.jsdelivr.net/npm/eruda@3.0.1";
  7709. console.log(1);
  7710. let s = document.createElement("script");
  7711. s.src = src;
  7712. s.onload = () => {
  7713. let s1 = document.createElement("script");
  7714. s1.innerText = `eruda.init();`;
  7715. document.body.append(s1);
  7716. };
  7717. document.body.append(s);
  7718. }
  7719. })();
  7720. run();
  7721. let vueApp = vue.createApp(App);
  7722. vueApp.config.unwrapInjectedRef = true;
  7723. vueApp.mount($section);
  7724.  
  7725. })(Vue);