summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-07-23 14:31:40 +0200
committerJo-Philipp Wich <jo@mein.io>2018-07-23 14:31:40 +0200
commit875b561875cb4eca4c913c69ce2dfd21265b6ac6 (patch)
treebc3e5113af2a082a13f2f02c40705a6338ffadd3
parentb6dd0ecd6cc7eb1f4c758a0815f725ff0be4f157 (diff)
luci-base: cbi.js: use adjacent button dynlist add/remove buttons
Change the cbi.js code to create a div based button element instead of an image button. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index 89dfac9e46..9d79b81c19 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -818,9 +818,9 @@ function cbi_dynlist_init(parent, datatype, optional, choices)
t.placeholder = holder;
}
- var b = document.createElement('img');
- b.src = cbi_strings.path.resource + ((i+1) < values.length ? '/cbi/remove.gif' : '/cbi/add.gif');
- b.className = 'cbi-image-button';
+ var b = E('div', {
+ class: 'cbi-button cbi-button-' + ((i+1) < values.length ? 'remove' : 'add')
+ }, (i+1) < values.length ? '×' : '+');
parent.appendChild(t);
parent.appendChild(b);
@@ -986,8 +986,7 @@ function cbi_dynlist_init(parent, datatype, optional, choices)
input = input.previousSibling;
}
- if (se.src.indexOf('remove') > -1)
- {
+ if (se.classList.contains('cbi-button-remove')) {
input.value = '';
cbi_dynlist_keydown({
@@ -995,8 +994,7 @@ function cbi_dynlist_init(parent, datatype, optional, choices)
keyCode: 8
});
}
- else
- {
+ else {
cbi_dynlist_keydown({
target: input,
keyCode: 13