diff --git a/button-style.css b/button-style.css new file mode 100644 index 0000000..2f7b2f2 --- /dev/null +++ b/button-style.css @@ -0,0 +1,120 @@ + /* ***** Colors - Start ***** */ + /* ***** Colors - End ***** */ + /* ***** Global Styles - Start ***** */ + * { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: "Poppins", sans-serif; + } + + + .container-switch { + display: flex; + justify-content: center; + align-items: center; + } + + /* ***** Global Styles - End ***** */ + /* ***** Specific Styles - Start ***** */ + + + .switch { + width: 60px; + height: 110px; + padding-top: 2px; + background-color: #514e4b; + border-radius: 40px; + cursor: pointer; + outline: none; + overflow: hidden; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + } + + .toggle-button { + transform: scale(0.8); + transform-origin: center center; + } + + .toggle { + position: relative; + width: 35px; + height: 35px; + margin: 12px; + margin-top: 12px; + background-color: #fff; + border-radius: 50%; + } + + .moon-mask { + position: absolute; + width: 35px; + height: 35px; + margin: -74px 0 0 34px; + background-color: #514e4b; + border-radius: 50%; + } + + .circle { + position: absolute; + width: 4px; + height: 8px; + background-color: #fff; + border-radius: 10px; + } + + .circle:first-child { + margin: -57px 0 0 27px; + } + + .circle:nth-child(2) { + margin: -9px 0 0 28px; + } + + .circle:nth-child(3) { + margin: -32px 0 0 51px; + transform: rotate(90deg); + } + + .circle:nth-child(4) { + margin: -33px 0 0 4px; + transform: rotate(90deg); + } + + .circle:nth-child(5) { + margin: -14px 0 0 10px; + transform: rotate(45deg); + } + + .circle:nth-child(6) { + margin: -14px 0 0 45px; + transform: rotate(320deg); + } + + .circle:nth-child(7) { + margin: -50px 0 0 10px; + transform: rotate(135deg); + } + + .circle:nth-child(8) { + margin: -50px 0 0 45px; + transform: rotate(235deg); + } + + .text p { + margin-left: 5px; + font-size: 55px; + line-height: 1.1; + font-weight: 700; + } + + .social-icons { + display: flex; + justify-content: space-between; + position: fixed; + bottom: 20px; + right: 20px; + width: 70px; + } + + /* ***** Specific Styles - End ***** */ diff --git a/generator.js b/generator.js new file mode 100644 index 0000000..50077fd --- /dev/null +++ b/generator.js @@ -0,0 +1,98 @@ +function changeColor() { + document.body.classList.toggle('dark') + return +} +const animate = gsap.timeline({ paused: true }); +const animateBackground = new TimelineMax({ paused: true }); +let toggle = true; + +animateBackground + .set(".switch", { boxShadow: "0 0 10px rgba(255, 255, 255, 0.2)" }) + .to(".text p", 0.1, { color: "#FFF" }, 0.1); + +animate + .set(".circle", { backgroundColor: "rgba(0,0,0,0)" }, 0.2) + .to(".toggle-button", 0.1, { scale: 0.7 }, 0) + .set(".toggle", { backgroundColor: "#FFF" }) + .to(".moon-mask", 0.2, { translateY: 20, translateX: -10 }, 0.3) + .to(".toggle-button", 0.1, { translateY: 49 }, 0.1) + .to(".toggle-button", 0.1, { scale: 0.9 }) + +document.getElementsByClassName("switch")[0].addEventListener("click", () => { + if (toggle) { + animate.restart(); + animateBackground.restart(); + } else { + animate.reverse(); + animateBackground.reverse(); + } + toggle = !toggle; + changeColor() +}); + +function insert(pos, id, placeholder) { + let input = document.createElement('input') + input.type = 'text' + input.id = id + input.placeholder = placeholder + input.oninput = () => { generate('generator_body') } + document.querySelector(pos).appendChild(input) +} +function removeLast(pos) { + console.log(document.querySelector(pos).lastChild.tagName); + if (document.querySelector(pos).lastChild.tagName != 'INPUT') { + return + } + document.querySelector(pos).removeChild(document.querySelector(pos).lastChild) +} +function generate(params) { + let form = document.getElementById(params) + // console.log(form) + let list = form.querySelectorAll('input') + let finalArgs = [] + for (let index = 0; index < list.length; index++) { + const element = list[index]; + switch (element.type) { + case 'text': + if (element.value.length != 0) { + if (element.id != 'input') { + finalArgs.push('--' + element.id + ' "' + element.value + '"') + + } else { + finalArgs.push('"' + element.value + '"') + } + } + break; + case 'checkbox': + + if (element.checked != Boolean(element.getAttribute('default'))) { + finalArgs.push('--' + element.id) + finalArgs.push(String(element.checked)) + } + break; + + default: + break; + } + // console.log(element.type + ' ' + element.id + ' value:[' + element.value + '] ' + element.placeholder) + } + let list2 = form.querySelectorAll('select') + for (let index = 0; index < list2.length; index++) { + const element = list2[index]; + let opt = element.options[element.selectedIndex] + if (opt.value === '' || opt.hidden) { + // console.log(element.type + ' ' + element.id + ' ' + 'hidden') + } else { + if (element.value.length != 0) { + finalArgs.push('--' + element.id + ' "' + opt.value + '"') + } + // console.log(element.type + ' ' + element.id + ' ' + opt.value) + } + } + document.getElementById('output').textContent = 'N_m3u8DL-RE.exe ' + finalArgs.join(" ") + console.log(finalArgs.join(" ")) +} +generate('generator_body') +for (const input of document.querySelectorAll('input')) { + input.addEventListener('input', () => generate('generator_body')) +} \ No newline at end of file diff --git a/generator.html b/index.html similarity index 56% rename from generator.html rename to index.html index cac6edb..964c890 100644 --- a/generator.html +++ b/index.html @@ -1,865 +1,360 @@ - - - -
- -