--- a/static/dmx.js Thu May 01 23:44:42 2014 +0300
+++ b/static/dmx.js Thu May 01 23:55:53 2014 +0300
@@ -1,3 +1,8 @@
+/*
+ * Get current value for given head/attr.
+ *
+ * Returns undefined if no such attr.
+ */
function dmx_input (head, attr) {
var value = $('.dmx-input#' + head + '-' + attr).val();
@@ -11,6 +16,23 @@
}
/*
+ * Update current output value.
+ */
+function dmx_update (input) {
+ var name = input.attr('name');
+ var value = input.val();
+
+ console.log("dmx_update: " + name + ": " + value);
+
+ var data = { }; data[name] = value;
+
+ $.ajax({
+ type: 'POST',
+ data: data,
+ });
+}
+
+/*
* Update color for head.
*/
function dmx_color (head) {
@@ -46,7 +68,10 @@
*/
function slider_input (input, slider) {
// bind
- input.change(function () { _slider_input(input, slider); });
+ input.change(function () {
+ dmx_update(input);
+ _slider_input(input, slider);
+ });
// initialize
_slider_input(input, slider);
@@ -78,6 +103,8 @@
dmx_color(head);
}
+ // send output
+ dmx_update(input);
},
});