From 466ab6d880b4696fc52188fe1a4bb03b7d50442b Mon Sep 17 00:00:00 2001 From: piair Date: Fri, 25 Aug 2023 12:06:52 +0200 Subject: [PATCH] =?UTF-8?q?euh=20en=20gros=20:=20-=20j'ai=20boug=C3=A9=20p?= =?UTF-8?q?lus=20de=20JS=20dans=20le=20fichier=20main.js=20-=20j'ai=20chan?= =?UTF-8?q?g=C3=A9=20le=20css=20pour=20que=20les=20listes=20soient=20joli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Flask/static/css/flask.css | 3 ++ Flask/static/js/main.js | 69 +++++++++++++++++++++++++++++++++++ Flask/templates/config.html | 38 +------------------ Flask/templates/discord.html | 26 +------------ Flask/templates/proxy.html | 21 +---------- Flask/templates/settings.html | 10 ++--- 6 files changed, 80 insertions(+), 87 deletions(-) diff --git a/Flask/static/css/flask.css b/Flask/static/css/flask.css index 23c2079..d9ebf75 100644 --- a/Flask/static/css/flask.css +++ b/Flask/static/css/flask.css @@ -186,6 +186,9 @@ body { } +.content > ul { + display: inline-block; +} .container { display: flex; width: 100%; diff --git a/Flask/static/js/main.js b/Flask/static/js/main.js index 055d320..7f5a343 100644 --- a/Flask/static/js/main.js +++ b/Flask/static/js/main.js @@ -1,4 +1,73 @@ function addline(ligne){ var lplus = parseInt(ligne) + 1; document.getElementById("table").insertRow(lplus).insertCell(0).innerHTML = '' +} + + +function change_discord(value) { + data = JSON.parse('{{data|tojson}}'); //convertit le dictionnaire data en JSON + + if (value == "{{len}}"){ + document.getElementById("name").value = ""; + document.getElementById("submit").value = "Create !"; + document.getElementById("successT").checked = false; + document.getElementById("errorsT").checked = false; + document.getElementById("successL").value = ""; + document.getElementById("errorsL").value = ""; + } + else { + console.log(data[parseInt(value)]["successL"]); + document.getElementById("submit").value = "Update"; + document.getElementById("successT").checked = data[parseInt(value)]["successT"] == "True"; + document.getElementById("errorsT").checked = data[parseInt(value)]["errorsT"] == "True"; + document.getElementById("successL").value = data[parseInt(value)]["successL"]; + document.getElementById("errorsL").value = data[parseInt(value)]["errorsL"]; + document.getElementById("name").value = data[parseInt(value)]["name"]; + } +} + +function change_config(value) { + data = JSON.parse('{{data|tojson}}'); //convertit le dictionnaire data en JSON + document.getElementById("delete").style.visibility = "hidden"; + if (value == "{{len}}"){ + document.getElementById("submit").value = "Create !"; + document.getElementById("discord").value = "-1"; + document.getElementById("proxy").value = "-1"; + document.getElementById("name").value = ""; + for (let i = 1; i < 6; i++) { + document.getElementById("mail"+ i).value = ""; + document.getElementById("pwd"+ i).value = "" ; + document.getElementById("2fa"+ i).value = "" ; + } + } + else { + document.getElementById("delete").style.visibility = "visible"; + document.getElementById("submit").value = "Update !"; + document.getElementById("discord").value = data[parseInt(value)]["discord"]; + document.getElementById("proxy").value = data[parseInt(value)]["proxy"]; + document.getElementById("name").value = data[parseInt(value)]["name"]; + for (let i = 1; i < 6; i++) { + document.getElementById("mail"+ i).value = data[parseInt(value)]['accounts'][i]["mail"] ; + document.getElementById("pwd"+ i).value = data[parseInt(value)]['accounts'][i]["pwd"] ; + document.getElementById("2fa"+ i).value = data[parseInt(value)]['accounts'][i]["2fa"] ; + } + + } +} + + +function change_proxy(value) { + data = JSON.parse('{{data|tojson}}'); //convertit le dictionnaire data en JSON + if (value == "{{len}}"){ + document.getElementById("submit").value = "Create"; + document.getElementById("address").value = ""; + document.getElementById("port").value = ""; + document.getElementById("name").value = ""; + } + else { + document.getElementById("submit").value = "Update"; + document.getElementById("address").value = data[parseInt(value)]["address"]; + document.getElementById("port").value = data[parseInt(value)]["port"]; + document.getElementById("name").value = data[parseInt(value)]["name"]; + } } \ No newline at end of file diff --git a/Flask/templates/config.html b/Flask/templates/config.html index 6c4a9af..852b86a 100644 --- a/Flask/templates/config.html +++ b/Flask/templates/config.html @@ -47,7 +47,7 @@ config : - {% for i in configs %} @@ -136,41 +136,5 @@ - - - - - - {% endif %} {% endblock %} \ No newline at end of file diff --git a/Flask/templates/discord.html b/Flask/templates/discord.html index a7fae49..fb0f0f5 100644 --- a/Flask/templates/discord.html +++ b/Flask/templates/discord.html @@ -44,7 +44,7 @@ - {% for i in data %} @@ -85,30 +85,6 @@ - {% endif %} {% endblock %} \ No newline at end of file diff --git a/Flask/templates/proxy.html b/Flask/templates/proxy.html index 025cdad..d8efd48 100644 --- a/Flask/templates/proxy.html +++ b/Flask/templates/proxy.html @@ -48,7 +48,7 @@ - {% for i in data %} @@ -81,25 +81,6 @@ - - {% endif %} {% endblock %} diff --git a/Flask/templates/settings.html b/Flask/templates/settings.html index 61d7044..7e240b1 100644 --- a/Flask/templates/settings.html +++ b/Flask/templates/settings.html @@ -52,10 +52,10 @@ - + +

TODO


+

Backup config files