summaryrefslogtreecommitdiffstats
path: root/templates/base/footer.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/base/footer.tmpl')
-rw-r--r--templates/base/footer.tmpl22
1 files changed, 22 insertions, 0 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 0dd8871525..1734d32600 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -49,6 +49,28 @@
<script src="https://www.google.com/recaptcha/api.js" async></script>
{{end}}
{{end}}
+{{if .EnableHeatmap}}
+ <script src="{{AppSubUrl}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script>
+ <script src="{{AppSubUrl}}/vendor/plugins/d3/d3.v4.min.js" charset="utf-8"></script>
+ <script src="{{AppSubUrl}}/vendor/plugins/calendar-heatmap/calendar-heatmap.js" charset="utf-8"></script>
+ <script type="text/javascript">
+ $.get( '{{AppSubUrl}}/api/v1/users/{{.HeatmapUser}}/heatmap', function( chartRawData ) {
+ var chartData = [];
+ for (var i = 0; i < chartRawData.length; i++) {
+ chartData[i] = {date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions};
+ }
+
+ $('#loading-heatmap').removeClass('active');
+
+ var heatmap = calendarHeatmap()
+ .data(chartData)
+ .selector('#user-heatmap')
+ .colorRange(['#f4f4f4', '#459928'])
+ .tooltipEnabled(true);
+ heatmap();
+ });
+ </script>
+{{end}}
{{if .RequireTribute}}
<script src="{{AppSubUrl}}/vendor/plugins/tribute/tribute.min.js"></script>