2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-18 21:26:38 +00:00

Fixed operation with zones in JS.

This commit is contained in:
Revertron 2021-04-01 12:09:38 +02:00
parent 89cb23306a
commit 11bc887fbb

View File

@ -1,6 +1,6 @@
var recordsBuffer = []; var recordsBuffer = [];
var availableZones = []; var availableZones = [];
var currentZone = ""; var currentZone;
function addRecord(record) { function addRecord(record) {
recordsBuffer.push(record); recordsBuffer.push(record);
@ -180,8 +180,10 @@ function sendAction(param) {
} }
function onDomainChange(element) { function onDomainChange(element) {
var domain = element.value + "." + currentZone.name; if (typeof currentZone !== 'undefined') {
external.invoke(JSON.stringify({cmd: 'checkDomain', name: domain})); var domain = element.value + "." + currentZone.name;
external.invoke(JSON.stringify({cmd: 'checkDomain', name: domain}));
}
} }
function domainAvailable(available) { function domainAvailable(available) {
@ -337,7 +339,7 @@ function refreshZonesList() {
availableZones.forEach(function(value, index, array) { availableZones.forEach(function(value, index, array) {
var zone = value.name + " (" + value.difficulty + "🔥)"; var zone = value.name + " (" + value.difficulty + "🔥)";
var add_class = ""; var add_class = "";
if (currentZone.name == value.name) { if (typeof currentZone !== 'undefined' && currentZone.name == value.name) {
add_class = "is-active"; add_class = "is-active";
} }
buf += "<a id=\"zone-{1}\" class=\"dropdown-item {2}\" onclick=\"changeZone('{3}');\">.{4}</a>" buf += "<a id=\"zone-{1}\" class=\"dropdown-item {2}\" onclick=\"changeZone('{3}');\">.{4}</a>"
@ -348,8 +350,10 @@ function refreshZonesList() {
}); });
var links = document.getElementById("zones-links"); var links = document.getElementById("zones-links");
links.innerHTML = buf; links.innerHTML = buf;
var cur_name = document.getElementById("zones-current-name"); if (typeof currentZone !== 'undefined') {
cur_name.innerHTML = "." + currentZone.name + " (" + currentZone.difficulty + "🔥)"; var cur_name = document.getElementById("zones-current-name");
cur_name.innerHTML = "." + currentZone.name + " (" + currentZone.difficulty + "🔥)";
}
} }
function zonesChanged(text) { function zonesChanged(text) {