1
0
This repository has been archived on 2025-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
siadrive/SiaDrive/res/code.js
2017-02-16 22:30:49 -06:00

75 lines
1.8 KiB
JavaScript

function setValue(elementName, data) {
var elem = document.getElementById(elementName);
elem.value = data;
}
function setInnerText(elementName, data) {
var elem = document.getElementById(elementName);
elem.innerText = data;
}
function getInnerText(elementName) {
var elem = document.getElementById(elementName);
return elem.innerText;
}
function getValue(elementName) {
var elem = document.getElementById(elementName);
return elem.value;
}
function setWalletUnlockPassword(pwd) {
setValue("ID_WalletUnlockPwd", pwd);
}
function getWalletUnlockPassword() {
return getValue("ID_WalletUnlockPwd");
}
function setWalletReceiveAddress(address) {
setInnerText("ID_WalletReceiveAddress", address);
}
function getWalletReceiveAddress() {
return getInnerText("ID_WalletReceiveAddress");
}
function setWalletTotalBalance(balance) {
setInnerText("ID_WalletTotalBalance", balance);
}
function setWalletConfirmedBalance(balance) {
setInnerText("ID_WalletConfirmedBalance", balance);
}
function setWalletUnconfirmedBalance(balance) {
setInnerText("ID_WalletBalanceUnconfirmed", balance);
}
function setClientVersion(version) {
setInnerText("ID_ClientVersion", version);
}
function setServerVersion(version) {
setInnerText("ID_ServerVersion", version);
}
function setAvailableDrives(driveList) {
driveList = Array.isArray(driveList) ? driveList : JSON.parse(driveList);
var sel = document.getElementById("MountDrives");
sel.innerHTML = "";
for (var i in driveList) {
if (driveList.hasOwnProperty(i)) {
var drive = driveList[i];
var option = document.createElement("option");
option.innerText = drive + ":";
sel.appendChild(option);
}
}
}