Implemented mining zone screen. Added a lot of user input checks.
This commit is contained in:
@@ -128,6 +128,7 @@
|
||||
<p class="menu-label">Domain management</p>
|
||||
<ul class="menu-list">
|
||||
<li><a onclick="openTab(this, 'dom_new')">Mine domain</a></li>
|
||||
<li><a onclick="openTab(this, 'zone_new')">Mine zone</a></li>
|
||||
<!--<li><a onclick="openTab(this, 'dom_edit')">Manage domain</a></li>
|
||||
<li><a onclick="openTab(this, 'dom_renew')">Renew domain</a></li>
|
||||
<li><a onclick="openTab(this, 'dom_transfer')">Transfer domain</a></li>-->
|
||||
@@ -209,6 +210,37 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content is-hidden" id="zone_new">
|
||||
<form action="#">
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Zone name</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" placeholder="ygg" id="new_zone" oninput="onZoneChange()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Difficulty (for all domains in zone)</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" placeholder="20" id="new_zone_difficulty" oninput="onZoneChange()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
<button class="button is-link" id="new_zone_button" onclick="createZone();" disabled>Mine zone</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content is-hidden" id="dom_edit">
|
||||
<form action="#">
|
||||
<div class="field">
|
||||
|
||||
+46
-2
@@ -131,7 +131,17 @@ function createDomain() {
|
||||
recordsBuffer = [];
|
||||
}
|
||||
|
||||
function changeDomain() {
|
||||
function createZone() {
|
||||
new_zone = document.getElementById("new_zone").value;
|
||||
difficulty = document.getElementById("new_zone_difficulty").value;
|
||||
obj = {};
|
||||
obj.name = new_zone;
|
||||
obj.difficulty = difficulty;
|
||||
data = JSON.stringify(obj);
|
||||
external.invoke(JSON.stringify({cmd: 'createZone', name: new_zone, data: data}));
|
||||
}
|
||||
|
||||
/*function changeDomain() {
|
||||
domain = document.getElementById("change_domain").value;
|
||||
dom_records = document.getElementById("change_domain_records").value;
|
||||
dom_tags = document.getElementById("change_domain_records").value;
|
||||
@@ -148,7 +158,7 @@ function transferDomain() {
|
||||
domain = document.getElementById("transfer_domain").value;
|
||||
new_owner = document.getElementById("transfer_domain_transfer_owner").value;
|
||||
external.invoke(JSON.stringify({cmd: 'transferDomain', name: domain, owner: new_owner}));
|
||||
}
|
||||
}*/
|
||||
|
||||
function sendAction(param) {
|
||||
external.invoke(JSON.stringify(param));
|
||||
@@ -170,6 +180,40 @@ function domainAvailable(available) {
|
||||
}
|
||||
}
|
||||
|
||||
function onZoneChange() {
|
||||
button = document.getElementById("new_zone_button");
|
||||
diff = document.getElementById("new_zone_difficulty");
|
||||
d = parseInt(diff.value);
|
||||
// Checking for NaN first
|
||||
if (d != d || d < 20 || d > 50) {
|
||||
button.disabled = true;
|
||||
diff.className = "input is-danger";
|
||||
} else {
|
||||
diff.className = "input";
|
||||
input = document.getElementById("new_zone");
|
||||
external.invoke(JSON.stringify({cmd: 'checkZone', name: input.value}));
|
||||
}
|
||||
}
|
||||
|
||||
function zoneAvailable(available) {
|
||||
input = document.getElementById("new_zone");
|
||||
button = document.getElementById("new_zone_button");
|
||||
if (available) {
|
||||
input.className = "input";
|
||||
button.disabled = false;
|
||||
diff = document.getElementById("new_zone_difficulty");
|
||||
d = parseInt(diff.value);
|
||||
// Checking for NaN first
|
||||
if (d != d || d < 20 || d > 50) {
|
||||
button.disabled = true;
|
||||
diff.className = "input is-danger";
|
||||
}
|
||||
} else {
|
||||
input.className = "input is-danger";
|
||||
button.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
function showModalDialog(text, callback) {
|
||||
message = document.getElementById("modal_text");
|
||||
message.textContent = text;
|
||||
|
||||
Reference in New Issue
Block a user