From: Jo-Philipp Wich Date: Thu, 19 Sep 2019 13:39:46 +0000 (+0200) Subject: luci-base: ui.js: mark user-changed widgets X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4dfa657f77183c4add96cfd349721be1ca425a49;p=oweals%2Fluci.git 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 --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index c0b57528f..99e1548a4 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)); } });