-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (40 loc) · 1.87 KB
/
main.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
var redirectUrl = "https://www.youtube.com/c/BizDayGlobal/videos";
var imgDir = "./automated-images/";
var url = "https://api.github.com/repos/bridgetownpartners/BizDayGlobal-live/git/trees/master"; // master/assets/automated-images
var fileextension = ".png";
var fileextensionJpg = ".jpg";
var fileextensionJpeg = ".jpeg";
$.ajax({
url: url,
cors: true,
type: 'GET',
secure: true,
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "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")
},
success: function (automatedImages) {
automatedImages.tree.map((automatedImage) => {
if (automatedImage.path === 'automated-images') {
$.ajax({
url: automatedImage.url,
cors: true,
type: 'GET',
secure: true,
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "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")
},
success: function (autoImages) {
console.log(autoImages)
autoImages.tree.map((imageObj) => {
if (imageObj.path.includes(fileextension) || imageObj.path.includes(fileextensionJpg) || imageObj.path.includes(fileextensionJpeg)) {
$('#biz-day-card__wrapper').append(
"<a href='" + redirectUrl + "' target='_blank' class='bizday_card_topic bizday_card_topic--has-image' style='background-image: url(" + imgDir + encodeURIComponent(imageObj.path) + "); background-size: cover; background-repeat: no-repeat; background-position: center center;'></a>"
);
}
});
}
})
}
})
}
});