Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/conpherence/behavior-pontificate.js
Show All 16 Lines | var _sendMessage = function(e) { | ||||
threadManager.sendMessage(form, {}); | threadManager.sendMessage(form, {}); | ||||
}; | }; | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
['submit', 'didSyntheticSubmit'], | ['submit', 'didSyntheticSubmit'], | ||||
'conpherence-pontificate', | 'conpherence-pontificate', | ||||
_sendMessage); | _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); | |||||
}); | |||||
}); | }); |