1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00
phorge-phorge/webroot/rsrc/js/application/differential/behavior-comment-preview.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2011-02-01 03:05:20 +01:00
/**
* @provides javelin-behavior-differential-feedback-preview
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
* javelin-request
* javelin-util
* phabricator-shaped-request
2011-02-01 03:05:20 +01:00
*/
JX.behavior('differential-feedback-preview', function(config) {
var action = JX.$(config.action);
var content = JX.$(config.content);
var callback = function(r) {
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
};
2011-02-01 03:05:20 +01:00
var getdata = function() {
return {
content : content.value,
action : action.value
};
};
2011-02-01 03:05:20 +01:00
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
var trigger = JX.bind(request, request.trigger);
2011-02-01 03:05:20 +01:00
JX.DOM.listen(content, 'keydown', null, trigger);
JX.DOM.listen(action, 'change', null, trigger);
2011-02-01 03:05:20 +01:00
2011-08-16 23:39:01 +02:00
setTimeout(function() { request.start(); }, 0);
2011-02-03 04:38:43 +01:00
function refreshInlinePreview() {
new JX.Request(config.inlineuri, function(r) {
JX.DOM.setContent(JX.$(config.inline), JX.$H(r));
2011-02-03 04:38:43 +01:00
})
.setTimeout(5000)
.send();
}
JX.Stratcom.listen(
'differential-inline-comment-update',
null,
refreshInlinePreview);
setTimeout(refreshInlinePreview, 0);
2011-02-01 03:05:20 +01:00
});