2013-03-06 00:45:36 +01:00
|
|
|
/**
|
|
|
|
* @provides javelin-behavior-conpherence-pontificate
|
|
|
|
* @requires javelin-behavior
|
|
|
|
* javelin-dom
|
2013-03-08 19:40:06 +01:00
|
|
|
* javelin-util
|
|
|
|
* javelin-workflow
|
2013-03-31 23:41:13 +02:00
|
|
|
* javelin-stratcom
|
2015-03-10 20:20:29 +01:00
|
|
|
* conpherence-thread-manager
|
2013-03-06 00:45:36 +01:00
|
|
|
*/
|
|
|
|
|
2014-06-23 19:27:47 +02:00
|
|
|
JX.behavior('conpherence-pontificate', function() {
|
2014-06-11 22:52:15 +02:00
|
|
|
|
2016-09-28 04:26:02 +02:00
|
|
|
var _sendMessage = function(e) {
|
2013-03-06 00:45:36 +01:00
|
|
|
e.kill();
|
2013-03-31 23:41:13 +02:00
|
|
|
var form = e.getNode('tag:form');
|
2015-03-10 20:20:29 +01:00
|
|
|
var threadManager = JX.ConpherenceThreadManager.getInstance();
|
|
|
|
threadManager.sendMessage(form, {});
|
2013-03-06 00:45:36 +01:00
|
|
|
};
|
|
|
|
|
2013-03-31 23:41:33 +02:00
|
|
|
JX.Stratcom.listen(
|
|
|
|
['submit', 'didSyntheticSubmit'],
|
|
|
|
'conpherence-pontificate',
|
2016-09-28 04:26:02 +02:00
|
|
|
_sendMessage);
|
|
|
|
|
|
|
|
// Send on enter if the shift key is not held.
|
|
|
|
JX.Stratcom.listen(
|
|
|
|
'keydown',
|
|
|
|
'conpherence-pontificate',
|
|
|
|
function(e) {
|
|
|
|
if (e.getSpecialKey() != 'return') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var raw = e.getRawEvent();
|
|
|
|
if (raw.shiftKey) {
|
|
|
|
// If the shift key is pressed, let the browser write a newline into
|
|
|
|
// the textarea.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// From here on, interpret this as a "send" action, not a literal
|
|
|
|
// newline.
|
|
|
|
e.kill();
|
|
|
|
|
|
|
|
_sendMessage(e);
|
|
|
|
});
|
2013-03-06 00:45:36 +01:00
|
|
|
|
|
|
|
});
|