-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
185 lines (164 loc) · 4.59 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Code Viewer</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background-color: #121212;
color: #e0e0e0;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: flex-start;
min-height: 100vh;
padding: 20px;
}
.container {
width: 100%;
max-width: 900px;
background-color: #1c1c1e;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
overflow: hidden;
padding: 20px;
}
.section {
margin-bottom: 20px;
padding: 20px;
background-color: #282828;
border-radius: 8px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.section h2 {
margin-top: 0;
color: #a29bfe;
font-size: 1.5rem;
border-bottom: 2px solid #8e44ad;
padding-bottom: 5px;
}
.code-container {
background-color: #2c2c2c;
border-radius: 8px;
padding: 15px;
overflow-x: auto;
font-family: "Courier New", Courier, monospace;
white-space: pre-wrap;
word-wrap: break-word;
}
.explanation-container {
background-color: #2c2c2c;
border-radius: 8px;
padding: 15px;
white-space: pre-wrap;
word-wrap: break-word;
min-height: 100px;
}
.video-container {
background-color: #2c2c2c;
border-radius: 8px;
padding: 15px;
text-align: center;
word-wrap: break-word;
}
.no-content {
font-style: italic;
color: #aaa;
text-align: center;
}
/* Responsive Design */
@media screen and (max-width: 768px) {
.container {
padding: 15px;
}
.section {
padding: 15px;
}
.code-container {
padding: 10px;
}
.video-container iframe {
height: 250px;
}
}
@media screen and (max-width: 480px) {
.container {
padding: 10px;
}
.code-container {
padding: 8px;
}
.video-container iframe {
height: 200px;
}
}
</style>
</head>
<body>
<div class="container">
<!-- Code Section -->
<div class="section">
<h2>Code</h2>
<div class="code-container">
<pre><code id="code-container"></code></pre>
</div>
</div>
<!-- Explanation Section -->
<div class="section">
<h2>Explanation</h2>
<div
id="explanation-container"
class="explanation-container no-content"
>
No explanation provided.
</div>
</div>
<!-- Recommended Video Section -->
<div class="section">
<h2>Recommended Video</h2>
<div id="video-container" class="video-container no-content">
No video provided.
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", () => {
const codeContainer = document.getElementById("code-container");
const explanationContainer = document.getElementById(
"explanation-container"
);
const videoContainer = document.getElementById("video-container");
// Get the parameters from the URL
const params = new URLSearchParams(window.location.search);
// Code
const code = params.get("code");
if (code) {
const decodedCode = decodeURIComponent(code);
codeContainer.textContent = decodedCode;
} else {
codeContainer.textContent = "No code provided.";
}
// Explanation
const explanation = params.get("explanation");
if (explanation) {
explanationContainer.textContent = decodeURIComponent(explanation);
explanationContainer.classList.remove("no-content");
}
// YouTube Video
const query = params.get("queryvideo");
if (query) {
const videoUrl = `https://www.youtube.com/results?search_query=${encodeURIComponent(
query
)}`;
videoContainer.innerHTML = `
<p>Click <a href="${videoUrl}" target="_blank">Watch Explanation video</a> to view videos for "${query}".</p>
`;
videoContainer.classList.remove("no-content");
}
});
</script>
</body>
</html>