-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.js
57 lines (38 loc) · 2.2 KB
/
video.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
var videoCardArray = JSON.parse(localStorage.getItem("videCard")) || [];
var suggestionCardArray = JSON.parse(localStorage.getItem("suggestionCard")) || [];
console.log(suggestionCardArray)
let videoId = videoCardArray.id.videoId
let videoCard = document.createElement("div");
videoCard.id = "videocard"
let iframe = document.createElement("iframe");
iframe.src = `https://www.youtube.com/embed/${videoId}`
iframe.setAttribute("allowfullscreen",true);
iframe.width= "100%";
iframe.height = "100%"
videoCard.append(iframe);
iframediv.append(videoCard)
suggestionCardArray.forEach(function (suggest){
let suggestbox = document.createElement("div");
suggestbox.id = "suggestbox";
let thumbnail_div = document.createElement("div");
thumbnail_div.id = "left";
let right_div = document.createElement("div");
right_div.id = "right"
let thumbnail = document.createElement("img");
thumbnail.src = suggest.snippet.thumbnails.default.url;
console.log(thumbnail)
let videoTitle = document.createElement("p");
videoTitle.width="100%";
videoTitle.textContent = suggest.snippet.title;
videoTitle.id = "videotitle";
let channelTitle = document.createElement("p");
channelTitle.textContent = suggest.snippet.channelTitle;
let description = document.createElement("p");
description.textContent = suggest.snippet.description;
description.id = "desc";
description.width="100%";
thumbnail_div.append(thumbnail)
right_div.append(videoTitle,channelTitle,description);
suggestbox.append(thumbnail_div,right_div);
document.getElementById("suggestionsdiv").append(suggestbox);
})