File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 } ,
5050 "reviewRating" : {
5151 "@type" : "Rating" ,
52- "ratingValue" : 1500 ,
53- "bestRating" : 1500 ,
52+ "ratingValue" : 2000 ,
53+ "bestRating" : 2000 ,
5454 "worstRating" : 0
5555 }
5656 } ,
@@ -141,14 +141,11 @@ <h1 class="hero-fluff">
141141 </ svg >
142142 < span > Discord</ span >
143143 </ a >
144- < a href ="https://github.com/ValveResourceFormat/ValveResourceFormat " class ="social-button " id =" js-stars " >
145- < svg aria-hidden ="true " viewBox ="0 0 16 16 " version ="1.1 " width ="16 " height ="16 ">
146- < path d ="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l -3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4 .21-.611L7.327.668A.75.75 0 0 1 8 .25Z "> </ path >
144+ < a href ="https://github.com/ValveResourceFormat/ValveResourceFormat " class ="social-button ">
145+ < svg aria-hidden ="true " viewBox ="0 0 16 16 " version ="1.1 " width ="16 " height ="16 ">
146+ < path d ="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65 -3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z "> </ path >
147147 </ svg >
148- < span >
149- < b id ="js-stars-count "> —</ b >
150- stars
151- </ span >
148+ < span > GitHub</ span >
152149 </ a >
153150 </ div >
154151 </ div >
Original file line number Diff line number Diff line change 1- fetch ( 'https://api.github.com/repositories/42366054' )
2- . then ( ( response ) => {
3- if ( ! response . ok ) {
4- throw new Error ( 'Failed to fetch github repo info' ) ;
5- }
6-
7- return response . json ( ) ;
8- } )
9- . then ( ( response ) => {
10- const stars = response . stargazers_count ;
11- const starsCount = document . getElementById ( 'js-stars-count' ) ;
12- const formatter = new Intl . NumberFormat ( 'en' , { notation : 'compact' } ) ;
13- starsCount . textContent = formatter . format ( stars ) ;
14-
15- const schemaScript = document . querySelector (
16- 'script[type="application/ld+json"]' ,
17- ) ;
18- const schema = JSON . parse ( schemaScript . textContent ) ;
19- schema . review . reviewRating . ratingValue = stars ;
20- schema . review . reviewRating . bestRating = stars ;
21- schemaScript . textContent = JSON . stringify ( schema ) ;
22- } ) ;
23-
241fetch ( 'https://api.github.com/repositories/42366054/releases?per_page=5' , {
252 headers : {
263 Accept : 'application/vnd.github.html+json' ,
You can’t perform that action at this time.
0 commit comments