upd: play animated MFM button

This commit is contained in:
Mar0xy 2023-11-06 00:26:23 +01:00
parent 5698a0e0fb
commit 2dfd8b2842
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
6 changed files with 93 additions and 4 deletions

View file

@ -0,0 +1,29 @@
import * as mfm from 'mfm-js';
export function checkAnimationFromMfm(nodes: mfm.MfmNode[]): boolean {
const animatedNodes = mfm.extract(nodes, (node) => {
if (node.type === 'fn') {
if (node.props.name === 'tada' ||
node.props.name === 'jelly' ||
node.props.name === 'twitch' ||
node.props.name === 'shake' ||
node.props.name === 'spin' ||
node.props.name === 'jump' ||
node.props.name === 'bounce' ||
node.props.name === 'rainbow' ||
node.props.name === 'sparkle') {
return true;
} else {
return false;
}
} else {
return false;
}
});
if (animatedNodes.length > 0) {
return true;
} else {
return false;
}
}