mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 02:42:40 +01:00
33 lines
761 B
JavaScript
33 lines
761 B
JavaScript
|
/**
|
||
|
* @provides javelin-behavior-ponder-feedback-preview
|
||
|
* @requires javelin-behavior
|
||
|
* javelin-dom
|
||
|
* javelin-util
|
||
|
* phabricator-shaped-request
|
||
|
*/
|
||
|
|
||
|
JX.behavior('ponder-feedback-preview', function(config) {
|
||
|
|
||
|
var content = JX.$(config.content);
|
||
|
var question_id = config.question_id;
|
||
|
|
||
|
var callback = function(r) {
|
||
|
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
|
||
|
};
|
||
|
|
||
|
var getdata = function() {
|
||
|
var data = {
|
||
|
content : content.value,
|
||
|
question_id : question_id
|
||
|
};
|
||
|
return data;
|
||
|
};
|
||
|
|
||
|
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||
|
var trigger = JX.bind(request, request.trigger);
|
||
|
|
||
|
JX.DOM.listen(content, 'keydown', null, trigger);
|
||
|
|
||
|
request.start();
|
||
|
});
|