mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-14 10:00:53 +00:00
Add support for clickable stream metadata. Add helper utility for detecting clicks outside of elements. Add support for manually shown/hidden tooltips, which is used for custom pop-ups.
This commit is contained in:
parent
dfa0c9c88f
commit
e224800fb9
7 changed files with 241 additions and 36 deletions
|
@ -146,4 +146,26 @@ export class ManagedStyle {
|
|||
this._blocks[key] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class ClickOutside {
|
||||
constructor(element, callback) {
|
||||
this.el = element;
|
||||
this.cb = callback;
|
||||
this._fn = this.handleClick.bind(this);
|
||||
document.documentElement.addEventListener('click', this._fn);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if ( this._fn )
|
||||
document.documentElement.removeEventListener('click', this._fn);
|
||||
|
||||
this.cb = this.el = this._fn = null;
|
||||
}
|
||||
|
||||
handleClick(e) {
|
||||
if ( ! this.el.contains(e.target) )
|
||||
this.cb(e);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue