summaryrefslogtreecommitdiff
path: root/scripts/history.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-08-18 21:25:20 +0300
committerAlon Levy <alon@pobox.com>2014-08-18 21:27:01 +0300
commitf8741870a1dcd066a22545635faac274413b05bd (patch)
tree0a98ce9ec4d72d107b4723308884bd9cfb0bce16 /scripts/history.js
parent59370f16a20cc56aaa61ca8a9a2aa62d418af22b (diff)
recording: record keystrokes. no strokes recorded for link renames
Diffstat (limited to 'scripts/history.js')
-rw-r--r--scripts/history.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/history.js b/scripts/history.js
index 396b3f3c..03c9f4a1 100644
--- a/scripts/history.js
+++ b/scripts/history.js
@@ -20,11 +20,15 @@ function History(user) {
this.user = user;
}
-var ACTION_TYPE = 'ACTION_TYPE';
+var ACTION_KEYSTROKES = 'ACTION_KEYSTROKES';
var ACTION_MOUSE = 'ACTION_MOUSE';
var ACTION_GRAPH_ADD = 'ACTION_GRAPH_ADD';
var ACTION_GRAPH_DELETE = 'ACTION_GRAPH_DELETE';
+var KEYSTROKE_WHERE_TEXTANALYSIS = 'KEYSTROKE_WHERE_TEXTANALYSIS';
+var KEYSTROKE_WHERE_DOCUMENT = 'KEYSTROKE_WHERE_DOCUMENT';
+var KEYSTROKE_WHERE_EDIT_NODE = 'KEYSTROKE_WHERE_EDIT_NODE';
+
History.prototype.record = function(d)
{
if (d === undefined || d.action === undefined) {
@@ -77,3 +81,18 @@ History.prototype.record_nodes = function(nodes)
'linkes': []
});
}
+
+History.prototype.record_keystrokes = function(where, keys)
+{
+ if (keys === undefined || keys.length === undefined || keys.length <= 0) {
+ throw "Invalid arguments";
+ }
+ keys = keys.filter(function(k) { return k !== undefined; });
+ if (keys.length == 0) {
+ return;
+ }
+ this.record({'action': ACTION_KEYSTROKES,
+ 'keys': keys,
+ 'where': where
+ });
+}