Spaces:
Sleeping
Sleeping
Update settings.html
Browse files- settings.html +17 -18
settings.html
CHANGED
|
@@ -35,16 +35,23 @@
|
|
| 35 |
border-radius: 4px;
|
| 36 |
}
|
| 37 |
button {
|
| 38 |
-
background-color: #4CAF50;
|
| 39 |
-
color: white;
|
| 40 |
padding: 10px 20px;
|
| 41 |
border: none;
|
| 42 |
border-radius: 4px;
|
| 43 |
cursor: pointer;
|
| 44 |
margin-top: 20px;
|
| 45 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
button:hover {
|
| 47 |
-
|
| 48 |
}
|
| 49 |
</style>
|
| 50 |
</head>
|
|
@@ -52,7 +59,7 @@
|
|
| 52 |
|
| 53 |
<form id="settingsForm">
|
| 54 |
<label for="api_key_sys">api_key_sys:</label>
|
| 55 |
-
<input type="text" id="api_key_sys" name="api_key_sys" onblur="saveApiKeySys()"
|
| 56 |
|
| 57 |
<label for="crypto_key_sys">crypto_key_sys:</label>
|
| 58 |
<input type="text" id="crypto_key_sys" name="crypto_key_sys"><br><br>
|
|
@@ -75,7 +82,8 @@
|
|
| 75 |
<label for="call_api_key">call_api_key:</label>
|
| 76 |
<input type="text" id="call_api_key" name="call_api_key"><br><br>
|
| 77 |
|
| 78 |
-
<button type="button" onclick="saveSettings()"
|
|
|
|
| 79 |
</form>
|
| 80 |
|
| 81 |
<script>
|
|
@@ -84,7 +92,6 @@
|
|
| 84 |
const apiKeySys = localStorage.getItem('api_key_sys');
|
| 85 |
if (apiKeySys) {
|
| 86 |
document.getElementById('api_key_sys').value = apiKeySys;
|
| 87 |
-
hideApiKeySys();
|
| 88 |
}
|
| 89 |
|
| 90 |
fetch('/load_settings', {
|
|
@@ -131,21 +138,13 @@
|
|
| 131 |
.catch(error => console.error('Error:', error));
|
| 132 |
}
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
function saveApiKeySys() {
|
| 135 |
const apiKeySys = document.getElementById('api_key_sys').value;
|
| 136 |
localStorage.setItem('api_key_sys', apiKeySys);
|
| 137 |
-
hideApiKeySys();
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
function showApiKeySys() {
|
| 141 |
-
const apiKeySys = localStorage.getItem('api_key_sys');
|
| 142 |
-
document.getElementById('api_key_sys').value = apiKeySys;
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
function hideApiKeySys() {
|
| 146 |
-
const apiKeySys = localStorage.getItem('api_key_sys');
|
| 147 |
-
const hiddenValue = '*'.repeat(apiKeySys.length);
|
| 148 |
-
document.getElementById('api_key_sys').value = hiddenValue;
|
| 149 |
}
|
| 150 |
|
| 151 |
window.onload = loadSettings;
|
|
|
|
| 35 |
border-radius: 4px;
|
| 36 |
}
|
| 37 |
button {
|
|
|
|
|
|
|
| 38 |
padding: 10px 20px;
|
| 39 |
border: none;
|
| 40 |
border-radius: 4px;
|
| 41 |
cursor: pointer;
|
| 42 |
margin-top: 20px;
|
| 43 |
}
|
| 44 |
+
button.save {
|
| 45 |
+
background-color: #4CAF50;
|
| 46 |
+
color: white;
|
| 47 |
+
}
|
| 48 |
+
button.refresh {
|
| 49 |
+
background-color: #FFA500;
|
| 50 |
+
color: white;
|
| 51 |
+
margin-left: 10px;
|
| 52 |
+
}
|
| 53 |
button:hover {
|
| 54 |
+
opacity: 0.8;
|
| 55 |
}
|
| 56 |
</style>
|
| 57 |
</head>
|
|
|
|
| 59 |
|
| 60 |
<form id="settingsForm">
|
| 61 |
<label for="api_key_sys">api_key_sys:</label>
|
| 62 |
+
<input type="text" id="api_key_sys" name="api_key_sys" onblur="saveApiKeySys()"><br><br>
|
| 63 |
|
| 64 |
<label for="crypto_key_sys">crypto_key_sys:</label>
|
| 65 |
<input type="text" id="crypto_key_sys" name="crypto_key_sys"><br><br>
|
|
|
|
| 82 |
<label for="call_api_key">call_api_key:</label>
|
| 83 |
<input type="text" id="call_api_key" name="call_api_key"><br><br>
|
| 84 |
|
| 85 |
+
<button type="button" class="save" onclick="saveSettings()">Сохранить данные</button>
|
| 86 |
+
<button type="button" class="refresh" onclick="refreshSettings()">Обновить данные</button>
|
| 87 |
</form>
|
| 88 |
|
| 89 |
<script>
|
|
|
|
| 92 |
const apiKeySys = localStorage.getItem('api_key_sys');
|
| 93 |
if (apiKeySys) {
|
| 94 |
document.getElementById('api_key_sys').value = apiKeySys;
|
|
|
|
| 95 |
}
|
| 96 |
|
| 97 |
fetch('/load_settings', {
|
|
|
|
| 138 |
.catch(error => console.error('Error:', error));
|
| 139 |
}
|
| 140 |
|
| 141 |
+
function refreshSettings() {
|
| 142 |
+
loadSettings();
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
function saveApiKeySys() {
|
| 146 |
const apiKeySys = document.getElementById('api_key_sys').value;
|
| 147 |
localStorage.setItem('api_key_sys', apiKeySys);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
window.onload = loadSettings;
|