mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-16 15:08:15 +08:00
Merge branch 'oopuuu:master' into master
This commit is contained in:
@@ -878,16 +878,21 @@ var tb_html = `
|
|||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < actions.length; i++) {
|
for (var i = 0; i < actions.length; i++) {
|
||||||
var rowId = `select-${i}`;
|
var rowId = `select-${i}`;
|
||||||
|
var index = parseInt(actions[i]);
|
||||||
|
var valueText = (isNaN(index) || index < 0 || index >= BTN_OPERATIONS.length) ? '未设置' : BTN_OPERATIONS[index];
|
||||||
|
|
||||||
tb_html += `
|
tb_html += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${i > 0 ? '连续' : ''}短按${i + 1}次</td>
|
<td>${i > 0 ? '连续' : ''}短按${i + 1}次</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label getmdl-select getmdl-select__fix-height">
|
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label getmdl-select getmdl-select__fix-height">
|
||||||
<input class="mdl-textfield__input" type="text" id="${rowId}-input" readonly value="${(parseInt(actions[i])<0||parseInt(actions[i])>7)?'未设置':BTN_OPERATIONS[actions[i]]}">
|
<input class="mdl-textfield__input" type="text" id="${rowId}-input" readonly value="${valueText}">
|
||||||
<input type="hidden" id="${rowId}-value" value="${actions[i]}">
|
<input type="hidden" id="${rowId}-value" value="${index}">
|
||||||
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu" for="${rowId}-input">
|
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu" for="${rowId}-input">
|
||||||
|
<li class="mdl-menu__item" data-val="-1" onclick="selectOperation('${rowId}', -1,BTN_OPERATIONS)">未设置</li>
|
||||||
${BTN_OPERATIONS.map((op, idx) =>
|
${BTN_OPERATIONS.map((op, idx) =>
|
||||||
`<li class="mdl-menu__item" data-val="${idx}" onclick="selectOperation('${rowId}', ${idx},BTN_OPERATIONS)">${op}</li>`
|
`<li class="mdl-menu__item" data-val="${idx}" onclick="selectOperation('${rowId}', ${idx},BTN_OPERATIONS)">${op}</li>`
|
||||||
).join('')}
|
).join('')}
|
||||||
@@ -1226,14 +1231,18 @@ var tb_html = `
|
|||||||
|
|
||||||
for (var i = 0; i < actions.length; i++) {
|
for (var i = 0; i < actions.length; i++) {
|
||||||
var rowId = `select-${i}`;
|
var rowId = `select-${i}`;
|
||||||
|
var index = parseInt(actions[i]);
|
||||||
|
var valueText = (isNaN(index) || index < 0 || index >= BTN_OPERATIONS.length) ? '未设置' : BTN_OPERATIONS[index];
|
||||||
|
|
||||||
tb_html += `
|
tb_html += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${i > 0 ? '连续' : ''}短按${i + 1}次</td>
|
<td>${i > 0 ? '连续' : ''}短按${i + 1}次</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label getmdl-select getmdl-select__fix-height">
|
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label getmdl-select getmdl-select__fix-height">
|
||||||
<input class="mdl-textfield__input" type="text" id="${rowId}-input" readonly value="${(parseInt(actions[i])<0||parseInt(actions[i])>7)?'未设置':BTN_OPERATIONS[actions[i]]}">
|
<input class="mdl-textfield__input" type="text" id="${rowId}-input" readonly value="${valueText}">
|
||||||
<input type="hidden" id="${rowId}-value" value="${actions[i]}">
|
<input type="hidden" id="${rowId}-value" value="${index}">
|
||||||
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu" for="${rowId}-input">
|
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu" for="${rowId}-input">
|
||||||
|
<li class="mdl-menu__item" data-val="-1" onclick="selectOperation('${rowId}', -1,BTN_OPERATIONS)">未设置</li>
|
||||||
${BTN_OPERATIONS.map((op, idx) =>
|
${BTN_OPERATIONS.map((op, idx) =>
|
||||||
`<li class="mdl-menu__item" data-val="${idx}" onclick="selectOperation('${rowId}', ${idx},BTN_OPERATIONS)">${op}</li>`
|
`<li class="mdl-menu__item" data-val="${idx}" onclick="selectOperation('${rowId}', ${idx},BTN_OPERATIONS)">${op}</li>`
|
||||||
).join('')}
|
).join('')}
|
||||||
@@ -1324,10 +1333,15 @@ componentHandler.upgradeDom();
|
|||||||
}, cmd);
|
}, cmd);
|
||||||
}
|
}
|
||||||
function selectOperation(rowId, index, operations) {
|
function selectOperation(rowId, index, operations) {
|
||||||
|
if (index === -1) {
|
||||||
|
document.getElementById(`${rowId}-input`).value = '未设置';
|
||||||
|
document.getElementById(`${rowId}-value`).value = -1;
|
||||||
|
} else {
|
||||||
var witch = parseInt(rowId.split('-')[1]);
|
var witch = parseInt(rowId.split('-')[1]);
|
||||||
const selectedText = operations[index];
|
const selectedText = operations[index];
|
||||||
document.getElementById(`${rowId}-input`).value = selectedText;
|
document.getElementById(`${rowId}-input`).value = selectedText;
|
||||||
document.getElementById(`${rowId}-value`).value = index;
|
document.getElementById(`${rowId}-value`).value = index;
|
||||||
|
}
|
||||||
HttpDel("/shortClickEvent", function (re) {
|
HttpDel("/shortClickEvent", function (re) {
|
||||||
ShowToast("已设置按钮事件");
|
ShowToast("已设置按钮事件");
|
||||||
}, `${witch} index`);
|
}, `${witch} index`);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ extern char socket_status[32];
|
|||||||
|
|
||||||
void UserLedSet(char x);
|
void UserLedSet(char x);
|
||||||
void KeyInit(void);
|
void KeyInit(void);
|
||||||
void UserRelaySet(unsigned char x,unsigned char y);
|
void UserRelaySet(unsigned char x, char y);
|
||||||
void UserRelaySetAll(char y);
|
void UserRelaySetAll(char y);
|
||||||
bool RelayOut(void);
|
bool RelayOut(void);
|
||||||
char* GetSocketStatus();
|
char* GetSocketStatus();
|
||||||
|
|||||||
Reference in New Issue
Block a user