utils.jq(() => { $(function () { const els = document.getElementsByClassName('ds-waline'); for (var i = 0; i < els.length; i++) { const el = els[i]; const limit = parseInt(el.getAttribute('limit')) || 10; const apiBase = el.getAttribute('api'); if (apiBase == null) { continue; } const api = apiBase + '/comment?type=recent&count=' + limit; const default_avatar = def.avatar; utils.request(el, api, function(data) { data.forEach((item, i) => { var cell = '
'; cell += '
'; cell += ''; cell += '' + new Date(item.time).toLocaleString() + ''; cell += '
'; cell += ''; cell += item.comment.replace(/]*>(.*?)<\/a>/g, '$1'); cell += ''; cell += '
'; $(el).append(cell); }); }); } }); });