X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Fmonitoring%2Fmonitor.js;fp=test%2Fmonitoring%2Fmonitor.js;h=5b9dc0ea091a4185ffef8aec4b81a03c42b7a676;hb=814561d06929f3adbeb3fbedc0da2fa71074fb35;hp=6ca75cc6043729e8bd5be2c6281f647738492a19;hpb=15d0dae1cd6ab982137a7c2848de9303a9c969f0;p=src%2Fapp-framework-binder.git diff --git a/test/monitoring/monitor.js b/test/monitoring/monitor.js index 6ca75cc6..5b9dc0ea 100644 --- a/test/monitoring/monitor.js +++ b/test/monitoring/monitor.js @@ -39,6 +39,8 @@ var logmsgs_node; var apis_node; var all_node; +var styles; + /* flags */ var show_perms = false; var show_monitor_events = false; @@ -81,7 +83,14 @@ function on_connect(evt) { connect(); } +function next_style(evt) { + styles.next(); +} + function init() { + styles = makecss(); + at("style").onclick = next_style; + /* prepare the DOM templates */ t_api = at("t-api").content.firstElementChild; t_verb = at("t-verb").content.firstElementChild; @@ -510,3 +519,44 @@ function obj2html(json) { }); } +function makecss() +{ + var i, l, a, links, x; + + x = { idx: 0, byidx: [], byname: {}, names: [] }; + links = document.getElementsByTagName("link"); + for (i = 0 ; i < links.length ; i++) { + l = links[i]; + if (l.title && l.rel.indexOf( "stylesheet" ) != -1) { + if (!(l.title in x.byname)) { + x.byname[l.title] = x.byidx.length; + x.names.push(l.title); + x.byidx.push([]); + } + x.byidx[x.byname[l.title]].push(l); + } + } + + x.set = function(id) { + if (id in x.byname) + id = x.byname[id]; + if (id in x.byidx) { + var i, j, a, b; + x.idx = id; + a = x.byidx; + for (i = 0 ; i < a.length ; i++) { + b = a[i]; + for (j = 0 ; j < b.length ; j++) + b[j].disabled = i != id; + } + } + }; + + x.next = function() { + x.set((x.idx + 1) % x.byidx.length); + }; + + x.set(0); + return x; +} +