有没有办法在 HTML5 中嵌入 Github 贡献图?
我编写了一个 JavaScript 库来做到这一点:github日历 https://github.com/IonicaBizau/github-calendar.
Here https://github.com/IonicaBizau/github-calendar#installation是如何使用它的示例:
<!-- 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>
Here http://ionicabizau.github.io/github-calendar/example/你可以看到它的实际效果:
基本上,由于我们需要跨域请求,所以我们需要一个代理。它向 GitHub 个人资料页面发出请求 (github.com/<user>
)然后从那里带回所需的东西。
欲了解更多信息,请查看GitHub 上的文档 https://github.com/IonicaBizau/github-calendar#installation.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)