// ==UserScript==
// @name V2EX - 超级增强
// @namespace http://tampermonkey.net/
// @version 2.8.2
// @description 最完整的楼中楼回复(支持按感谢排序),在列表可预览帖子内容,列表点击帖子弹出帖子详情,划词 base64 解码,自动加载下一页,操作按钮(感谢、收藏、回复、隐藏)异步请求,不会刷新页面,支持黑暗模式
// @author Zyronon
// @match https://*.v2ex.com/
// @match https://*.v2ex.com/?tab=*
// @match https://*.v2ex.com/t/*
// @match https://*.v2ex.com/recent*
// @match https://*.v2ex.com/go/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=v2ex.com
// @require https://cdn.bootcdn.net/ajax/libs/vue/3.2.47/vue.runtime.global.prod.min.js
// @grant none
// @license GPL License
// ==/UserScript==
(function () {
let style = `
html,body{font-size:62.5%}.flex{display:flex;align-items:center;justify-content:space-between}.flex-end{justify-content:flex-end}.flex-center{justify-content:center}.p1{padding:1rem}.p0{padding:0!important}.post-author{display:flex;align-items:center;position:relative;color:#ccc!important}.post-author>.username{font-size:1.2rem}.sticky{position:sticky;bottom:0}.sticky[stuck]{box-shadow:0 2px 20px #00000059}a{color:#778087;text-decoration:none;cursor:pointer}a:hover{text-decoration:underline}.subtlesHtml{font-size:1.4rem;border-top:1px solid #e2e2e2;margin-bottom:1rem}.subtlesHtml .subtle:last-child{border-bottom:none}.subtlesHtml .subtle .fade{color:#ccc}.subtlesHtml .subtle .sep5{height:5px}.subtlesHtml .subtle .topic_content{color:#000}.base-loading{border:2px solid;border-color:#000 #00000033 #00000033 #00000033;border-radius:100%;animation:circle infinite 1s linear}.loading-c{border:2px solid;border-color:#000 #00000033 #00000033 #00000033;border-radius:100%;animation:circle infinite 1s linear;width:3rem;height:3rem}.loading-b{border:2px solid;border-color:#000 #00000033 #00000033 #00000033;border-radius:100%;animation:circle infinite 1s linear;border-color:#ffffff rgba(178,177,177,.2) rgba(178,177,177,.2) rgba(178,177,177,.2);width:3rem;height:3rem}@keyframes circle{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.button{cursor:pointer;padding:.4rem 2.4rem;border-radius:10rem;display:inline-flex;justify-content:center;align-items:center;font-weight:700;font-size:1.2rem;color:#fff;background:#0079d3;border:1px solid #0079d3;user-select:none}.button:hover{opacity:.9}.button:before{content:" ";border:2px solid;border-color:#000 #00000033 #00000033 #00000033;border-radius:100%;animation:circle infinite 1s linear;border-color:#fff transparent transparent transparent;width:1rem;height:1rem;margin-right:1rem;display:none}.button.loading{cursor:not-allowed;opacity:.5}.button.loading:before{display:block}.button.disabled{cursor:not-allowed;color:#c6c6c6;background:#8d8d8d;border:1px solid transparent}.tool{position:relative;margin-left:.6rem;display:flex;align-items:center;font-size:1.2rem;font-weight:700;border-radius:.2rem;cursor:pointer;height:3rem;padding:0 .5rem}.tool:before{content:" ";border:2px solid;border-color:#000 #00000033 #00000033 #00000033;border-radius:100%;animation:circle infinite 1s linear;border-color:transparent #929596 #929596 #929596;width:1rem;height:1rem;margin-left:1rem;display:none}.tool.loading{cursor:not-allowed;opacity:.5}.tool.loading:before{display:block}.tool.loading:hover{background:unset}.tool>svg{width:1.6rem!important;height:1.6rem!important;margin-right:.4rem;box-sizing:border-box;border-radius:.2rem}.tool:hover{background:#e8e8e8}.tool.no-hover{cursor:default}.tool.no-hover:hover{background:unset}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node:hover{text-decoration:none;background:#e2e2e2}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.msg{cursor:default;margin-bottom:2rem;background:white;display:flex;color:#000;font-size:1.4rem;box-sizing:border-box;border-radius:.4rem;box-shadow:0 0 1rem 1px silver}.msg.success .left{background:#0079d3}.msg.warning .left{background:#c8c002}.msg.error .left{background:red}.msg .left{border-radius:.4rem 0 0 .4rem;display:flex;align-items:center;background:#0079d3}.msg .left svg{margin:0 .3rem;cursor:pointer}.msg .right{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.line{border-bottom:1px solid #e2e2e2}.my-box{box-shadow:0 2px 3px #0000001a;border-radius:.4rem;background:white;margin-bottom:2rem;width:100%;box-sizing:border-box}.my-cell{padding:1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid #e2e2e2}.f14{font-size:1.4rem}.switch{width:4.5rem;height:2.2rem;border-radius:2rem;position:relative;display:flex;align-items:center;background:#ccc;transition:all .3s}.switch.active{background:#0079d3}.switch.active:before{right:.2rem}.switch:before{position:absolute;content:" ";transition:all .3s;right:calc(100% - 2rem);width:1.8rem;height:1.8rem;border-radius:50%;background:white}.horizontal[data-v-4dbb3f30]{flex-direction:row!important;padding:0!important}.horizontal .num[data-v-4dbb3f30]{margin-left:.2rem}.point[data-v-4dbb3f30]{font-size:1.2rem;padding:1rem 0;min-width:4rem;border-radius:.4rem 0 0 .4rem;display:flex;flex-direction:column;align-items:center}.point .up[data-v-4dbb3f30]{display:flex;flex-direction:column;align-items:center;justify-content:center}.point .num[data-v-4dbb3f30]{font-weight:700;color:#000;user-select:none}.point svg[data-v-4dbb3f30]{width:2rem;padding:.4rem;border-radius:.2rem}.point svg[data-v-4dbb3f30]:hover{background:#e5e5e5}.point .disabled[data-v-4dbb3f30]:hover{background:unset}.Author[data-v-1d0f657a]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative;margin-bottom:.4rem}.Author.expand[data-v-1d0f657a]{margin-bottom:0}.Author .Author-left[data-v-1d0f657a]{display:flex;align-items:center}.Author .Author-left .username[data-v-1d0f657a]{font-size:1.4rem}.Author .Author-left .expand-icon[data-v-1d0f657a]{cursor:pointer;margin-right:.8rem;width:2rem;height:2rem;transform:rotate(90deg)}.Author .Author-left .icon[data-v-1d0f657a]{margin-right:1rem;display:flex}.Author .Author-left .icon img[data-v-1d0f657a]{width:3.4rem;height:3.4rem;border-radius:.3rem}.Author .Author-left .op[data-v-1d0f657a]{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-right[data-v-1d0f657a]{position:absolute;right:0;display:flex;align-items:center}.Author .Author-right .toolbar[data-v-1d0f657a]{display:flex;align-items:center;color:#929596;opacity:0}.Author .Author-right .toolbar[data-v-1d0f657a]:hover{background:white;opacity:1}.Author .Author-right .floor[data-v-1d0f657a]{margin-left:1rem;font-size:1.2rem;line-height:1rem;border-radius:1rem;display:inline-block;background-color:#f0f0f0;color:#ccc;padding:.2rem .5rem;cursor:default}.Author .Author-right .isDev[data-v-1d0f657a]{color:#000!important}.post-editor-wrapper[data-v-711cb3dc]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s}.post-editor-wrapper.reply-post .post-editor[data-v-711cb3dc]{border:1px solid #e2e2e2;border-radius:.4rem}.post-editor-wrapper.reply-post.isFocus .post-editor[data-v-711cb3dc]{border:1px solid #968b8b}.post-editor-wrapper.reply-comment[data-v-711cb3dc]{border:1px solid #e2e2e2;border-radius:.4rem;overflow:hidden}.post-editor-wrapper.reply-comment.isFocus[data-v-711cb3dc]{border:1px solid #968b8b}.post-editor-wrapper.reply-comment .toolbar[data-v-711cb3dc]{background:#f6f7f8}.post-editor-wrapper .post-editor[data-v-711cb3dc]{transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;border:none;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none}.post-editor-wrapper .toolbar[data-v-711cb3dc]{box-sizing:border-box;padding:.5rem 1rem;width:100%;position:relative;display:flex;justify-content:space-between;align-items:center}.post-editor-wrapper .toolbar span[data-v-711cb3dc]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-711cb3dc]{transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;border:none;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;position:absolute;top:0;z-index:-100}.comment[data-v-2005ce85]{width:100%;box-sizing:border-box;margin-top:1rem;background:white}.comment .comment-content-w[data-v-2005ce85]{background:white}.comment .comment-content-w .more[data-v-2005ce85]{text-align:center;margin:2rem 0}.comment .comment-content[data-v-2005ce85]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-2005ce85]{cursor:pointer;width:2.6rem;min-width:2.6rem;position:relative}.comment .comment-content .expand-line[data-v-2005ce85]:after{position:absolute;left:calc(68% - 1px);content:" ";height:100%;width:0;border-right:2px solid #ddd}.comment .comment-content .expand-line[data-v-2005ce85]:hover:after{border-right:2px solid #0079D3}.comment .comment-content .right[data-v-2005ce85]{flex:1;width:calc(100% - 2.6rem)}.comment .comment-content .right .w[data-v-2005ce85]{padding-left:1.7rem}.comment .comment-content .right .w .text[data-v-2005ce85]{color:#000;word-break:break-word}.comment .comment-content .right .w .post-editor-wrapper[data-v-2005ce85]{margin-top:1rem}.toolbar[data-v-957db65c]{display:flex;align-items:center;color:#929596}.toolbar .tooltip[data-v-957db65c]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:white;padding:1rem;top:4rem;left:-3rem;width:15rem;position:absolute;z-index:99}.toolbar .tooltip a[data-v-957db65c]{color:#0079d3!important}.htmlContent{width:100%}.htmlContent img{max-width:100%}.sticky{position:sticky;bottom:-2px}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.post-detail[data-v-4760dc18]{text-align:start;position:fixed;z-index:99;left:0;right:0;bottom:0;top:0;background:rgba(46,47,48,.8);overflow:auto;font-size:1.4rem;display:flex;justify-content:center;flex-wrap:wrap}.post-detail.isNight[data-v-4760dc18]{background:rgba(46,47,48,.8)}.post-detail.isNight .main[data-v-4760dc18]{background:#22303f}.post-detail.isNight .main .my-box[data-v-4760dc18]{color:#fff;background:#18222d}.post-detail.isNight .main .my-box .title[data-v-4760dc18],.post-detail.isNight .main .my-box .content[data-v-4760dc18]{color:#d1d5d9!important}.post-detail.isNight .main .my-box .base-info[data-v-4760dc18],.post-detail.isNight .main .my-box .content[data-v-4760dc18]{border:1px solid #22303f!important}.post-detail.isNight .main[data-v-4760dc18] .subtle .fade{color:#b2c3d4!important}.post-detail.isNight .main[data-v-4760dc18] .subtle .topic_content{color:#d1d5d9!important}.post-detail.isNight .main .my-cell[data-v-4760dc18]{border-bottom:1px solid #22303f!important}.post-detail.isNight .main .options[data-v-4760dc18]{background:#22303f!important}.post-detail.isNight .main .options .option[data-v-4760dc18]:hover{background-color:#393f4e!important}.post-detail.isNight .main[data-v-4760dc18] .comment{background:#18222d}.post-detail.isNight .main[data-v-4760dc18] .comment .expand-line:after{border-right:2px solid #507092!important}.post-detail.isNight .main[data-v-4760dc18] .comment .comment-content{background:#18222d!important}.post-detail.isNight .main[data-v-4760dc18] .comment .comment-content .w>.text{color:#d1d5d9!important}.post-detail.isNight .main[data-v-4760dc18] .Author-right .toolbar:hover{background:#18222d!important}.post-detail.isNight .main[data-v-4760dc18] .Author-right .tool{background:#22303f!important}.post-detail.isNight .main[data-v-4760dc18] .point{margin-left:.5rem}.post-detail.isNight .main[data-v-4760dc18] .point svg:hover{background:#22303f}.post-detail.isNight .main[data-v-4760dc18] .point .num{color:#d1d5d9!important}.post-detail.isNight .main[data-v-4760dc18] .floor{background:#393f4e!important;color:#d1d5d9!important}.post-detail.isNight .main .editor-wrapper[data-v-4760dc18]{background:#393f4e!important}.post-detail.isNight .main[data-v-4760dc18] .post-editor-wrapper .post-editor{background:#18222d;border:transparent;color:#fff}.post-detail.isNight .main[data-v-4760dc18] .post-editor-wrapper .toolbar{background:#393f4e!important}.post-detail.isNight .main .call-list[data-v-4760dc18]{background:#22303f}.post-detail.isNight .main .call-list .call-item[data-v-4760dc18]{border-top:1px solid #18222d}.post-detail.isNight .main .call-list .call-item .select[data-v-4760dc18],.post-detail.isNight .main .call-list .call-item[data-v-4760dc18]:hover,.post-detail.isNight .main .call-list .call-item.select[data-v-4760dc18]{background-color:#393f4e;text-decoration:none}.post-detail .main[data-v-4760dc18]{display:flex;justify-content:flex-end;padding:6rem 12rem 15rem;background:#e2e2e2;position:relative}.post-detail .main>.left[data-v-4760dc18]{width:77rem}.post-detail .main>.left .left-wrapper[data-v-4760dc18]{width:100%;padding-bottom:2rem;display:flex;flex-direction:column;align-items:center}.post-detail .main>.left .post-wrapper .base-info[data-v-4760dc18]{padding:1rem;box-sizing:border-box;border-bottom:1px solid #e2e2e2}.post-detail .main>.left .post-wrapper .base-info .avatar[data-v-4760dc18]{float:right;border-radius:.4rem;height:7.3rem}.post-detail .main>.left .post-wrapper .base-info .post-nodes[data-v-4760dc18]{font-size:1.5rem;margin-bottom:.8rem;display:flex}.post-detail .main>.left .post-wrapper .base-info .title[data-v-4760dc18]{margin-bottom:1rem;line-height:150%;font-size:2.4rem;color:#000}.post-detail .main>.left .post-wrapper .base-info .post-author[data-v-4760dc18]{font-size:1.25rem;color:#999!important}.post-detail .main>.left .post-wrapper .content[data-v-4760dc18]{color:#000;word-break:break-word;line-height:1.6;border-bottom:1px solid #e2e2e2}.post-detail .main>.left .post-wrapper .content .baseContent[data-v-4760dc18]{padding:1rem}.post-detail .main>.left .post-wrapper .toolbar-wrapper[data-v-4760dc18]{height:4rem;padding-left:.6rem;display:flex;align-items:center}.post-detail .main>.left .editor-wrapper .float[data-v-4760dc18]{margin-right:2rem}.post-detail .main>.left .editor-wrapper .w[data-v-4760dc18]{padding:1.2rem}.post-detail .main>.left .comment-wrapper .comments[data-v-4760dc18]{width:100%;box-sizing:border-box}.post-detail .main>.left .sort-select[data-v-4760dc18]{position:relative}.post-detail .main>.left .sort-select .target[data-v-4760dc18]{color:#0079d3;font-size:1.2rem;font-weight:700;display:inline-flex;align-items:center;cursor:pointer}.post-detail .main>.left .sort-select .target svg[data-v-4760dc18]{width:1.4rem;height:1.4rem;margin-left:.5rem}.post-detail .main>.left .sort-select .options[data-v-4760dc18]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:white;z-index:9998;border-radius:.5rem;cursor:pointer;font-size:1.4rem;position:absolute;top:2.6rem;left:2.7rem;width:8rem;color:#778087}.post-detail .main>.left .sort-select .options .option[data-v-4760dc18]{padding:.8rem 1.4rem}.post-detail .main>.left .sort-select .options .option.active[data-v-4760dc18]{color:#0079d3}.post-detail .main>.left .sort-select .options .option[data-v-4760dc18]:hover{background:#e9f5fd}.post-detail .main>.left .loading-wrapper[data-v-4760dc18]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .main>.left #no-comments-yet[data-v-4760dc18]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin-bottom:2rem;box-sizing:border-box}.post-detail .main>.right[data-v-4760dc18]{margin-left:2rem;margin-top:-2rem;display:flex;flex-direction:column;align-items:center}.post-detail .main .call-list[data-v-4760dc18]{z-index:9;position:absolute;top:12rem;border:1px solid #ccc;background-color:#fff;box-shadow:0 5px 15px #0000001a;overflow:hidden;max-height:30rem;min-width:8rem;box-sizing:content-box}.post-detail .main .call-list .call-item[data-v-4760dc18]{border-top:1px solid #ccc;height:3rem;display:flex;padding:0 1rem;align-items:center;cursor:pointer;font-size:14px;box-sizing:border-box}.post-detail .main .call-list .call-item .select[data-v-4760dc18],.post-detail .main .call-list .call-item[data-v-4760dc18]:hover,.post-detail .main .call-list .call-item.select[data-v-4760dc18]{background-color:#f0f0f0;text-decoration:none}.post-detail .main .call-list .call-item[data-v-4760dc18]:nth-child(1){border-top:1px solid transparent}@media screen and (max-width: 1500px){.post-detail .main[data-v-4760dc18]{padding:8rem 8rem 15rem}.post-detail .main>.left[data-v-4760dc18]{width:65vw}.post-detail .main>.right[data-v-4760dc18]{display:none}}@media screen and (max-width: 1280px){.post-detail .main[data-v-4760dc18]{padding:5rem 5rem 15rem}.post-detail .main>.left[data-v-4760dc18]{width:75vw}.post-detail .main>.right[data-v-4760dc18]{display:none}}.post-detail .scroll-top[data-v-4760dc18]{position:fixed;bottom:3rem;z-index:99}.post-detail .close-btn[data-v-4760dc18]{cursor:pointer;position:fixed;top:6rem;transform:translate(4rem)}p:first-child{margin-top:0}p:last-child{margin-bottom:0}.post[data-v-71df4ceb]{font-size:1.4rem;background:white;text-align:start;padding:1rem;overflow:hidden}.post.isNight[data-v-71df4ceb]{background:#18222d;border:none!important}.post.isNight .title a[data-v-71df4ceb]{color:#a9bcd6!important}.post.isNight .bottom .date[data-v-71df4ceb]{color:#738292}.post.isNight .post-content-wrapper[data-v-71df4ceb]{color:#d1d5d9!important}.post.isNight .my-node[data-v-71df4ceb]{background:#393f4e;color:#9caec7}.post.isNight .my-node[data-v-71df4ceb]:hover{background:#9caec7;color:#001d25}.post.isNight .count[data-v-71df4ceb]{background:#393f4e!important;color:#d1d5d9!important}.post.isNight.visited .count[data-v-71df4ceb]{background:#001d25!important;color:#393f4e!important}.post.isNight.visited .title a[data-v-71df4ceb]{color:#393f4e!important}.post.isNight.visited .post-content-wrapper[data-v-71df4ceb]{color:#576077!important}.post.table[data-v-71df4ceb]{border-bottom:1px solid #e2e2e2}.post.table .post-content-wrapper[data-v-71df4ceb]{display:none}.post.table .title a[data-v-71df4ceb]{color:#778087;font-size:1.6rem}.post.card[data-v-71df4ceb]{margin-top:1.1rem;border:1px solid #e2e2e2;border-radius:.4rem;cursor:pointer}.post.card[data-v-71df4ceb]:hover{border:1px solid #968b8b}.post.card .title a[data-v-71df4ceb]{color:#000;font-size:1.8rem}.post.visited .title a[data-v-71df4ceb]{color:#afb9c1!important}.post.visited .post-content-wrapper[data-v-71df4ceb]{opacity:.6}.post .base-info[data-v-71df4ceb]{box-sizing:border-box;display:flex;justify-content:space-between;align-items:flex-start}.post .base-info .left[data-v-71df4ceb]{display:flex;width:95%}.post .base-info .left .avatar[data-v-71df4ceb]{margin-right:1rem}.post .base-info .left .avatar img[data-v-71df4ceb]{border-radius:.4rem;width:4.8rem;min-width:4.8rem;min-height:4.8rem}.post .base-info .left .right[data-v-71df4ceb]{display:flex;flex-direction:column;justify-content:space-between}.post .base-info .left .right .title[data-v-71df4ceb]{display:inline;align-items:center}.post .base-info .left .right .bottom[data-v-71df4ceb]{font-size:1.2rem;line-height:1.2rem;display:flex;align-items:center;color:#ccc}.post .base-info .count[data-v-71df4ceb]{margin-top:1.8rem;line-height:12px;font-weight:700;color:#fff;background-color:#aab0c6;display:inline-block;padding:2px 10px;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;text-decoration:none;cursor:pointer}.post .base-info .count[data-v-71df4ceb]:hover{background-color:#969cb1}.post .post-content-wrapper[data-v-71df4ceb]{max-height:20rem;overflow:hidden;margin-top:.6rem;color:#000;position:relative;line-break:anywhere;font-size:1.4rem}.post .post-content-wrapper.mask[data-v-71df4ceb]{-webkit-mask-image:linear-gradient(180deg,#000 60%,transparent)}.base64_tooltip[data-v-2d42a498]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:white;min-height:2.2rem;max-width:20rem;padding:.8rem;position:fixed;z-index:9998;display:flex;align-items:center;border-radius:.5rem;cursor:pointer;line-break:anywhere}.base64_tooltip svg[data-v-2d42a498]{margin-left:1rem;min-width:1.8rem}.base64_tooltip .button[data-v-2d42a498]{margin-top:1rem;margin-left:2rem}.app-home{position:relative}.app-home.home,.app-home.recent,.app-home.nodePage{background:#e2e2e2}.app-home.isNight{background:#22303f}.app-home.isNight .open-post,.app-home.isNight .nav{color:#fff;background:#18222d;border:none}.app-home.isNight .setting .wrapper{background:#22303f}.app-home.isNight .setting .wrapper .option{color:#000}.app-home.isNight .setting .wrapper .option span{color:gray!important}.app-home.card{padding:1rem 0}.page.card{margin-top:1rem}.nav{font-size:1.4rem;background:white;text-align:start;padding:1rem}.nav.card{border:1px solid #e2e2e2;border-radius:.4rem}.nav.table{border-bottom:1px solid #e2e2e2}.nav .nav-item{cursor:pointer;display:flex;margin-left:2rem;padding:.6rem;border-radius:.4rem}.nav .nav-item.active{background:#40a9ff;color:#fff}.nav .nav-item.active:hover{background:#40a9ff;opacity:.8}.nav .nav-item:hover{background:#e2e2e2}.nav .nav-item span{margin-left:.4rem}.setting{position:fixed;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.setting .mask{position:fixed;width:100vw;height:100vh;left:0;top:0;background:rgba(0,0,0,.3)}.setting .wrapper{z-index:9;background:#f1f1f1;border-radius:.8rem;font-size:1.4rem;padding:2rem 6rem 4rem}.setting .wrapper .title{font-size:2.4rem;margin-bottom:1rem}.setting .wrapper .sub-title{color:gray;font-size:1.4rem;margin-bottom:4rem}.setting .wrapper .option{width:40rem;display:flex;justify-content:space-between;align-items:center;padding:1rem}.setting .wrapper .option .radio-group2{display:flex;border-radius:.5rem;overflow:hidden}.setting .wrapper .option .radio-group2 .radio{cursor:pointer;background:white;padding:.7rem 1.5rem;border:none}.setting .wrapper .option .radio-group2 .active{background:#40a9ff;color:#fff}
`
let addStyle = document.createElement ("style");
addStyle.rel = "stylesheet";
addStyle.type = "text/css";
addStyle.innerHTML = style
document.head.append (addStyle)
setTimeout(function(){
const G=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function l(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerpolicy&&(o.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?o.credentials="include":n.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=l(n);fetch(n.href,o)}};G();var i={eventMap:new Map,on(t,e){let l=this.eventMap.get(t);l?l.push(e):l=[e],this.eventMap.set(t,l)},emit(t,e){let l=this.eventMap.get(t);l&&l.map(a=>a(e))},off(t){this.eventMap.has(t)&&this.eventMap.delete(t)},clear(){this.eventMap=new Map}};const r={SHOW_TOOLTIP:"SHOW_TOOLTIP",SHOW_MSG:"SHOW_MSG",SET_CALL:"SET_CALL",SHOW_CALL:"SHOW_CALL",REFRESH_ONCE:"REFRESH_ONCE",ADD_REPLY:"ADD_REPLY",IGNORE:"IGNORE",MERGE:"MERGE",REMOVE:"REMOVE",CHANGE_COMMENT_THANK:"CHANGE_COMMENT_THANK",CHANGE_POST_THANK:"CHANGE_POST_THANK"};var k=(t,e)=>{const l=t.__vccOpts||t;for(const[a,n]of e)l[a]=n;return l};const z={name:"Point",inject:["post","isLogin"],props:{item:{type:Object,default(){return{}}},type:{type:String,default(){return"horizontal"}},apiUrl:""},computed:{disabled(){return this.item.username===window.win().user.username||this.item.isThanked}},methods:{getColor(t){return t?"#ff4500":"#929596"},getIsFull(t){return t?"#ff4500":"none"},async thank(){if(!this.isLogin)return i.emit(r.SHOW_MSG,{type:"warning",text:"\u8BF7\u5148\u767B\u5F55\uFF01"});if(this.item.username===window.win().user.username)return i.emit(r.SHOW_MSG,{type:"warning",text:"\u4E0D\u80FD\u611F\u8C22\u81EA\u5DF1"});if(this.item.isThanked)return i.emit(r.SHOW_MSG,{type:"warning",text:"\u5DF2\u7ECF\u611F\u8C22\u8FC7\u4E86"});this.$emit("addThank");let t=`${window.win().url}/thank/${this.apiUrl}?once=${this.post.once}`;$.post(t).then(e=>{console.log("\u611F\u8C22",e),e.success||(this.$emit("recallThank"),i.emit(r.SHOW_MSG,{type:"error",text:e.message})),i.emit(r.REFRESH_ONCE,e.once)},e=>{this.$emit("recallThank"),i.emit(r.SHOW_MSG,{type:"error",text:"\u611F\u8C22\u5931\u8D25"}),i.emit(r.REFRESH_ONCE)})}}},W=["fill","stroke"],U={class:"num"};function Z(t,e,l,a,n,o){return Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["point",l.type])},[Vue.createElementVNode("div",{class:"up",onClick:e[0]||(e[0]=Vue.withModifiers((...c)=>o.thank&&o.thank(...c),["stop"]))},[(Vue.openBlock(),Vue.createElementBlock("svg",{class:Vue.normalizeClass({disabled:o.disabled}),width:"19",height:"19",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M15 8C8.92487 8 4 12.9249 4 19C4 30 17 40 24 42.3262C31 40 44 30 44 19C44 12.9249 39.0751 8 33 8C29.2797 8 25.9907 9.8469 24 12.6738C22.0093 9.8469 18.7203 8 15 8Z",fill:o.getIsFull(l.item.isThanked),stroke:o.getColor(l.item.isThanked),"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,W)],2))]),Vue.createElementVNode("div",U,Vue.toDisplayString(l.item.thankCount?l.item.thankCount:"\u611F\u8C22"),1)],2)}var L=k(z,[["render",Z],["__scopeId","data-v-4dbb3f30"]]);const K={name:"Author",components:{Point:L},inject:["isDev","isLogin"],props:{modelValue:!1,comment:{type:Object,default(){return{}}}},data(){return{}},computed:{pointInfo(){return{isThanked:this.comment.isThanked,thankCount:this.comment.thankCount,username:this.comment.username}}},methods:{checkIsLogin(t=""){return this.isLogin?(this.$emit(t),!0):(i.emit(r.SHOW_MSG,{type:"warning",text:"\u8BF7\u5148\u767B\u5F55\uFF01"}),!1)},addThank(){i.emit(r.CHANGE_COMMENT_THANK,{id:this.comment.id,type:"add"})},recallThank(){i.emit(r.CHANGE_COMMENT_THANK,{id:this.comment.id,type:"recall"})}}},M=t=>(Vue.pushScopeId("data-v-1d0f657a"),t=t(),Vue.popScopeId(),t),Y={class:"Author-left"},q=M(()=>Vue.createElementVNode("path",{d:"M22 42H6V26",stroke:"#177EC9","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)),X=M(()=>Vue.createElementVNode("path",{d:"M26 6H42V22",stroke:"#177EC9","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)),J=[q,X],Q=["href"],ee=["src"],te=["href"],oe={key:0,class:"op"},ne={class:"ago"},le={class:"Author-right"},se={class:"toolbar"},ie=Vue.createStaticVNode('<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-1d0f657a><path d="M4 6H44V36H29L24 41L19 36H4V6Z" fill="none" stroke="#929596" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-1d0f657a></path><path d="M23 21H25.0025" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-1d0f657a></path><path d="M33.001 21H34.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-1d0f657a></path><path d="M13.001 21H14.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-1d0f657a></path></svg><span data-v-1d0f657a>\u56DE\u590D</span>',2),re=[ie],ae=M(()=>Vue.createElementVNode("span",null,"\u9690\u85CF",-1)),ce=[ae];function de(t,e,l,a,n,o){const c=Vue.resolveComponent("Point");return Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["Author",{expand:!l.modelValue}])},[Vue.createElementVNode("div",Y,[l.modelValue?Vue.createCommentVNode("",!0):(Vue.openBlock(),Vue.createElementBlock("svg",{key:0,class:"expand-icon",onClick:e[0]||(e[0]=u=>t.$emit("update:modelValue",!0)),width:"24",height:"24",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},J)),Vue.createElementVNode("a",{class:"icon",href:`/member/${l.comment.username}`},[Vue.createElementVNode("img",{src:l.comment.avatar,alt:""},null,8,ee)],8,Q),Vue.createElementVNode("span",null,[Vue.createElementVNode("strong",null,[Vue.createElementVNode("a",{href:`/member/${l.comment.username}`,class:"username"},Vue.toDisplayString(l.comment.username),9,te)]),Vue.createTextVNode(" \xA0\xA0\xA0 "),l.comment.isOp?(Vue.openBlock(),Vue.createElementBlock("div",oe,"OP")):Vue.createCommentVNode("",!0),Vue.createElementVNode("span",ne,Vue.toDisplayString(l.comment.date),1)])]),Vue.createElementVNode("div",le,[Vue.createElementVNode("div",se,[Vue.createElementVNode("div",{class:"tool",onClick:e[1]||(e[1]=u=>o.checkIsLogin("reply"))},re),Vue.createElementVNode("div",{class:"tool",onClick:e[2]||(e[2]=u=>o.checkIsLogin("hide"))},ce),l.comment.thankCount?Vue.createCommentVNode("",!0):(Vue.openBlock(),Vue.createBlock(c,{key:0,item:o.pointInfo,onAddThank:o.addThank,onRecallThank:o.recallThank,"api-url":"reply/"+l.comment.id},null,8,["item","onAddThank","onRecallThank","api-url"]))]),l.comment.thankCount?(Vue.openBlock(),Vue.createBlock(c,{key:0,item:o.pointInfo,onAddThank:o.addThank,onRecallThank:o.recallThank,"api-url":"reply/"+l.comment.id},null,8,["item","onAddThank","onRecallThank","api-url"])):Vue.createCommentVNode("",!0),Vue.createElementVNode("div",{class:Vue.normalizeClass(["floor",{isDev:o.isDev}])},Vue.toDisplayString(l.comment.floor),3)])],2)}var ue=k(K,[["render",de],["__scopeId","data-v-1d0f657a"]]);const pe=t=>(Vue.pushScopeId("data-v-711cb3dc"),t=t(),Vue.popScopeId(),t),me={class:"get-cursor"},he=["innerHTML"],Ve={class:"toolbar"},fe=pe(()=>Vue.createElementVNode("span",null,"\u8BF7\u5C3D\u91CF\u8BA9\u81EA\u5DF1\u7684\u56DE\u590D\u80FD\u591F\u5BF9\u522B\u4EBA\u6709\u5E2E\u52A9",-1)),we={__name:"PostEditor",props:{replyInfo:null,replyFloor:null,useType:{type:String,default(){return"reply-comment"}}},emits:["close"],setup(t,{emit:e}){const{replyInfo:l,replyFloor:a,useType:n,isShow:o}=t,c=Vue.inject("post");Vue.inject("allReplyUsers");let u=Vue.ref(!1);const p=Vue.ref(!1),m=Vue.ref("editorId_"+Date.now()),s=Vue.ref(l),d=Vue.ref(null),V=Vue.ref(null),g=Vue.ref('<span style="white-space:pre-wrap;"> </span>'),S=Vue.computed(()=>[n,u.value?"isFocus":""]),y=Vue.computed(()=>{var h;if(!d.value||!s.value)return"";let v=((h=d.value)==null?void 0:h.selectionStart)||0;return s.value.substring(0,v).replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br/>").replace(/\s/g,g.value)}),H=Vue.computed(()=>s.value?s.value===l:!0);async function P(){if(H.value||p.value)return;p.value=!0;let v={thankCount:0,isThanked:!1,isOp:c.value.username===window.win().user.username,id:Date.now(),username:window.win().user.username,avatar:window.win().user.avatar,date:"\u51E0\u79D2\u524D",floor:c.value.replyCount+1,reply_content:s.value||Date.now(),children:[],replyUsers:[],replyFloor:a||-1},h=s.value.match(/@([\w]+?[\s])/g);h&&h.map(f=>{let w=f.replace("@","").replace(" ","");v.reply_content=v.reply_content.replace(w,`<a href="/member/${w}">${w}</a>`)});let _=`${window.win().url}/t/${c.value.id}`;$.post(_,{content:s.value,once:c.value.once}).then(f=>{if(p.value=!1,f.search("\u4F60\u4E0A\u4E00\u6761\u56DE\u590D\u7684\u5185\u5BB9\u548C\u8FD9\u6761\u76F8\u540C")>-1)return i.emit(r.SHOW_MSG,{type:"error",text:"\u4F60\u4E0A\u4E00\u6761\u56DE\u590D\u7684\u5185\u5BB9\u548C\u8FD9\u6761\u76F8\u540C"});if(f.search("\u521B\u5EFA\u65B0\u56DE\u590D")>-1)return i.emit(r.REFRESH_ONCE,f),i.emit(r.SHOW_MSG,{type:"error",text:"\u56DE\u590D\u5931\u8D25"});s.value=l,e("close"),i.emit(r.REFRESH_ONCE,f),i.emit(r.SHOW_MSG,{type:"success",text:"\u56DE\u590D\u6210\u529F"}),i.emit(r.ADD_REPLY,v)},f=>{p.value=!1,i.emit(r.SHOW_MSG,{type:"error",text:"\u56DE\u590D\u5931\u8D25"})})}function C(){i.emit(r.SHOW_CALL,{show:!1}),i.off(r.SET_CALL)}function E(v){let h=V.value.getBoundingClientRect();i.emit(r.SHOW_CALL,{show:!0,top:h.top,left:h.left,text:v}),i.off(r.SET_CALL),i.on(r.SET_CALL,_=>{let f=d.value.selectionStart,w=s.value.slice(0,f),B=s.value.slice(f,s.value.length),F=w.lastIndexOf("@");w=s.value.slice(0,F+1),s.value=w+_+" "+B;let O=w.length+_.length+1;setTimeout(()=>{d.value.setSelectionRange(O,O)}),i.off(r.SET_CALL)})}function A(v){switch(v.keyCode){case 8:s.value==="@"&&C();break;case 37:case 38:case 39:case 40:setTimeout(()=>I({data:""}),100);break}}function I(v){let h=d.value.selectionStart;if(!!s.value){if(v.data===" ")return C();if(v.data==="@"){if(s.value.length!==1){if(s.value[h-2]===" "||s.value[h-2]===`
`)return E("")}else return E("");C()}else{let _=s.value.slice(0,h),f=_.lastIndexOf("@");if(f===-1)return C();let w=_.slice(f,h);if(w.includes(" "))C();else{if(f===0)return E(w.replace("@",""));if(s.value.length!==1){if(s.value[f-1]===" "||s.value[f-1]===`
`)return E(w.replace("@",""))}else return E(w.replace("@",""));C()}}}}function j(){u.value=!1}return Vue.onMounted(()=>{$(`.${m.value}`).each(function(){this.setAttribute("style","height:"+this.scrollHeight+"px;overflow-y:hidden;")}).on("input",function(){this.style.height=0,this.style.height=this.scrollHeight+"px"}),d.value&&d.value.focus()}),Vue.onBeforeUnmount(()=>{$(`.${m.value}`).off()}),(v,h)=>(Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["post-editor-wrapper",Vue.unref(S)])},[Vue.withDirectives(Vue.createElementVNode("textarea",{class:Vue.normalizeClass(["post-editor",m.value]),ref_key:"txtRef",ref:d,onFocus:h[0]||(h[0]=_=>Vue.isRef(u)?u.value=!0:u=!0),onBlur:j,onInput:I,onKeydown:A,"onUpdate:modelValue":h[1]||(h[1]=_=>s.value=_)},null,34),[[Vue.vModelText,s.value]]),Vue.createElementVNode("div",me,[Vue.createElementVNode("span",{innerHTML:Vue.unref(y)},null,8,he),Vue.createElementVNode("span",{class:"cursor",ref_key:"cursorRef",ref:V},"|",512)]),Vue.createElementVNode("div",Ve,[fe,Vue.createElementVNode("div",{class:Vue.normalizeClass(["button",{disabled:Vue.unref(H),loading:p.value}]),onClick:P},"\u56DE\u590D ",2)])],2))}};var D=k(we,[["__scopeId","data-v-711cb3dc"]]);const ve=["innerHTML"],R={__name:"BaseHtmlRender",props:["html"],setup(t){const e=t;function l(a){let n=window.win().getSelection().toString();if(n){let o=n.match(/([A-Za-z0-9+/=]+)/g);if(o){if(o[0].length<4)return;i.emit(r.SHOW_TOOLTIP,{text:o[0],e:a})}}}return(a,n)=>(Vue.openBlock(),Vue.createElementBlock("div",Vue.mergeProps(a.$attrs,{innerHTML:e.html,onMouseup:l}),null,16,ve))}};const ge={name:"Comment",components:{BaseHtmlRender:R,Author:ue,PostEditor:D,Point:L},props:{modelValue:{reply_content:""}},data(){return{edit:!1,expand:!0,replyInfo:`@${this.modelValue.username} #${this.modelValue.floor} `,cssStyle:null}},inject:["post","postDetailWidth"],watch:{},created(){},mounted(){let t=this.$refs.comment.getBoundingClientRect(),e=this.postDetailWidth/2;if(e<t.width&&t.width<e+25&&this.modelValue.children.length){this.expand=!1;let l=2;this.cssStyle={padding:"1rem 0",width:`calc(${this.postDetailWidth}px - ${l}rem)`,transform:`translateX(calc(${t.width-this.postDetailWidth}px + ${l}rem))`}}},methods:{hide(){let t=`${window.win().url}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;i.emit(r.REMOVE,this.modelValue.floor),$.post(t).then(e=>{i.emit(r.REFRESH_ONCE),i.emit(r.SHOW_MSG,{type:"success",text:"\u9690\u85CF\u6210\u529F"})},e=>{i.emit(r.SHOW_MSG,{type:"warning",text:"\u9690\u85CF\u6210\u529F,\u4EC5\u672C\u6B21\u6709\u6548\uFF08\u63A5\u53E3\u8C03\u7528\u5931\u8D25\uFF01\uFF09"})})},toggle(){this.expand=!this.expand}}},_e={class:"comment-content"},ke={class:"right"},ye={class:"w"};function Ce(t,e,l,a,n,o){const c=Vue.resolveComponent("Author"),u=Vue.resolveComponent("BaseHtmlRender"),p=Vue.resolveComponent("PostEditor"),m=Vue.resolveComponent("Comment",!0);return Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["comment",l.modelValue.isOp?"op":""]),ref:"comment"},[Vue.createVNode(c,{modelValue:n.expand,"onUpdate:modelValue":e[0]||(e[0]=s=>n.expand=s),comment:l.modelValue,onReply:e[1]||(e[1]=s=>n.edit=!n.edit),onHide:o.hide},null,8,["modelValue","comment","onHide"]),n.cssStyle&&!n.expand?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:"more ago",onClick:e[2]||(e[2]=s=>n.expand=!n.expand)}," \u7531\u4E8E\u5D4C\u5957\u56DE\u590D\u5C42\u7EA7\u592A\u6DF1\uFF0C\u81EA\u52A8\u5C06\u540E\u7EED\u56DE\u590D\u9690\u85CF ")):Vue.createCommentVNode("",!0),Vue.withDirectives(Vue.createElementVNode("div",{class:"comment-content-w",style:Vue.normalizeStyle(n.cssStyle)},[n.cssStyle?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:"more ago",onClick:e[3]||(e[3]=s=>n.expand=!n.expand)}," \u7531\u4E8E\u5D4C\u5957\u56DE\u590D\u5C42\u7EA7\u592A\u6DF1\uFF0C\u81EA\u52A8\u5C06\u4EE5\u4E0B\u56DE\u590D\u79FB\u81F3\u53EF\u89C1\u8303\u56F4 ")):Vue.createCommentVNode("",!0),Vue.createElementVNode("div",_e,[Vue.createElementVNode("div",{class:"left expand-line",onClick:e[4]||(e[4]=(...s)=>o.toggle&&o.toggle(...s))}),Vue.createElementVNode("div",ke,[Vue.createElementVNode("div",ye,[Vue.createVNode(u,{class:"text",html:l.modelValue.reply_content},null,8,["html"]),n.edit?(Vue.openBlock(),Vue.createBlock(p,{key:0,onClose:e[5]||(e[5]=s=>n.edit=!1),replyInfo:n.replyInfo,replyFloor:l.modelValue.floor},null,8,["replyInfo","replyFloor"])):Vue.createCommentVNode("",!0)]),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(l.modelValue.children,(s,d)=>(Vue.openBlock(),Vue.createBlock(m,{modelValue:l.modelValue.children[d],"onUpdate:modelValue":V=>l.modelValue.children[d]=V,key:d},null,8,["modelValue","onUpdate:modelValue"]))),128))])]),n.cssStyle?(Vue.openBlock(),Vue.createElementBlock("div",{key:1,class:"more ago",onClick:e[6]||(e[6]=s=>n.expand=!n.expand)}," \u7531\u4E8E\u5D4C\u5957\u56DE\u590D\u5C42\u7EA7\u592A\u6DF1\uFF0C\u81EA\u52A8\u5C06\u4EE5\u4E0A\u56DE\u590D\u79FB\u81F3\u53EF\u89C1\u8303\u56F4 ")):Vue.createCommentVNode("",!0)],4),[[Vue.vShow,n.expand]])],2)}var Ee=k(ge,[["render",Ce],["__scopeId","data-v-2005ce85"]]);const Ne={name:"Toolbar",inject:["isLogin","post","pageType"],data(){return{timer:null,showTooltip:!1,loading:!1,loading2:!1,loading3:!1}},methods:{checkIsLogin(t=""){return this.isLogin?(this.$emit(t),!0):(i.emit(r.SHOW_MSG,{type:"warning",text:"\u8BF7\u5148\u767B\u5F55\uFF01"}),!1)},getColor(t){return t?"#ff4500":"#929596"},getIsFull(t){return t?"#ff4500":"none"},showTooltipHandler(){this.timer&&clearTimeout(this.timer),this.showTooltip=!0},hideTooltip(){this.timer=setTimeout(()=>{this.showTooltip=!1},500)},tweet(){if(!this.checkIsLogin())return;let t=window.win().user.username,e=`https://twitter.com/share?url=${window.win().url}/t/${this.post.id}?r=${t}&related=v2ex&hashtags=apple&text=${this.post.title}`;window.win().open(e,"_blank","width=550,height=370")},report(){if(!this.checkIsLogin()||!this.isLogin||this.post.isReport)return;let t=window.win().user.username,e=`https://twitter.com/share?url=${window.win().url}/t/${this.post.id}?r=${t}&related=v2ex&hashtags=apple&text=${this.post.title}`;window.win().open(e,"_blank","width=550,height=370")},async toggleIgnore(){if(!this.checkIsLogin())return;let t=`${window.win().url}/${this.post.isIgnore?"unignore":"ignore"}/topic/${this.post.id}?once=${this.post.once}`;this.pageType==="post"?(this.loading2=!0,(await window.win().fetch(t)).redirected?(this.post.isIgnore||(window.win().location=window.win().url),i.emit(r.SHOW_MSG,{type:"success",text:this.post.isIgnore?"\u53D6\u6D88\u6210\u529F":"\u5FFD\u7565\u6210\u529F"}),i.emit(r.MERGE,{isIgnore:!this.post.isIgnore})):i.emit(r.SHOW_MSG,{type:"warning",text:"\u5FFD\u7565\u5931\u8D25"}),this.loading2=!1):(this.post.isIgnore?this.loading2=!0:i.emit(r.IGNORE),(await window.win().fetch(t)).redirected?(this.post.isIgnore&&i.emit(r.REFRESH_ONCE),i.emit(r.SHOW_MSG,{type:"success",text:this.post.isIgnore?"\u53D6\u6D88\u6210\u529F":"\u5FFD\u7565\u6210\u529F"}),i.emit(r.MERGE,{isIgnore:!this.post.isIgnore})):i.emit(r.SHOW_MSG,{type:"warning",text:"\u5FFD\u7565\u6210\u529F,\u4EC5\u672C\u6B21\u6709\u6548\uFF08\u63A5\u53E3\u8C03\u7528\u5931\u8D25\uFF01\uFF09"}),this.loading2=!1)},async toggleFavorite(){if(!this.checkIsLogin())return;this.loading=!0;let t=`${window.win().url}/${this.post.isFavorite?"unfavorite":"favorite"}/topic/${this.post.id}?once=${this.post.once}`,e=await window.win().fetch(t);if(this.loading=!1,e.redirected){let l=await e.text();if(l.search(this.post.isFavorite?"\u52A0\u5165\u6536\u85CF":"\u53D6\u6D88\u6536\u85CF")){i.emit(r.MERGE,{collectCount:this.post.isFavorite?this.post.collectCount-1:this.post.collectCount+1}),i.emit(r.SHOW_MSG,{type:"success",text:this.post.isFavorite?"\u53D6\u6D88\u6210\u529F":"\u6536\u85CF\u6210\u529F"}),i.emit(r.REFRESH_ONCE,l),i.emit(r.MERGE,{isFavorite:!this.post.isFavorite});return}}i.emit(r.SHOW_MSG,{type:"error",text:"\u64CD\u4F5C\u5931\u8D25"})}}},N=t=>(Vue.pushScopeId("data-v-957db65c"),t=t(),Vue.popScopeId(),t),Te={class:"toolbar"},xe=Vue.createStaticVNode('<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-957db65c><path d="M4 6H44V36H29L24 41L19 36H4V6Z" fill="none" stroke="#929596" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-957db65c></path><path d="M23 21H25.0025" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-957db65c></path><path d="M33.001 21H34.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-957db65c></path><path d="M13.001 21H14.9999" stroke="#929596" stroke-width="2" stroke-linecap="round" data-v-957db65c></path></svg><span data-v-957db65c>\u56DE\u590D</span>',2),Se=[xe],Be={viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Le=["fill","stroke"],Me={key:1,class:"tool no-hover"},be=N(()=>Vue.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M28 6H42V20",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M42 29.4737V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9C6 7.34315 7.34315 6 9 6L18 6",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M25.7998 22.1999L41.0998 6.8999",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),He=N(()=>Vue.createElementVNode("span",null,"Tweet",-1)),Ie=[be,He],Oe={viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},De=["fill","stroke"],Re=["fill","stroke"],Pe=["fill","stroke"],Ae=Vue.createStaticVNode('<svg width="19" height="19" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-957db65c><path d="M36 35H12V21C12 14.3726 17.3726 9 24 9C30.6274 9 36 14.3726 36 21V35Z" fill="#929596" stroke="#929596" stroke-width="4" stroke-linejoin="round" data-v-957db65c></path><path d="M8 42H40" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-957db65c></path><path d="M4 13L7 14" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-957db65c></path><path d="M13 3.9999L14 6.9999" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-957db65c></path><path d="M10.0001 9.99989L7.00009 6.99989" stroke="#929596" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-957db65c></path></svg>',1),je=N(()=>Vue.createElementVNode("a",{target:"_blank",href:"https://github.com/zyronon/v2ex-script/issues"},"\u70B9\u51FB\u8FD9\u91CC\u63D0\u4E00\u4E2AIssue",-1)),Fe=N(()=>Vue.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M8 44H12H16",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M12 44V4",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M40 6H12V22H40L36 14L40 6Z",fill:"none",stroke:"#929596","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),Ge=N(()=>Vue.createElementVNode("span",null,"\u811A\u672C\u6709\u95EE\u9898\uFF1F",-1));function ze(t,e,l,a,n,o){return Vue.openBlock(),Vue.createElementBlock("div",Te,[Vue.createElementVNode("div",{class:"tool",onClick:e[0]||(e[0]=c=>o.checkIsLogin("reply"))},Se),o.post.once?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:Vue.normalizeClass(["tool",{loading:n.loading}]),onClick:e[1]||(e[1]=(...c)=>o.toggleFavorite&&o.toggleFavorite(...c))},[(Vue.openBlock(),Vue.createElementBlock("svg",Be,[Vue.createElementVNode("path",{d:"M23.9986 5L17.8856 17.4776L4 19.4911L14.0589 29.3251L11.6544 43L23.9986 36.4192L36.3454 43L33.9586 29.3251L44 19.4911L30.1913 17.4776L23.9986 5Z",fill:o.getIsFull(o.post.isFavorite),stroke:o.getColor(o.post.isFavorite),"stroke-width":"2","stroke-linejoin":"round"},null,8,Le)])),Vue.createElementVNode("span",null,Vue.toDisplayString(o.post.isFavorite?"\u53D6\u6D88\u6536\u85CF":"\u52A0\u5165\u6536\u85CF"),1)],2)):Vue.createCommentVNode("",!0),o.post.once&&o.post.collectCount!==0?(Vue.openBlock(),Vue.createElementBlock("div",Me,[Vue.createElementVNode("span",null,Vue.toDisplayString(o.post.collectCount+"\u4EBA\u6536\u85CF"),1)])):Vue.createCommentVNode("",!0),Vue.createElementVNode("div",{class:"tool",onClick:e[2]||(e[2]=(...c)=>o.tweet&&o.tweet(...c))},Ie),o.post.once?(Vue.openBlock(),Vue.createElementBlock("div",{key:2,class:Vue.normalizeClass(["tool",{loading:n.loading2}]),onClick:e[3]||(e[3]=(...c)=>o.toggleIgnore&&o.toggleIgnore(...c))},[(Vue.openBlock(),Vue.createElementBlock("svg",Oe,[Vue.createElementVNode("path",{fill:o.getIsFull(o.post.isIgnore),stroke:o.getColor(o.post.isIgnore),d:"M9.85786 18C6.23858 21 4 24 4 24C4 24 12.9543 36 24 36C25.3699 36 26.7076 35.8154 28 35.4921M20.0318 12.5C21.3144 12.1816 22.6414 12 24 12C35.0457 12 44 24 44 24C44 24 41.7614 27 38.1421 30","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,De),Vue.createElementVNode("path",{fill:o.getIsFull(o.post.isIgnore),d:"M20.3142 20.6211C19.4981 21.5109 19 22.6972 19 23.9998C19 26.7612 21.2386 28.9998 24 28.9998C25.3627 28.9998 26.5981 28.4546 27.5 27.5705",stroke:o.getColor(o.post.isIgnore),"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Re),Vue.createElementVNode("path",{d:"M42 42L6 6",fill:o.getIsFull(o.post.isIgnore),stroke:o.getColor(o.post.isIgnore),"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Pe)])),Vue.createElementVNode("span",null,Vue.toDisplayString(o.post.isIgnore?"\u53D6\u6D88\u5FFD\u7565":"\u5FFD\u7565\u4E3B\u9898"),1)],2)):Vue.createCommentVNode("",!0),o.post.once&&o.post.isLogin?(Vue.openBlock(),Vue.createElementBlock("div",{key:3,class:Vue.normalizeClass(["tool",{loading:n.loading3,"no-hover":o.post.isLogin}]),onClick:e[4]||(e[4]=(...c)=>o.report&&o.report(...c))},[Ae,Vue.createElementVNode("span",null,Vue.toDisplayString(o.post.isReport?"\u4F60\u5DF2\u5BF9\u672C\u4E3B\u9898\u8FDB\u884C\u4E86\u62A5\u544A":"\u62A5\u544A\u8FD9\u4E2A\u4E3B\u9898"),1)],2)):Vue.createCommentVNode("",!0),o.post.once?(Vue.openBlock(),Vue.createElementBlock("div",{key:4,class:"tool no-hover",onMouseenter:e[7]||(e[7]=(...c)=>o.showTooltipHandler&&o.showTooltipHandler(...c)),onMouseleave:e[8]||(e[8]=(...c)=>o.hideTooltip&&o.hideTooltip(...c))},[n.showTooltip?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:"tooltip",onMouseenter:e[5]||(e[5]=(...c)=>o.showTooltipHandler&&o.showTooltipHandler(...c)),onMouseleave:e[6]||(e[6]=(...c)=>o.hideTooltip&&o.hideTooltip(...c))},[Vue.createTextVNode(" \u811A\u672C\u6709\u95EE\u9898\uFF1F"),je],32)):Vue.createCommentVNode("",!0),Fe,Ge],32)):Vue.createCommentVNode("",!0)])}var We=k(Ne,[["render",ze],["__scopeId","data-v-957db65c"]]);const Ue={name:"detail",components:{Comment:Ee,PostEditor:D,Point:L,Toolbar:We,BaseHtmlRender:R},inject:["allReplyUsers","post","clone","isLogin"],provide(){return{postDetailWidth:Vue.computed(()=>{var t;return((t=this.$refs.comments)==null?void 0:t.getBoundingClientRect().width)||0})}},props:{modelValue:{type:Boolean,default(){return!1}},loading:{type:Boolean,default(){return!1}},isNight:{type:Boolean,default(){return!1}},closePostDetailBySpace:{type:Boolean,default(){return!0}},commentDisplayType:0},data(){return{showSortOption:!1,isSticky:!1,sortOptions:[{value:0,label:"\u697C\u4E2D\u697C"},{value:1,label:"\u611F\u8C22"},{value:2,label:"V2\u539F\u7248"}],selectCallIndex:0,postDetailWidth:0,showCallList:!1,replyText:"",callStyle:{top:0,left:0}}},computed:{filterCallList(){return this.showCallList?this.replyText?this.allReplyUsers.filter(t=>t.search(this.replyText)>-1):this.allReplyUsers:[]},replies(){if(this.commentDisplayType===0)return this.post.nestedReplies;if(this.commentDisplayType===1)return this.clone(this.post.nestedReplies).sort((t,e)=>e.thankCount-t.thankCount);if(this.commentDisplayType===2)return this.post.replies}},watch:{modelValue(t){t?this.$nextTick(()=>{this.$refs.detail.scrollTo({top:0})}):(window.win().doc.body.style.overflow="unset",this.showSortOption=this.isSticky=!1,window.win().pageType==="home"&&window.history.back())}},mounted(){this.isLogin&&(new IntersectionObserver(([e])=>e.target.toggleAttribute("stuck",e.intersectionRatio<1),{threshold:[1]}).observe(this.$refs.replyBox),window.win().addEventListener("keydown",this.onKeyDown)),i.on(r.SHOW_CALL,t=>{t.show?(this.showCallList=!0,this.replyText=t.text,this.callStyle.top=t.top+$(".post-detail").scrollTop()+15+"px",this.callStyle.left=t.left-$(".main")[0].getBoundingClientRect().left+10+"px",this.selectCallIndex>=this.filterCallList.length&&(this.selectCallIndex=0)):(this.replyText="",this.showCallList=!1,this.selectCallIndex=0)})},beforeUnmount(){this.$refs.right.innerHTML="",window.win().removeEventListener("keydown",this.onKeyDown),i.off(r.SHOW_CALL)},methods:{close(t){t==="space"?this.closePostDetailBySpace&&this.$emit("update:modelValue",!1):this.$emit("update:modelValue",!1)},setCall(t){i.emit(r.SET_CALL,t),this.showCallList=!1},onKeyDown(t){if(!this.modelValue||!this.showCallList)return;let e=this.filterCallList.slice(0,10).length;t.keyCode===13&&(this.setCall(this.filterCallList[this.selectCallIndex]),t.preventDefault()),t.keyCode===38&&(this.selectCallIndex--,this.selectCallIndex<0&&(this.selectCallIndex=e-1),t.preventDefault()),t.keyCode===40&&(this.selectCallIndex++,this.selectCallIndex>e-1&&(this.selectCallIndex=0),t.preventDefault())},changeOption(t){this.showSortOption=!1,this.$emit("update:commentDisplayType",t.value)},stop(){this.showSortOption=!1},scroll(){this.showSortOption=!1},addThank(){i.emit(r.CHANGE_POST_THANK,{id:this.post.id,type:"add"})},recallThank(){i.emit(r.CHANGE_POST_THANK,{id:this.post.id,type:"recall"})},scrollTop(){this.$refs.detail.scrollTo({top:0,behavior:"smooth"})}}},T=t=>(Vue.pushScopeId("data-v-4760dc18"),t=t(),Vue.popScopeId(),t),$e={class:"left"},Ze={class:"left-wrapper"},Ke={class:"my-box post-wrapper"},Ye={class:"base-info"},qe=["href"],Xe=["src"],Je={class:"post-nodes"},Qe=T(()=>Vue.createElementVNode("a",{href:"/"},"V2EX",-1)),et=T(()=>Vue.createElementVNode("span",{class:"chevron"},"\xA0\xA0\u203A\xA0\xA0",-1)),tt=["href"],ot=["innerHTML"],nt={class:"post-author"},lt={class:"username"},st=["href"],it={class:"date"},rt={class:"date"},at={key:0,class:"content"},ct={class:"toolbar-wrapper"},dt={key:0,class:"my-box comment-wrapper"},ut={class:"my-cell flex"},pt={class:"gray"},mt={key:0},ht=T(()=>Vue.createElementVNode("strong",{class:"snow"},"\u2022",-1)),Vt={class:"sort-select"},ft=T(()=>Vue.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M36 19L24 31L12 19H36Z",fill:"#0079d3",stroke:"#0079d3","stroke-width":"2","stroke-linejoin":"round"})],-1)),wt={key:0,class:"options"},vt=["onClick"],gt={key:0,class:"loading-wrapper"},_t={key:1,class:"comments",ref:"comments"},kt={key:1,id:"no-comments-yet"},yt={class:"my-cell flex"},Ct=T(()=>Vue.createElementVNode("span",null,"\u6DFB\u52A0\u4E00\u6761\u65B0\u56DE\u590D",-1)),Et={class:"notice-right"},Nt={class:"w"},Tt={class:"right",ref:"right"},xt=["innerHTML"],St=["onClick"],Bt={width:"30",height:"30",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Lt=["stroke"],Mt=["stroke"];function bt(t,e,l,a,n,o){const c=Vue.resolveComponent("BaseHtmlRender"),u=Vue.resolveComponent("Point"),p=Vue.resolveComponent("Toolbar"),m=Vue.resolveComponent("Comment"),s=Vue.resolveComponent("PostEditor");return Vue.withDirectives((Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["post-detail",[l.isNight?"isNight":""]]),ref:"detail",onScroll:e[8]||(e[8]=(...d)=>o.scroll&&o.scroll(...d)),onClick:e[9]||(e[9]=d=>o.close("space"))},[Vue.createElementVNode("div",{class:"main",onClick:e[7]||(e[7]=Vue.withModifiers((...d)=>o.stop&&o.stop(...d),["stop"]))},[Vue.createElementVNode("div",$e,[Vue.createElementVNode("div",Ze,[Vue.createElementVNode("div",Ke,[Vue.createElementVNode("div",Ye,[Vue.createElementVNode("a",{href:`/member/${o.post.username}`},[Vue.createElementVNode("img",{class:"avatar",src:o.post.avatar,alt:""},null,8,Xe)],8,qe),Vue.createElementVNode("div",Je,[Qe,et,Vue.createElementVNode("a",{href:o.post.nodeUrl},Vue.toDisplayString(o.post.node),9,tt)]),Vue.createElementVNode("div",{class:"title",innerHTML:o.post.title},null,8,ot),Vue.createElementVNode("div",nt,[Vue.createElementVNode("div",lt,[Vue.createElementVNode("a",{href:`/member/${o.post.username}`},Vue.toDisplayString(o.post.username),9,st)]),Vue.createTextVNode(" \xA0\xA0\xB7\xA0\xA0 "),Vue.createElementVNode("div",it,Vue.toDisplayString(o.post.date),1),Vue.createTextVNode(" \xA0\xA0\xB7\xA0\xA0 "),Vue.createElementVNode("div",rt,Vue.toDisplayString(o.post.clickCount)+"\u6B21\u70B9\u51FB",1)])]),o.post.content_rendered||o.post.subtlesHtml?(Vue.openBlock(),Vue.createElementBlock("div",at,[Vue.createVNode(c,{html:o.post.content_rendered,class:"baseContent"},null,8,["html"]),Vue.createVNode(c,{html:o.post.subtlesHtml},null,8,["html"])])):Vue.createCommentVNode("",!0),Vue.createElementVNode("div",ct,[Vue.createVNode(u,{onAddThank:o.addThank,onRecallThank:o.recallThank,item:{isThanked:o.post.isThanked,thankCount:o.post.thankCount,username:o.post.username},"api-url":"topic/"+o.post.id},null,8,["onAddThank","onRecallThank","item","api-url"]),Vue.createVNode(p,{onReply:e[0]||(e[0]=d=>n.isSticky=!n.isSticky)})])]),o.replies.length||l.loading?(Vue.openBlock(),Vue.createElementBlock("div",dt,[Vue.createElementVNode("div",ut,[Vue.createElementVNode("span",pt,[Vue.createTextVNode(Vue.toDisplayString(o.post.replyCount)+" \u6761\u56DE\u590D ",1),o.post.createDate?(Vue.openBlock(),Vue.createElementBlock("span",mt,[Vue.createTextVNode(" \xA0"),ht,Vue.createTextVNode(" \xA0"+Vue.toDisplayString(o.post.createDate),1)])):Vue.createCommentVNode("",!0)]),Vue.createElementVNode("div",Vt,[Vue.createElementVNode("div",{class:"target",onClick:e[1]||(e[1]=Vue.withModifiers(d=>n.showSortOption=!0,["stop"]))},[Vue.createElementVNode("span",null,"\u6392\u5E8F\uFF1A"+Vue.toDisplayString(n.sortOptions.find(d=>d.value===l.commentDisplayType).label),1),ft]),n.showSortOption?(Vue.openBlock(),Vue.createElementBlock("div",wt,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(n.sortOptions,d=>(Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["option",{active:l.commentDisplayType===d.value}]),onClick:V=>o.changeOption(d)},Vue.toDisplayString(d.label),11,vt))),256))])):Vue.createCommentVNode("",!0)])]),l.loading?(Vue.openBlock(),Vue.createElementBlock("div",gt,[Vue.createElementVNode("div",{class:Vue.normalizeClass([l.isNight?"loading-b":"loading-c"])},null,2)])):(Vue.openBlock(),Vue.createElementBlock("div",_t,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(o.replies,(d,V)=>(Vue.openBlock(),Vue.createBlock(m,{key:d.floor,style:Vue.normalizeStyle(`border-bottom: 1px solid ${l.isNight?"#22303f":"#e2e2e2"}; padding: 1rem;margin-top: 0;`),modelValue:o.replies[V],"onUpdate:modelValue":g=>o.replies[V]=g},null,8,["style","modelValue","onUpdate:modelValue"]))),128))],512))])):(Vue.openBlock(),Vue.createElementBlock("div",kt,"\u76EE\u524D\u5C1A\u65E0\u56DE\u590D")),o.isLogin?(Vue.openBlock(),Vue.createElementBlock("div",{key:2,class:Vue.normalizeClass(["my-box editor-wrapper",{sticky:n.isSticky}]),ref:"replyBox"},[Vue.createElementVNode("div",yt,[Ct,Vue.createElementVNode("div",Et,[n.isSticky?(Vue.openBlock(),Vue.createElementBlock("a",{key:0,class:"float",onClick:e[2]||(e[2]=d=>n.isSticky=!1)},"\u53D6\u6D88\u56DE\u590D\u6846\u505C\u9760")):Vue.createCommentVNode("",!0),Vue.createElementVNode("a",{onClick:e[3]||(e[3]=(...d)=>o.scrollTop&&o.scrollTop(...d))},"\u56DE\u5230\u9876\u90E8")])]),Vue.createElementVNode("div",Nt,[Vue.createVNode(s,{useType:"reply-post",onClick:e[4]||(e[4]=d=>n.isSticky=!0)})])],2)):Vue.createCommentVNode("",!0)])]),Vue.createElementVNode("div",Tt,[Vue.createElementVNode("div",{id:"Rightbar",innerHTML:o.post.RightbarHTML},null,8,xt),Vue.createElementVNode("div",{class:"scroll-top button",onClick:e[5]||(e[5]=Vue.withModifiers((...d)=>o.scrollTop&&o.scrollTop(...d),["stop"]))}," \u56DE\u5230\u9876\u90E8 ")],512),n.showCallList&&o.filterCallList.length?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:"call-list",style:Vue.normalizeStyle(n.callStyle)},[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(o.filterCallList.slice(0,10),(d,V)=>(Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["call-item",{select:V===n.selectCallIndex}]),onClick:g=>o.setCall(d)},[Vue.createElementVNode("a",null,Vue.toDisplayString(d),1)],10,St))),256))],4)):Vue.createCommentVNode("",!0),Vue.createElementVNode("div",{class:"close-btn",onClick:e[6]||(e[6]=d=>o.close("btn"))},[(Vue.openBlock(),Vue.createElementBlock("svg",Bt,[Vue.createElementVNode("path",{d:"M8 8L40 40",stroke:l.isNight?"#ffffff":"#000000","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Lt),Vue.createElementVNode("path",{d:"M8 40L40 8",stroke:l.isNight?"#ffffff":"#000000","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Mt)]))])])],34)),[[Vue.vShow,l.modelValue]])}var Ht=k(Ue,[["render",bt],["__scopeId","data-v-4760dc18"]]);const It={class:"base-info"},Ot={class:"left"},Dt=["onClick","href"],Rt={class:"avatar"},Pt=["src"],At={class:"right"},jt={class:"title"},Ft=["href"],Gt={class:"bottom"},zt=["onClick","href"],Wt=["onClick","href"],Ut={class:"date"},$t={key:0,class:"count"},Zt=["innerHTML"],Kt={__name:"Post",props:["post","viewType","isNight"],setup(t){const e=t,l=200,a=Vue.ref(!1),n=Vue.ref(null),o=Vue.computed(()=>e.post.bg?{backgroundImage:e.post.bg,backgroundRepeat:"no-repeat",backgroundSize:"20px 20px",backgroundPosition:"right top"}:{});Vue.watch([()=>e.post,()=>n.value,()=>e.viewType],()=>{if(!n.value||e.viewType==="table")return;let u=n.value.getBoundingClientRect();n.value.querySelectorAll("img").forEach(p=>{p.addEventListener("load",c)}),a.value=u.height>=l},{immediate:!0,flush:"post"});function c(){if(a.value)return;let u=n.value.getBoundingClientRect();a.value=u.height>=l}return(u,p)=>(Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["post",[e.viewType,e.isNight?"isNight":""]]),style:Vue.normalizeStyle(Vue.unref(o)),onClick:p[0]||(p[0]=m=>u.$emit("show",m))},[Vue.createElementVNode("div",It,[Vue.createElementVNode("div",Ot,[Vue.createElementVNode("a",{onClick:Vue.withModifiers(m=>null,["stop"]),href:`/member/${e.post.username}`},[Vue.createElementVNode("div",Rt,[Vue.createElementVNode("img",{src:e.post.avatar,alt:""},null,8,Pt)])],8,Dt),Vue.createElementVNode("div",At,[Vue.createElementVNode("div",jt,[Vue.createElementVNode("a",{href:`t/${e.post.id}`},Vue.toDisplayString(e.post.title),9,Ft)]),Vue.createElementVNode("div",Gt,[e.post.node?(Vue.openBlock(),Vue.createElementBlock(Vue.Fragment,{key:0},[Vue.createElementVNode("a",{onClick:Vue.withModifiers(m=>null,["stop"]),href:e.post.nodeUrl,class:"my-node"},Vue.toDisplayString(e.post.node),9,zt),Vue.createTextVNode(" \xA0\xA0\u2022\xA0\xA0 ")],64)):Vue.createCommentVNode("",!0),Vue.createElementVNode("strong",null,[Vue.createElementVNode("a",{onClick:Vue.withModifiers(m=>null,["stop"]),class:"username",href:`/member/${e.post.username}`},Vue.toDisplayString(e.post.username),9,Wt)]),Vue.createTextVNode(" \xA0\xA0\u2022\xA0\xA0 "),Vue.createElementVNode("span",Ut,Vue.toDisplayString(e.post.date),1)])])]),e.post.replyCount?(Vue.openBlock(),Vue.createElementBlock("div",$t,Vue.toDisplayString(e.post.replyCount),1)):Vue.createCommentVNode("",!0)]),e.post.content_rendered?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:Vue.normalizeClass(["post-content-wrapper",{mask:a.value}])},[Vue.createElementVNode("div",{innerHTML:e.post.content_rendered,ref_key:"contentRef",ref:n},null,8,Zt)],2)):Vue.createCommentVNode("",!0)],6))}};var Yt=k(Kt,[["__scopeId","data-v-71df4ceb"]]);const qt={name:"Msg",props:{type:"",text:""},created(){setTimeout(()=>{this.$emit("close")},3e3)}},Xt=Vue.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M14 14L34 34",stroke:"#ffffff","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M14 34L34 14",stroke:"#ffffff","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"})],-1),Jt=[Xt],Qt={class:"right"};function eo(t,e,l,a,n,o){return Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["msg",l.type])},[Vue.createElementVNode("div",{class:"left",onClick:e[0]||(e[0]=c=>t.$emit("close"))},Jt),Vue.createElementVNode("div",Qt,Vue.toDisplayString(l.text),1)],2)}var to=k(qt,[["render",eo]]),oo=[{avatar:"https://cdn.v2ex.com/avatar/cdca/41db/41900_normal.png?m=1644293935",id:"887913",content_rendered:"",thankCount:0,title:"\u6B63\u6587\u663E\u793A\u5F02\u5E3812123",node:"\u7ECF\u5178\u56DE\u987E",username:"\u7ECF\u5178\u56DE\u987E",date:"\u51E0\u5C0F\u65F6\u524D"},{avatar:"https://cdn.v2ex.com/avatar/cdca/41db/41900_normal.png?m=1644293935",id:"667520",content_rendered:"",thankCount:0,title:"\u5D4C\u5957\u6709\u95EE\u9898",node:"\u7ECF\u5178\u56DE\u987E",username:"\u7ECF\u5178\u56DE\u987E",date:"\u51E0\u5C0F\u65F6\u524D"},{avatar:"https://cdn.v2ex.com/avatar/cdca/41db/41900_normal.png?m=1644293935",id:"724408",content_rendered:"",thankCount:0,title:"\u5185\u5BB9\u8D85\u7EA7\u591A",node:"\u7ECF\u5178\u56DE\u987E",username:"\u7ECF\u5178\u56DE\u987E",date:"\u51E0\u5C0F\u65F6\u524D"},{avatar:"https://cdn.v2ex.com/avatar/cdca/41db/41900_normal.png?m=1644293935",id:"886622",thankCount:0,title:"\u56DE\u590D\u91CC\u9762\u5982\u679C\u662F \u672C\u7AD9\u5E16\u5B50\uFF0C\u90A3\u4E48\u4E0D\u6253\u5F00\u65B0\u7684\u9875\u9762",node:"\u7ECF\u5178\u56DE\u987E",username:"\u7ECF\u5178\u56DE\u987E",date:"\u51E0\u5C0F\u65F6\u524D"}];const no=t=>(Vue.pushScopeId("data-v-2d42a498"),t=t(),Vue.popScopeId(),t),lo=no(()=>Vue.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M17 32L19.1875 27M31 32L28.8125 27M19.1875 27L24 16L28.8125 27M19.1875 27H28.8125",stroke:"#929596","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M43.1999 20C41.3468 10.871 33.2758 4 23.5999 4C13.9241 4 5.85308 10.871 4 20L10 18",stroke:"#929596","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M4 28C5.85308 37.129 13.9241 44 23.5999 44C33.2758 44 41.3468 37.129 43.1999 28L38 30",stroke:"#929596","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),so={key:1},io={__name:"Base64Tooltip",setup(t){const e=Vue.ref(null),l=Vue.ref(!1),a=Vue.ref(""),n=Vue.ref(""),o=Vue.reactive({left:"-100vw",top:"-100vh"});Vue.onMounted(()=>{i.on(r.SHOW_TOOLTIP,({text:m,e:s})=>{setTimeout(()=>l.value=!0),a.value=m,n.value="",o.left=s.clientX+"px",o.top=s.clientY+20+"px"}),window.win().addEventListener("click",m=>{!e.value||!e.value.contains(m.target)&&l.value&&(l.value=!1)},{capture:!0});const p=()=>l.value&&(l.value=!1);$(".post-detail",window.win().doc).on("scroll",p)});function c(){window.win().navigator.clipboard?(window.win().navigator.clipboard.writeText(n.value),i.emit(r.SHOW_MSG,{type:"success",text:"\u590D\u5236\u6210\u529F"})):i.emit(r.SHOW_MSG,{type:"error",text:"\u590D\u5236\u5931\u8D25\uFF01\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\uFF01"})}function u(){try{n.value=window.atob(a.value)}catch{i.emit(r.SHOW_MSG,{type:"error",text:"Base64\u89E3\u7801\u5931\u8D25\uFF01\u4E0D\u662F\u6807\u51C6\u6570\u636E\uFF01"})}}return(p,m)=>Vue.withDirectives((Vue.openBlock(),Vue.createElementBlock("div",{class:"base64_tooltip",style:Vue.normalizeStyle(o),onClick:u,ref_key:"tooltip",ref:e},[n.value?(Vue.openBlock(),Vue.createElementBlock("div",so,[Vue.createElementVNode("span",null,Vue.toDisplayString(n.value),1),Vue.createElementVNode("div",{class:"button",onClick:c},"\u70B9\u51FB\u590D\u5236")])):(Vue.openBlock(),Vue.createElementBlock(Vue.Fragment,{key:0},[Vue.createTextVNode(" Base64\u89E3\u7801\uFF1A"+Vue.toDisplayString(a.value)+" ",1),lo],64))],4)),[[Vue.vShow,l.value]])}};var ro=k(io,[["__scopeId","data-v-2d42a498"]]);const ao={name:"home",provide(){return{isDev:Vue.computed(()=>!1),isLogin:Vue.computed(()=>!!window.win().user.username),pageType:Vue.computed(()=>this.pageType),clone:window.win().clone,post:Vue.computed(()=>this.current),allReplyUsers:Vue.computed(()=>Array.from(new Set(this.current.replies.map(t=>t.username))))}},components:{PostDetail:Ht,Post:Yt,Msg:to,Base64Tooltip:ro},data(){return{loading:window.win().pageType==="post",loadMore:!1,pageType:window.win().pageType,isNight:window.win().isNight,msgList:[],show:!1,showConfig:!1,current:window.win().initPost,list:[],config:{autoOpenDetail:!1,closePostDetailBySpace:!0,readList:new Set,viewType:"card",commentDisplayType:0}}},computed:{isDev(){return!1},showList(){return this.pageType==="home"||this.pageType==="recent"||this.pageType==="nodePage"}},watch:{"current.replies":{handler(t,e){if(t.length){this.current.replyCount=t.length;let l=window.parse.createNestedList(t,this.current.allReplyUsers);l&&(this.current.nestedReplies=l)}else this.current.replyCount=0,this.current.nestedReplies=[];if(this.list){let l=this.list.findIndex(a=>a.id===this.current.id);l>-1&&(this.list[l].replyCount=t.length)}},deep:!0},config:{handler(t){var a;let e=Array.from(t.readList),l={[(a=window.win().user.username)!=null?a:"default"]:{...t,readList:e}};window.win().localStorage.setItem("v2ex-config",JSON.stringify(l))},deep:!0}},created(){var e;console.log("create"),window.win().cb=this.winCb;let t=window.win().localStorage.getItem("v2ex-config");if(t){let l=JSON.parse(t);l=l[(e=window.win().user.username)!=null?e:"default"],l&&(l.readList=new Set(l.readList),this.config=Object.assign(this.config,l),this.config.autoOpenDetail&&this.pageType==="post"&&(this.loading=!0,this.openPostDetail()))}if(window.win().canParseV2exPage){if(this.list=window.win().postList,window.win().waitDelElList.map(l=>l.remove()),window.win().waitDelElList=[],this.showList){let l=window.win().appNode.nextElementSibling,a=1e3;if(this.pageType!=="home"){let c=l.querySelectorAll("a");a=Number(c[c.length-1].innerText)}let n=window.win().IntersectionObserver;new n(async c=>{if(c[0].isIntersecting){if(this.loadMore)return;console.log("\u52A0\u8F7D\u66F4\u591A"),this.loadMore=!0;let u;if(this.pageType==="home")u=window.win().url+"/recent?p=1",this.pageType="recent";else{let{href:d,search:V,origin:g,pathname:S}=window.win().location;u=d+"?p=2";let y=V.match(/p=([\d]+)/);if(y){if(Number(y[1])>=a)return i.emit(r.SHOW_MSG,{type:"success",text:"\u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u9875\u4E86"}),this.loadMore=!1;u=g+S+V.replace(y[1],Number(y[1])+1)}}window.win().history.pushState({},0,u);let m=await(await window.win().fetch(u)).text(),s=window.parse.parseOtherPage(m,this.pageType);console.log("res",s),l.innerHTML=s.page,this.list.push({type:"page",innerHTML:l.innerHTML}),s.postList.map(d=>{this.list.findIndex(g=>g.id==d.id)===-1&&this.list.push(d)}),this.loadMore=!1,Promise.allSettled(s.apiList.map(d=>$.get(d))).then(async d=>{let V=d.filter(g=>g.status==="fulfilled").map(g=>g.value[0]);this.winCb({type:"list",value:V})})}}).observe(l)}}else this.list=oo;this.initEvent()},beforeUnmount(){console.log("unmounted"),i.clear()},methods:{winCb({type:t,value:e}){t==="list"&&(e.map(l=>{let a=this.list.findIndex(n=>n.id==l.id);a>-1&&(this.list[a]=Object.assign(this.list[a],{content_rendered:l.content_rendered,nodeUrl:l.node.url,avatar:l.member.avatar_large}))}),window.win().vueCb&&window.win().vueCb()),t==="postContent"&&(this.config.readList.add(e.id),this.current=Object.assign(this.clone(window.win().initPost),this.clone(e))),t==="postReplies"&&(this.current=Object.assign(this.current,this.clone(e)),this.loading=!1),t==="ad"&&(window.win().adList.map(l=>{let a=window.win().query("#"+l.id),n=this.list.findIndex(o=>o.id==l.id);n>-1&&(this.list[n]=Object.assign(this.list[n],{innerHTML:a.innerHTML}))}),window.win().$adListEl.innerHTML="",window.win().adList=[])},clone(t){return window.win().clone(t)},initEvent(){i.on(r.CHANGE_COMMENT_THANK,t=>{const{id:e,type:l}=t;let a=this.current.replies.findIndex(n=>n.id===e);a>-1&&(this.current.replies[a].isThanked=l==="add",l==="add"?this.current.replies[a].thankCount++:this.current.replies[a].thankCount--)}),i.on(r.CHANGE_POST_THANK,t=>{const{id:e,type:l}=t;this.current.isThanked=l==="add",l==="add"?this.current.thankCount++:this.current.thankCount--;let a=this.list.findIndex(n=>n.id===e);a>-1&&(this.list[a].isThanked=l==="add",l==="add"?this.list[a].thankCount++:this.list[a].thankCount++)}),i.on(r.REMOVE,t=>{let e=this.current.replies.findIndex(a=>a.floor===t);e>-1&&this.current.replies.splice(e,1);let l=this.list.findIndex(a=>a.id===this.current.id);l>-1&&(this.list[l]=Object.assign(this.list[l],t))}),i.on(r.SHOW_MSG,t=>{this.msgList.push({...t,id:Date.now()})}),i.on(r.IGNORE,()=>{this.show=!1;let t=this.list.findIndex(e=>e.id===this.current.id);t>-1&&this.list.splice(t,1),this.current=this.clone(window.win().initPost)}),i.on(r.MERGE,t=>{this.current=Object.assign(this.current,t);let e=this.list.findIndex(l=>l.id===this.current.id);e>-1&&(this.list[e]=Object.assign(this.list[e],t))}),i.on(r.ADD_REPLY,t=>{this.current.replies.push(t)}),i.on(r.REFRESH_ONCE,async t=>{if(t){if(typeof t=="string"){let e=t.match(/var once = "([\d]+)";/);if(e&&e[1]){this.current.once=Number(e[1]);return}}if(typeof t=="number"){this.current.once=t;return}}window.win().fetchOnce().then(e=>{this.current.once=e})})},svgColor(t){return t===this.config.viewType?"white":"#929596"},removeMsg(t){let e=this.msgList.findIndex(l=>l.id===t);e>-1&&this.msgList.splice(e,1)},openPostDetail(){this.show=!0,window.win().doc.body.style.overflow="hidden"},async getPostDetail(t,e){if(this.openPostDetail(),e){let p=e.target||e.srcElement;if(p.nodeName.toLocaleLowerCase()==="a"){e.preventDefault();let s=p.innerText.match(/t\/([\d]+)/);s&&(t={id:s[1]})}}let l=window.win().url+"/t/"+t.id;window.win().history.pushState({},0,l),this.config.readList.add(t.id),this.current=Object.assign(window.win().clone(window.win().initPost),{RightbarHTML:this.current.RightbarHTML},window.win().clone(t)),this.current.replies.length||(this.loading=!0);let a=await window.win().fetch(l+"?p=1");if(a.redirected)return i.emit(r.SHOW_MSG,{type:"error",text:"\u6CA1\u6709\u6743\u9650"}),this.loading=!1;let n=await a.text();if(n.search("\u4F60\u8981\u67E5\u770B\u7684\u9875\u9762\u9700\u8981\u5148\u767B\u5F55")>-1)return i.emit(r.SHOW_MSG,{type:"error",text:"\u4F60\u8981\u67E5\u770B\u7684\u9875\u9762\u9700\u8981\u5148\u767B\u5F55"}),this.loading=!1;let c=n.match(/<body[^>]*>([\s\S]+?)<\/body>/g),u=$(c[0]);if(this.current=await window.parse.getPostDetail(this.current,u,n),this.current.replies.length){let p=this.list.findIndex(m=>m.id===t.id);p>-1&&(this.list[p].replies=this.current.replies,this.list[p].nestedReplies=this.current.nestedReplies,this.list[p].once=this.current.once,this.list[p].createDate=this.current.createDate)}this.loading=!1,console.log("\u5F53\u524D\u5E16\u5B50",this.current)}}},co=Vue.createElementVNode("svg",{width:"19",height:"19",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Vue.createElementVNode("path",{d:"M34.0003 41L44 24L34.0003 7H14.0002L4 24L14.0002 41H34.0003Z",fill:"none",stroke:"#000000","stroke-width":"4","stroke-linejoin":"round"}),Vue.createElementVNode("path",{d:"M24 29C26.7614 29 29 26.7614 29 24C29 21.2386 26.7614 19 24 19C21.2386 19 19 21.2386 19 24C19 26.7614 21.2386 29 24 29Z",fill:"none",stroke:"#000000","stroke-width":"4","stroke-linejoin":"round"})],-1),uo=Vue.createElementVNode("span",null,"\u914D\u7F6E",-1),po=[co,uo],mo={width:"19",height:"19",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ho=["stroke"],Vo=["stroke"],fo=["stroke"],wo=Vue.createElementVNode("span",null,"\u8868\u683C",-1),vo={width:"19",height:"19",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},go=["stroke"],_o=["stroke"],ko=["fill"],yo=["fill"],Co=["fill"],Eo=Vue.createElementVNode("span",null,"\u5361\u7247",-1),No={class:"posts"},To=["innerHTML"],xo=["innerHTML"],So={key:0,class:"flex flex-center p1"},Bo=Vue.createElementVNode("div",{class:"loading-c"},null,-1),Lo=[Bo],Mo={key:1,class:"my-box flex f14 open-post",style:{margin:"1rem 0 0 0",padding:"1rem"}},bo={class:"flex"},Ho={class:"msgs"},Io={key:2,class:"setting"},Oo={class:"wrapper"},Do=Vue.createElementVNode("div",{class:"title"}," \u811A\u672C\u914D\u7F6E ",-1),Ro=Vue.createElementVNode("div",{class:"sub-title"}," \u914D\u7F6E\u81EA\u52A8\u4FDD\u5B58\u5230\u672C\u5730\uFF0C\u4E0B\u6B21\u6253\u5F00\u4F9D\u7136\u751F\u6548 ",-1),Po={class:"option"},Ao=Vue.createElementVNode("span",null,"\u5217\u8868\u5E16\u5B50\u5C55\u793A\u65B9\u5F0F\uFF1A",-1),jo={class:"radio-group2"},Fo={class:"option"},Go=Vue.createElementVNode("span",null,"\u56DE\u590D\u5C55\u793A\u65B9\u5F0F\uFF1A",-1),zo={class:"radio-group2"},Wo={class:"option"},Uo=Vue.createElementVNode("span",null,"\u81EA\u52A8\u52A0\u8F7D\u8BE6\u60C5\u9875 \uFF1A",-1),$o={class:"option"},Zo=Vue.createElementVNode("span",null,"\u70B9\u51FB\u4E24\u4FA7\u7A7A\u767D\u5904\u5173\u95ED\u5E16\u5B50\u8BE6\u60C5\uFF1A",-1);function Ko(t,e,l,a,n,o){const c=Vue.resolveComponent("Post"),u=Vue.resolveComponent("PostDetail"),p=Vue.resolveComponent("Msg"),m=Vue.resolveComponent("Base64Tooltip");return Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["app-home",[n.config.viewType,n.pageType,n.isNight?"isNight":""]])},[o.showList?(Vue.openBlock(),Vue.createElementBlock(Vue.Fragment,{key:0},[Vue.createElementVNode("div",{class:Vue.normalizeClass(["nav flex flex-end",n.config.viewType])},[Vue.createElementVNode("div",{class:"nav-item",onClick:e[0]||(e[0]=s=>n.showConfig=!0)},po),Vue.createElementVNode("div",{class:Vue.normalizeClass(["nav-item",{active:n.config.viewType==="table"}]),onClick:e[1]||(e[1]=s=>n.config.viewType="table")},[(Vue.openBlock(),Vue.createElementBlock("svg",mo,[Vue.createElementVNode("path",{d:"M42 5H6V13H42V5Z",fill:"none",stroke:o.svgColor("table"),"stroke-width":"4","stroke-linejoin":"round"},null,8,ho),Vue.createElementVNode("path",{d:"M42 20H6V28H42V20Z",fill:"none",stroke:o.svgColor("table"),"stroke-width":"4","stroke-linejoin":"round"},null,8,Vo),Vue.createElementVNode("path",{d:"M42 35H6V43H42V35Z",fill:"none",stroke:o.svgColor("table"),"stroke-width":"4","stroke-linejoin":"round"},null,8,fo)])),wo],2),Vue.createElementVNode("div",{class:Vue.normalizeClass(["nav-item",{active:n.config.viewType==="card"}]),onClick:e[2]||(e[2]=s=>n.config.viewType="card")},[(Vue.openBlock(),Vue.createElementBlock("svg",vo,[Vue.createElementVNode("path",{d:"M42 18V40C42 41.1046 41.1046 42 40 42H8C6.89543 42 6 41.1046 6 40V18",stroke:o.svgColor("card"),"stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null,8,go),Vue.createElementVNode("path",{d:"M6 8C6 6.89543 6.89543 6 8 6H40C41.1046 6 42 6.89543 42 8V18H6V8Z",fill:"none",stroke:o.svgColor("card"),"stroke-width":"4","stroke-linejoin":"round"},null,8,_o),Vue.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14Z",fill:o.svgColor("card")},null,8,ko),Vue.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 14C19.1046 14 20 13.1046 20 12C20 10.8954 19.1046 10 18 10C16.8954 10 16 10.8954 16 12C16 13.1046 16.8954 14 18 14Z",fill:o.svgColor("card")},null,8,yo),Vue.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 14C25.1046 14 26 13.1046 26 12C26 10.8954 25.1046 10 24 10C22.8954 10 22 10.8954 22 12C22 13.1046 22.8954 14 24 14Z",fill:o.svgColor("card")},null,8,Co)])),Eo],2)],2),Vue.createElementVNode("div",No,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(n.list,s=>(Vue.openBlock(),Vue.createElementBlock(Vue.Fragment,null,[s.type==="ad"&&s.innerHTML?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,class:Vue.normalizeClass(["nav p0 page",n.config.viewType])},[Vue.createElementVNode("div",{innerHTML:s.innerHTML},null,8,To)],2)):Vue.createCommentVNode("",!0),s.type==="page"&&s.innerHTML?(Vue.openBlock(),Vue.createElementBlock("div",{key:1,class:Vue.normalizeClass(["nav page",n.config.viewType])},[Vue.createElementVNode("div",{innerHTML:s.innerHTML},null,8,xo)],2)):(Vue.openBlock(),Vue.createBlock(c,{key:2,viewType:n.config.viewType,post:s,isNight:n.isNight,class:Vue.normalizeClass({visited:n.config.readList.has(s.id)}),onShow:d=>o.getPostDetail(s,d)},null,8,["viewType","post","isNight","class","onShow"]))],64))),256)),n.loadMore?(Vue.openBlock(),Vue.createElementBlock("div",So,Lo)):Vue.createCommentVNode("",!0)])],64)):Vue.createCommentVNode("",!0),n.pageType==="post"?(Vue.openBlock(),Vue.createElementBlock("div",Mo,[Vue.createElementVNode("div",bo,[Vue.createTextVNode(" \u81EA\u52A8\u52A0\u8F7D\u8BE6\u60C5\u9875 \uFF1A "),Vue.createElementVNode("div",{class:Vue.normalizeClass(["switch",{active:n.config.autoOpenDetail}]),onClick:e[3]||(e[3]=s=>n.config.autoOpenDetail=!n.config.autoOpenDetail)},null,2)]),Vue.createElementVNode("div",{class:Vue.normalizeClass(["button",{loading:n.loading}]),onClick:e[4]||(e[4]=(...s)=>o.openPostDetail&&o.openPostDetail(...s))}," \u70B9\u51FB\u663E\u793A\u8BE6\u60C5\u9875 ",2)])):Vue.createCommentVNode("",!0),Vue.createVNode(u,{modelValue:n.show,"onUpdate:modelValue":e[5]||(e[5]=s=>n.show=s),isNight:n.isNight,commentDisplayType:n.config.commentDisplayType,"onUpdate:commentDisplayType":e[6]||(e[6]=s=>n.config.commentDisplayType=s),closePostDetailBySpace:n.config.closePostDetailBySpace,loading:n.loading},null,8,["modelValue","isNight","commentDisplayType","closePostDetailBySpace","loading"]),Vue.createElementVNode("div",Ho,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(n.msgList,s=>(Vue.openBlock(),Vue.createBlock(p,{key:s.id,type:s.type,text:s.text,onClose:d=>o.removeMsg(s.id)},null,8,["type","text","onClose"]))),128))]),Vue.createVNode(m),n.showConfig?(Vue.openBlock(),Vue.createElementBlock("div",Io,[Vue.createElementVNode("div",{class:"mask",onClick:e[7]||(e[7]=s=>n.showConfig=!n.showConfig)}),Vue.createElementVNode("div",Oo,[Do,Ro,Vue.createElementVNode("div",Po,[Ao,Vue.createElementVNode("div",jo,[Vue.createElementVNode("div",{class:Vue.normalizeClass(["radio",n.config.viewType==="table"?"active":""]),onClick:e[8]||(e[8]=s=>n.config.viewType="table")},"\u8868\u683C ",2),Vue.createElementVNode("div",{class:Vue.normalizeClass(["radio",n.config.viewType==="card"?"active":""]),onClick:e[9]||(e[9]=s=>n.config.viewType="card")},"\u5361\u7247 ",2)])]),Vue.createElementVNode("div",Fo,[Go,Vue.createElementVNode("div",zo,[Vue.createElementVNode("div",{class:Vue.normalizeClass(["radio",n.config.commentDisplayType===0?"active":""]),onClick:e[10]||(e[10]=s=>n.config.commentDisplayType=0)},"\u697C\u4E2D\u697C ",2),Vue.createElementVNode("div",{class:Vue.normalizeClass(["radio",n.config.commentDisplayType===1?"active":""]),onClick:e[11]||(e[11]=s=>n.config.commentDisplayType=1)},"\u611F\u8C22\u6700\u591A ",2),Vue.createElementVNode("div",{class:Vue.normalizeClass(["radio",n.config.commentDisplayType===2?"active":""]),onClick:e[12]||(e[12]=s=>n.config.commentDisplayType=2)},"V2\u539F\u7248 ",2)])]),Vue.createElementVNode("div",Wo,[Uo,Vue.createElementVNode("div",{class:Vue.normalizeClass(["switch",{active:n.config.autoOpenDetail}]),onClick:e[13]||(e[13]=s=>n.config.autoOpenDetail=!n.config.autoOpenDetail)},null,2)]),Vue.createElementVNode("div",$o,[Zo,Vue.createElementVNode("div",{class:Vue.normalizeClass(["switch",{active:n.config.closePostDetailBySpace}]),onClick:e[14]||(e[14]=s=>n.config.closePostDetailBySpace=!n.config.closePostDetailBySpace)},null,2)])])])):Vue.createCommentVNode("",!0)],2)}var Yo=k(ao,[["render",Ko]]);let x;window.win().isFrame?x=$("#app",window.win().doc)[0]:x=$("#app")[0];window.win().vue&&window.win().vue.unmount();let b=Vue.createApp(Yo);window.win().vue=b;window.win().appNode=x;b.config.unwrapInjectedRef=!0;b.mount(x);
//# sourceMappingURL=index.ab508a37.js.map
})
const isDev = false
if (window.top[0]) {
window.win = () => window.top
window.win().url = 'https://www.v2ex.com'
// window.win().url = location.origin
window.win().isFrame = true
//直接使用v2的jquery,因为v2对jquery作了修改,加了一些header,缺少这些header发送请求会报403
window.$ = window.win().$
} else {
window.win = () => window
window.win().url = 'https://www.v2ex.com'
// window.win().url = location.origin
window.win().isFrame = false
}
window.win().initPost = {
replies: [],
nestedReplies: [],
username: '',
title: '',
id: '',
type: 'post',
once: '',
replyCount: 0,
clickCount: 0,
thankCount: 0,
collectCount: 0,
isFavorite: false,
isIgnore: false,
isThanked: false,
isReport: false,
RightbarHTML: '',
}
window.win().doc = window.win().document
window.win().query = (v) => window.win().document.querySelector(v)
window.win().queryAll = window.win().document.querySelectorAll
window.win().clone = (val) => JSON.parse(JSON.stringify(val))
window.win().user = {}
window.win().pageType = ''
window.win().pageData = {pageNo: 1}
window.win().adIndex = 0 //广告下标,用于区分广告id
window.win().adList = []//广告列表,用于延时通知vue复制广告的innerHTML,因为一开始就复制,google的js不能正常加载
//待删除元素列表。等vue加载好了,再删除。之所以要用数组,是因为帖子中间夹杂着广告。
// 只删除帖子,广告会被移除到其他地方,保证google的js能正常加载出广告来
window.win().waitDelElList = []
window.parse = {
//解析帖子内容
async parsePostContent(post = {}, body, htmlText) {
//如果没有正文(点的本站的a标签),才会解析正文
if (!post.title || !post.content_rendered) {
let main = body.find('#Main')
let topic_content = main.find('.topic_content')
if (topic_content.length) {
post.content_rendered = topic_content.html()
}
let title = main.find('.header h1')
if (title.length) {
post.title = title.html()
}
let as = main.find('.header a')
if (as[2]) {
post.nodeUrl = as[2].href
post.node = as[2].innerText
}
let aName = main.find('.header small a:nth-child(1)')
if (aName) {
post.username = aName[0].innerText
post.date = aName[0].nextElementSibling.innerText
}
let avatarNode = main.find('.header .fr img')
if (avatarNode.length) {
post.avatar = avatarNode[0].src
}
}
let subtles = body.find('.subtle')
if (subtles.length) {
post.subtlesHtml = `
<div class="subtlesHtml">${Array.from(subtles).reduce((p, i) => {
p += `<div class="subtle">${i.innerHTML}</div>`
return p
}, '')}</div>
`
}
let once = htmlText.match(/var once = "([\d]+)";/)
// console.log(once)
if (once && once[1]) {
post.once = once[1]
}
post.isReport = htmlText.includes('你已对本主题进行了报告')
let topic_buttons = body.find('.topic_buttons')
if (topic_buttons.length) {
let favoriteNode = topic_buttons.find('.tb:first')
if (favoriteNode.length) {
post.isFavorite = favoriteNode[0].innerText === '取消收藏'
}
let ignoreNode = topic_buttons.find('.tb:nth-child(3)')
if (ignoreNode.length) {
post.isIgnore = ignoreNode[0].innerText === '取消忽略'
}
//
let thankNode = topic_buttons.find('#topic_thank .tb')
if (!thankNode.length) {
post.isThanked = true
}
let topic_stats = topic_buttons.find('.topic_stats')
//topic_stats = $(`<div class="fr topic_stats" style="padding-top: 4px;">9569 次点击 ∙ 28 人收藏 ∙ 1 人感谢 </div>`)
//收藏数、感谢数
if (topic_stats.length) {
let text = topic_stats[0].innerText
let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g)
let collectCountReg = [...reg1]
if (collectCountReg.length) {
post.collectCount = Number(collectCountReg[0][1])
}
// console.log([...collectCountReg])
let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g)
let thankCountReg = [...reg2]
if (thankCountReg.length) {
post.thankCount = Number(thankCountReg[0][1])
}
// console.log([...thankCountReg])
}
}
//点击数
let baseInfo = body.find('.header small.gray')
if (baseInfo.length) {
let text = baseInfo.text()
let reg = text.matchAll(/([\d]+)[\s]*次点击/g)
let clickCountReg = [...reg]
if (clickCountReg.length) {
post.clickCount = Number(clickCountReg[0][1])
}
}
// let Rightbar = window.win().query('#Rightbar')
let Rightbar = body.find('#Rightbar')
if (Rightbar.length) {
post.RightbarHTML = Rightbar[0].innerHTML
//让修改背景的样式失效
post.RightbarHTML = post.RightbarHTML.replace('type="text/css"', 'type="text/css1"')
}
// console.log('基本信息', post)
return post
},
//获取帖子所有回复
async getPostAllReplies(post = {}, body, htmlText, pageNo = 1) {
if (body.find('#no-comments-yet').length) {
return post
}
let box = body.find('#Main > .box')[1]
let cells = box.querySelectorAll('.cell')
cells = Array.from(cells)
//获取创建时间
let snow = cells[0].querySelector('.snow')
post.createDate = snow?.nextSibling.nodeValue.trim() || ''
let repliesMap = []
if (cells[1].id) {
repliesMap.push({i: pageNo, replyList: this.parsePageReplies(cells.slice(1))})
let replies = this.getAllReply(repliesMap)
post.replies = replies
post.replyCount = replies.length
post.allReplyUsers = Array.from(new Set(replies.map(v => v.username)))
let nestedList = this.createNestedList(replies, post.allReplyUsers)
if (nestedList) post.nestedReplies = nestedList
return post
} else {
let promiseList = []
// console.log(this.current.repliesMap)
return new Promise((resolve, reject) => {
repliesMap.push({i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1))})
let pages = cells[1].querySelectorAll('a')
pages = Array.from(pages)
// console.log(pages)
let url = window.win().url + '/t/' + post.id
for (let i = 0; i < pages.length; i++) {
let currentPageNo = Number(pages[i].innerText)
if (currentPageNo == pageNo) continue
promiseList.push(this.fetchPostOtherPageReplies(url + '?p=' + currentPageNo, currentPageNo))
}
Promise.allSettled(promiseList).then(
(results) => {
results.filter((result) => result.status === "fulfilled").map(v => repliesMap.push(v.value))
let replies = this.getAllReply(repliesMap)
post.replies = replies
post.replyCount = replies.length
post.allReplyUsers = Array.from(new Set(replies.map(v => v.username)))
let nestedList = this.createNestedList(replies, post.allReplyUsers)
if (nestedList) post.nestedReplies = nestedList
resolve(post)
}
);
})
}
},
//请求帖子其他页的回复
fetchPostOtherPageReplies(url, pageNo) {
return new Promise(resolve => {
$.get(url).then(res => {
let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g)
let box = $(s[0]).find('#Main .box')[1]
let cells = box.querySelectorAll('.cell')
cells = Array.from(cells)
resolve({i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1))})
})
})
},
//解析页面的回复
parsePageReplies(nodes) {
let replyList = []
nodes.forEach((node, index) => {
if (!node.id) return
let item = {
thankCount: 0,
isThanked: false,
isOp: false,
id: node.id.replace('r_', '')
}
let reply_content = node.querySelector('.reply_content')
// console.log('reply_content',reply_content)
item.reply_content = reply_content.innerHTML
item.reply_text = reply_content.innerText
let {users, floor} = this.parseReplyContent(item.reply_content)
item.replyUsers = users
item.replyFloor = floor
if (index === 5) {
// console.log(item)
// console.log(reply_content.innerText)
// console.log(reply_content.innerHTML)
}
let ago = node.querySelector('.ago')
item.date = ago.innerText
let userNode = node.querySelector('strong a')
item.username = userNode.innerText
let avatar = node.querySelector('td img')
item.avatar = avatar.src
let no = node.querySelector('.no')
item.floor = Number(no.innerText)
let thank_area = node.querySelector('.thank_area')
if (thank_area) {
item.isThanked = thank_area.classList.contains('thanked')
}
let small = node.querySelector('.small')
if (small) {
item.thankCount = Number(small.innerText)
}
let op = node.querySelector('.op')
if (op) {
item.isOp = true
}
// console.log('item', item)
replyList.push(item)
})
return replyList
},
//解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
parseReplyContent(str) {
if (!str) return
let users = []
let getUsername = (userStr) => {
let endIndex = userStr.indexOf('">')
if (endIndex > -1) {
let user = userStr.substring(0, endIndex)
if (!users.find(i => i === user)) {
users.push(user)
}
}
}
// str = `@<a hr a> #4 @<a1 href="/member/Eiden1">Eiden1</a1> @<a href="/member/Eiden111">Eiden21</a> #11 这也是执行阶段,所谓的安装也是程序业务的 setup 。<br>windows 、Android 并没有系统级的 CD-KEY 。`
let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g
let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g
let hasFloor = str.matchAll(floorReg)
let res = [...hasFloor]
// console.log('总匹配', res)
let floor = -1
if (res.length) {
floor = Number(res[0][1])
}
let has = str.matchAll(userReg)
let res2 = [...has]
// console.log('总匹配', res2)
if (res2.length > 1) {
res2.map(item => {
getUsername(item[1])
})
}
if (res2.length === 1) {
getUsername(res2[0][1])
}
// console.log('用户', users)
// console.log('楼层', floor)
return {users, floor}
},
//获取帖子详情
async getPostDetail(post = {}, body, htmlText, pageNo = 1) {
post = await this.parsePostContent(post, body, htmlText)
return await this.getPostAllReplies(post, body, htmlText, pageNo)
},
getAllReply(repliesMap = []) {
return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
pre = pre.concat(i.replyList)
return pre
}, [])
},
//生成嵌套回复
createNestedList(allList = []) {
if (!allList.length) return []
if ((Date.now() - window.win().lastCallDate) < 1000) {
// console.log('短时间内,重复调用,因为监听了replies,所以打开时会触发两次。第二次不管他')
return false
}
// console.log('cal-createNestedList', Date.now())
let list = JSON.parse(JSON.stringify(allList))
let nestedList = []
list.map((item, index) => {
let startList = list.slice(0, index)
let startReplyUsers = Array.from(new Set(startList.map(v => v.username)))
let endList = list.slice(index + 1)
if (index === 0) {
item.level = 0
nestedList.push(this.findChildren(item, endList, list))
} else {
let isParentReply = false
// if (item.replyFloor === -1) {
// isParentReply = true
// }
if (item.replyUsers.length) {
if (item.replyUsers.length > 1) {
isParentReply = true
} else {
isParentReply = !startReplyUsers.find(v => v === item.replyUsers[0]);
}
} else {
isParentReply = true
}
if (isParentReply) {
item.level === 0
nestedList.push(this.findChildren(item, endList, list))
}
}
})
// console.log('replies长度', allList)
// console.log('nestedList长度', nestedList)
window.win().lastCallDate = Date.now()
return nestedList
},
//查找子回复
findChildren(item, endList, all) {
const fn = (child, endList2, parent) => {
child.level = parent.level + 1
let rIndex = all.findIndex(v => v.floor === child.floor)
if (rIndex > -1) {
all[rIndex].isUse = true
}
parent.children.push(this.findChildren(child, endList2, all))
}
// console.log('endList', endList)
item.children = []
// if (item.floor ==8)debugger
for (let i = 0; i < endList.length; i++) {
let currentItem = endList[i]
//如果已被使用,直接跳过
if (currentItem.isUse) continue
let endList2 = endList.slice(i + 1)
//注: 2022-10-26,回复被忽略了之后,会占据原来的楼层
//但是,未忽略这条回复的人,看到的楼层和忽略回复的人看到的不一样,导致以楼层号来判断会出问题
// if (currentItem.replyFloor !== -1) {
if (false) {
if (currentItem.replyFloor === item.floor) {
fn(currentItem, endList2, item)
}
} else {
if (currentItem.replyUsers.length === 1) {
// //找出自己最近一条正常回复,以那条为搜索终点
// let rIndex = endList.findIndex(v => v.username === item.username && (currentItem.replyUsers.length === 0 && currentItem.replyFloor === -1))
// if (rIndex > -1) {
// endList2 = endList.slice(i + 1, rIndex)
// }
//如果是下一条是同一人的回复,那么跳出循环。children从下一条开始找
if (currentItem.username === item.username) {
//自己回复自己的特殊情况
if (currentItem.replyUsers[0] === item.username) {
fn(currentItem, endList2, item)
continue
}
//有种特殊情况,就是自己连着评论了两条。然后后面的人以#号的方式 回复了自己第一条。
//如果检测到下条是自己的回复,直接略过的话就会丢失第一条的所有楼中楼回复
//具体如下
// 自己:1楼,在for的时候,如果碰到 2楼不能直接跳过,直接略过的话就会丢失第一条的所有楼中楼回复,即3楼。所以应该以3楼为起点
//进行楼中楼查找,查找完了再跳过
// 自己:2楼
// 别人:指定回复1楼
// endList2.map((v, vi) => {
// if (v.replyFloor === item.floor) {
// fn(v, endList.slice(vi + 1), item)
// }
// })
break
} else {
if (currentItem.replyUsers[0] === item.username) {
fn(currentItem, endList2, item)
}
}
}
}
}
return item
},
//解析其他页面
parseOtherPage(html, pageType) {
let bodyText = html.match(/<body[^>]*>([\s\S]+?)<\/body>/g)
let body = $(bodyText[0])
if (pageType === 'recent') {
// box = window.win().query('#Wrapper #Main .box')
// let arr = Array.from(box.children)
// let start = arr.findIndex(v => v.classList.contains('item'))
// list = arr.slice(start, arr.length - 1)
let list = body.find('.item')
let res = this.parsePagePostList(Array.from(list))
let page = body.find('.cell:last').html()
return {...res, page}
}
if (pageType === 'nodePage') {
let topics = body.find('#TopicsNode')
let list = topics.children()
let res = this.parsePagePostList(Array.from(list))
let page = topics.next().html()
return {...res, page}
}
},
//解析页面帖子列表
parsePagePostList(list) {
let postList = []
let apiList = []
list.forEach(function (listItem) {
if (!listItem.classList.contains('cell')) {
window.win().$adListEl.append(listItem)
window.win().adIndex += 1
let adId = 'ad' + window.win().adIndex
listItem.id = adId
let item = {
type: 'ad',
id: adId,
innerHTML: listItem.innerHTML
}
postList.push(item)
window.win().adList.push(item)
// listItem.remove()
return
}
let item = window.win().clone(window.win().initPost)
let bg = listItem.style['background-image']
item.bg = bg
let item_title = listItem.querySelector('.item_title a')
let href = item_title.href
item.id = href.substring(href.indexOf('/t/') + 3, href.indexOf('#'))
item.title = item_title.innerText
let topic_info = listItem.querySelector('.topic_info')
let userNode = topic_info.querySelector('strong a')
item.username = userNode.innerText
let timeNode = listItem.querySelector('.topic_info span')
item.date = timeNode.innerText
let tagNode = topic_info.querySelector('.node')
if (tagNode) {
item.node = tagNode.innerText
}
let countNode = listItem.querySelector('.count_livid')
item.replyCount = countNode ? countNode.innerText : 0
let avatar = listItem.querySelector('img')
item.avatar = avatar.src
let url = window.win().location.origin + '/api/topics/show.json?id=' + item.id
// console.log(url)
apiList.push(url)
postList.push(item)
window.win().waitDelElList.push(listItem)
// listItem.remove()
})
setTimeout(() => {
cbChecker({type: 'ad'})
}, 3000)
return {postList, apiList}
},
fetchAll(list) {
return new Promise(resolve => {
Promise.allSettled(list.map(url => $.get(url))).then(async (res) => {
let ok = res.filter((r) => r.status === "fulfilled").map(v => v.value[0])
let fail = res.filter((r) => r.status === "rejected")
console.log('fail', fail)
resolve(ok)
});
})
}
}
async function sleep(time) {
return new Promise(resolve => {
// console.log('等待vue加载完成,第' + count + '次', Date.now())
setTimeout(resolve, time)
})
}
async function cbChecker(val, count = 0) {
if (window.win().cb) {
window.win().cb(val)
} else {
while ((!window.win().cb) && count < 20) {
await sleep(500)
count++
}
window.win().cb && window.win().cb(val)
}
}
// console.log('type===', window.win().pageType, 'pageData===', window.win().pageData)
// console.log('postList', window.win().postList)
// console.log('init', window.win().init)
window.win().canParseV2exPage = true
//开发环境并且没有嵌套到v2ex的网页里面时,不要解析
if (isDev && !window.win().isFrame) {
window.win().canParseV2exPage = false
}
if (window.win().canParseV2exPage) {
let location2 = window.win().location
if (location2.pathname === '/') {
window.win().pageType = 'home'
} else if (location2.href.match(/.com\/?tab=/)) {
window.win().pageType = 'home'
} else if (location2.href.match(/.com\/go\//)) {
window.win().pageType = 'nodePage'
} else if (location2.href.match(/.com\/recent/)) {
window.win().pageType = 'recent'
} else {
let r = location2.href.match(/.com\/t\/([\d]+)/)
if (r) {
window.win().pageType = 'post'
window.win().pageData.id = r[1]
if (location2.search) {
let pr = location2.href.match(/\?p=([\d]+)/)
if (pr) window.win().pageData.pageNo = Number(pr[1])
}
}
}
window.win().isNight = $('.Night').length === 1
let top2 = window.win().query('.tools .top:nth-child(2)').text
if (top2 !== '注册(不可用)') {
window.win().user = {
username: top2,
avatar: $('#Rightbar .box .avatar', window.win().doc).attr('src')
}
}
window.win().cb = null
window.win().vueCb = null
window.win().postList = []
let $section = document.createElement('section')
$section.id = 'app'
window.win().$adListEl = document.createElement('section')
window.win().$adListEl.id = 'ad_list'
window.win().$adListEl.style.position = 'fixed'
window.win().$adListEl.style.left = '-100vw'
window.win().$adListEl.style.top = '0'
window.win().doc.body.append(window.win().$adListEl)
let wrapper
let box
let list
let res
switch (window.win().pageType) {
case 'nodePage':
box = $('#Wrapper #Main .box:first')
box.css({'box-shadow': 'unset'})
let topics = $('#TopicsNode')
topics.attr('id', 'app')
list = topics.children()
res = window.parse.parsePagePostList(Array.from(list))
window.win().postList = res.postList
window.parse.fetchAll(res.apiList).then(async r => {
await cbChecker({type: 'list', value: r})
})
break
case 'recent':
case 'home':
box = window.win().query('#Wrapper #Main .box')
box.style.boxShadow = 'unset'
wrapper = box.querySelector('.item')
wrapper.before($section)
let arr = Array.from(box.children)
let start = arr.findIndex(v => v.classList.contains('item'))
list = arr.slice(start, arr.length - 1)
res = window.parse.parsePagePostList(list)
window.win().postList = res.postList
window.parse.fetchAll(res.apiList).then(async r => {
await cbChecker({type: 'list', value: r})
})
break
case 'post':
box = window.win().query('#Wrapper #Main .box')
box.after($section)
window.parse.parsePostContent(
{id: window.win().pageData.id},
$(window.win().doc.body),
window.win().doc.documentElement.outerHTML
).then(async res => {
// console.log('详情页-基本信息解析完成', new Date())
window.win().pageData.post = res
await cbChecker({type: 'postContent', value: res}, 0)
})
window.parse.getPostAllReplies(
{id: window.win().pageData.id},
$(window.win().doc.body),
window.win().doc.documentElement.outerHTML,
window.win().pageData.pageNo
).then(async res => {
// console.log('详情页-回复解析完成', new Date())
window.win().pageData.post = Object.assign(window.win().pageData.post, res)
await cbChecker({type: 'postReplies', value: res}, 0)
})
break
default:
console.error('未知页面')
break
}
}
})();