File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- console . log ( `Hello World` ) ;
1+ function getAuthorFromParams ( defaultAuthor = 'pphatdev' ) {
2+ const urlParams = new URLSearchParams ( window . location . search ) ;
3+ return urlParams . get ( 'author' ) || defaultAuthor ;
4+ }
5+
6+ async function fetchGithubCommits ( author ) {
7+ const response = await fetch ( `https://api.github.com/search/commits?q=author:${ author } ` ) ;
8+ const data = await response . json ( ) ;
9+ return data ;
10+ }
11+
12+ // Usage
13+ const author = getAuthorFromParams ( ) ;
14+ fetchGithubCommits ( author )
15+ . then ( totalCount => {
16+ const total = document . getElementById ( 'total' ) ;
17+ total . innerHTML = totalCount . total_count ;
18+ } )
19+ . catch ( error => {
20+ console . error ( 'Error fetching commits:' , error ) ;
21+ } ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+ < title > pphatdev.github.oi</ title >
8+ </ head >
9+
10+ < body >
11+ < svg width ="118 " height ="25 " viewBox ="0 0 118 25 " fill ="none " xmlns ="http://www.w3.org/2000/svg ">
12+ < g id ="Sections ">
13+ < g >
14+ <!-- <path d="M0 4.9964C0 2.48772 2.03368 0.454041 4.54236 0.454041H83.6271V24.0811H4.54237C2.03369 24.0811 0 22.0474 0 19.5388V4.9964Z" fill="#F43B43" /> -->
15+ < text fill ="white " xml:space ="preserve " style ="white-space: pre " font-family ="Inter " font-size ="10.9017 " font-weight ="600 " letter-spacing ="-0.104474px ">
16+ < tspan x ="7.28777 " y ="16.2284 " id ="label "> Total Commit</ tspan >
17+ </ text >
18+ </ g >
19+ < g >
20+ <!-- <path d="M83.6271 0.454041H112.712C115.22 0.454041 117.254 2.48772 117.254 4.9964V19.5388C117.254 22.0474 115.22 24.0811 112.712 24.0811H83.6271V0.454041Z" fill="#290FA8" /> -->
21+ < text id ="1242 " fill ="white " xml:space ="preserve " style ="white-space: pre " font-family ="Kantumruy Pro " font-size ="9.08472 " font-weight ="600 " letter-spacing ="-0.104474px ">
22+ < tspan x ="90.8694 " y ="15.2622 " id ="total "> 1242</ tspan >
23+ </ text >
24+ </ g >
25+ </ g >
26+ </ svg >
27+
28+ < script type ="module " src ="./hello-world.js "> </ script >
29+ </ body >
30+ </ html >
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " pphatdev.github.io" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " <div align=\" center\" >\r <h1> Hello! I am Sophat (or PPhatdev) ππ </h1>\r </div>" ,
5+ "main" : " hello-world.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "author" : " " ,
10+ "license" : " MIT"
11+ }
You canβt perform that action at this time.
0 commit comments