refactoring

This commit is contained in:
Maxim Devaev 2025-06-03 03:38:23 +03:00
parent 517e79fd65
commit 007371d30b
2 changed files with 21 additions and 12 deletions

View File

@ -484,18 +484,7 @@ export function Switch() {
<table style="width: 100%">
<tr>
<td>Simulate display on inactive port:</td>
<td align="right">
<div class="switch-box">
<input
type="checkbox" id="__switch-port-dummy-switch"
${pa.video.dummy ? "checked" : ""}
/>
<label for="__switch-port-dummy-switch">
<span class="switch-inner"></span>
<span class="switch"></span>
</label>
</div>
</td>
<td align="right">${tools.sw.makeItem("__switch-port-dummy-switch", pa.video.dummy)}</td>
</tr>
</table>
`;

View File

@ -265,6 +265,26 @@ export var tools = new function() {
};
};
self.sw = new function() {
return {
"makeItem": function(id, checked) {
id = tools.escape(id);
return `
<div class="switch-box">
<input
type="checkbox" id="${id}"
${checked ? "checked" : ""}
/>
<label for="${id}">
<span class="switch-inner"></span>
<span class="switch"></span>
</label>
</div>
`;
},
};
};
self.radio = new function() {
return {
"makeItem": function(name, title, value) {