diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-04-17 09:30:20 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-17 09:30:54 +0200 |
commit | 01d8283ecea730191ce41302acb7ecd1aaf0631f (patch) | |
tree | 6e9e09ba7b6471af0dd386e8f3c620754fdb234b /modules/luci-base | |
parent | 65958c499295d23b592e6027cfb79827e9150ea8 (diff) |
luci-base: ui.js: order indicators by ID value
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 6d77f3782..625363811 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3291,12 +3291,23 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ { } var handlerFn = (typeof(handler) == 'function') ? handler : null, - indicatorElem = indicatorDiv.querySelector('span[data-indicator="%s"]'.format(id)) || - indicatorDiv.appendChild(E('span', { + indicatorElem = indicatorDiv.querySelector('span[data-indicator="%s"]'.format(id)); + + if (indicatorElem == null) { + var beforeElem = null; + + for (beforeElem = indicatorDiv.firstElementChild; + beforeElem != null; + beforeElem = beforeElem.nextElementSibling) + if (beforeElem.getAttribute('data-indicator') > id) + break; + + indicatorElem = indicatorDiv.insertBefore(E('span', { 'data-indicator': id, 'data-clickable': handlerFn ? true : null, 'click': handlerFn - }, [''])); + }, ['']), beforeElem); + } if (label == indicatorElem.firstChild.data && style == indicatorElem.getAttribute('data-style')) return false; |