-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (38 loc) · 1.34 KB
/
index.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
let createCard = (title, cName, views, upldDate, dur, thumb) => {
let v = views < 1000 ? views : views > 100000 ? views/100000 + "M" : views/1000 + "k";
let u =
upldDate < 13
? upldDate + " months ago "
: upldDate < 25
? (upldDate - 13) + " year ago "
: upldDate + " years ago ";
let html = `<div class="card">
<div class="image">
<img src="${thumb}" onclick="p()" alt="Thumbnail image" style="cursor: pointer;">
<div class="dur">${dur}</div>
</div>
<div class="text">
<h1>${title}</h1>
<p>${cName} <b>.</b> ${v} views <b>.</b> ${u}</p>
</div>
</div>`;
document.querySelector(".container").innerHTML = document.querySelector(".container").innerHTML + html;
};
var c = 1;
document.querySelector("button").addEventListener("click", () => {
if(c&&c<3){
createCard(
"Ariana Grande - We Can't Be Friends -「AMV」- Anime MV",
"Anime Amv Sensei",
79000,
24,
"2:56",
"https://i.ytimg.com/vi/x299KHmCeT0/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCsBypwYb8ZM0JC5ml014gv40JvBQ"
)
c++;
}
});
let p = ()=>{
document.body.getElementsByClassName('container')[0].innerHTML = `<video src='video.mp4' autoplay controls>`;
c=0;
}