diff options
| author | Alon Levy <alon@pobox.com> | 2014-08-19 19:50:02 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-08-19 19:50:02 +0300 |
| commit | b7723546a8b9b07c724e4be062c0c0c58501478f (patch) | |
| tree | c35f65440fc3a2ac0dd62a97f33d3ae49f58d9fd /scripts/textanalysis-ui.js | |
| parent | cca5a2dbc2e0a92bee72b56d9a708a641d4153a9 (diff) | |
textanalysis: remove usage of $
Diffstat (limited to 'scripts/textanalysis-ui.js')
| -rw-r--r-- | scripts/textanalysis-ui.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/textanalysis-ui.js b/scripts/textanalysis-ui.js index de163056..f5d2d5fe 100644 --- a/scripts/textanalysis-ui.js +++ b/scripts/textanalysis-ui.js @@ -7,11 +7,22 @@ $('#textanalyser').autocompleteTrigger({ source: sugg }); +// TODO - hide this in a scope function analyzeSentence(sentence, finalize) { var d = TextAnalyser2(graph, sentence, finalize); - for (var k in d.suggestions) { - sugg[k] = k; + for (var k in d.sugg) { + sugg.push(k); + } + switch (d.state) { + case ANALYSIS_NODE_START: + $('.typeselection').css({top:window.innerHeight/2-115,left:window.innerWidth/2-325}); + $('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>Use [TAB] key to pick a type</td></tr></table>'); + break; + case ANALYSIS_LINK: + $('.typeselection').css('top', -300); + $('.typeselection').css('left', 0); + break; } } @@ -24,7 +35,7 @@ $("#textanalyser").keypress(function(e) { if(!suggestionChange){ text = $('#textanalyser').val(); $('#textanalyser').val(""); - TextAnalyser2(graph, text, true); + analyzeSentence(text, true); typeStack=[]; } else { suggestionChange=false; @@ -116,7 +127,7 @@ window.setInterval(function() { if(text.length*8>500)$('#textanalyser').css('width',text.length*8+20); // text changed text = $('#textanalyser').val(); - TextAnalyser2(graph, text, false); + analyzeSentence(text, false); suggestionChange=false; } }, 5); |
