From 3ab78d05190c4ac0012b09fdfa54b20152badacf Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 9 Jun 2014 12:50:58 +0100 Subject: [PATCH] Expand all config-value attributes of the form !TYPE!PARAM --- src/mkws-widget.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mkws-widget.js b/src/mkws-widget.js index f702fb1..6bae333 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -153,26 +153,27 @@ function widget($, team, type, node) { for (var i = 0; i < node.attributes.length; i++) { var a = node.attributes[i]; + var val = that.expandValue(a.value); if (a.name === 'data-mkws-config') { // Treat as a JSON fragment configuring just this widget - log(node + ": parsing config fragment '" + a.value + "'"); + log(node + ": parsing config fragment '" + val + "'"); var data; try { - data = $.parseJSON(a.value); + data = $.parseJSON(val); for (var key in data) { log(node + ": adding config element " + key + "='" + data[key] + "'"); that.config[key] = data[key]; } } catch (err) { - alert("Can't parse " + node + " data-mkws-config as JSON: " + a.value); + alert("Can't parse " + node + " data-mkws-config as JSON: " + val); } } else if (a.name.match (/^data-mkws-/)) { var name = a.name.replace(/^data-mkws-/, '') - that.config[name] = a.value; - log(that + ": set data-mkws attribute " + name + "='" + a.value + "'"); + that.config[name] = val; + log(that + ": set data-mkws attribute " + name + "='" + val + "'"); } else if (!ignoreAttrs[a.name]) { - that.config[a.name] = a.value; - log(that + ": set regular attribute " + a.name + "='" + a.value + "'"); + that.config[a.name] = val; + log(that + ": set regular attribute " + a.name + "='" + val + "'"); } } -- 1.7.10.4