-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapps1.js
358 lines (285 loc) · 10.1 KB
/
apps1.js
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
let search = document.getElementById('search');
let search_icon = document.getElementById('search_icon');
search_icon.addEventListener('click', ()=>{
search.classList.toggle('search_input')
})
let cato_bx = document.getElementById('cato_bx');
let left_scroll = document.getElementById('left_scroll');
let right_scroll = document.getElementById('right_scroll');
left_scroll.addEventListener('click', ()=>{
cato_bx.scrollLeft -= 100;
})
right_scroll.addEventListener('click', ()=>{
cato_bx.scrollLeft += 100;
})
let mvoes_bx_1 = document.getElementById('mvoes_bx_1');
let left_scroll1 = document.getElementById('left_scroll1');
let right_scroll1 = document.getElementById('right_scroll1');
left_scroll1.addEventListener('click', ()=>{
mvoes_bx_1.scrollLeft -= 150;
})
right_scroll1.addEventListener('click', ()=>{
mvoes_bx_1.scrollLeft += 150;
})
// year and a-z box start
let year = document.getElementById('year');
let a_z = document.getElementById('a_z');
year.addEventListener('click', ()=>{
year.classList.toggle('show_year1');
})
a_z.addEventListener('click', ()=>{
a_z.classList.toggle('show_year1');
})
// year and a-z box end
//other list start
let list = document.getElementById('list');
list.addEventListener('click', ()=>{
list.classList.toggle('ohetlist');
})
//other list end
// video control start //
let plays = document.getElementById('play');
let videos = document.getElementById('video');
let play_btn = document.getElementById('play_btn');
play_btn.addEventListener('click', ()=>{
videos.play();
plays.classList.add('bi-pause-fill');
plays.classList.remove('bi-play-fill');
});
plays.addEventListener('click', ()=>{
if (videos.paused || videos.currentTime <= 0) {
plays.classList.add('bi-pause-fill');
plays.classList.remove('bi-play-fill');
videos.play();
}else{
plays.classList.remove('bi-pause-fill');
plays.classList.add('bi-play-fill');
videos.pause();
}
});
// video control end //
// video time update start //
videos.addEventListener('timeupdate', ()=>{
let start_time = document.getElementById('start_time');
let end_time = document.getElementById('end_time');
let video_duration = videos.duration;
let min = Math.floor(video_duration/60);
let hour = Math.floor(min/60);
let sec = Math.floor(video_duration%60);
let video_current_time = videos.currentTime;
let start_min = Math.floor(video_current_time /60);
let start_sec = Math.floor(video_current_time %60);
let start_hour = Math.floor(start_min /60);
if (start_min < 10) {
start_min = "0" + start_min;
}
if (start_sec < 10) {
start_sec = "0" + start_sec;
}
start_time.innerText = start_min + ":" + start_sec;
if (start_hour < 10) {
start_hour = "0" + start_hour;
}
if (start_min == 60 || start_min > 60) {
start_time.innerText = start_hour + ":" + start_min + ":" + start_sec;
}
// end
let end_min = min - start_min;
let end_sec = video_duration - start_sec;
let end_hour = hour - start_hour;
let end_mins = Math.floor(end_min % 60);
let end_secs = Math.floor(end_sec % 60);
let end_hours = Math.floor(end_min / 60);
if (end_mins < 10) {
end_mins = "0" + end_mins;
}
if (end_secs < 10) {
end_secs = "0" + end_secs;
}
if (end_hours < 10) {
end_hours = "0" + end_hours;
}
end_time.innerText = "-" + end_mins + ":" + end_secs;
if (end_min == 60 || end_min > 60) {
end_time.innerText = "-" + end_hours + ":" + end_mins + ":" + end_secs;
}
// seek bar start
let seek = document.getElementById('seek');
let seek_2 = document.getElementById('seek_2');
let seek_dot = document.getElementById('seek_dot');
let progressbar = parseInt((videos.currentTime / videos.duration)*100);
seek.value = progressbar;
let seekbar = seek.value;
seek_2.style.width = `${seekbar}%`;
seek_dot.style.left = `${seekbar}%`;
// seekbar value change //
let sec_30 = document.getElementById('sec_30');
seek.addEventListener('change', ()=>{
videos.currentTime = seek.value * videos.duration / 100;
sec_30.addEventListener('click', ()=>{
videos.currentTime = seek.value * ((videos.duration - 30)/ 100);
})
});
//video end event
videos.addEventListener('ended', ()=>{
plays.classList.remove('bi-pause-fill');
plays.classList.add('bi-play-fill');
})
});
// video time update end //
// volume change //
let start_seekbar_end = document.querySelector('.start_seekbar_end');
let cc_vol_screen = document.querySelector('.cc_vol_screen');
let vol = document.getElementById('vol');
let vol_icon = document.getElementById('vol_icon');
vol_icon.addEventListener('click', ()=>{
cc_vol_screen.classList.toggle('cc_vol');
start_seekbar_end.classList.toggle('start_seekbar');
vol.classList.toggle('input_vol');
});
vol.addEventListener('change', ()=>{
if (vol.value == 0) {
vol_icon.classList.remove('bi-volume-up-fill');
vol_icon.classList.remove('bi-volume-down-fill');
vol_icon.classList.add('bi-volume-off-fill');
}
if (vol.value > 0) {
vol_icon.classList.remove('bi-volume-up-fill');
vol_icon.classList.add('bi-volume-down-fill');
vol_icon.classList.remove('bi-volume-off-fill');
}
if (vol.value > 60) {
vol_icon.classList.add('bi-volume-up-fill');
vol_icon.classList.remove('bi-volume-down-fill');
vol_icon.classList.remove('bi-volume-off-fill');
}
let vol_a = vol.value;
videos.volume = vol_a /100;
})
// full screen start
let full_screen = document.getElementById('full_screen');
full_screen.addEventListener('click', ()=>{
videos.requestFullscreen();
});
// video box start
let title_video = document.getElementsByClassName('title_video');
let video_1 = document.getElementsByClassName('video_1');
video_1[0].addEventListener('click', ()=>{
videos.src = "video/trailer1.mp4";
videos.play();
title_video[0].innerText = "Pantera Negra Wakanda para Sempre Marvel Studios Trailer Oficial(2023)";
plays.classList.add('bi-pause-fill');
plays.classList.remove('bi-play-fill');
})
video_1[1].addEventListener('click', ()=>{
videos.src = "video/trailer2.mp4";
videos.play();
title_video[0].innerText = "ARMOR WARS Trailer 1 HD Disney- Concept Don Cheadle- Gwyneth Paltrow";
plays.classList.add('bi-pause-fill');
plays.classList.remove('bi-play-fill');
})
video_1[2].addEventListener('click', ()=>{
videos.src = "video/trailer3.mp4";
videos.play();
title_video[0].innerText = "TRANSFORMERS O DESPERTAR DAS FERAS Trailer Brasileiro -2023- ᴴᴰ";
plays.classList.add('bi-pause-fill');
plays.classList.remove('bi-play-fill');
});
let action1 = document.getElementById('action1');
let action_bx = document.getElementById('action_bx');
action1.addEventListener('click', ()=>{
action1.classList.toggle('cato_button_active');
action_bx.classList.toggle('movie_box_active');
});
const action_array = movies.filter((e)=>{
return e.genre1 == 'action';
});
action_array.forEach(element => {
const {img, title, year, url, rate} = element;
let card = document.createElement('div');
card.classList.add('card');
card.innerHTML = `
<a href="${url}">
<img src="${img}" alt="${title}">
<div class="content">
<h5>${title}</h5>
<h6>
<span>${year}</span>
<div class="rate">
<i class="bi bi-heart-fill"></i>
<i class="bi bi-eye-fill"></i>
<i class="bi bi-star-fill"></i>
<h6>${rate}</h6>
</div>
</h6>
</div>
</a>
`
action_bx.appendChild(card);
});
// crime button and active box
let crime1 = document.getElementById('crime1');
let crime_bx = document.getElementById('crime_bx');
crime1.addEventListener('click', ()=>{
crime1.classList.toggle('cato_button_active');
crime_bx.classList.toggle('movie_box_active');
});
const crime_array = movies.filter((e)=>{
return e.genre2 == 'crime';
});
crime_array.forEach(element => {
const {img, title, year, url, rate} = element;
let card = document.createElement('div');
card.classList.add('card');
card.innerHTML = `
<a href="${url}">
<img src="${img}" alt="${title}">
<div class="content">
<h5>${title}</h5>
<h6>
<span>${year}</span>
<div class="rate">
<i class="bi bi-heart-fill"></i>
<i class="bi bi-eye-fill"></i>
<i class="bi bi-star-fill"></i>
<h6>${rate}</h6>
</div>
</h6>
</div>
</a>
`
crime_bx.appendChild(card);
});
// drama button and active box
let drama1 = document.getElementById('drama1');
let drama_bx = document.getElementById('drama_bx');
drama1.addEventListener('click', ()=>{
drama1.classList.toggle('cato_button_active');
drama_bx.classList.toggle('movie_box_active');
});
const drama_array = movies.filter((e)=>{
return e.genre8 == 'drama';
});
drama_array.forEach(element => {
const {img, title, year, url, rate} = element;
let card = document.createElement('div');
card.classList.add('card');
card.innerHTML = `
<a href="${url}">
<img src="${img}" alt="${title}">
<div class="content">
<h5>${title}</h5>
<h6>
<span>${year}</span>
<div class="rate">
<i class="bi bi-heart-fill"></i>
<i class="bi bi-eye-fill"></i>
<i class="bi bi-star-fill"></i>
<h6>${rate}</h6>
</div>
</h6>
</div>
</a>
`
drama_bx.appendChild(card);
});