michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: On a return key, send the content of the textArea back to the add-on, michael@0: and zero the textArea for the next time. michael@0: */ michael@0: michael@0: var textArea = document.getElementById('annotation-box'); michael@0: michael@0: textArea.onkeyup = function(event) { michael@0: if (event.keyCode == 13) { michael@0: self.postMessage(textArea.value); michael@0: textArea.value = ''; michael@0: } michael@0: }; michael@0: michael@0: self.on('message', function() { michael@0: var textArea = document.getElementById('annotation-box'); michael@0: textArea.value = ''; michael@0: textArea.focus(); michael@0: });