mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-01 23:55:58 +09:00
✌️
This commit is contained in:
parent
b55185f236
commit
1817b3e6c3
@ -2,16 +2,12 @@ const riot = require('riot');
|
|||||||
|
|
||||||
riot.mixin('user-preview', {
|
riot.mixin('user-preview', {
|
||||||
init: () => {
|
init: () => {
|
||||||
this.on('mount', () => {
|
const scan = () => {
|
||||||
scan.call(this);
|
|
||||||
});
|
|
||||||
this.on('updated', () => {
|
|
||||||
scan.call(this);
|
|
||||||
});
|
|
||||||
function scan(){
|
|
||||||
this.root.querySelectorAll('[data-user-preview]:not([data-user-preview-attached])')
|
this.root.querySelectorAll('[data-user-preview]:not([data-user-preview-attached])')
|
||||||
.forEach(attach.bind(this));
|
.forEach(attach.bind(this));
|
||||||
}
|
};
|
||||||
|
this.on('mount', scan);
|
||||||
|
this.on('updated', scan);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,12 +55,12 @@ function attach(el) {
|
|||||||
tag = riot.mount(document.body.appendChild(preview), {
|
tag = riot.mount(document.body.appendChild(preview), {
|
||||||
user: user
|
user: user
|
||||||
})[0];
|
})[0];
|
||||||
}
|
};
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
if (tag) {
|
if (tag) {
|
||||||
tag.close();
|
tag.close();
|
||||||
tag = null;
|
tag = null;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user