File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed
Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ interface GithubProfile {
88 url : string ;
99 photo : string ;
1010 username : string ;
11+ contributions : number ;
1112}
1213
1314export default ( ( ctx ) => {
@@ -29,13 +30,20 @@ export default ((ctx) => {
2930 }
3031 for ( const contribution of await res . json ( ) ) {
3132 const author = contribution . author || contribution . commit . author ;
32- contributors [ author . login ] ??= {
33- username : author . login ,
34- photo : author . avatar_url ,
35- url : author . html_url ,
36- } ;
33+ if ( contributors [ author . login ] ) {
34+ contributors [ author . login ] . contributions ++ ;
35+ } else {
36+ contributors [ author . login ] = {
37+ username : author . login ,
38+ photo : author . avatar_url ,
39+ url : author . html_url ,
40+ contributions : 1 ,
41+ } ;
42+ }
3743 }
38- return Object . values ( contributors ) ;
44+ return Object . values ( contributors ) . sort (
45+ ( a , b ) => b . contributions - a . contributions ,
46+ ) ;
3947 } )
4048 . catch ( ( e ) => {
4149 return [ ] ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ div#site-menu class=styles.menu
1414 a href = value aria-current = ($global .url .pathname === value && " true" )
1515 ${content }
1616
17- nav class = styles .nav id = styles .siteNav
17+ nav / $nav class = styles .nav id = styles .siteNav
1818 ul
1919 li
2020 strong -- Introduction
@@ -86,3 +86,15 @@ div#site-menu class=styles.menu
8686 ,off = " HTML"
8787 ,on = " Concise"
8888 app-switch aria-label = " Toggle TS mode" checked := tsMode off = " JS" on = " TS"
89+
90+ html-script -- ${` document.getElementById("${styles .siteNav }").scrollTop = +(sessionStorage.getItem("menu-scroll-position") || 0) ` }
91+ script --
92+ addEventListener (
93+ " beforeunload" ,
94+ () => {
95+ sessionStorage .setItem (" menu-scroll-position" , $nav ().scrollTop + " " );
96+ },
97+ {
98+ signal: $signal ,
99+ },
100+ );
You can’t perform that action at this time.
0 commit comments