diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..1e75e36 --- /dev/null +++ b/css/index.css @@ -0,0 +1,8 @@ +.mediatile{ + background-color: aqua; + height: 40mm; + width: 40mm; + margin: 3mm; + float: left; + font-size: 10pt; +} diff --git a/index.html b/index.html index 566549b..cb87d4a 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,25 @@ + - Title + HomeMediaCenter + + + + + +
+
vid1
+
vid2
+
\ No newline at end of file diff --git a/js/BaseRequest.js b/js/BaseRequest.js new file mode 100644 index 0000000..c3b9b0e --- /dev/null +++ b/js/BaseRequest.js @@ -0,0 +1,33 @@ +class Req { + static post(url, data, callback) { + const xhttp = new XMLHttpRequest(); + xhttp.open("POST",url,true); + xhttp.onload = function(){ + if (this.readyState == 4 && this.status == 200) { + callback(JSON.parse(xhttp.responseText)); + } + } + xhttp.onerror = function () { + console.log("error") + }; + xhttp.send(data); + } + + static get(url, callback) { + const xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function(){ + if (this.readyState == 4 && this.status == 200) { + callback(JSON.parse(xhttp.responseText)); + }else{ + console.log("err") + } + } + + xhttp.open("GET",url,true); + xhttp.send(); + } + + static ready(callback){ + document.addEventListener('DOMContentLoaded', callback); + } +} \ No newline at end of file diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..9b5c0dd --- /dev/null +++ b/js/index.js @@ -0,0 +1,9 @@ +Req.ready((event) => { + Req.post("php/movie.php", "action=getMovies", function (dta) { + console.log(dta); + // for (const ii in dta.movies) { + // document.getElementsByClassName("mediawrapper").item(0).insertAdjacentHTML('beforeend', ` + //
${dta.movies[ii].title}
`); + // } + }); +}); \ No newline at end of file diff --git a/php/movie.php b/php/movie.php new file mode 100644 index 0000000..b8efbbe --- /dev/null +++ b/php/movie.php @@ -0,0 +1,6 @@ +