add loading more mutation callback
This commit is contained in:
parent
88b46bc359
commit
fdfd0a6454
|
@ -30,6 +30,7 @@ class BetterDiscord {
|
|||
window.bdmodals = Modals;
|
||||
window.bdlogs = Logger;
|
||||
window.emotes = EmoteModule;
|
||||
window.dom = DOM;
|
||||
EmoteModule.observe();
|
||||
DOM.injectStyle(BdCss, 'bdmain');
|
||||
Events.on('global-ready', this.globalReady.bind(this));
|
||||
|
|
|
@ -74,6 +74,16 @@ export default class {
|
|||
const markup = e.element.querySelector('.markup:not(.mutable)');
|
||||
if (markup) this.injectMarkup(markup, this.cloneMarkup(markup), false);
|
||||
});
|
||||
|
||||
const filter = function (mutation) {
|
||||
return mutation.removedNodes && mutation.removedNodes.length && mutation.removedNodes[0].className && mutation.removedNodes[0].className.includes('loading-more');
|
||||
}
|
||||
|
||||
DOM.observer.subscribe('loading-more-manip', filter, mutation => {
|
||||
Events.emit('ui:loadedmore');
|
||||
this.setIds();
|
||||
this.makeMutable();
|
||||
});
|
||||
}
|
||||
|
||||
getEts(node) {
|
||||
|
|
|
@ -37,6 +37,7 @@ class DOMObserver {
|
|||
this.subscribe = this.subscribe.bind(this);
|
||||
this.observerCallback = this.observerCallback.bind(this);
|
||||
this.observer = new MutationObserver(this.observerCallback);
|
||||
this.observe();
|
||||
}
|
||||
|
||||
observerCallback(mutations) {
|
||||
|
|
Loading…
Reference in New Issue