aboutsummaryrefslogtreecommitdiff
path: root/tools/addon-sdk-1.5/examples/annotator/data/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/addon-sdk-1.5/examples/annotator/data/editor')
-rw-r--r--tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.html39
-rw-r--r--tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.js23
2 files changed, 62 insertions, 0 deletions
diff --git a/tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.html b/tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.html
new file mode 100644
index 0000000..6125999
--- /dev/null
+++ b/tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.html
@@ -0,0 +1,39 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<!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.5/examples/annotator/data/editor/annotation-editor.js b/tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.js
new file mode 100644
index 0000000..2fe5888
--- /dev/null
+++ b/tools/addon-sdk-1.5/examples/annotator/data/editor/annotation-editor.js
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+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();
+});