[Pkg-mozext-commits] [itsalltext] 264/459: Added some stuff in prep for hot-key support.

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository itsalltext.

commit d74017cb76447efcaa1a0b00332857e70e243a7a
Author: Christian Höltje <docwhat at gerf.org>
Date:   Sun Jul 15 01:19:36 2007 -0400

    Added some stuff in prep for hot-key support.
---
 src/chrome/content/itsalltext.js | 44 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index 274a4cf..932f329 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -531,7 +531,6 @@ var ItsAllText = function() {
         return pos;
     };
 
-
     /**
      * This function is called regularly to watch changes to web documents.
      */
@@ -703,6 +702,49 @@ var ItsAllText = function() {
 };
 
 /**
+ * Convert an event into a key fingerprint, aka keyprint.
+ * @param {Event} event 
+ * @returns {String} keyprint
+ */
+ItsAllText.prototype.eventToKeyprint = function (event) {
+    return [ event.ctrlKey,
+             event.altKey,
+             event.metaKey,
+             event.shiftKey,
+             event.keyCode,
+             event.charCode ].join(':');
+};
+
+/**
+ * Convert a keyprint to a string suitable for human display.
+ * @param {String} keyprint
+ * @return {String} 
+ */
+ItsAllText.prototype.keyprintToString = function (keyprint) {
+    var split = keyprint.split(':');
+    var string = [];
+    if (split[0] === 'true') {
+        string.push('Ctrl');
+    }
+    if (split[1] === 'true') {
+        string.push('Alt');
+    }
+    if (split[2] === 'true') {
+        string.push('Meta');
+    }
+    if (split[3] === 'true') {
+        string.push('Shift');
+    }
+    if (split[4] === '0') {
+        string.push(String.fromCharCode(split[5]));
+    } else {
+        string.push('keyCode=',split[4]);
+    }
+    return string.join(' ');
+};
+
+
+/**
  * Cleans out the edit directory, deleting all old files.
  */
 ItsAllText.prototype.cleanEditDir = function(force) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list