-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
132 lines (101 loc) · 3.41 KB
/
Copy pathscripts.js
File metadata and controls
132 lines (101 loc) · 3.41 KB
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
var files = [];
function loadDoc() {
// var xhttp = new XMLHttpRequest();
// xhttp.onreadystatechange = function () {
// if (this.readyState == 4 && this.status == 200) {
// myFunction(this);
// }
// };
// xhttp.open("GET", "https://api.github.com/repos/jadrsamara/Multimedia/contents/media/", true);
// xhttp.send();
files = ['Nobody', 'PeakyBlinders', 'Tenet', 'Godfather',
'Interstellar', 'DriveToSurvive', 'Vikings', 'PersonOfInterest', 'TheWitcher'];
load();
}
function myFunction(xml) {
console.log(xml.responseText);
// response = JSON.parse(xml.responseText);
// response.forEach(element => {
// files.push(element.name);
// });
load();
}
loadDoc();
function addDiv(name) {
var node = document.createElement("div");
node.className = "video";
node.addEventListener("mouseover", function () {
chbg(name);
}, false);
node.addEventListener("mouseout", function () {
chbg_out();
}, false);
var a = document.createElement("a");
a.addEventListener("click", function () {
myHandler(name);
}, false);
a.id = name;
a.href = "/Multimedia/video.html";
var img = document.createElement("img");
img.className = "imgg";
img.src = "https://raw.githubusercontent.com/jadrsamara/Multimedia/main/media/" + name + "/" + name + ".jpg";
var div = document.createElement("div");
div.className = "box";
var h2 = document.createElement("h2");
h2.innerHTML = name;
div.appendChild(h2);
var p = document.createElement("p");
fetch("https://raw.githubusercontent.com/jadrsamara/Multimedia/main/media/" + name + "/description.txt")
.then(r => r.text())
.then(t => {
if (t.includes("class=\"meta\"")) {
p.innerHTML = t;
} else {
p.innerHTML = "<p></p><p>No description.</p><p></p>";
}
});
div.appendChild(p);
node.appendChild(a);
a.appendChild(img);
a.appendChild(div);
const container = document.getElementById("container");
container.appendChild(node);
}
function load() {
for (i = 0; i < files.length; i++) {
addDiv(files[i]);
}
}
// ***************************************************************************************
// loadfile('PeakyBlinders/description.txt');
function loadfile(path) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
myFunctionFile(this);
}
};
xhttp.open("GET", "https://raw.githubusercontent.com/jadrsamara/Multimedia/main/media/" + path, true);
xhttp.send();
}
function myFunctionFile(xml) {
console.log(xml.responseText);
}
var movie = "null";
// your handler
function myHandler(e) {
movie = e;
sessionStorage.setItem("movie", movie);
}
function chbg(background) {
document.body.style.backgroundImage = "url(https://raw.githubusercontent.com/jadrsamara/Multimedia/main/media/" + background + "/" + background + ".jpg" + ")";
$(".video").hover(function () {
$(this).css("background-color", "rgba(29, 29, 29, 0.507)")
});
$(".video").mouseover(function () {
$(this).css("background-color", "rgb(0, 0, 0, 0.75)")
});
}
function chbg_out() {
document.body.style.backgroundImage = 'url(https://raw.githubusercontent.com/jadrsamara/Multimedia/main/color.PNG)';
}