ginipick commited on
Commit
33170ea
ยท
verified ยท
1 Parent(s): bb390cb

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +162 -19
index.html CHANGED
@@ -1,19 +1,162 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Video Gallery</title>
7
+ <style>
8
+ * {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ .container {
15
+ max-width: 1800px;
16
+ margin: 0 auto;
17
+ padding: 20px;
18
+ }
19
+
20
+ .selected-content {
21
+ display: flex;
22
+ margin-bottom: 30px;
23
+ gap: 20px;
24
+ height: 400px;
25
+ }
26
+
27
+ .selected-thumbnail {
28
+ flex: 1;
29
+ background-color: #000;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ }
34
+
35
+ .selected-thumbnail video {
36
+ max-width: 100%;
37
+ max-height: 100%;
38
+ object-fit: contain;
39
+ }
40
+
41
+ .selected-video {
42
+ flex: 1;
43
+ background-color: #000;
44
+ }
45
+
46
+ .selected-video video {
47
+ width: 100%;
48
+ height: 100%;
49
+ object-fit: contain;
50
+ }
51
+
52
+ .gallery {
53
+ display: grid;
54
+ grid-template-columns: repeat(12, 1fr);
55
+ gap: 10px;
56
+ }
57
+
58
+ .thumbnail {
59
+ position: relative;
60
+ padding-top: 56.25%; /* 16:9 ๋น„์œจ */
61
+ cursor: pointer;
62
+ overflow: hidden;
63
+ background-color: #000;
64
+ }
65
+
66
+ .thumbnail video {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ width: 100%;
71
+ height: 100%;
72
+ object-fit: cover;
73
+ transition: transform 0.3s ease;
74
+ }
75
+
76
+ .thumbnail:hover video {
77
+ transform: scale(1.1);
78
+ }
79
+ </style>
80
+ </head>
81
+ <body>
82
+ <div class="container">
83
+ <div class="selected-content">
84
+ <div class="selected-thumbnail">
85
+ <video id="selected-thumb" playsinline muted>
86
+ <source src="" type="video/mp4">
87
+ </video>
88
+ </div>
89
+ <div class="selected-video">
90
+ <video id="selected-video" controls>
91
+ <source src="" type="video/mp4">
92
+ </video>
93
+ </div>
94
+ </div>
95
+
96
+ <div class="gallery" id="video-gallery"></div>
97
+ </div>
98
+
99
+ <script>
100
+ async function getVideoFiles() {
101
+ try {
102
+ const response = await fetch('.');
103
+ const text = await response.text();
104
+ const parser = new DOMParser();
105
+ const doc = parser.parseFromString(text, 'text/html');
106
+ const links = Array.from(doc.querySelectorAll('a'));
107
+ return links
108
+ .map(link => link.href)
109
+ .filter(href => href.endsWith('.mp4'))
110
+ .sort();
111
+ } catch (error) {
112
+ console.error('Error loading video files:', error);
113
+ return [];
114
+ }
115
+ }
116
+
117
+ async function initializeGallery() {
118
+ const gallery = document.getElementById('video-gallery');
119
+ const selectedThumb = document.getElementById('selected-thumb');
120
+ const selectedVideo = document.getElementById('selected-video');
121
+
122
+ const videoFiles = await getVideoFiles();
123
+
124
+ videoFiles.forEach((videoPath) => {
125
+ const thumbnail = document.createElement('div');
126
+ thumbnail.className = 'thumbnail';
127
+
128
+ const thumbVideo = document.createElement('video');
129
+ thumbVideo.src = videoPath;
130
+ thumbVideo.playsinline = true;
131
+ thumbVideo.muted = true;
132
+ thumbVideo.preload = 'metadata';
133
+
134
+ thumbVideo.addEventListener('loadeddata', () => {
135
+ thumbVideo.currentTime = 0;
136
+ });
137
+
138
+ thumbnail.appendChild(thumbVideo);
139
+
140
+ thumbnail.addEventListener('click', () => {
141
+ selectedThumb.src = videoPath;
142
+ selectedVideo.src = videoPath;
143
+ selectedThumb.currentTime = 0;
144
+ selectedVideo.play();
145
+ });
146
+
147
+ gallery.appendChild(thumbnail);
148
+ });
149
+
150
+ // ์ฒซ ๋ฒˆ์งธ ๋น„๋””์˜ค ์ž๋™ ์„ ํƒ
151
+ if (videoFiles.length > 0) {
152
+ selectedThumb.src = videoFiles[0];
153
+ selectedVideo.src = videoFiles[0];
154
+ selectedThumb.currentTime = 0;
155
+ }
156
+ }
157
+
158
+ // ๊ฐค๋Ÿฌ๋ฆฌ ์ดˆ๊ธฐํ™”
159
+ initializeGallery();
160
+ </script>
161
+ </body>
162
+ </html>