diff options
author | Vitaly Takmazov | 2018-10-24 09:26:48 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-10-24 09:30:13 +0300 |
commit | c65346138dff21ac2bb61bfad12f6bcb970c6a1c (patch) | |
tree | 1fdaba8571a67d6092c2ca1119ad49e053e7bd02 /juick-server/src/main/assets | |
parent | d794d789fbec39c2e1a81629cf539bffab58ed7e (diff) |
scripts: fetch users with throttle
Diffstat (limited to 'juick-server/src/main/assets')
-rw-r--r-- | juick-server/src/main/assets/scripts.js | 8 |
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(); |