Skip to content

Commit 95c7bc9

Browse files
authored
Add ability to display GitHub stars (#51)
1 parent 3598c0e commit 95c7bc9

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

_sass/ecosystem.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@
377377
li {
378378
display: inline;
379379
}
380+
li.github-stars-count-whole-number {
381+
display: none;
382+
}
380383
}
381384

382385

assets/github-stars.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
var githubStarsScript = $("script[src*=github-stars]");
22
var starCountCallDate = githubStarsScript.attr("star-count-call-date");
33
var starCountData = githubStarsScript.attr("star-count-data");
4+
var ecosystemStars = githubStarsScript.attr("ecosystem");
5+
var cloudfrontUrl = "";
6+
7+
if (ecosystemStars == "true") {
8+
cloudfrontUrl = "https://d2ze5o8gurgoho.cloudfront.net/star-count";
9+
}
10+
else {
11+
cloudfrontUrl = "https://du4l4liqvfo92.cloudfront.net/star-count";
12+
}
413

514
var today = new Date();
615
var starCountCallDateParsed = new Date(
@@ -19,7 +28,7 @@ if (
1928

2029
function updateStarCount() {
2130
console.log("Updated star count fetched");
22-
$.getJSON("https://du4l4liqvfo92.cloudfront.net/star-count", function (data) {
31+
$.getJSON(cloudfrontUrl, function (data) {
2332
localStorage.setItem(starCountCallDate, Date.parse(today));
2433
localStorage.setItem(starCountData, JSON.stringify(data));
2534

ecosystem/ecosystem.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h1>
3434
{% assign ecosystem = site.ecosystem | sort_natural: "title" %}
3535

3636
{% for item in ecosystem %}
37-
<div class="col-md-6 ecosystem-card-wrapper" id="ecosystemCards" data-categories="{{ item.category | join: "," }}" data-date-added="{{ item.date-added }}">
37+
<div class="col-md-6 ecosystem-card-wrapper" id="ecosystemCards" data-categories="{{ item.category | join: "," }}" data-date-added="{{ item.date-added }}" data-id="{{ item.github-id }}">
3838
<div class="card ecosystem-card">
3939
<a href="{{ item.link }}" target="_blank">
4040
<div class="card-body {{ item.logo-class }} {% if item.experimental %}experimental{% endif %}">
@@ -44,6 +44,7 @@ <h1>
4444
<div class="icon-count-container">
4545
<li><img class="github-logo" src="/assets/images/logo-github.svg"></li>
4646
<li class="github-stars-count"></li>
47+
<li class="github-stars-count-whole-number"></li>
4748
</div>
4849
</ul>
4950
{% if item.experimental %}
@@ -122,6 +123,6 @@ <h1>
122123
</script>
123124

124125
<script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>
125-
<script star-count-call-date="ecosystemStarCountCallDate" star-count-data="ecosystemStarCountData" src="{{ site.baseurl }}/assets/github-stars.js"></script>
126+
<script id="filter-script" ecosystem="true" star-count-call-date="ecosystemStarCountCallDate" star-count-data="ecosystemStarCountData" src="{{ site.baseurl }}/assets/github-stars.js"></script>
126127
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
127128
<script list-id="ecosystem-index-cards" display-count="100" pagination="false" src="{{ site.baseurl }}/assets/filter-hub-tags.js"></script>

0 commit comments

Comments
 (0)