-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoursdisplay.html
220 lines (188 loc) · 6.7 KB
/
coursdisplay.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>E-learning website</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="coursedisplay.css" />
</head>
<body>
<div class="header">
<div class="top-header">
<div class="notifications">
<h3>All course 28% off for somali people’s.</h3>
</div>
<div class="social">
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-square-facebook"></i>
<i class="fa-brands fa-instagram"></i>
<i class="fa-brands fa-skype"></i>
</div>
</div>
<section>
<div class="menu">
<div class="logo">
<a href="index.html" style="display: flex; align-items: center;" ><img src="images/logo.png" alt="" />
</div>
<div class="left">
<ul>
<li><a href="index.html">home</a></li>
<li><a href="courses.html">courses</a></li>
<li><a href="block.html">blog</a></li>
<li><a href="contact.html">contact</a></li>
</ul>
<div class="regitration">
<a href="login.html">
<div class="signin allbtn"><button>Signin</button></div></a
>
<a href="registration.html">
<div class="signup allbtn"><button>Sign Up</button></div></a
>
<div class="account hide"></div>
<div class="account-info hide">
<h4 class="currentusername" ></h4>
<h5 class="myaccount"><i class="fa-solid fa-user "></i> my account</h5>
<h5 class="logout"><i class="fa-solid fa-right-from-bracket"></i> logout</h5>
</div>
</div>
</div>
<div class="bars"><i class="fa-solid fa-bars-staggered"></i></div>
</div>
<div class="content">
<div class="left-content">
<h4>Home // courses Display</h4>
<p class="courseName"></p>
</div>
<div class="right-content">
<img src="images//co.avif" alt="" />
</div>
</div>
</section>
</div>
<main>
<div class="coursesdetail">
<div class="right-description">
<div class="card"></div>
</div>
<div class="left-Description">
<h5 class="titleplay">
</h5>
<div class="image-container">
<iframe
style="border: none"
class="playvideo"
allowfullscreen
width="100%"
height="600"
src="https://www.youtube.com/embed/JicwvOX6YTo"
>
</iframe>
</div>
</div>
</div>
</main>
<footer>
<p>© Team dugsiiye</p>
</footer>
<script>
let accountinfo = document.querySelector(".account-info");
let account = document.querySelector(".account");
let allbtn = document.querySelectorAll(".allbtn");
let card = document.querySelector(".card");
let imagecontainer = document.querySelector(".playvideo");
let courseName = document.querySelector(".courseName");
let userdata = JSON.parse(localStorage.getItem("currentUser"));
let logout = document.querySelector(".logout");
let myaccount = document.querySelector(".myaccount");
if (userdata) {
let currentusername = document.querySelector(".currentusername")
currentusername.innerText = userdata.fullname
account.innerText = userdata.fullname.charAt(0);
allbtn.forEach((element) => {
element.classList.add("hide");
account.classList.remove("hide");
});
} else {
allbtn.forEach((element) => {
element.classList.remove("hide");
account.classList.add("hide");
});
}
account.addEventListener("click", function () {
accountinfo.classList.toggle("hide");
});
const urldata = new URLSearchParams(window.location.search);
let courses = urldata.get("selectedcourses");
let decodeddata = JSON.parse(decodeURIComponent(courses));
let duration = decodeddata.lessons.reduce(
function (acc, value) {
if (!acc.includes(value.duration)) {
acc.push(value.duration);
}
return acc;
},
[0]
);
let d = duration.map((element) => {
return parseFloat(element);
});
let lastdata = d.reduce(function (acc, val) {
return acc + val;
});
decodeddata.lessons.forEach((Element) => {
card.innerHTML += `<div class="video">
<div class="title">
<i class="fa-solid fa-circle-play"></i>
<div class="displaycontent">
<h5 class="videodisplay">
${Element.content}
</h5>
<p class="description"> ${Element.duration}</p>
</div>
</div>
<a
class="url"
href="${Element.video}"
></a>
</div>`;
courseName.innerText = Element.title
});
let VIDEO = document.querySelectorAll(".video");
VIDEO.forEach((element) => {
element.addEventListener("click", (event) => {
if (event.target.classList.contains("videodisplay")) {
let url =
event.target.parentElement.parentElement.parentElement.querySelector(
".url"
);
let titleplay = document.querySelector(".titleplay");
let title =
event.target.textContent;
titleplay.textContent=title
imagecontainer.src = url;
}
});
});
myaccount.addEventListener("click",()=>{
window.location.href="userAccount.html"
})
logout.addEventListener("click",()=>{
localStorage.removeItem("currentUser");
window.location.href="index.html"
})
let bars = document.querySelector(".bars i");
let left = document.querySelector(".left");
bars.onclick=()=>{
bars.classList.toggle("fa-xmark")
left.classList.toggle("open")
}
</script>
</body>
</html>