mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-05 18:48:31 +00:00
More fixes for the React 16 update.
This commit is contained in:
parent
0ae6e5021d
commit
eb967e115f
9 changed files with 40 additions and 16 deletions
|
@ -1,5 +1,11 @@
|
|||
<div class="list-header">4.0.0-beta1.5<span>@e5095bc624a4d0c6be15</span> <time datetime="2018-02-22">(2018-02-22)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Further fixes for the React 16 upgrade. Most features should now be working.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">4.0.0-beta1.5<span>@ef163f5d644217193110</span> <time datetime="2018-02-22">(2018-02-22)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Integration for the <code>Emote Menu for Twitch</code> extension.</li>
|
||||
<li>Fixed: React 16 support.</li>
|
||||
<li>Note: Many features are still broken. This is just an initial quick fix.</li>
|
||||
</ul>
|
||||
|
|
|
@ -54,12 +54,12 @@ export default class ChannelBar extends Module {
|
|||
this.ChannelBar.on('update', this.updateChannelBar, this);
|
||||
|
||||
/*this.HostBar.on('mount', inst => {
|
||||
this.log.info('host-mount', inst, this.fine.getHostNode(inst));
|
||||
this.log.info('host-mount', inst, this.fine.getChildNode(inst));
|
||||
});
|
||||
|
||||
this.HostBar.ready((cls, instances) => {
|
||||
for(const inst of instances)
|
||||
this.log.info('host-found', inst, this.fine.getHostNode(inst));
|
||||
this.log.info('host-found', inst, this.fine.getChildNode(inst));
|
||||
})*/
|
||||
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ export default class ChannelBar extends Module {
|
|||
|
||||
|
||||
updateMetadata(inst, keys) {
|
||||
const container = this.fine.getHostNode(inst),
|
||||
const container = this.fine.getChildNode(inst),
|
||||
metabar = container && container.querySelector && container.querySelector('.channel-info-bar__action-container > .tw-flex');
|
||||
|
||||
if ( ! inst._ffz_mounted || ! metabar )
|
||||
|
|
|
@ -526,7 +526,7 @@ export default class ChatHook extends Module {
|
|||
// ========================================================================
|
||||
|
||||
fixPinnedCheer(inst) {
|
||||
const el = this.fine.getHostNode(inst),
|
||||
const el = this.fine.getChildNode(inst),
|
||||
container = el && el.querySelector && el.querySelector('.pinned-cheer__headline'),
|
||||
tc = inst.props.topCheer;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ export default class Scroller extends Module {
|
|||
this._ffz_freeze_visible = true;
|
||||
let el = this._ffz_freeze_indicator;
|
||||
if ( ! el ) {
|
||||
const node = t.fine.getHostNode(this);
|
||||
const node = t.fine.getChildNode(this);
|
||||
if ( ! node )
|
||||
return;
|
||||
|
||||
|
@ -204,7 +204,7 @@ export default class Scroller extends Module {
|
|||
|
||||
|
||||
cls.prototype.ffzEnableFreeze = function() {
|
||||
const node = t.fine.getHostNode(this);
|
||||
const node = t.fine.getChildNode(this);
|
||||
if ( ! node || this.ffz_freeze_enabled )
|
||||
return;
|
||||
|
||||
|
@ -236,7 +236,7 @@ export default class Scroller extends Module {
|
|||
this._ffz_outside = null;
|
||||
}
|
||||
|
||||
const node = t.fine.getHostNode(this);
|
||||
const node = t.fine.getChildNode(this);
|
||||
if ( ! node )
|
||||
return;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ export default class BrowsePopular extends SiteModule {
|
|||
}
|
||||
|
||||
updateChannelCard(inst) {
|
||||
const container = this.fine.getHostNode(inst);
|
||||
const container = this.fine.getChildNode(inst);
|
||||
if (!container) return;
|
||||
|
||||
if (container.classList.contains('ffz-modified-channel-card')) return;
|
||||
|
|
|
@ -332,7 +332,7 @@ export default class Following extends SiteModule {
|
|||
}
|
||||
|
||||
updateChannelCard(inst) {
|
||||
const container = this.fine.getHostNode(inst),
|
||||
const container = this.fine.getChildNode(inst),
|
||||
card = container && container.querySelector && container.querySelector('.tw-card');
|
||||
|
||||
if ( ! card )
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class Game extends SiteModule {
|
|||
}
|
||||
|
||||
updateButtons(inst, update = false) {
|
||||
const container = this.fine.getHostNode(inst);
|
||||
const container = this.fine.getChildNode(inst);
|
||||
if ( inst.props.directoryType !== 'GAMES' || ! container || ! container.querySelector )
|
||||
return;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ export default class Directory extends SiteModule {
|
|||
|
||||
|
||||
updateChannelCard(inst) {
|
||||
const container = this.fine.getHostNode(inst);
|
||||
const container = this.fine.getChildNode(inst);
|
||||
if (!container) return;
|
||||
|
||||
this.updateUptime(inst, 'props.streamNode.viewersCount.createdAt', '.tw-card-img');
|
||||
|
@ -230,7 +230,7 @@ export default class Directory extends SiteModule {
|
|||
|
||||
|
||||
updateUptime(inst, created_path, selector) {
|
||||
const container = this.fine.getHostNode(inst),
|
||||
const container = this.fine.getChildNode(inst),
|
||||
card = container && container.querySelector && container.querySelector(selector),
|
||||
setting = this.settings.get('directory.uptime'),
|
||||
created_at = get(created_path, inst),
|
||||
|
@ -275,7 +275,7 @@ export default class Directory extends SiteModule {
|
|||
|
||||
|
||||
addCardAvatar(inst, created_path, selector, data) {
|
||||
const container = this.fine.getHostNode(inst),
|
||||
const container = this.fine.getChildNode(inst),
|
||||
card = container && container.querySelector && container.querySelector(selector),
|
||||
setting = this.settings.get('directory.show-channel-avatars');
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ export default class Fine extends Module {
|
|||
return instance.return;
|
||||
}
|
||||
|
||||
getHostNode(instance) {
|
||||
getParentNode(instance) {
|
||||
if ( instance._reactInternalFiber )
|
||||
instance = instance._reactInternalFiber;
|
||||
else if ( instance instanceof Node )
|
||||
|
@ -87,6 +87,23 @@ export default class Fine extends Module {
|
|||
instance = instance.parent;
|
||||
}
|
||||
|
||||
getChildNode(instance) {
|
||||
if ( instance._reactInternalFiber )
|
||||
instance = instance._reactInternalFiber;
|
||||
else if ( instance instanceof Node )
|
||||
instance = this.getReactInstance(instance);
|
||||
|
||||
while( instance )
|
||||
if ( instance.stateNode instanceof Node )
|
||||
return instance.stateNode
|
||||
else
|
||||
instance = instance.child;
|
||||
}
|
||||
|
||||
getHostNode(instance) {
|
||||
return this.getChildNode(instance);
|
||||
}
|
||||
|
||||
getParent(instance) {
|
||||
return this.getOwner(instance);
|
||||
}
|
||||
|
@ -424,8 +441,9 @@ export class FineWrapper extends EventEmitter {
|
|||
if ( instances )
|
||||
for(const inst of instances) {
|
||||
// How do we check mounted state for fibers?
|
||||
//if ( inst._reactInternalInstance && inst._reactInternalInstance._renderedComponent )
|
||||
// inst._ffz_mounted = true;
|
||||
if ( this.fine.getChildNode(inst) )
|
||||
inst._ffz_mounted = true;
|
||||
|
||||
_instances.add(inst);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue