mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed error in fetching stargazer count
This commit is contained in:
parent
06311058f6
commit
056b09fcbb
@ -503,12 +503,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Get Stars for current repository */
|
/* Get Stars for current repository */
|
||||||
pegasus('https://api.github.com/repos/' + repo_id + '/stargazers').then(
|
pegasus('https://api.github.com/repos/' + repo_id).then(
|
||||||
|
|
||||||
/* Request successful, we got the stars */
|
/* Request successful, we got the stars */
|
||||||
function(data, xhr) {
|
function(data, xhr) {
|
||||||
var count = data.length;
|
var count = data.stargazers_count;
|
||||||
if (count > 1000)
|
if (count > 10000)
|
||||||
|
count = (count / 1000).toFixed(0) + "k";
|
||||||
|
else if (count > 1000)
|
||||||
count = (count / 1000).toFixed(1) + "k";
|
count = (count / 1000).toFixed(1) + "k";
|
||||||
|
|
||||||
/* Set number of stars */
|
/* Set number of stars */
|
||||||
|
Loading…
Reference in New Issue
Block a user