2017-11-15 14:04:59 -05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Chat Settings Menu
|
|
|
|
// ============================================================================
|
|
|
|
|
2018-03-14 13:58:04 -04:00
|
|
|
import Twilight from 'site';
|
2017-11-15 14:04:59 -05:00
|
|
|
import Module from 'utilities/module';
|
|
|
|
|
|
|
|
export default class SettingsMenu extends Module {
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
|
|
|
|
|
this.inject('settings');
|
|
|
|
this.inject('i18n');
|
|
|
|
this.inject('chat');
|
|
|
|
this.inject('site.fine');
|
|
|
|
this.inject('site.web_munch');
|
|
|
|
|
|
|
|
this.SettingsMenu = this.fine.define(
|
|
|
|
'chat-settings',
|
2018-03-14 13:58:04 -04:00
|
|
|
n => n.renderUniversalOptions && n.dismissRaidsTooltip,
|
|
|
|
Twilight.CHAT_ROUTES
|
2017-11-15 14:04:59 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
onEnable() {
|
|
|
|
this.on('i18n:update', () => this.SettingsMenu.forceUpdate());
|
|
|
|
|
|
|
|
const t = this,
|
|
|
|
React = this.web_munch.getModule('react');
|
|
|
|
if ( ! React )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const e = React.createElement;
|
|
|
|
|
2017-11-22 15:39:38 -05:00
|
|
|
this.SettingsMenu.ready(cls => {
|
2017-11-15 14:04:59 -05:00
|
|
|
const old_universal = cls.prototype.renderUniversalOptions;
|
|
|
|
|
|
|
|
cls.prototype.renderUniversalOptions = function() {
|
|
|
|
const val = old_universal.call(this);
|
|
|
|
val.props.children.push(e('div', {
|
2017-12-13 17:35:20 -05:00
|
|
|
className: 'tw-mg-t-1'
|
2017-11-15 14:04:59 -05:00
|
|
|
}, e('button', {
|
|
|
|
onClick: () => t.click(this)
|
|
|
|
}, t.i18n.t('site.menu_button', 'FrankerFaceZ Control Center'))
|
|
|
|
));
|
|
|
|
|
|
|
|
window.menu = this;
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.SettingsMenu.forceUpdate();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
click(inst) {
|
2018-03-11 14:04:55 -04:00
|
|
|
this.emit('site.menu_button:clicked');
|
2017-11-15 14:04:59 -05:00
|
|
|
const parent = this.fine.searchParent(inst, n => n.toggleBalloonId);
|
|
|
|
parent && parent.handleButtonClick();
|
|
|
|
}
|
|
|
|
}
|