在网站中嵌入 Github 贡献图

新手上路,请多包涵

有没有办法在 HTML5 中嵌入 Github 贡献图?

在此处输入图像描述

原文由 geek4079 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 458
2 个回答

我写了一个 JavaScript 库来做到这一点: github-calendar

是一个如何使用它的例子:

 <!-- Prepare a container for your calendar. -->
<script
  src="https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.min.js"
>
</script>

<!-- Optionally, include the theme (if you don't want to struggle to write the CSS) -->
<link
  rel="stylesheet"
  href="https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.css"
/>

<!-- Prepare a container for your calendar. -->
<div class="calendar">
    <!-- Loading stuff -->
    Loading the data just for you.
</div>

<script>
    new GitHubCalendar(".calendar", "your-username");
</script>

在这里 您可以看到它的实际效果:

基本上,因为我们需要跨域请求,所以我们需要一个代理。它向 GitHub 个人资料页面 ( github.com/<user> ) 发出请求,然后从那里带回所需的东西。

有关详细信息,请查看 GitHub 上的文档

原文由 Ionică Bizău 发布,翻译遵循 CC BY-SA 3.0 许可协议

这个家伙: http ://www.rshah.org/ 写了一个 Github 图表 API。这绝对有帮助:http: //ghchart.rshah.org/ 。另外,它只是 HTML,所以无法得到任何清洁。只需将用户名和 alt 标签更改为您的。

原文由 Chetan Malhotra 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题