summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2021-01-07 19:02:57 +0200
committerGitHub <noreply@github.com>2021-01-07 19:02:57 +0200
commitc49d33f6cba15f38eb4eea74ea815601449a70cd (patch)
tree12b2393ce6ecb56402b9aa827078827b22f22283 /modules/luci-base/htdocs/luci-static/resources
parente7aeb9b153abc97a77be1e8ef9c8c499a0735895 (diff)
parent91a00084575621d786d5cc49b202012d293b3baa (diff)
Merge pull request #4598 from Ansuel/wifi_chan
luci-mod-status: add new channel analysis page
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/firewall.js16
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/tools/prng.js18
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js8
3 files changed, 24 insertions, 18 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/firewall.js b/modules/luci-base/htdocs/luci-static/resources/firewall.js
index b1c7de4358..2e032ca2d5 100644
--- a/modules/luci-base/htdocs/luci-static/resources/firewall.js
+++ b/modules/luci-base/htdocs/luci-static/resources/firewall.js
@@ -57,21 +57,7 @@ function getColorForName(forName) {
else if (forName == 'wan')
return '#f09090';
- random.seed(parseInt(sfh(forName), 16));
-
- var r = random.get(128),
- g = random.get(128),
- min = 0,
- max = 128;
-
- if ((r + g) < 128)
- min = 128 - r - g;
- else
- max = 255 - r - g;
-
- var b = min + Math.floor(random.get() * (max - min));
-
- return '#%02x%02x%02x'.format(0xff - r, 0xff - g, 0xff - b);
+ return random.derive_color(forName);
}
diff --git a/modules/luci-base/htdocs/luci-static/resources/tools/prng.js b/modules/luci-base/htdocs/luci-static/resources/tools/prng.js
index 752dc75ce8..b916cc7792 100644
--- a/modules/luci-base/htdocs/luci-static/resources/tools/prng.js
+++ b/modules/luci-base/htdocs/luci-static/resources/tools/prng.js
@@ -89,5 +89,23 @@ return L.Class.extend({
}
return Math.floor(r * (u - l + 1)) + l;
+ },
+
+ derive_color: function(string) {
+ this.seed(parseInt(sfh(string), 16));
+
+ var r = this.get(128),
+ g = this.get(128),
+ min = 0,
+ max = 128;
+
+ if ((r + g) < 128)
+ min = 128 - r - g;
+ else
+ max = 255 - r - g;
+
+ var b = min + Math.floor(this.get() * (max - min));
+
+ return '#%02x%02x%02x'.format(0xff - r, 0xff - g, 0xff - b);
}
});
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js
index 77074d5075..e35a26a8ba 100644
--- a/modules/luci-base/htdocs/luci-static/resources/ui.js
+++ b/modules/luci-base/htdocs/luci-static/resources/ui.js
@@ -3597,9 +3597,11 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
this.setActiveTabId(panes[selected], selected);
}
- panes[selected].dispatchEvent(new CustomEvent('cbi-tab-active', {
- detail: { tab: panes[selected].getAttribute('data-tab') }
- }));
+ requestAnimationFrame(L.bind(function(pane) {
+ pane.dispatchEvent(new CustomEvent('cbi-tab-active', {
+ detail: { tab: pane.getAttribute('data-tab') }
+ }));
+ }, this, panes[selected]));
this.updateTabs(group);
},