summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules-available/usblockoff/templates/usb-edit-rule.html26
1 files changed, 14 insertions, 12 deletions
diff --git a/modules-available/usblockoff/templates/usb-edit-rule.html b/modules-available/usblockoff/templates/usb-edit-rule.html
index 55cdce0d..e2bc5b65 100644
--- a/modules-available/usblockoff/templates/usb-edit-rule.html
+++ b/modules-available/usblockoff/templates/usb-edit-rule.html
@@ -31,39 +31,41 @@
<script>
var idArray = {{{usbJson}}};
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function() {
$('.switch-input').click(function() {
var $op = $(this).parent().find('select');
var val = $op.val();
$op.replaceWith($('<input class="form-control" type="text">').attr('name', $op.attr('name')).val(val));
});
- var vid = $('#prop-vid').val();
- var pid = $('#prop-pid').val();
- $('#prop-vid').empty();
+ var vendorid = $('#prop-vid');
+ var productid = $('#prop-pid');
+
+ var vid = vendorid.val();
+ vendorid.empty();
$('[id^="prop-"]').change(function () {
updateAttributes();
});
- $('#prop-vid').change(function () {
+ vendorid.change(function () {
var $this = $(this);
var vid = $this.val();
- var pid = $('#prop-pid').val();
- $('#prop-pid').empty();
+ var pid = productid.val();
+ productid.empty();
$.each(idArray[vid]['products'], function(key, value) {
- $('#prop-pid').append($('<option></option>').val(key).html(value));
+ productid.append($('<option></option>').val(key).html(value));
});
- $("#prop-pid").val(pid);
+ productid.val(pid);
});
$.each(idArray, function(key, value) {
- $('#prop-vid').append($('<option></option>').val(key).html(value['name']));
+ vendorid.append($('<option></option>').val(key).html(value['name']));
});
- $("#prop-vid").val(vid);
- $("#prop-vid").change();
+ vendorid.val(vid);
+ vendorid.change();
});
function updateAttributes() {