summaryrefslogtreecommitdiff
path: root/svg/subcan.js
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2013-06-29 03:50:26 +0200
committerDavid Lamparter <equinox@diac24.net>2013-06-29 04:06:44 +0200
commit2b89cdf6dd8e183ad3f07bfb7b6d67a15a508752 (patch)
tree273fdbda1246b008aa4ebbf88fd8fe5fe255c0b5 /svg/subcan.js
parent940ba36573b620ee227d0bd525e381a517252fe4 (diff)
svg: add DMX PARs
Diffstat (limited to 'svg/subcan.js')
-rw-r--r--svg/subcan.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/svg/subcan.js b/svg/subcan.js
index 21c2d01..d3652c0 100644
--- a/svg/subcan.js
+++ b/svg/subcan.js
@@ -295,6 +295,25 @@ function update_elements(json) {
console.log("unknown dynamic content type", node.localName);
}
}
+
+ nodes = simple_xpath('//*[contains(svg:title, "=")]');
+ for (i in nodes) {
+ var node = nodes[i];
+ var spec = node.getElementsByTagName('title')[0].firstChild.nodeValue.split('=', 2);
+ var dataelem = json[spec[0]];
+
+ if (dataelem === null)
+ continue;
+
+ if (node.localName == "path") {
+ node.style.fill = "rgb("
+ + dataelem['r'] + ", "
+ + dataelem['g'] + ", "
+ + dataelem['b'] + ")";
+ } else {
+ console.log("unknown dynamic content type", node.localName);
+ }
+ }
}
var xhr = new XMLHttpRequest();