revenge-plugins/copy-role-color/install/index.js
2026-08-01 16:06:41 +00:00

1 line
1.3 KiB
JavaScript

(function(c,l,i,p,s,d,f,y){"use strict";function g(o,a,t,r){try{return t()}catch(e){return r.error(`[${o}] Failed to apply the "${a}" patch, that surface will be skipped: ${e}`),function(){}}}function h(o,a,t){const r=Object.entries(t).map(function([e,n]){return g(o,e,n,a)});return function(){return r.forEach(function(e){return e()})}}function b(){const o=i.findByName("RolePill",!1)??i.findByName("ThemedRolePill",!1);return o?p.after("default",o,function(a,t){try{if(!t?.props?.onPress)return;const r=s.findInReactTree(t,function(n){return n?.props?.roleColor}),e=s.findInReactTree(t,function(n){return n?.props?.style?.[0]?.borderRadius&&typeof n?.props?.style?.[1]?.backgroundColor=="string"&&n.props.style[1].backgroundColor.startsWith("#")})?.props?.style?.[1]?.backgroundColor??r?.props?.roleColor;if(!e)return;t.props.onLongPress=function(){d.clipboard.setString(e),y.showToast("Copied role color to clipboard",f.getAssetIDByName("ic_message_copy"))}}catch{}}):function(){}}let u=function(){};var m={onLoad:function(){u=h("CopyRoleColor",l.logger,{"role pill long-press":b})},onUnload:function(){return u()}};return c.default=m,Object.defineProperty(c,"__esModule",{value:!0}),c})({},vendetta,vendetta.metro,vendetta.patcher,vendetta.utils,vendetta.metro.common,vendetta.ui.assets,vendetta.ui.toasts);