aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-24 09:26:48 +0300
committerGravatar Vitaly Takmazov2018-10-24 09:30:13 +0300
commitc65346138dff21ac2bb61bfad12f6bcb970c6a1c (patch)
tree1fdaba8571a67d6092c2ca1119ad49e053e7bd02
parentd794d789fbec39c2e1a81629cf539bffab58ed7e (diff)
scripts: fetch users with throttle
-rw-r--r--juick-server/src/main/assets/scripts.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/juick-server/src/main/assets/scripts.js b/juick-server/src/main/assets/scripts.js
index 25450d30..6b1176ee 100644
--- a/juick-server/src/main/assets/scripts.js
+++ b/juick-server/src/main/assets/scripts.js
@@ -827,7 +827,7 @@ ready(function() {
document.querySelectorAll('[data-uri]').forEach(el => {
let dataUri = el.getAttribute('data-uri');
if (dataUri) {
- fetchUserUri(dataUri, user => {
+ setTimeout(() => fetchUserUri(dataUri, user => {
let header = el.closest('.msg-header');
header.querySelectorAll('.a-username').forEach(a => {
a.setAttribute('href', user.uri);
@@ -842,19 +842,19 @@ ready(function() {
a.replaceChild(uname, a.firstChild);
}
});
- });
+ }), 100);
}
});
document.querySelectorAll('[data-user-uri]').forEach(el => {
let dataUri = el.getAttribute('href');
if (dataUri) {
- fetchUserUri(dataUri, user => {
+ setTimeout(() => fetchUserUri(dataUri, user => {
let textNode = el.childNodes[0];
if (textNode.nodeType === Node.TEXT_NODE && textNode.nodeValue.trim().length > 0) {
let uname = document.createTextNode(`@${user.uname}`);
el.replaceChild(uname, el.firstChild);
}
- });
+ }), 100);
}
});
initES();