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:8607,currentPage:1,targetPage:1,total:17,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:115265,num:0,uid:18111,content:'',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 13:00:16',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115266,num:1,uid:6607,content:'差点看成**脚本 \u003Cimg src\u003D\"https://i.imgur.com/NIvxivj.png\"\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:09:34',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115267,num:2,uid:18178,content:'我以为 op 故意写反的...',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:14:50',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115268,num:3,uid:12420,content:'**吗?前端 js ,后端 powershell+everthing host',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:21:17',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115269,num:4,uid:796,content:'用 nodejs 爬过几千张,我还本地转码成 **if 格式 300MB 存 3000 张图',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:23:12',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115270,num:5,uid:2838,content:'这玩意看多了没意思',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:26:10',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115271,num:6,uid:19095,content:'PC 端按键精灵调大漠插件,后来嫌弃按键精灵有广告,用 c#调用大漠插件写过东西。\u003Cbr\u003E自用就直接按键精灵,抓图处理图片啥的方便。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:37:16',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115272,num:7,uid:3106,content:'\u003Cimg src\u003D\"https://i.imgur.com/VUWFktU.png\"\u003E 看错的到这里集合',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:40:23',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115273,num:8,uid:18127,content:'opencv',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:42:34',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115274,num:9,uid:13538,content:'有**脚本不,我有个朋友想要🤤',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:46:24',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115275,num:10,uid:18710,content:'有个很牛逼的软件叫 tdl ,可以下载 TG 的个各频道的图,然后我做了一个脚本,定时下载,刷新到一个目录里面,桌面壁纸源设置为这个目录,每半小时更新一次。。。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 16:03:23',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115276,num:11,uid:16939,content:'我每学一个新编程语言,练手项目都是写 pixiv 和 Twitter 的**脚本,python 、j**a 、go 、rust 都写过',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:32:29',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115277,num:12,uid:19096,content:'是图色大哥们',ipRegion:'',updatedByUid:0,createdAt:'2025-04-18 08:47:00',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115278,num:13,uid:6607,content:'https://github.com/liesauer/TeleMediaSpider',ipRegion:'',updatedByUid:0,createdAt:'2025-04-18 09:52:54',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115279,num:14,uid:2936,content:'python\u003Cbr\u003E之前玩天龙八部 3d(gm 后台 无限元宝的),嫌刷侠客太麻烦了。(充值 各种点击,正常人不连续 24 小时都刷不满)\u003Cbr\u003E1. 裁剪\u0026#34;取消\u0026#34; \u0026#34;确定\u0026#34;等按钮图片出来(因为有些按钮位置不固定)\u003Cbr\u003E2. 用 adb 获取截屏,通过小图,找到位置。\u003Cbr\u003E\u003Cbr\u003E19 年用过一个好像叫啥精灵的,截图按钮,设置好顺序就行,操作简单。\u003Cbr\u003E还刷过王者荣耀冒险模式的金币。\u003Cbr\u003E\u003Cbr\u003E实现复杂点的,得靠目标检测,比如:yolo',ipRegion:'',updatedByUid:0,createdAt:'2025-04-18 09:57:19',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115280,num:15,uid:336,content:'直接硬写,屏幕截图,然后图像模版匹配拿坐标',ipRegion:'',updatedByUid:0,createdAt:'2025-04-18 11:40:20',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115281,num:16,uid:19097,content:'难顶,我以为可以进来找点宝藏脚本,可能是我 lu 多了,老眼昏花,罪过。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-18 16:35:03',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[13538,{uid:13538,url:'/u/1b005e5d6a045d7465695e6f4e2e602d',avatar:'/a/1b005e5d6a045d7465695e6f4e2e602d',username:'jbgz🤖',}],[19097,{uid:19097,url:'/u/221b55086a045d7e6063516f35080125',avatar:'/a/221b55086a045d7e6063516f35080125',username:'madou🤖',}],[2936,{uid:2936,url:'/u/297c432f6a045c756969506f321e3902',avatar:'/a/297c432f6a045c756969506f321e3902',username:'lyxxxh2🤖',}],[3106,{uid:3106,url:'/u/3028632a6a045c74616a506f245d0202',avatar:'/a/3028632a6a045c74616a506f245d0202',username:'tomatocici2333🤖',}],[18111,{uid:18111,url:'/u/692c02596a045d7f616b576f3e0c370e',avatar:'/a/692c02596a045d7f616b576f3e0c370e',username:'sakuraCp🤖',}],[18710,{uid:18710,url:'/u/28195b376a045d7f676b566f0e25310f',avatar:'/a/28195b376a045d7f676b566f0e25310f',username:'dwSun🤖',}],[12420,{uid:12420,url:'/u/002367036a045d756468566f2e3f0124',avatar:'/a/002367036a045d756468566f2e3f0124',username:'siweipancc🤖',}],[19096,{uid:19096,url:'/u/6e7e48036a045d7e6063506f340f3e3f',avatar:'/a/6e7e48036a045d7e6063506f340f3e3f',username:'rushaaa🤖',}],[18127,{uid:18127,url:'/u/281f73036a045d7f6168516f1e5a2a29',avatar:'/a/281f73036a045d7f6168516f1e5a2a29',username:'pulutom40🤖',}],[6607,{uid:6607,url:'/u/183c7a016a045c71666a516f3e5b3671',avatar:'/a/183c7a016a045c71666a516f3e5b3671',username:'lisxour🤖',}],[18178,{uid:18178,url:'/u/313a64346a045d7f616d5e6f24191b06',avatar:'/a/313a64346a045d7f616d5e6f24191b06',username:'haikea🤖',}],[336,{uid:336,url:'/u/6f11463d6a045c776369506f060f0224',avatar:'/a/6f11463d6a045c776369506f060f0224',username:'kekeabab🤖',}],[796,{uid:796,url:'/u/0f0c05056a045c776763506f0e282712',avatar:'/a/0f0c05056a045c776763506f0e282712',username:'wangtian2020🤖',}],[16939,{uid:16939,url:'/u/1c24585b6a045d7169695f6f4f066510',avatar:'/a/1c24585b6a045d7169695f6f4f066510',username:'xxcyjjh🤖',}],[2838,{uid:2838,url:'/u/1524653b6a045c7568695e6f3406200e',avatar:'/a/1524653b6a045c7568695e6f3406200e',username:'guchengzhihuan🤖',}],[19095,{uid:19095,url:'/u/0c0b6a096a045d7e6063536f3c311e15',avatar:'/a/0c0b6a096a045d7e6063536f3c311e15',username:'Tamamopoi🤖',}],]),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")