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:7186,currentPage:1,targetPage:1,total:10,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',},],posts:[{id:90389,num:0,uid:3411,content:'\u003Cp\u003Eip47 hk\u003C/p\u003E\u003Cp\u003E中国优化云服务器 - 2C / 2G / 40G / 1T\u003Cbr\u003ECPU\u003Cbr\u003E2 vCPU\u003Cbr\u003E内存\u003Cbr\u003E2 GiB\u003Cbr\u003E存储\u003Cbr\u003E40 GiB\u003Cbr\u003E带宽\u003Cbr\u003E1000 Mbps\u003Cbr\u003E流量\u003Cbr\u003E1000 GB (已用 2.4 GB)\u003C/p\u003E\u003Cp\u003E重置流量\u003Cbr\u003E流量重置日期\u003Cbr\u003E2025-04-01 00:00:00\u003C/p\u003E\u003Cp\u003E状态\u003Cbr\u003E可用\u003Cbr\u003E付款方式\u003Cbr\u003EAlipay (支付宝)\u003Cbr\u003E首期付款金额\u003Cbr\u003E$4.00 USD\u003Cbr\u003E循环出账金额\u003Cbr\u003E$4.00 USD\u003Cbr\u003E注册日期\u003Cbr\u003E2024-09-29\u003Cbr\u003E下次到期日\u003Cbr\u003E2025-05-01\u003Cbr\u003E出账周期\u003Cbr\u003E月缴\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:49:24',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90390,num:1,uid:3123,content:'\u003Cp\u003EBD\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:52:48',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90391,num:2,uid:3411,content:'\u003Cp\u003E顶\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:54:31',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90392,num:3,uid:3411,content:'\u003Cp\u003E\u003Cimg src\u003D\"/z/img/xhj/010.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 00:05:43',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90393,num:4,uid:3411,content:'\u003Cp\u003E\u003Cimg src\u003D\"/z/img/xhj/003.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 00:19:11',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90394,num:5,uid:1707,content:'\u003Cp\u003EBD\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 00:24:12',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90395,num:6,uid:11815,content:'\u003Cp\u003E好鸡bd\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 00:42:35',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90396,num:7,uid:10474,content:'\u003Cp\u003E这个是单向的还是双向的?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 07:01:37',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90397,num:8,uid:1878,content:'\u003Cp\u003E好价格,赶紧冲\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 11:29:15',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90398,num:9,uid:14992,content:'\u003Cp\u003Ebd\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-01 11:58:10',updatedAt:'2025-04-01 12:22:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[11815,{uid:11815,url:'/u/0323422c6a045d76686b536f4207301d',avatar:'/a/0323422c6a045d76686b536f4207301d',username:'Nova-c🤖',}],[3411,{uid:3411,url:'/u/0031485d6a045c74646b576f231f6312',avatar:'/a/0031485d6a045c74646b576f231f6312',username:'muzili121🤖',}],[3123,{uid:3123,url:'/u/232b7e1d6a045c746168556f31111630',avatar:'/a/232b7e1d6a045c746168556f31111630',username:'BarkQ🤖',}],[1878,{uid:1878,url:'/u/172476396a045c76686d5e6f0e06170d',avatar:'/a/172476396a045c76686d5e6f0e06170d',username:'史密斯专员🤖',}],[1707,{uid:1707,url:'/u/690355036a045c76676a516f1d0d113e',avatar:'/a/690355036a045c76676a516f1d0d113e',username:'37012🤖',}],[10474,{uid:10474,url:'/u/0d7f47096a045d77646d526f163a372e',avatar:'/a/0d7f47096a045d77646d526f163a372e',username:'clonedpig🤖',}],[14992,{uid:14992,url:'/u/332a430f6a045d736963546f1e082620',avatar:'/a/332a430f6a045d736963546f1e082620',username:'dengmx99🤖',}],]),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:'【已出】出Claw 老4刀 HK',url:'/d/371074226a045c77606a56754e51656a07331863',},{title:'秒出:CLAW的2C4G的新加坡主机25.2刀年付',url:'/d/2c2504286a045c77606a56754e5e646a2211661c',},{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:'claw翻倍 Yxvm hyper skystroll 三家网络对比',url:'/d/203956396a045c77606a5675405d6a6a25146022',},{title:'我决定保留我的Claw $4',url:'/d/3d1168196a045c77606a5675405a626a3b0f3164',},{title:'claw和yxvm哪个体验更好? 三网来看',url:'/d/2e257c226a045c77606a567540586a6a151b3020',},{title:'Claw代理一直在',url:'/d/3f7941296a045c77606a56754558616a1e732b34',},{title:'claw 这个机子谁知道?',url:'/d/0025761d6a045c77606a5675465c616a3f133e35',},{title:'收claw hk8.4季付的',url:'/d/693b74026a045c77606a56754658676a0e11100b',},{title:'[已出] Claw 4$ 香港 VDS 2C2G-1T 中国优化款',url:'/d/1e0200356a045c77606a56754750626a0b02181a',},{title:'120 claw 4U -250428 push',url:'/d/69017e2f6a045c77606a5674405c666a00171d2a',},{title:'Claw这个25.6的和论坛里经常看到的老4刀是一样的吗',url:'/d/367f56246a045c77606a5674405d6b6a55282b20',},{title:'260收一台Claw HK $4翻倍款',url:'/d/6831763f6a045c77606a5674405b646a0e710a64',},],} 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")