diff --git a/Chat-Bubbles/index.js b/Chat-Bubbles/index.js index 62e058a..f63716b 100644 --- a/Chat-Bubbles/index.js +++ b/Chat-Bubbles/index.js @@ -1,25 +1 @@ -(function(n,l,c,t,h){"use strict";const o={avatarRadius:12,bubbleChatRadius:12,bubbleChatColor:""},C=function(){return{...o,...l.storage}},u=function(e){Object.assign(l.storage,e)};let s=[];const a=function(){const e=C(),{avatarRadius:b,bubbleChatRadius:r,bubbleChatColor:m}=e,d=document.createElement("style");d.id="chat-bubbles-style";const p=m||"var(--background-tertiary)";d.textContent=` - /* Chat message styling */ - .message_d5deea { - background-color: ${p}; - border-radius: ${r}px; - padding: 8px 12px; - margin: 2px 0; - max-width: 80%; - } - - /* Avatar styling */ - .avatar_f8541f { - border-radius: ${b}px !important; - } - - /* Message content adjustments */ - .contents_f9f2ca { - background: transparent; - } - - /* Message group styling */ - .groupStart_d5deea { - margin-top: 8px; - } - `;const i=document.getElementById("chat-bubbles-style");i&&i.remove(),document.head.appendChild(d)},f=function(){const e=document.getElementById("chat-bubbles-style");e&&e.remove()};var g={onLoad:function(){try{a();const e=c.findByProps("Message","MessageContent");e&&s.push(h.after("type",e,function(b,r){return setTimeout(a,100),r})),t.showToast("ChatBubbles loaded successfully!",t.showToast.Kind.SUCCESS)}catch(e){console.error("Failed to load ChatBubbles:",e),t.showToast("Failed to load ChatBubbles plugin",t.showToast.Kind.FAILURE)}},onUnload:function(){try{s.forEach(function(e){return e()}),s=[],f(),t.showToast("ChatBubbles unloaded",t.showToast.Kind.SUCCESS)}catch(e){console.error("Failed to unload ChatBubbles:",e)}},settings:{avatarRadius:{type:"slider",title:"Avatar Curve",note:"Adjust the border radius of avatars",default:o.avatarRadius,min:0,max:18,step:3,onValueChange:function(e){u({avatarRadius:e}),a()}},bubbleChatRadius:{type:"slider",title:"Bubble Curve",note:"Adjust the border radius of chat bubbles",default:o.bubbleChatRadius,min:0,max:18,step:3,onValueChange:function(e){u({bubbleChatRadius:e}),a()}},bubbleChatColor:{type:"text",title:"Bubble Color",note:"The color of the chat bubble (in #RRGGBBAA format). When empty, default background is used.",default:o.bubbleChatColor,placeholder:"#RRGGBBAA",onValueChange:function(e){e===""||/^#[0-9A-Fa-f]{8}$/.test(e)?(u({bubbleChatColor:e}),a()):t.showToast("Invalid color format! Use #RRGGBBAA",t.showToast.Kind.FAILURE)}}}};return n.default=g,Object.defineProperty(n,"__esModule",{value:!0}),n})({},vendetta.plugin,vendetta.metro,vendetta.ui.toasts,vendetta.patcher); +(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); diff --git a/Chat-Bubbles/manifest.json b/Chat-Bubbles/manifest.json index b9665c9..1896576 100644 --- a/Chat-Bubbles/manifest.json +++ b/Chat-Bubbles/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","name":"Chat Bubbles","description":"Make the messages be in... bubbles...?","vendetta":{"icon":"ChatIcon","original":"plugins/Chat-Bubbles"},"version":"1.0.0","hash":"c346cfc7bf7d5d6f94b25974baad8334aca7f3e5d04c2824d0eebc772f8e1910"} \ No newline at end of file +{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","name":"Chat Bubbles","description":"Make the messages be in... bubbles...?","vendetta":{"icon":"ChatIcon","original":"plugins/Chat-Bubbles"},"version":"1.0.0","hash":"f946ab24c8cc6f961c0cbf868e3459fe914ca7f2d81b11cfa1fdf7ea91b20bf5"} \ No newline at end of file