utils.jq(() => { $(function () { const els = document.getElementsByClassName('ds-friends_and_posts'); for (var i = 0; i < els.length; i++) { const el = els[i]; const api = el.dataset.api; if (api == null) { continue; } const default_avatar = def.avatar; // layout utils.request(el, api, async resp => { const data = await resp.json(); for (let item of (data.content || data)) { var cell = `
`; cell += `
`; cell += ``;; cell += ``; cell += `${item.title || item.login}`; cell += ``; cell += `
`; for (let label of item.labels) { if (label.lightness > 75) { cell += `
${label.name}
`; } else if (label.saturation > 90 && label.lightness > 40) { cell += `
${label.name}
`; } else { cell += `
${label.name}
`; } } cell += `
`; cell += `
`; cell += `
`; if (item.description) { cell += `
${item.description || item.issue_number || ''}
`; } else { cell += `
#${item.issue_number}
`; } cell += `
`; if (item.posts?.length > 0) { for (let post of item.posts) { cell += ``; cell += `${post.title}`; cell += `${post.published}`; cell += ``; } } else { cell += `${item.feed?.length > 0 ? 'RSS 解析失败' : '未设置 RSS 链接'}`; } cell += `
`; cell += `
`; cell += `
`; $(el).find('.grid-box').append(cell); } window.wrapLazyloadImages(el); }); } }); });