File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > Python File Viewer</ title >
7
+ </ head >
8
+ < body >
9
+ < h1 > Python File Viewer</ h1 >
10
+ < ul id ="file-list "> </ ul >
11
+
12
+ < script >
13
+ // GitHub API를 통해 Repository의 파일 목록을 가져옵니다.
14
+ fetch ( 'https://api.github.com/repos/Code-Study/Code-Study.github.io/contents/' )
15
+ . then ( response => response . json ( ) )
16
+ . then ( data => {
17
+ // 파일 목록을 순회하며 Python 파일인 경우 링크를 생성합니다.
18
+ const fileList = document . getElementById ( 'file-list' ) ;
19
+ data . forEach ( file => {
20
+ if ( file . name . endsWith ( '.py' ) ) {
21
+ const listItem = document . createElement ( 'li' ) ;
22
+ const link = document . createElement ( 'a' ) ;
23
+ link . href = file . html_url ;
24
+ link . textContent = file . name ;
25
+ listItem . appendChild ( link ) ;
26
+ fileList . appendChild ( listItem ) ;
27
+ }
28
+ } ) ;
29
+ } )
30
+ . catch ( error => console . error ( 'Error fetching file list:' , error ) ) ;
31
+ </ script >
32
+ </ body >
33
+ </ html >
You can’t perform that action at this time.
0 commit comments