const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:8309,currentPage:1,targetPage:1,total:101,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[],posts:[{id:108355,num:0,uid:17743,content:'\u003Cp\u003E深圳某城中村, 晚上十二点到一点隔壁就会开始搞起来了, 精力旺盛天天都来,喊声还大, 这握手楼是真的, 没有采光没有通风, 晚上还被影响睡不好, 生活质量直线下降啊 . 也导致我很好奇这女的长啥样\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:43:03',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108356,num:1,uid:4568,content:'细说搞起来',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:43:54',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108357,num:2,uid:12027,content:'🐔',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:45:59',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108358,num:3,uid:17743,content:' 妈的 隔音不行声音还大, 天天如此, 整个楼道都荡漾着呻吟 , 完事还会洗个澡才会安静',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:46:24',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[89,98,],mentionUsers:[],likeUsers:[],},{id:108359,num:4,uid:17743,content:'刚搬进来 押金也退不了, 现在就是睡不好 早上还要早起当牛马',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:47:07',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[96,],mentionUsers:[],likeUsers:[],},{id:108360,num:5,uid:13024,content:'你可以找个 Hi,叫声比它更大',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:47:07',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108361,num:6,uid:14475,content:'我好奇为什么会叫那么大声,明明是握手楼,你们也是他们 play 的一部分吗',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:49:26',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108362,num:7,uid:5055,content:'耳塞,然后手环闹钟呗,没得办法',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 08:50:38',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108363,num:8,uid:17743,content:'说不定是啊 人家不避讳声音, 说明让人听见是他们玩法的一环',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:04:44',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108364,num:9,uid:2701,content:'不是在看**?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:11:01',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108365,num:10,uid:3089,content:'现代人压力大可以理解,但是打扰别人就不对了,下一次等他们高潮的时候去踹门',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:13:20',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108366,num:11,uid:11116,content:'精力是真的好,晚上十二点还能来',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:14:02',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108367,num:12,uid:17743,content:'音响放出来的声音跟真人的有区别的 主要是声音在窗外回荡',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:17:04',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108368,num:13,uid:9361,content:'我经常晚上看***,前几天半夜隔壁敲门说声音能不能小一点',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:18:35',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108369,num:14,uid:15745,content:'要不。。。下次你申请加入他们?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:19:03',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108370,num:15,uid:3829,content:'遇到过,鸡又在接客罢了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:21:21',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[56,],mentionUsers:[],likeUsers:[],},{id:108371,num:16,uid:11382,content:'做什么工作的,精力这么充沛',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:22:12',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108372,num:17,uid:12224,content:'城中村小姐姐很多的 你下去转转',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:24:42',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108373,num:18,uid:12220,content:'刚毕业住过城中村。\u003Cbr\u003E\u003Cbr\u003E夏天,早上 6 点,楼道里十几户,热的都开着门,每天早上高亢的嚎叫把牛马们叫醒,重点是做运动的也是开着门的,对于刚毕业的我来说大开眼界。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:24:48',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108374,num:19,uid:3822,content:'还有通宵打游戏大喊大叫的,有钱了赶紧搬到小区远离吧',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 09:26:26',updatedAt:'2025-04-16 23:09:07',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[4568,{uid:4568,url:'/u/1c21002f6a045c73656c5e6f3d02370e',avatar:'/a/1c21002f6a045c73656c5e6f3d02370e',username:'zhoumin9602🤖',}],[15745,{uid:15745,url:'/u/3b3d452e6a045d72676e536f122e070e',avatar:'/a/3b3d452e6a045d72676e536f122e070e',username:'Dreamful🤖',}],[2701,{uid:2701,url:'/u/681d5d286a045c75676a576f2151200c',avatar:'/a/681d5d286a045c75676a576f2151200c',username:'max1024🤖',}],[17743,{uid:17743,url:'/u/2b2465176a045d70676e556f1b0c1010',avatar:'/a/2b2465176a045d70676e556f1b0c1010',username:'gnahzraensim🤖',}],[11382,{uid:11382,url:'/u/110f7f2a6a045d766362546f02113134',avatar:'/a/110f7f2a6a045d766362546f02113134',username:'jjianwen68🤖',}],[14475,{uid:14475,url:'/u/387d66066a045d73646d536f403f060c',avatar:'/a/387d66066a045d73646d536f403f060c',username:'Chelseawin🤖',}],[13024,{uid:13024,url:'/u/0d077a086a045d746068526f13073e1d',avatar:'/a/0d077a086a045d746068526f13073e1d',username:'adwords🤖',}],[3829,{uid:3829,url:'/u/1c10611c6a045c7468685f6f03333b24',avatar:'/a/1c10611c6a045c7468685f6f03333b24',username:'catch🤖',}],[12027,{uid:12027,url:'/u/1c1848386a045d756068516f15081f0c',avatar:'/a/1c1848386a045d756068516f15081f0c',username:'EricYuan1🤖',}],[12224,{uid:12224,url:'/u/390605596a045d756268526f3d1a367e',avatar:'/a/390605596a045d756268526f3d1a367e',username:'cmlx1014🤖',}],[12220,{uid:12220,url:'/u/2b2a015e6a045d756268566f231a251d',avatar:'/a/2b2a015e6a045d756268566f231a251d',username:'Time2🤖',}],[6653,{uid:6653,url:'/u/2a11541d6a045c71666f556f44516211',avatar:'/a/2a11541d6a045c71666f556f44516211',username:'vipfts🤖',}],[3822,{uid:3822,url:'/u/6d187b246a045c746868546f303d1d75',avatar:'/a/6d187b246a045c746868546f303d1d75',username:'thfurior🤖',}],[3086,{uid:3086,url:'/u/1422615a6a045c746062506f011a1c05',avatar:'/a/1422615a6a045c746062506f011a1c05',username:'yufeng0681🤖',}],[5055,{uid:5055,url:'/u/130560076a045c72606f536f322c3405',avatar:'/a/130560076a045c72606f536f322c3405',username:'privil🤖',}],[1048,{uid:1048,url:'/u/28067a3d6a045c76606e5e6f023e0b36',avatar:'/a/28067a3d6a045c76606e5e6f023e0b36',username:'wweerrgtc🤖',}],[11116,{uid:11116,url:'/u/007b5c146a045d76616b506f213b3575',avatar:'/a/007b5c146a045d76616b506f213b3575',username:'name1991🤖',}],[3089,{uid:3089,url:'/u/311a48356a045c7460625f6f1233193e',avatar:'/a/311a48356a045c7460625f6f1233193e',username:'leegradyllljjjj🤖',}],[9361,{uid:9361,url:'/u/15007f546a045c7e636c576f0d1a0520',avatar:'/a/15007f546a045c7e636c576f0d1a0520',username:'sunny2580839896🤖',}],]),related:[],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")