diff options
Diffstat (limited to 'tools/addon-sdk-1.3/examples/annotator/data/editor')
-rw-r--r-- | tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.html | 35 | ||||
-rw-r--r-- | tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.js | 19 |
2 files changed, 54 insertions, 0 deletions
diff --git a/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.html b/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.html new file mode 100644 index 0000000..760d1f6 --- /dev/null +++ b/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.html @@ -0,0 +1,35 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> + <title>Annotation</title> + <style type="text/css" media="all"> + body, html { + font: 100% arial, helvetica, sans-serif; + padding: 0; + margin: 0; + position: fixed; + } + textarea { + width: 100%; + height: 100%; + margin: 10px; + padding: 0; + color: inherit !important; + font: inherit !important; + background: transparent; + border: none; + } + </style> + +</head> + +<body> + +<textarea rows='10' cols='20' id='annotation-box'> +</textarea> + +</body> + +</html> diff --git a/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.js b/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.js new file mode 100644 index 0000000..5a762fc --- /dev/null +++ b/tools/addon-sdk-1.3/examples/annotator/data/editor/annotation-editor.js @@ -0,0 +1,19 @@ +/* +On a return key, send the content of the textArea back to the add-on, +and zero the textArea for the next time. +*/ + +var textArea = document.getElementById('annotation-box'); + +textArea.onkeyup = function(event) { + if (event.keyCode == 13) { + self.postMessage(textArea.value); + textArea.value = ''; + } +}; + +self.on('message', function() { + var textArea = document.getElementById('annotation-box'); + textArea.value = ''; + textArea.focus(); +}); |