mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
Improve support for interactive tooltips. Allow chat tokenizers to supply custom delays and interactive flags for their tooltips. Wrap text in <span> elements. Fix bug with stream uptime metadata. Fix bug with fine-router. Add method to EventEmitter that wraps emit in a try/catch. Add lilz to the socket server lineup.
This commit is contained in:
parent
c0320dd3ab
commit
a081247fdc
14 changed files with 168 additions and 40 deletions
|
@ -5,6 +5,7 @@
|
|||
// ============================================================================
|
||||
|
||||
import {createElement as e} from 'utilities/dom';
|
||||
import {has, maybe_call} from 'utilities/object';
|
||||
|
||||
import Tooltip from 'utilities/tooltip';
|
||||
import Module from 'utilities/module';
|
||||
|
@ -65,14 +66,47 @@ export default class TooltipProvider extends Module {
|
|||
onEnable() {
|
||||
this.tips = new Tooltip('[data-reactroot]', 'ffz-tooltip', {
|
||||
html: true,
|
||||
delayHide: this.checkDelayHide.bind(this),
|
||||
delayShow: this.checkDelayShow.bind(this),
|
||||
content: this.process.bind(this),
|
||||
interactive: this.checkInteractive.bind(this),
|
||||
popper: {
|
||||
placement: 'top'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
process(target, tip) { //eslint-disable-line class-methods-use-this
|
||||
checkDelayShow(target, tip) {
|
||||
const type = target.dataset.tooltipType,
|
||||
handler = this.types[type];
|
||||
|
||||
if ( has(handler, 'delayShow') )
|
||||
return maybe_call(handler.delayShow, null, target, tip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
checkDelayHide(target, tip) {
|
||||
const type = target.dataset.tooltipType,
|
||||
handler = this.types[type];
|
||||
|
||||
if ( has(handler, 'delayHide') )
|
||||
return maybe_call(handler.delayHide, null, target, tip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
checkInteractive(target, tip) {
|
||||
const type = target.dataset.tooltipType,
|
||||
handler = this.types[type];
|
||||
|
||||
if ( has(handler, 'interactive') )
|
||||
return maybe_call(handler.interactive, null, target, tip);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
process(target, tip) {
|
||||
const type = target.dataset.tooltipType,
|
||||
handler = this.types[type];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue