utils.jq(() => { $(function () { const reactions = { '+1': '👍', '-1': '👎', 'laugh': '😀', 'hooray': '🎉', 'confused': '😕', 'heart': '❤️', 'rocket': '🚀', 'eyes': '👀' } const timelines = document.getElementsByClassName('ds-timeline'); for (var i = 0; i < timelines.length; i++) { const el = timelines[i]; const api = el.getAttribute('api'); if (api == null) { continue; } // layout utils.request(el, api, function(data) { const query = new URL(api).search; const arr = data.content || data; var users = []; const filter = el.getAttribute('user'); if (filter && filter.length > 0) { users = filter.split(","); } var hide = []; const hideStr = el.getAttribute('hide'); if (hideStr && hideStr.length > 0) { hide = hideStr.split(","); } arr.forEach((item, i) => { if (item.user && item.user.login && users.length > 0) { if (!users.includes(item.user.login)) { return; } } var cell = '
'; cell += '
'; if (!users.length && item.user && !hide.includes('user')) { cell += ''; } let date = new Date(item.created_at); cell += '' + date.toLocaleString() + ''; cell += '
'; cell += '
'; if (!hide.includes('title')) { cell += '

'; cell += ''; cell += item.title || item.name || item.tag_name; cell += ''; cell += '

'; } cell += marked.parse(item.body || ''); if (!hide.includes('footer')) { cell += ''; } cell += '
'; cell += '
'; $(el).append(cell); }); }); } }); });