let's go ca marche je pense

This commit is contained in:
piair 2023-08-26 13:14:32 +02:00
parent 6e25dcd115
commit fd8f972cf8
3 changed files with 6 additions and 11 deletions

View File

@ -4,9 +4,7 @@ function addline(ligne){
} }
function change_discord(value) { function change_discord(value, data) {
data = JSON.parse('{{data|tojson}}'); //convertit le dictionnaire data en JSON
if (value == "{{len}}"){ if (value == "{{len}}"){
document.getElementById("name").value = ""; document.getElementById("name").value = "";
document.getElementById("submit").value = "Create !"; document.getElementById("submit").value = "Create !";
@ -26,8 +24,7 @@ function change_discord(value) {
} }
} }
function change_config(value) { function change_config(value, data) {
data = JSON.parse('{{data|tojson}}'); //convertit le dictionnaire data en JSON
document.getElementById("delete").style.visibility = "hidden"; document.getElementById("delete").style.visibility = "hidden";
if (value == "{{len}}"){ if (value == "{{len}}"){
document.getElementById("submit").value = "Create !"; document.getElementById("submit").value = "Create !";
@ -73,6 +70,5 @@ function change_proxy(value, data) {
function change_logs(value) { function change_logs(value) {
console.log(value);
document.getElementById("embed").src = "/static/logs/" + value + ".txt"; document.getElementById("embed").src = "/static/logs/" + value + ".txt";
} }

View File

@ -42,17 +42,16 @@
{% block content %} {% block content %}
<script>data = JSON.parse('{{data|tojson}}'); </script>
{%if not current_user.is_authenticated %} {%if not current_user.is_authenticated %}
<button class="unselected" onclick="location.href = '/login';">login</button> <button class="unselected" onclick="location.href = '/login';">login</button>
{% else %} {% else %}
<form method="post" action="/config/"> <form method="post" action="/config/">
<table> <table>
<tr> <tr>
<td style="width: 10%;">config : </td> <td style="width: 10%;">config : </td>
<td style="width: 40%;"> <td style="width: 40%;">
<select onchange="change_config(this.value)" name="config"> <select onchange="change_config(this.value, data)" name="config">
<option id="config" value="{{len}}">New config</option> <option id="config" value="{{len}}">New config</option>
{% for i in configs %} {% for i in configs %}
<option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option> <option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option>

View File

@ -40,7 +40,7 @@
</table> </table>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<script>data = JSON.parse('{{data|tojson}}'); </script>
{%if not current_user.is_authenticated %} {%if not current_user.is_authenticated %}
<button class="unselected" onclick="location.href = '/login';">login</button> <button class="unselected" onclick="location.href = '/login';">login</button>
{% else %} {% else %}
@ -49,7 +49,7 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<select name="select" onchange="change_discord(this.value)"> <select name="select" onchange="change_discord(this.value, data)">
<option selected id="new" value="{{ len }}">Create new Discord config</option> <option selected id="new" value="{{ len }}">Create new Discord config</option>
{% for i in data %} {% for i in data %}
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option> <option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>