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:1145,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:50,url:'/t/32715a296a045c7260770f713010',name:'图床',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:14366,num:0,uid:5222,content:'\u003Cp\u003E我用的最多的就是**图床,用了大概两年,存的都是一些PPT截图,笔记截图之类的,存了大概有大几百张吧\u003Cbr\u003E然后我有时候又会想,要是**死了咋办(目前他已经活了10年,但是万一呢\u003Cbr\u003E但是公共图床确实方便啊,而且我感觉**比我自建的速度快多了\u003Cbr\u003E\u003Cimg src\u003D\"/z/img/xhj/011.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:35:56',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14367,num:1,uid:5222,content:'\u003Cp\u003E不止十年吧,十多年了\u003Cbr\u003E\u003Cimg src\u003D\"/z/img/xhj/008.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:36:24',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14368,num:2,uid:1998,content:'\u003Cp\u003E阁下陈冠希?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:36:54',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14369,num:3,uid:1741,content:'\u003Cp\u003E死了就再换一个\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:38:10',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14370,num:4,uid:5222,content:'\u003Cp\u003E我是怕图片丢,公共图床都有审核的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:38:20',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14371,num:5,uid:5222,content:'\u003Cp\u003E主要是图片没了,笔记的图链不就死了嘛\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:38:43',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14372,num:6,uid:1572,content:'\u003Cp\u003E哪有不死的网站,一句不运营了就不运营了,之前那个匿名下载网站不也是说没就没\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:38:49',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14373,num:7,uid:5222,content:'\u003Cp\u003E对呀对呀,所以我就想感觉自建可能更稳妥一些\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:39:17',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14374,num:8,uid:1827,content:'\u003Cp\u003E我自用的都每年刪一次,https://cdn.microcharon.com/temp\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:40:14',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14375,num:9,uid:1449,content:'\u003Cp\u003ECF图床不好吗\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:40:16',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:14376,num:10,uid:5223,content:'\u003Cp\u003E你付费也有不安全感啊\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:41:19',updatedAt:'2025-03-12 16:38:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[1827,{uid:1827,url:'/u/2e1e5c276a045c766868516f111d6305',avatar:'/a/2e1e5c276a045c766868516f111d6305',username:'Testcharon🤖',}],[1998,{uid:1998,url:'/u/351e7d3f6a045c7669635e6f44253476',avatar:'/a/351e7d3f6a045c7669635e6f44253476',username:'weaponlive🤖',}],[1741,{uid:1741,url:'/u/081c040c6a045c76676e576f11051206',avatar:'/a/081c040c6a045c76676e576f11051206',username:'鸿星尔克🤖',}],[5223,{uid:5223,url:'/u/333158086a045c726268556f15003c1e',avatar:'/a/333158086a045c726268556f15003c1e',username:'jessegold🤖',}],[1449,{uid:1449,url:'/u/697f545a6a045c76646e5f6f241a3b20',avatar:'/a/697f545a6a045c76646e5f6f241a3b20',username:'cboby🤖',}],[1572,{uid:1572,url:'/u/3b3155016a045c76656d546f11193436',avatar:'/a/3b3155016a045c76656d546f11193436',username:'大古熬成汤🤖',}],[5222,{uid:5222,url:'/u/003b0b2e6a045c726268546f3d330a29',avatar:'/a/003b0b2e6a045c726268546f3d330a29',username:'Aicnal🤖',}],]),related:[{title:'兰空图床马上要涨价了!',url:'/d/2f78602b6a045c77606a567a445d6b6a1d2a3b0a',},{title:'过客图床测试',url:'/d/33105d076a045c77606a5675405a6b6a1a73623e',},{title:'有大佬会minio接入CloudFlare-ImgBed',url:'/d/091e5f206a045c77606a5675405b606a2e39113c',},{title:'大伙为什么做公益图床',url:'/d/092340196a045c77606a56744650626a580a6338',},{title:'love图床 欢迎使用',url:'/d/160274006a045c77606a56774f51626a2e1b071d',},{title:'测一下图床速度',url:'/d/117f772f6a045c77606a56774f5b6b6a3a140460',},{title:'有服务器、网盘、nas、公网IP怎么搞一套最好的图床',url:'/d/340a7e026a045c77606a5677435d666a01316315',},{title:'上次看到有人分享avif的图床,是哪个的?',url:'/d/3d2107556a045c77606a56774658626a140e6420',},{title:'兰空开源版,有办法上传avif吗?',url:'/d/0d0b00176a045c77606a5676465a606a2b7b2907',},{title:'不懂就问 蓝空图床的注册点了之后没反应是怎么回事?',url:'/d/157c0a276a045c77606a56714e58626a3d071d04',},{title:'论坛只能用自建图床发图片吗?',url:'/d/303f642c6a045c77606a56714159626a08022562',},{title:'屌大的来个免费稳定的图床!',url:'/d/1f2277036a045c77606a567145586a6a0f2d6b28',},{title:'自建图床测试NSFW',url:'/d/6e2864386a045c77606a5671475f616a22326a26',},{title:'请教大佬们图床问题',url:'/d/6d70631e6a045c77606a5671475a6a6a3e753131',},{title:'废物利用自建php图床+插件',url:'/d/12185e1e6a045c77606a56704e5e666a2b0e2b38',},{title:'bing出问题了吗?简单图床登录界面抓取bing图片失败',url:'/d/6e394b256a045c77606a5670405a676a010d1507',},{title:'图床半挂?',url:'/d/192e7b226a045c77606a5670445b656a1c090935',},{title:'来花1H自建自己的图床吧',url:'/d/2a2b582a6a045c77606a56704651666a00070733',},{title:'Lsky 公益图床',url:'/d/3e22785c6a045c77606a5673465e666a25313067',},{title:'收个二手蓝空图床正版认证',url:'/d/693941346a045c77606a56724e5e676a5f331825',},],} 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")