-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinject.js
More file actions
27 lines (23 loc) · 798 Bytes
/
inject.js
File metadata and controls
27 lines (23 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$(document).ready(function() {
// Build a test map
var testFunction = function() { return 'accel'; }.toString();
localStorage["ruleTable"] = JSON.stringify({ "investors .+" : testFunction });
// Save the most recently focused upon text box
var el;
$('input[type="text"]').focus(function() {
el = $(this);
});
window.addEventListener("keyup", function(event) {
if (event.shiftKey && event.keyCode == 221) {
// Read text
var text = el.val();
if (text.length < 4 || text[text.length-2] != '}') {
return;
}
var tokenList = processText(el, text); // returns jsonobject of queries
var dataList = getData(tokenList);
var formattedList = formatData(dataList, tokenList);
replaceData(formattedList);
}
}, false);
});