ultrawidify/js/lib/libghettoui/settings/ActionItem.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-12-01 01:35:22 +01:00
class ActionItem extends BaseElement {
constructor(id, action, onClick) {
2018-12-13 23:09:29 +01:00
super(id, undefined, onClick, undefined, document.createElement('tr'));
this.element.classList.add("action-list-item");
2018-12-01 01:35:22 +01:00
2018-12-13 23:09:29 +01:00
let cmd = "";
2018-12-01 01:35:22 +01:00
for (var c in action.cmd) {
2018-12-13 23:09:29 +01:00
cmd += `${c > 0 ? '; ' : ''}${action.cmd[0].action} ${action.cmd[0].arg}`
2018-12-01 01:35:22 +01:00
}
2018-12-13 23:09:29 +01:00
this.element.innerHTML = `
<td class="cmd monospace">${cmd}</td>
<td class="label">${action.label ? action.label : ""}</td>
<td class="shortcut">${action.parsedShortcut ? action.parsedShortcut : ""}</td>
<td class="checkbox">
<input type="checkbox" disabled ${
action.shortcut && action.shortcut.length && (action.shortcut[0].onMouseMove || action.shortcut[0].onClick || action.shortcut[0].onScroll) ?
"checked" : ""
}>
</td>
<td class="checkbox">
<input type="checkbox" disabled ${action.popup_global ? "checked" : ""}>
</td>
<td class="checkbox">
<input type="checkbox" disabled ${action.popup_site ? "checked" : ""}>
</td>
<td class="checkbox">
<input type="checkbox" disabled ${action.popup_ ? "checked" : ""}>
</td>
<td class="checkbox">
<input type="checkbox" disabled ${action.ui ? "checked" : ""}>
</td>
<td>${action.ui_path ? action.ui_path : ""}</td>
`;
2018-12-01 01:35:22 +01:00
}
}