Commit 7db6d058 authored by bbaer's avatar bbaer

Dynamic Output

parent bbc764ec
/**
* @author Benjamin Baer <benjamin.baer@math.uzh.ch>
*/
/* global $ */
/* global EventEmitter */
/* @depend QfqEvents.js */
/**
* Qfq Namespace
*
* @namespace QfqNS
*/
var QfqNS = QfqNS || {};
(function (n) {
'use strict';
n.DynamicSearch = function ($hook, api) {
this.$container = $hook;
};
n.DynamicSearch.prototype.display = function() {
var $input = this._generateInputField();
var $output = this._generateOutputField();
this.$container
.append($input)
.append($output);
};
n.DynamicSearch.prototype._generateInputField = function() {
var that = this;
var $inputField = $("<input />", {
class: "form-control"
});
$inputField.on("keyup", function() {
that._handleKeyUp($inputField);
});
return $inputField;
};
n.DynamicSearch.prototype._generateOutputField = function() {
var $outputField = $("<div />", {
class: "qfqDynamicSearchOutput"
});
return $outputField;
};
n.DynamicSearch.prototype._handleKeyUp = function($field) {
if($field.val().length > 3) {
console.log("blupp");
}
};
})(QfqNS);
\ No newline at end of file
......@@ -40,15 +40,12 @@
-->
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
<div class="fabric"
data-buttons="mockData/fabric.buttons.json"
data-emojis="mockData/qfq.emoji.json"
data-control-name='fabric-output'
data-background-image="mockData/Scan2a.jpeg">
</div>
<input id="fabric-output" name="fabric-data" type="hidden">
</div>
<div class="col-md-6">
<div class="qfq-dynamic-search"></div>
</div>
......@@ -77,7 +74,10 @@
QfqNS.Log.level = 0;
// Just for mockup, init() function called from new QfqNS.Plugin class maybe.
$(".qfq-dynamic-search").each(function() {
var dynamicSearch = new QfqNS.DynamicSearch($(this), "url-soso");
dynamicSearch.display();
});
});
</script>
</body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment