Remastered domain mining interface!
This commit is contained in:
+32
-9
@@ -76,16 +76,39 @@
|
||||
|
||||
<!-- Domain mining -->
|
||||
<div class="tab content is-hidden" id="tab_domains">
|
||||
<div class="field is-grouped">
|
||||
<div class="control is-expanded has-icons-left">
|
||||
<input class="input is-expanded" type="text" placeholder="example.tld" id="new_domain" oninput="onDomainChange(this)">
|
||||
<span class="icon is-small is-left">
|
||||
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px;"><path d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"></path></svg>
|
||||
</span>
|
||||
<div class="field is-grouped is-fullwidth">
|
||||
<div class="control field has-addons is-expanded">
|
||||
<div class="control is-expanded has-icons-left">
|
||||
<input class="input is-expanded" type="text" placeholder="domain" id="new_domain" oninput="onDomainChange(this)">
|
||||
<span class="icon is-small is-left">
|
||||
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px;"><path d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Zones -->
|
||||
<div class="control">
|
||||
<div class="dropdown" onclick="toggle(this, event);" onblur="alert('blured!')">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button" aria-haspopup="true" aria-controls="zones-menu">
|
||||
<span id="zones-current-name">Select zone</span>
|
||||
<span class="icon is-small">
|
||||
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px;"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"></path></svg>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="zones-menu" role="menu">
|
||||
<div class="dropdown-content" id="zones-links">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons has-addons">
|
||||
<button id="add_record_button" class="button is-info is-light" onclick="showNewRecordDialog();">Add record</button>
|
||||
<button id="new_domain_button" class="button is-info" onclick="createDomain();">Mine domain</button>
|
||||
|
||||
<div class="control">
|
||||
<div class="buttons has-addons">
|
||||
<button id="add_record_button" class="button is-info is-light" onclick="showNewRecordDialog();">Add record</button>
|
||||
<button id="new_domain_button" class="button is-info" onclick="createDomain();">Mine domain</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help">Enter domain name, add some DNS-records, then hit the "Mine domain" button!</p>
|
||||
|
||||
+52
-7
@@ -1,16 +1,18 @@
|
||||
var recordsBuffer = [];
|
||||
var availableZones = [];
|
||||
var currentZone = "";
|
||||
|
||||
function addRecord(record) {
|
||||
recordsBuffer.push(record);
|
||||
refresh_records_list();
|
||||
refreshRecordsList();
|
||||
}
|
||||
|
||||
function delRecord(index) {
|
||||
recordsBuffer.splice(index, 1);
|
||||
refresh_records_list();
|
||||
refreshRecordsList();
|
||||
}
|
||||
|
||||
function refresh_records_list() {
|
||||
function refreshRecordsList() {
|
||||
var buf = "";
|
||||
if (recordsBuffer.length > 0) {
|
||||
buf = "<label class=\"label\">Records:</label>\n";
|
||||
@@ -66,7 +68,7 @@ function showNewRecordDialog() {
|
||||
button_negative.onclick = function() {
|
||||
var dialog = document.getElementById("new_record_dialog");
|
||||
dialog.className = "modal";
|
||||
refresh_records_list();
|
||||
refreshRecordsList();
|
||||
}
|
||||
|
||||
var dialog = document.getElementById("new_record_dialog");
|
||||
@@ -117,7 +119,12 @@ function openTab(element, tabName) {
|
||||
// Show the current tab, and add an "is-active" class to the button that opened the tab
|
||||
document.getElementById(tabName).className = "tab content";
|
||||
element.parentElement.className = "tab is-active";
|
||||
refresh_records_list();
|
||||
refreshRecordsList();
|
||||
}
|
||||
|
||||
function toggle(element, event) {
|
||||
event.stopPropagation();
|
||||
element.classList.toggle('is-active');
|
||||
}
|
||||
|
||||
function loadKey() {
|
||||
@@ -149,11 +156,13 @@ function recordOkay(okay) {
|
||||
function createDomain() {
|
||||
var new_domain = document.getElementById("new_domain").value.toLowerCase();
|
||||
var new_dom_records = JSON.stringify(recordsBuffer);
|
||||
external.invoke(JSON.stringify({cmd: 'mineDomain', name: new_domain, records: new_dom_records}));
|
||||
var domain = new_domain + "." + currentZone.name;
|
||||
external.invoke(JSON.stringify({cmd: 'mineDomain', name: domain, records: new_dom_records}));
|
||||
}
|
||||
|
||||
function domainMiningStarted() {
|
||||
recordsBuffer = [];
|
||||
refreshRecordsList();
|
||||
}
|
||||
|
||||
function createZone() {
|
||||
@@ -171,7 +180,8 @@ function sendAction(param) {
|
||||
}
|
||||
|
||||
function onDomainChange(element) {
|
||||
external.invoke(JSON.stringify({cmd: 'checkDomain', name: element.value}));
|
||||
var domain = element.value + "." + currentZone.name;
|
||||
external.invoke(JSON.stringify({cmd: 'checkDomain', name: domain}));
|
||||
}
|
||||
|
||||
function domainAvailable(available) {
|
||||
@@ -320,4 +330,39 @@ function keystoreChanged(path, pub_key, hash) {
|
||||
new_zone.disabled = false;
|
||||
var new_zone_difficulty = document.getElementById("new_zone_difficulty");
|
||||
new_zone_difficulty.disabled = false;
|
||||
}
|
||||
|
||||
function refreshZonesList() {
|
||||
var buf = "";
|
||||
availableZones.forEach(function(value, index, array) {
|
||||
var zone = value.name + " (" + value.difficulty + "🔥)";
|
||||
var add_class = "";
|
||||
if (currentZone.name == value.name) {
|
||||
add_class = "is-active";
|
||||
}
|
||||
buf += "<a id=\"zone-{1}\" class=\"dropdown-item {2}\" onclick=\"changeZone('{3}');\">.{4}</a>"
|
||||
.replace("{1}", value.name)
|
||||
.replace("{2}", add_class)
|
||||
.replace("{3}", value.name)
|
||||
.replace("{4}", zone);
|
||||
});
|
||||
var links = document.getElementById("zones-links");
|
||||
links.innerHTML = buf;
|
||||
var cur_name = document.getElementById("zones-current-name");
|
||||
cur_name.innerHTML = "." + currentZone.name + " (" + currentZone.difficulty + "🔥)";
|
||||
}
|
||||
|
||||
function zonesChanged(text) {
|
||||
availableZones = JSON.parse(text);
|
||||
currentZone = availableZones[0];
|
||||
refreshZonesList();
|
||||
}
|
||||
|
||||
function changeZone(zone) {
|
||||
availableZones.forEach(function(value, index, array) {
|
||||
if (value.name == zone) {
|
||||
currentZone = value;
|
||||
}
|
||||
});
|
||||
refreshZonesList();
|
||||
}
|
||||
Reference in New Issue
Block a user