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:7831,currentPage:1,targetPage:1,total:20,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:17,url:'/t/327878556a045c76677716150f0d',name:'Apple',color:'#66BB6A',icon:'mdi-apple',},],posts:[{id:100379,num:0,uid:13629,content:'\u003Cp\u003E系统版本: Macos Sequoia 15.4问题: 这两天忽然小键盘 Enter 键在任何其他 app 中只要按下 enter 键就自动打开 apple music 并播放.(可能是小孩子乱敲键盘导致的)\u003C/p\u003E\u003Cp\u003E排查: 设置--键盘--键盘快捷键 中没有看到有该设置.\u003C/p\u003E\u003Cp\u003E用 gpt 排查了一遍也没找到原因,实在没办法了, 求救! xdm.\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:08:09',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100380,num:1,uid:13629,content:'补充: telegram 正在播放的音频时在其他 app 按下 enter 键会暂停 telegram 音频(不会唤醒 apple music)',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:12:05',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100381,num:2,uid:5789,content:'macOS 上的 Apple music 是有点神叨叨的,经常暂停合盖后打开,提示要停止其它设备的播放',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:34:55',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100382,num:3,uid:13629,content:'我这个应该是音频播放/暂停 热键被劫持到 enter 键了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:37:55',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100383,num:4,uid:704,content:'把右上角的程序挨个关一下试试',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:38:57',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100384,num:5,uid:13629,content:'重启了, 就开了 chrome.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-09 23:48:20',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100385,num:6,uid:1138,content:'自带键盘吗?把什么 nvram 之类的都重置一遍\u003Cbr\u003E\u003Cbr\u003E不是自带键盘的话,有那种看 keycode 的网页,在上面敲一敲看看\u003Cbr\u003E\u003Cbr\u003E高级点儿的机械键盘的话 还可以去那些刷固件的网页尝试 会有更底层的反馈',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 00:00:47',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100386,num:7,uid:13629,content:'不是自带的, mac mini m2 pro 配的之前 win 用剩下的 rapoo v500 pro 键盘,大概率不是键盘的问题.\u003Cbr\u003E暂时我是先用 hidutil 禁用了: \u003Cbr\u003Ehidutil property --set \u0026#39;{\u0026#34;UserKeyMapping\u0026#34;:[{\u0026#34;HIDKeyboardModifierMappingSrc\u0026#34;:0x700000058,\u0026#34;HIDKeyboardModifierMappingDst\u0026#34;:0x7000000E7}]}\u0026#39;',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 00:06:25',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100387,num:8,uid:13629,content:'hidutil property --set \u0026#39;{\u0026#34;UserKeyMapping\u0026#34;:[{\u0026#34;HIDKeyboardModifierMappingSrc\u0026#34;:0x700000058,\u0026#34;HIDKeyboardModifierMappingDst\u0026#34;:0x700000028}]}\u0026#39;\u003Cbr\u003E\u003Cbr\u003E将 小键盘 Enter ( 0x58 )映射为普通 Enter ( 0x28 ),macOS 依然触发了音频播放行为, 真的是会谢',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 00:09:34',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100388,num:9,uid:1138,content:'新建个用户切过去试试看\u003Cbr\u003E如果是硬件问题(或者系统问题),新用户应该也同样会触发',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 00:30:24',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100389,num:10,uid:13629,content:'新用户也触发了.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 00:57:03',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100390,num:11,uid:1138,content:'笑死,\u003Cbr\u003E让我想起了我小时候玩我哥手机,一通设置,之后也改不回来了🤣',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 09:14:18',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100391,num:12,uid:9531,content:'这种情况我在 windows 上遇到过类似的,就是我家小孩在键盘上一通乱按,最后键盘功能全乱了,按了之后莫名其妙打开各种程序,我还不知道怎么改回来,只能重启电脑。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 09:29:00',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100392,num:13,uid:16048,content:'有喜感的帖子',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 13:00:01',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100393,num:14,uid:976,content:'看上去就是被映射到了苹果键盘的播放 function 键 即 F8 对应的位置…',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 13:10:52',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100394,num:15,uid:13629,content:'\u003Cbr\u003E是的, 但是 enter 键本身换行功能也还在.\u003Cbr\u003E目前找到一个方案暂时解决吧, 用 karabiner-elements 添加一个规则 : \u003Cbr\u003E\u003Cbr\u003E{\u003Cbr\u003E \u0026#34;title\u0026#34;: \u0026#34;Prevent Keypad Enter from triggering Play/Pause\u0026#34;,\u003Cbr\u003E \u0026#34;rules\u0026#34;: [\u003Cbr\u003E {\u003Cbr\u003E \u0026#34;description\u0026#34;: \u0026#34;Block play_or_pause caused by keypad_enter\u0026#34;,\u003Cbr\u003E \u0026#34;manipulators\u0026#34;: [\u003Cbr\u003E {\u003Cbr\u003E \u0026#34;type\u0026#34;: \u0026#34;basic\u0026#34;,\u003Cbr\u003E \u0026#34;from\u0026#34;: {\u003Cbr\u003E \u0026#34;consumer_key_code\u0026#34;: \u0026#34;play_or_pause\u0026#34;\u003Cbr\u003E },\u003Cbr\u003E \u0026#34;conditions\u0026#34;: [\u003Cbr\u003E {\u003Cbr\u003E \u0026#34;type\u0026#34;: \u0026#34;device_if\u0026#34;,\u003Cbr\u003E \u0026#34;identifiers\u0026#34;: [\u003Cbr\u003E {\u003Cbr\u003E \u0026#34;vendor_id\u0026#34;: 666,\u003Cbr\u003E \u0026#34;product_id\u0026#34;: 888\u003Cbr\u003E }\u003Cbr\u003E ]\u003Cbr\u003E }\u003Cbr\u003E ],\u003Cbr\u003E \u0026#34;to\u0026#34;: []\u003Cbr\u003E }\u003Cbr\u003E ]\u003Cbr\u003E }\u003Cbr\u003E ]\u003Cbr\u003E}',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 14:16:39',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100395,num:16,uid:13629,content:' \u003Cbr\u003E \u003Cbr\u003E\u003Cbr\u003Ethx all',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 14:24:59',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100396,num:17,uid:6891,content:'确认下键盘其他按键有没有按压,会不会触发组合键了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 17:04:10',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100397,num:18,uid:2814,content:'应该是硬件问题,可能是电路板上某两个点意外相连了,可能是灰尘或氧化等原因,导致你每次按下 enter 时,会同时连通媒体播放键的电路。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 18:29:22',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:100398,num:19,uid:13629,content:'确定没有\u003Cbr\u003E用了很久,这个可能性很高啊.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 21:08:28',updatedAt:'2025-04-11 17:47:55',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[5789,{uid:5789,url:'/u/6819613e6a045c7267625f6f1a51051d',avatar:'/a/6819613e6a045c7267625f6f1a51051d',username:'xuangoer666🤖',}],[6891,{uid:6891,url:'/u/307b5e5c6a045c716863576f140c3022',avatar:'/a/307b5e5c6a045c716863576f140c3022',username:'Maipol🤖',}],[976,{uid:976,url:'/u/22705d056a045c77696d506f2d1c3000',avatar:'/a/22705d056a045c77696d506f2d1c3000',username:'MacsedProtoss🤖',}],[1138,{uid:1138,url:'/u/032577226a045c7661695e6f020a1720',avatar:'/a/032577226a045c7661695e6f020a1720',username:'ETiV🤖',}],[704,{uid:704,url:'/u/3f05545c6a045c77676a526f263c3723',avatar:'/a/3f05545c6a045c77676a526f263c3723',username:'Yuanlaoer🤖',}],[16048,{uid:16048,url:'/u/0023603e6a045d71606e5e6f072a6572',avatar:'/a/0023603e6a045d71606e5e6f072a6572',username:'sinotw🤖',}],[2814,{uid:2814,url:'/u/152a5a066a045c75686b526f3e3d0b03',avatar:'/a/152a5a066a045c75686b526f3e3d0b03',username:'lonely701🤖',}],[13629,{uid:13629,url:'/u/287861176a045d7466685f6f3c38150c',avatar:'/a/287861176a045d7466685f6f3c38150c',username:'wqsdfdddd🤖',}],[9531,{uid:9531,url:'/u/692e755a6a045c7e6569576f433d3274',avatar:'/a/692e755a6a045c7e6569576f433d3274',username:'peasant🤖',}],]),related:[{title:'mac mini m4 32G 扩容到 2T,能当黑奴部署 sd 或 flux 么',url:'/d/203e71236a045c77606a567a445c616a03040937',},{title:'pdd macmini 2979 了,忍不住还是下单了',url:'/d/293a610b6a045c77606a567a4458606a1b706767',},{title:'求 macOS 好用的录音软件,关键录微信通话和电话, wiretap 下架了。无论软件启动顺序总是能录下才是王。。。',url:'/d/120c45386a045c77606a567a455e616a07341262',},{title:'Spotlight 图标竟然穿模了, macOS 15 越来越不苹果了',url:'/d/0c0a54216a045c77606a567a455c676a38082b3d',},{title:'MacOS 15.4 休眠 Bug:休眠后以太网会断开连接, Wi-Fi 不会',url:'/d/360a785e6a045c77606a567a465a646a2b2f6b2b',},{title:'mac mini pro 64 和 mac studio',url:'/d/000443266a045c77606a56754e58626a5e266611',},{title:'刚买的 mba m4,试用 crossover 玩玩暗黑 2,黑屏啊',url:'/d/3d7a45266a045c77606a56754f506a6a2f240660',},{title:'京东 19199 买 MBP M4pro 14 核 48G 1T 国家补贴+教育优惠',url:'/d/227a745e6a045c77606a56754f50666a5934253d',},{title:'Macmini M4 是否继续使用。',url:'/d/3b1b540e6a045c77606a56754f5f656a08101d65',},{title:'IOS 18.4 safari 发热严重',url:'/d/121366206a045c77606a5675425c626a0d280366',},{title:'IOS 18.4 中文 intelligence 大家有啥想吐槽的么(非国行机)',url:'/d/380854296a045c77606a5675425a626a34731a2a',},{title:'macos Sequoia 15.4 中 chronod 一直占用 100%+ CPU',url:'/d/3b7c73236a045c77606a56754350646a58202b1f',},{title:'intel 的 mac 远程连接 m 芯片 mac 最佳姿势是什么?',url:'/d/2f08582f6a045c77606a5675435e656a29252322',},{title:'M1 iPad pro 耗电惊人',url:'/d/353b470e6a045c77606a5675435e606a25171411',},{title:'苹果这次 iOS 18.4 只有中国国内更新了 5G-A 吗?',url:'/d/09277c096a045c77606a5675435f656a3d283d1d',},{title:'日经贴:推荐个 mac 下适用的机械键盘',url:'/d/3f3978016a045c77606a5675435f666a030f042a',},{title:'MacBook 的 AC+ 是不是只有意外险的作用,并没有延长保修?',url:'/d/387c475e6a045c77606a5675435c666a272c3f17',},{title:'iPhone 的 Apple Intelligence 需要下载多久?',url:'/d/1b2f48196a045c77606a5675435a636a02731d1e',},{title:'mac mini 放办公室摸鱼怎么样?',url:'/d/68395e0b6a045c77606a56754359646a182a241e',},{title:'macOS 15.4 稳定出现一个大 bug',url:'/d/3b0e5b1b6a045c77606a567544506b6a08112708',},],} 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")