mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-17 02:16:54 +00:00
4.0.0-rc8
* Added: Initial support for chat on Clips. * Fixed: Do not attempt to apply the dark theme to the Twitch Prime landing page. * Fixed: Remove debug logging from Chat on Videos.
This commit is contained in:
parent
ae9aa66799
commit
2297edb051
26 changed files with 962 additions and 34 deletions
89
src/sites/twitch-clips/index.js
Normal file
89
src/sites/twitch-clips/index.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
'use strict';
|
||||
|
||||
// ============================================================================
|
||||
// Site Support: Twitch Clips
|
||||
// ============================================================================
|
||||
|
||||
import BaseSite from '../base';
|
||||
|
||||
import WebMunch from 'utilities/compat/webmunch';
|
||||
import Fine from 'utilities/compat/fine';
|
||||
import Apollo from 'utilities/compat/apollo';
|
||||
|
||||
import {createElement} from 'utilities/dom';
|
||||
|
||||
import MAIN_URL from 'site/styles/main.scss';
|
||||
|
||||
import Switchboard from './switchboard';
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// The Site
|
||||
// ============================================================================
|
||||
|
||||
export default class Clippy extends BaseSite {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
this.inject(WebMunch);
|
||||
this.inject(Fine);
|
||||
this.inject(Apollo, false);
|
||||
|
||||
this.inject(Switchboard);
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
this.populateModules();
|
||||
}
|
||||
|
||||
onEnable() {
|
||||
const thing = this.fine.searchTree(null, n => n.props && n.props.store),
|
||||
store = this.store = thing && thing.props && thing.props.store;
|
||||
|
||||
if ( ! store )
|
||||
return new Promise(r => setTimeout(r, 50)).then(() => this.onEnable());
|
||||
|
||||
// Share Context
|
||||
store.subscribe(() => this.updateContext());
|
||||
this.updateContext();
|
||||
|
||||
this.settings.updateContext({
|
||||
clips: true
|
||||
});
|
||||
|
||||
document.head.appendChild(createElement('link', {
|
||||
href: MAIN_URL,
|
||||
rel: 'stylesheet',
|
||||
type: 'text/css',
|
||||
crossOrigin: 'anonymouse'
|
||||
}));
|
||||
}
|
||||
|
||||
updateContext() {
|
||||
try {
|
||||
const state = this.store.getState(),
|
||||
history = this.router && this.router.history;
|
||||
|
||||
this.settings.updateContext({
|
||||
location: history && history.location,
|
||||
ui: state && state.ui,
|
||||
session: state && state.session
|
||||
});
|
||||
} catch(err) {
|
||||
this.log.error('Error updating context.', err);
|
||||
}
|
||||
}
|
||||
|
||||
getSession() {
|
||||
const state = this.store && this.store.getState();
|
||||
return state && state.session;
|
||||
}
|
||||
|
||||
getUser() {
|
||||
if ( this._user )
|
||||
return this._user;
|
||||
|
||||
const session = this.getSession();
|
||||
return this._user = session && session.user;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue