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:7152,currentPage:1,targetPage:1,total:11,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:90073,num:0,uid:16143,content:'\u003Cp\u003E\u003Cimg src\u003D\"https://img.n**hub.com/i/2025/03/31/11d5rox.png\" alt\u003D\"image\"\u003E\u003C/p\u003E\u003Cp\u003E都是香港鸡\u003Cbr\u003E这个两个有什么区别?谁知道,为什么下面哪个配置大反而便宜一些?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:00:56',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90074,num:1,uid:1736,content:'\u003Cp\u003E优化?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:01:25',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90075,num:2,uid:5570,content:'\u003Cp\u003E没有优化,延迟很高\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:01:42',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90076,num:3,uid:8530,content:'\u003Cp\u003E47.76 VS 47.79\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:02:05',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90077,num:4,uid:1714,content:'\u003Cp\u003E看起来没优惠,巨吃亏\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:02:28',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90078,num:5,uid:16143,content:'\u003Cp\u003E 老哥的意思是Poping这个没优化?VPS (虚拟专用服务器)这个有优化?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:03:08',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90079,num:6,uid:16143,content:'\u003Cp\u003E 啥意思?老板\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:03:39',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90080,num:7,uid:1672,content:'\u003Cp\u003E没用过,就一个7刀JP\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:04:40',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90081,num:8,uid:8530,content:'\u003Cp\u003E 延迟几十和几百的区别\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:04:46',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90082,num:9,uid:3144,content:'\u003Cp\u003E优化与非优化\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:04:59',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:90083,num:10,uid:2114,content:'\u003Cp\u003E上面是直连线路,下面非直连,网路上的区别\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:06:16',updatedAt:'2025-04-01 12:22:17',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[8530,{uid:8530,url:'/u/002344226a045c7f6569566f071a1909',avatar:'/a/002344226a045c7f6569566f071a1909',username:'ve**ir🤖',}],[16143,{uid:16143,url:'/u/297e75216a045d71616e556f252d0631',avatar:'/a/297e75216a045d71616e556f252d0631',username:'yokeive🤖',}],[1672,{uid:1672,url:'/u/627d7f2a6a045c76666d546f30003231',avatar:'/a/627d7f2a6a045c76666d546f30003231',username:'li62473🤖',}],[1736,{uid:1736,url:'/u/1b0e47266a045c766769506f26072335',avatar:'/a/1b0e47266a045c766769506f26072335',username:'Clare🤖',}],[5570,{uid:5570,url:'/u/202e75286a045c72656d566f052a312f',avatar:'/a/202e75286a045c72656d566f052a312f',username:'Nami🤖',}],[3144,{uid:3144,url:'/u/0f2c5d3f6a045c74616e526f4f3f310c',avatar:'/a/0f2c5d3f6a045c74616e526f4f3f310c',username:'Quan🤖',}],[2114,{uid:2114,url:'/u/0f3b591d6a045c75616b526f41331e0f',avatar:'/a/0f3b591d6a045c75616b526f41331e0f',username:'sasiburi🤖',}],[1714,{uid:1714,url:'/u/3b21473d6a045c76676b526f3d503c13',avatar:'/a/3b21473d6a045c76676b526f3d503c13',username:'南山如雪mi🤖',}],]),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 老4刀,没被限过,每月使用较少,五一到期,120口令包push',url:'/d/3d0e070f6a045c77606a56754651656a27301518',},{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")