mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
writable msd
This commit is contained in:
@@ -43,6 +43,8 @@ export function Msd() {
|
||||
|
||||
tools.radio.setOnClick("msd-mode-radio", __clickModeRadio);
|
||||
|
||||
tools.el.setOnClick($("msd-rw-switch"), __clickRwSwitch);
|
||||
|
||||
tools.el.setOnClick($("msd-select-new-button"), __toggleSelectSub);
|
||||
$("msd-new-file").onchange = __selectNewFile;
|
||||
$("msd-new-url").oninput = __selectNewUrl;
|
||||
@@ -88,6 +90,10 @@ export function Msd() {
|
||||
__sendParam("cdrom", tools.radio.getValue("msd-mode-radio"));
|
||||
};
|
||||
|
||||
var __clickRwSwitch = function() {
|
||||
__sendParam("rw", $("msd-rw-switch").checked);
|
||||
};
|
||||
|
||||
var __sendParam = function(name, value) {
|
||||
let http = tools.makeRequest("POST", `/api/msd/set_params?${name}=${encodeURIComponent(value)}`, function() {
|
||||
if (http.readyState === 4) {
|
||||
@@ -243,6 +249,9 @@ export function Msd() {
|
||||
tools.radio.setEnabled("msd-mode-radio", (online && s.features.cdrom && !s.drive.connected && !s.busy));
|
||||
tools.radio.setValue("msd-mode-radio", `${Number(online && s.features.cdrom && s.drive.cdrom)}`);
|
||||
|
||||
tools.el.setEnabled($("msd-rw-switch"), (online && s.features.rw && !s.drive.connected && !s.busy));
|
||||
$("msd-rw-switch").checked = (online && s.features.rw && s.drive.rw);
|
||||
|
||||
tools.el.setEnabled($("msd-connect-button"), (online && (!s.features.multi || s.drive.image) && !s.drive.connected && !s.busy));
|
||||
tools.el.setEnabled($("msd-disconnect-button"), (online && s.drive.connected && !s.busy));
|
||||
|
||||
@@ -289,6 +298,9 @@ export function Msd() {
|
||||
for (let el of $$$(".msd-cdrom-emulation")) {
|
||||
tools.feature.setEnabled(el, s.features.cdrom);
|
||||
}
|
||||
for (let el of $$$(".msd-rw")) {
|
||||
tools.feature.setEnabled(el, s.features.rw);
|
||||
}
|
||||
}
|
||||
|
||||
tools.hidden.setVisible($("msd-message-offline"), (s && !s.online));
|
||||
|
||||
Reference in New Issue
Block a user