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:5709,currentPage:1,targetPage:1,total:5,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:[{id:36,url:'/t/332c78596a045c7466775227135f',name:'Claw',color:'#78909C',icon:'mdi-server-network-outline',},{id:12,url:'/t/287903286a045c76627731243330',name:'甲骨文',color:'#EC407A',icon:'mdi-server-security',},{id:56,url:'/t/290f503a6a045c7266772d013d10',name:'GreenCloud',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:65868,num:0,uid:2106,content:'\u003Cp\u003E收 bage uk 11.11 140收\u003Cbr\u003E收 绿云iij/软银 2c4g 420/400收 原邮收\u003Cbr\u003E收 Akile TWLite-One 免费机 220收\u003Cbr\u003E收 claw hk $10.5半年付 400收\u003Cbr\u003E收 Northhost 法国 0.99/1o鸡 30收\u003Cbr\u003E收 龟壳甲骨文 悉尼 老号arm 原邮 500收\u003Cbr\u003E收 龟壳甲骨文 圣保罗 老号arm 原邮 300收\u003Cbr\u003E收 溢价80收 kuroit年付7刀英国\u003Cbr\u003E收 溢价100收 kuroit年付7欧 2C4G\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-20 22:42:52',updatedAt:'2025-03-21 13:05:06',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:65869,num:1,uid:1422,content:'\u003Cp\u003E好工整啊\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-20 22:44:29',updatedAt:'2025-03-21 13:05:06',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:65870,num:2,uid:1516,content:'\u003Cp\u003E感觉楼主每天都要发,这应该违反了论坛的准则哟,只能顶贴\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-20 23:41:23',updatedAt:'2025-03-21 13:05:06',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:65871,num:3,uid:2106,content:'\u003Cp\u003E 明天开始分开发\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-20 23:49:16',updatedAt:'2025-03-21 13:05:06',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:65872,num:4,uid:1613,content:'\u003Cp\u003Ebd\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 04:40:21',updatedAt:'2025-03-21 13:05:06',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[2106,{uid:2106,url:'/u/0219410c6a045c75616a506f2d20002e',avatar:'/a/0219410c6a045c75616a506f2d20002e',username:'shinian🤖',}],[1422,{uid:1422,url:'/u/682a6b3e6a045c766468546f3c053f3d',avatar:'/a/682a6b3e6a045c766468546f3c053f3d',username:'BlankSpace🤖',}],[1516,{uid:1516,url:'/u/22715b5d6a045c76656b506f300f3525',avatar:'/a/22715b5d6a045c76656b506f300f3525',username:'coldsword🤖',}],[1613,{uid:1613,url:'/u/3c0054356a045c76666b556f3a2f6209',avatar:'/a/3c0054356a045c76666b556f3a2f6209',username:'qqab🤖',}],]),related:[{title:'刚收了台 claw 服务器,该不该把网站从斯巴达迁过去?',url:'/d/312c051e6a045c77606a567a4559636a2f34031e',},{title:'慢出台claw-hk老4🔪,中国优化,ip8.218,5.1到期,无限速过',url:'/d/2f0477146a045c77606a567a4750606a3c072908',},{title:'ClawCloud 的7刀年付sg 移动突然直了',url:'/d/103f44096a045c77606a567a475e616a0b213725',},{title:'用claw免费容器搭建v0哪吒探针,0.05$一天',url:'/d/1820551d6a045c77606a567a475e636a14100962',},{title:'收claw年付12.6刀内存翻倍jp',url:'/d/6b717b3f6a045c77606a56754e50636a1c066135',},{title:'【老乌龟】各位mjj大佬问一下现在3年左右的老龟大概价格是多少?',url:'/d/1d057e146a045c77606a56754e516a6a58300315',},{title:'【已出】出Claw 老4刀 HK',url:'/d/371074226a045c77606a56754e51656a07331863',},{title:'甲骨文升级过的账户邮箱能换吗?',url:'/d/230a635d6a045c77606a56754e51636a28021930',},{title:'秒出:CLAW的2C4G的新加坡主机25.2刀年付',url:'/d/2c2504286a045c77606a56754e5e646a2211661c',},{title:'龟壳ARM DD成WINDOWS11 都能干点啥?',url:'/d/302f40006a045c77606a56754e5f656a1b20633e',},{title:'280收claw hk老4刀翻倍,100原邮出老4刀',url:'/d/2b3c79256a045c77606a56754f58606a59081104',},{title:'【已收】临期Claw SG 5.25/季 or 10.5/半年付',url:'/d/113c76386a045c77606a56754f59616a18052534',},{title:'阿里ecs,阿里轻量,isif,wawo pis claw Yxvm-hyper skystroll 网络横评',url:'/d/020862066a045c77606a5675405f616a0b2c121e',},{title:'(已出)出满月40天,圣何塞甲骨文!',url:'/d/23017a2f6a045c77606a5675405f626a2d251217',},{title:'claw翻倍 Yxvm hyper skystroll 三家网络对比',url:'/d/203956396a045c77606a5675405d6a6a25146022',},{title:'我决定保留我的Claw $4',url:'/d/3d1168196a045c77606a5675405a626a3b0f3164',},{title:'claw和yxvm哪个体验更好? 三网来看',url:'/d/2e257c226a045c77606a567540586a6a151b3020',},{title:'不是还ABC',url:'/d/113e7c3b6a045c77606a5675455b676a05762665',},{title:'Claw代理一直在',url:'/d/3f7941296a045c77606a56754558616a1e732b34',},{title:'出Claw 老4刀,没被限过,每月使用较少,五一到期,120口令包push',url:'/d/3d0e070f6a045c77606a56754651656a27301518',},],} 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")