1 line
2 KiB
JavaScript
1 line
2 KiB
JavaScript
(function(l,h,a,o,f){"use strict";const n={avatarRadius:12,bubbleChatRadius:12,bubbleChatColor:""},p=function(){return{...n,...h.storage}},d=function(e){Object.assign(h.storage,e)};let r=[],b,i;const C=function(){try{b=a.findByName("Message")||a.findByProps("Message"),i=a.findByName("Avatar")||a.findByProps("Avatar")}catch(e){console.warn("Could not find some components:",e)}},u=function(){const e=p(),{avatarRadius:c,bubbleChatRadius:y,bubbleChatColor:R}=e;b&&r.push(f.after("render",b,function(g,t){return t&&t.props&&(t.props.style={...t.props.style,backgroundColor:R||"rgba(0, 0, 0, 0.1)",borderRadius:y,padding:8,margin:4}),t})),i&&r.push(f.after("render",i,function(g,t){return t&&t.props&&t.props.style&&(t.props.style={...t.props.style,borderRadius:c}),t}))},s=function(){r.forEach(function(e){try{e()}catch(c){console.warn("Error removing patch:",c)}}),r=[]};var v={onLoad:function(){try{C(),u(),o.showToast("ChatBubbles loaded successfully!")}catch(e){console.error("Failed to load ChatBubbles:",e),o.showToast("Failed to load ChatBubbles plugin")}},onUnload:function(){try{s(),o.showToast("ChatBubbles unloaded")}catch(e){console.error("Failed to unload ChatBubbles:",e)}},settings:{avatarRadius:{type:"slider",title:"Avatar Curve",note:"Adjust the border radius of avatars",default:n.avatarRadius,min:0,max:18,step:3,onValueChange:function(e){d({avatarRadius:e}),s(),u()}},bubbleChatRadius:{type:"slider",title:"Bubble Curve",note:"Adjust the border radius of chat bubbles",default:n.bubbleChatRadius,min:0,max:18,step:3,onValueChange:function(e){d({bubbleChatRadius:e}),s(),u()}},bubbleChatColor:{type:"text",title:"Bubble Color",note:"The color of the chat bubble (in #RRGGBBAA format). When empty, default background is used.",default:n.bubbleChatColor,placeholder:"#RRGGBBAA",onValueChange:function(e){e===""||/^#[0-9A-Fa-f]{8}$/.test(e)?(d({bubbleChatColor:e}),s(),u()):o.showToast("Invalid color format! Use #RRGGBBAA")}}}};return l.default=v,Object.defineProperty(l,"__esModule",{value:!0}),l})({},vendetta.plugin,vendetta.metro,vendetta.ui.toasts,vendetta.patcher);
|