-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresentations.js
72 lines (63 loc) · 1.6 KB
/
presentations.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
let workPackages = (function () {
pub = {};
makePkg = (title, presenter, url) => {
var videoSection = "";
if (url.includes("youtube")) {
videoSection = `<div class="w-container">
<div class="w-richtext">
<h2>${title}</h2>
<h3>${presenter}</h3>
<blockquote>
<iframe id="ytplayer" type="text/html" width="600px" height="360"
src="${url}"
frameborder="0" allowfullscreen></iframe>
</blockquote>
</div>
</div>
`;
} else {
videoSection = `<div class="w-container">
<div class="w-richtext">
<h2>${title}</h2>
<h3>${presenter}</h3>
<blockquote>
<video tabindex="0" controls="true" x-webkit-airplay="allow" preload="none" id="ytplayer" style="max-width: 1024px; max-height: 1024px; width: 600px; height: 360px;">
<source src="${url}" type="">
</video>
</blockquote>
</div>
</div>
`;
}
return videoSection;
};
displayPkgs = (pkgs) => {
pkgs.forEach((presentation) => {
let title = presentation.title;
let presenter = presentation.presenter;
let url = presentation.video_url;
$("#main-content").append(makePkg(title, presenter, url));
});
};
pub.setup = () => {
$.ajax({
type: "GET",
url: "presentations.json",
data: {
get_param: "value",
},
dataType: "json",
async: false,
success: function (data) {
let presentations = [];
presentations = data.presentations;
displayPkgs(presentations);
},
error: () => {
alert("Could not load presentation data.");
},
});
};
return pub;
})();
$(document).ready(pub.setup);