mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-17 11:30:54 +00:00
4.9.1
Changed: Chat Room Actions now render beneath the chat input, next to the chat settings button. Fixed: The setting to hide `Latest Videos` from the Following directory breaking many parts of the website. Fixed: Due to the relocated Chat Room Actions, compatibility is improved with certain features of the BetterTTV browser extension.
This commit is contained in:
parent
ae06d67e9f
commit
fe300125c7
4 changed files with 43 additions and 14 deletions
|
@ -40,6 +40,42 @@ export function off(obj, ...args) {
|
|||
}
|
||||
|
||||
|
||||
export function findReactFragment(frag, criteria, depth = 25, current = 0, visited = null) {
|
||||
if ( ! visited )
|
||||
visited = new Set;
|
||||
else if ( visited.has(frag) )
|
||||
return null;
|
||||
|
||||
if ( criteria(frag) )
|
||||
return frag;
|
||||
|
||||
if ( current >= depth )
|
||||
return null;
|
||||
|
||||
visited.add(frag);
|
||||
|
||||
if ( frag && frag.props && Array.isArray(frag.props.children) )
|
||||
for(const child of frag.props.children) {
|
||||
if ( ! child )
|
||||
continue;
|
||||
|
||||
if ( Array.isArray(child) ) {
|
||||
for(const f of child) {
|
||||
const out = findReactFragment(f, criteria, depth, current + 1, visited);
|
||||
if ( out )
|
||||
return out;
|
||||
}
|
||||
} else {
|
||||
const out = findReactFragment(child, criteria, depth, current + 1, visited);
|
||||
if ( out )
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
export function createElement(tag, props, ...children) {
|
||||
const el = document.createElement(tag);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue