js: debounce name change
This commit is contained in:
parent
7df8d60f1b
commit
97c74d8542
3 changed files with 10 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
||||||
<script src="/static/js/jquery-1.9.1.min.js"></script>
|
<script src="/static/js/jquery-1.9.1.min.js"></script>
|
||||||
<script src="/static/js/jquery-ui.min.js"></script>
|
<script src="/static/js/jquery-ui.min.js"></script>
|
||||||
<script src="/static/js/jquery.ui.datepicker-it.min.js"></script>
|
<script src="/static/js/jquery.ui.datepicker-it.min.js"></script>
|
||||||
|
<script src="/static/js/underscore-min.js"></script>
|
||||||
<script src="/static/js/rec.js"></script>
|
<script src="/static/js/rec.js"></script>
|
||||||
<script src="/static/js/ui.js"></script>
|
<script src="/static/js/ui.js"></script>
|
||||||
<script src="/static/js/new.js"></script>
|
<script src="/static/js/new.js"></script>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*global $, config, RecAPI, poll_job*/
|
/*global $, config, RecAPI, poll_job, _*/
|
||||||
|
|
||||||
//TODO: move to a separate file(?)
|
//TODO: move to a separate file(?)
|
||||||
$.widget("ror.countclock", {
|
$.widget("ror.countclock", {
|
||||||
|
@ -82,7 +82,8 @@ $.widget("ror.ongoingrec", {
|
||||||
);
|
);
|
||||||
this._update();
|
this._update();
|
||||||
|
|
||||||
view.on("change keydown paste input", "input", function(evt) {
|
view.on("change keydown paste input", "input",
|
||||||
|
_.debounce(function onNameChanged(evt) {
|
||||||
console.log('change', evt);
|
console.log('change', evt);
|
||||||
var prevrec = widget.options.rec;
|
var prevrec = widget.options.rec;
|
||||||
prevrec.name = $(evt.target).val();
|
prevrec.name = $(evt.target).val();
|
||||||
|
@ -90,7 +91,7 @@ $.widget("ror.ongoingrec", {
|
||||||
widget._trigger("change", evt,
|
widget._trigger("change", evt,
|
||||||
{rec: rec, widget: widget, changed: {name: rec.name}}
|
{rec: rec, widget: widget, changed: {name: rec.name}}
|
||||||
);
|
);
|
||||||
});
|
}, 500));
|
||||||
view.on("click", ".rec-stop", function(evt) {
|
view.on("click", ".rec-stop", function(evt) {
|
||||||
widget._trigger("stop", evt, {rec: rec, widget: widget});
|
widget._trigger("stop", evt, {rec: rec, widget: widget});
|
||||||
});
|
});
|
||||||
|
|
5
server/static/js/underscore-min.js
vendored
Normal file
5
server/static/js/underscore-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue