From 4dfa657f77183c4add96cfd349721be1ca425a49 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 19 Sep 2019 15:39:46 +0200 Subject: luci-base: ui.js: mark user-changed widgets Set a `data-changed=true` attribute on the widget element when the user did any change to the default value. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/ui.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/luci-base') diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index c0b57528fb..99e1548a43 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -70,6 +70,11 @@ var UIElement = L.Class.extend({ }, setChangeEvents: function(targetNode /*, ... */) { + var tag_changed = L.bind(function(ev) { this.setAttribute('data-changed', true) }, this.node); + + for (var i = 1; i < arguments.length; i++) + targetNode.addEventListener(arguments[i], tag_changed); + this.registerEvents(targetNode, 'widget-change', this.varargs(arguments, 1)); } }); -- cgit v1.2.3