import { i18n } from '@/env' export function insertActiveForks(owner, repo, usePageHeadActions) { if (document.getElementById('github-active-forks')) return const svgStr = '' const targetUrl = `https://ossinsight.io/analyze/${owner}/${repo}` const title = `${repo} ${i18n.translate.activeforks}` const el = usePageHeadActions ? document.querySelector('.pagehead-actions') : document.querySelector('#responsive-meta-container .d-flex.gap-2.mt-n3.mb-3.flex-wrap') if (!el) { console.log('github-Active Forks: 没有找到目标元素, 无法添加按钮') return } const buttonHtml = `
${svgStr} ${usePageHeadActions ? i18n.translate.activeforks_ : ''}
` if (usePageHeadActions) { el.insertAdjacentHTML('afterbegin', `
  • ${buttonHtml}
  • `) } else { el.insertAdjacentHTML('afterbegin', buttonHtml) } } export function insertOssInsightButton(owner, repo, usePageHeadActions) { if (document.getElementById('github-ossinsight')) return const svgStr = ` ` const targetUrl = `https://ossinsight.io/analyze/${owner}/${repo}` const title = `${repo} ${i18n.translate.ossinsight}` const el = usePageHeadActions ? document.querySelector('.pagehead-actions') : document.querySelector('#responsive-meta-container .d-flex.gap-2.mt-n3.mb-3.flex-wrap') if (!el) { console.log('github-ossinsight: 没有找到目标元素, 无法添加按钮') return } const buttonHtml = `${svgStr}` if (usePageHeadActions) { el.insertAdjacentHTML('afterbegin', `
  • ${buttonHtml}
  • `) } else { el.insertAdjacentHTML('afterbegin', buttonHtml) } }