Skip to content

Commit 9d511ee

Browse files
committed
Auto repo counting, Archived is still manual
1 parent 1008e48 commit 9d511ee

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

js/morescripts.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,19 @@ $(document).ready(function(){
7878
b =rr[0].replace(/(\d{1,3}(?=(\d{3})+(?:\.\d|\b)))/g, "\$1" + separator);
7979
r = (rr[1] ? b + '.' + rr[1] : b);
8080
return r;
81-
}
82-
81+
}
82+
83+
const ghusername = "BoxOfDevs";
84+
fetch(`https://api.github.com/users/${ghusername}`, {})
85+
.then(response => response.json())
86+
.then(data => {
87+
let numRepos = data.public_repos;
88+
var numArchived = 28; // Update Me as Necessary, No API available for counting archived repos
89+
var adjustednumRepos = numRepos - numArchived;
90+
var adjustednumArchived = numArchived + 23 - 1;
91+
var curvalRepos = adjustednumRepos-1;
92+
var curvalArchived = adjustednumArchived-1;
93+
8394
setTimeout(function(){
8495
$('#counter').text('0');
8596
$('#counter1').text('0');
@@ -88,17 +99,18 @@ $(document).ready(function(){
8899
var curval = parseInt($('#counter').text());
89100
var curval1 = parseInt($('#counter1').text().replace(' ',''));
90101
var curval2 = parseInt($('#counter2').text());
91-
if(curval <= 2){
102+
if(curval <= curvalRepos){
92103
$('#counter').text(curval+1);
93104
}
94-
if(curval1 <= 49){
105+
if(curval1 <= curvalArchived){
95106
$('#counter1').text(curval1+1);
96107
}
97108
if(curval2 <= 7){
98109
$('#counter2').text(curval2+1);
99110
}
100111
}, 2);
101112
}, 500);
113+
})
102114

103115
var $menu = $("#menuF");
104116
$(window).scroll(function(){

0 commit comments

Comments
 (0)