Remove observers

This commit is contained in:
Jiiks 2018-03-11 17:58:09 +02:00
parent 37be465174
commit 5083a80ba2
1 changed files with 0 additions and 68 deletions

View File

@ -41,74 +41,6 @@ class TempApi {
export default class extends EventListener { export default class extends EventListener {
constructor() {
super();
const messageFilter = function (m) {
return m.addedNodes && m.addedNodes.length && m.addedNodes[0].classList && m.addedNodes[0].classList.contains('message-group');
}
DOM.observer.subscribe('loading-more-manip', messageFilter, mutations => {
this.setIds();
this.makeMutable();
Events.emit('ui:laodedmore', mutations.map(m => m.addedNodes[0]));
}, 'filter');
const userFilter = function (m) {
return m.addedNodes && m.addedNodes.length && m.addedNodes[0].classList && m.addedNodes[0].classList.contains('member');
}
DOM.observer.subscribe('loading-more-users-manip', userFilter, mutations => {
this.setUserIds();
Events.emit('ui:loadedmoreusers', mutations.map(m => m.addedNodes[0]));
}, 'filter');
const channelFilter = function(m) {
return m.addedNodes &&
m.addedNodes.length &&
m.addedNodes[0].className &&
m.addedNodes[0].className.includes('container');
}
DOM.observer.subscribe('loading-more-channels-manip', channelFilter, mutations => {
this.setChannelIds();
Events.emit('ui:loadedmorechannels', mutations.map(m => m.addedNodes[0]));
}, 'filter');
const popoutFilter = function(m) {
return m.addedNodes &&
m.addedNodes.length &&
m.addedNodes[0].className &&
m.addedNodes[0].className.includes('popout');
}
DOM.observer.subscribe('userpopout-manip', popoutFilter, mutations => {
const userPopout = document.querySelector('[class*=userPopout]');
if (!userPopout) return;
const user = Reflection(userPopout).prop('user');
if (!user) return;
userPopout.setAttribute('data-user-id', user.id);
if (user.id === TempApi.currentUserId) userPopout.setAttribute('data-currentuser', true);
}, 'filter');
const modalFilter = function(m) {
return m.addedNodes &&
m.addedNodes.length &&
m.addedNodes[0].className &&
m.addedNodes[0].className.includes('modal');
}
DOM.observer.subscribe('modal-manip', modalFilter, mutations => {
const userModal = document.querySelector('[class*=modal] > [class*=inner]');
if (!userModal) return;
const user = Reflection(userModal).prop('user');
if (!user) return;
const modal = userModal.closest('[class*=modal]');
if (!modal) return;
modal.setAttribute('data-user-id', user.id);
if (user.id === TempApi.currentUserId) modal.setAttribute('data-currentuser', true);
});
}
bindings() { bindings() {
this.manipAll = this.manipAll.bind(this); this.manipAll = this.manipAll.bind(this);
this.markupInjector = this.markupInjector.bind(this); this.markupInjector = this.markupInjector.bind(this);