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:1069,currentPage:1,targetPage:1,total:57,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:16,url:'/t/1f0163146a045c7666775e773a5d',name:'黑苹果',color:'#66BB6A',icon:'mdi-food-apple-outline',},],posts:[{id:13627,num:0,uid:5116,content:'\u003Cp\u003E请教一下大佬们, 黑苹果( Hackintosh )用什么显卡最合适?感谢🙏\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 02:25:26',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13628,num:1,uid:5117,content:'最高支持 6950 吧(好像需要破解),我用的 5500xt ,直接可以用',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 02:33:41',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13629,num:2,uid:5117,content:'个人建议,找个成色好一点 580 (虽然大概率都是矿卡)',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 02:34:12',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13630,num:3,uid:5118,content:'先学习怎么装黑苹果,再找显卡,amd 系列的,有些支持好,有些不好支持。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 07:14:48',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13631,num:4,uid:5119,content:'https://www.tonymacx86.com/buyersguide/building-a-customac-hackintosh-the-ultimate-buyers-guide/#Graphics_Cards',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:01:57',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13632,num:5,uid:5120,content:'amd rx6600xt',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:25:41',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13633,num:6,uid:5121,content:'我当时用的 AMD580 ,现在已经闲置吃灰了,M 系列太便宜,黑苹果失去性价比',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:26:56',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13634,num:7,uid:2395,content:'现在 mac mini 都这个价格了,没人搞黑苹果了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:35:00',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13635,num:8,uid:2689,content:'RX580',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:38:47',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13636,num:9,uid:1104,content:'如果不是有老机器,没必要黑苹果了,性价比很低。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:41:13',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13637,num:10,uid:5122,content:'出蓝宝石海外版 580',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:43:14',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13638,num:11,uid:5123,content:'哪里买的啊。多少钱啊 感谢',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:51:12',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13639,num:12,uid:3835,content:'10 代 cpu 集成显卡',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:58:10',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13640,num:13,uid:910,content:'用的是 rx590\u003Cbr\u003E周末刚刚把黑苹果格式化了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 08:59:55',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13641,num:14,uid:5123,content:'集成显卡和 rx580 性能差距大吗 感谢',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 09:06:54',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13642,num:15,uid:874,content:'我用的 6800XT ,不过那台黑苹果已经半年没开机了,留作收藏。mac mini 过于便宜,已经黑转白了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 09:15:53',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13643,num:16,uid:4814,content:'黑砖白好多年了,曾经是最离谱的 AU 配 N 卡',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 09:18:14',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13644,num:17,uid:1201,content:'额 m4 mini 也就 3000 多啊,不需要黑了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 09:40:22',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13645,num:18,uid:5124,content:'6 年前自组的 i5-9400F+rx590 跑的 catalina10.15 还很流畅但开机不多了,前两年换 M2 mini 了主用了。 现在这 mini 的价格感觉黑果也一去不返了。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 10:13:07',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:13646,num:19,uid:5125,content:'看用途,对 gpu 要求不高的话,5500xt 够了\u003Cbr\u003E不过现在是真不建议搞黑苹果了,除非是现成的机器',ipRegion:'',updatedByUid:0,createdAt:'2025-03-10 10:16:09',updatedAt:'2025-03-12 13:24:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[5117,{uid:5117,url:'/u/3378645a6a045c72616b516f052a3023',avatar:'/a/3378645a6a045c72616b516f052a3023',username:'cherbium🤖',}],[3835,{uid:3835,url:'/u/29797e356a045c746869536f2d136b05',avatar:'/a/29797e356a045c746869536f2d136b05',username:'zhangshine🤖',}],[1104,{uid:1104,url:'/u/1071500a6a045c76616a526f15246102',avatar:'/a/1071500a6a045c76616a526f15246102',username:'Socrazy🤖',}],[4814,{uid:4814,url:'/u/032d4a216a045c73686b526f25183f37',avatar:'/a/032d4a216a045c73686b526f25183f37',username:'chen1210🤖',}],[5121,{uid:5121,url:'/u/15314a0a6a045c726168576f363c2b29',avatar:'/a/15314a0a6a045c726168576f363c2b29',username:'Mandyer🤖',}],[5122,{uid:5122,url:'/u/313b781c6a045c726168546f31012723',avatar:'/a/313b781c6a045c726168546f31012723',username:'tangjialei00🤖',}],[2689,{uid:2689,url:'/u/342157546a045c7566625f6f0f1f1522',avatar:'/a/342157546a045c7566625f6f0f1f1522',username:'nutting🤖',}],[5124,{uid:5124,url:'/u/6313075f6a045c726168526f203e6175',avatar:'/a/6313075f6a045c726168526f203e6175',username:'allend**is🤖',}],[5123,{uid:5123,url:'/u/0d2778156a045c726168556f3501070b',avatar:'/a/0d2778156a045c726168556f3501070b',username:'cs4forever🤖',}],[5125,{uid:5125,url:'/u/6c1e6a586a045c726168536f2f3e2203',avatar:'/a/6c1e6a586a045c726168536f2f3e2203',username:'sophos🤖',}],[5120,{uid:5120,url:'/u/381a662b6a045c726168566f41056322',avatar:'/a/381a662b6a045c726168566f41056322',username:'zfyStars🤖',}],[5118,{uid:5118,url:'/u/337f48186a045c72616b5e6f4113243d',avatar:'/a/337f48186a045c72616b5e6f4113243d',username:'listenfree🤖',}],[1201,{uid:1201,url:'/u/111c68206a045c76626a576f1f3e372f',avatar:'/a/111c68206a045c76626a576f1f3e372f',username:'kokutou🤖',}],[5116,{uid:5116,url:'/u/223d5d2f6a045c72616b506f1c3b1e20',avatar:'/a/223d5d2f6a045c72616b506f1c3b1e20',username:'Int100🤖',}],[2395,{uid:2395,url:'/u/1c234b0c6a045c756363536f21260204',avatar:'/a/1c234b0c6a045c756363536f21260204',username:'licong🤖',}],[910,{uid:910,url:'/u/290a473b6a045c77696b566f1e5f6013',avatar:'/a/290a473b6a045c77696b566f1e5f6013',username:'huangqihong🤖',}],[874,{uid:874,url:'/u/6e0864216a045c77686d526f2e030611',avatar:'/a/6e0864216a045c77686d526f2e030611',username:'wxw752🤖',}],[5119,{uid:5119,url:'/u/082579286a045c72616b5f6f0225630e',avatar:'/a/082579286a045c72616b5f6f0225630e',username:'aliceclark🤖',}],]),related:[{title:'✨感慨下现在安装黑苹果真简单',url:'/d/2d030a0b6a045c77606a56744f59646a5a3b6019',},],} 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")