diff --git a/api.php b/api.php new file mode 100644 index 0000000..c1c74c9 --- /dev/null +++ b/api.php @@ -0,0 +1,14 @@ + { + console.log("App start"); + + const form = document.querySelector(".main-form"); + const startBtn = document.querySelector("[data-start-download]"); + const urlToPlaylistInp = document.querySelector("[name='url-to-playlist']"); + const playlistNameInp = document.querySelector("[name='playlist-name']"); + + form.resetValidationClasses = () => form.querySelectorAll(".is-invalid").forEach(i => i.classList.remove("is-invalid")); + + form.querySelectorAll("input").forEach(i => i.addEventListener("input", e => { + e.currentTarget.classList.remove("is-invalid"); + })); + + startBtn.addEventListener("click", e => { + if(startBtn.classList.contains("disabled")) { + return; + } + + form.resetValidationClasses(); + + let plUrl = urlToPlaylistInp.value; + let plName = playlistNameInp.value; + let dataIsValid = true; + + if(!plUrl.length || !validateURL(plUrl)) { + urlToPlaylistInp.classList.add("is-invalid"); + dataIsValid = false; + } + + if(plName.length < 4) { + playlistNameInp.classList.add("is-invalid"); + dataIsValid = false; + } + + if(!dataIsValid) { + return; + } + + + }); +}); diff --git a/index.html b/index.html new file mode 100644 index 0000000..4387297 --- /dev/null +++ b/index.html @@ -0,0 +1,31 @@ + + + GN Music Loader + + + + + + + +
+

Music Loader

+

Просто вставь ссылку на плейлист, дай ему новое название и через некоторое время этот плейлист станет доступен в общей медиатеке

+
+
+ + +
+
+ + +
+ + +
+
+ + + + + diff --git a/style.css b/style.css new file mode 100644 index 0000000..72989f3 --- /dev/null +++ b/style.css @@ -0,0 +1,3 @@ +body > .container:first-of-type { + margin-top: 50px; +}