euh en gros :

- j'ai bougé plus de JS dans le fichier main.js
- j'ai changé le css pour que les listes soient joli
This commit is contained in:
piair 2023-08-25 12:06:52 +02:00
parent 6fb0698d18
commit 466ab6d880
6 changed files with 80 additions and 87 deletions

View File

@ -186,6 +186,9 @@ body {
}
.content > ul {
display: inline-block;
}
.container {
display: flex;
width: 100%;

View File

@ -2,3 +2,72 @@ function addline(ligne){
var lplus = parseInt(ligne) + 1;
document.getElementById("table").insertRow(lplus).insertCell(0).innerHTML = '<input type="file" id="file' + lplus + '" name="file' + lplus + '" onchange="addline(' + lplus + ')">'
}
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"];
}
}

View File

@ -47,7 +47,7 @@
<tr>
<td style="width: 10%;">config : </td>
<td style="width: 40%;">
<select onchange="changecat(this.value)" name="config">
<select onchange="change_config(this.value)" name="config">
<option id="config" value="{{len}}">New config</option>
{% for i in configs %}
<option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option>
@ -136,41 +136,5 @@
</form>
<script>
function changecat(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"] ;
}
}
}
</script>
{% endif %}
{% endblock %}

View File

@ -44,7 +44,7 @@
<tr>
<td></td>
<td>
<select name="select" onchange="changecat(this.value)">
<select name="select" onchange="change_discord(this.value)">
<option selected id="new" value="{{ len }}">Create new Discord config</option>
{% for i in data %}
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
@ -85,30 +85,6 @@
</tr>
</table>
</form>
<script>
function changecat(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"];
}
}
</script>
{% endif %}
{% endblock %}

View File

@ -48,7 +48,7 @@
<tr>
<td class="comlumn-name"></td>
<td>
<select name="select" onchange="changecat(this.value)">
<select name="select" onchange="change_proxy(this.value)">
<option selected id="new" value="{{ len }}">Create new proxy</option>
{% for i in data %}
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
@ -81,25 +81,6 @@
</form>
<script>
function changecat(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"];
}
}
</script>
{% endif %}
{% endblock %}

View File

@ -52,10 +52,10 @@
</td>
</tr>
</table>
</form>
<h2>TODO</h2>
<ul>
<li>TODO</li>
<li>reorder config</li>
<li>real override</li>
<li>ban button</li>
@ -63,8 +63,8 @@
<li>logs viewer</li>
</ul>
<br>
<h2>Backup config files</h2>
<ul>
<li><h2>Backup config files</h2></li>
<li><a href="/download/configs.json">download account config</a></li>
<li><a href="/download/discord.json">download discord config</a></li>
<li><a href="/download/flask.json">download flask config</a></li>
@ -76,8 +76,8 @@
<h2>Upload your files</h2>
<form method="POST" action="/upload_file/" enctype=multipart/form-data>
<table id="table">
<li><input type="file" id="file1" name="file1" onchange='addline(0)'></li>
<li><input type="submit" name="settings" id="submit" value="send file" class="button"/></li>
<tr><td><input type="file" id="file1" name="file1" onchange='addline(0)'></td></tr>
<tr><td><input type="submit" name="settings" id="submit" value="send file" class="button"/></td></tr>
</table>
</form>