diff options
| author | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-08-13 16:16:53 +0300 |
|---|---|---|
| committer | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-08-13 16:21:18 +0300 |
| commit | d69fef47528c8ccb5e24eee05ac9ddadf94ef904 (patch) | |
| tree | aa63f154d103d1f85aa5ea3666f0c841bd2534c1 /scripts/textanalysis.js | |
| parent | 429aa1275acdd7ad2776ae6d2596d16e10f0c09f (diff) | |
Issue #38
Diffstat (limited to 'scripts/textanalysis.js')
| -rw-r--r-- | scripts/textanalysis.js | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index 31b759d9..9422a095 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -35,25 +35,37 @@ $("#textanalyser").keypress(function(e) { return false; } + if (e.which == 37) {//RIGHT - if (e.which == 9) {//TAB - text = $('#textanalyser').val(); - $('#textanalyser').val(text+" "); + $('body').scrollLeft(0); + e.stopPropagation(); return false; } -}); + if (e.which == 39) { //LEFT -$(document).keydown(function(e) { - if (e.keyCode == 37) {//RIGHT - e.preventDefault(); - changeType("up", lastnode); + $('body').scrollLeft(0); + e.stopPropagation(); return false; } - if (e.keyCode == 39) { //LEFT + +}); + +$(document).keydown(function(e) { + + + if (e.keyCode == 9) {//TAB e.preventDefault(); changeType("down", lastnode); return false; } + + if (e.keyCode == 37) {//UP + $('html, body').scrollLeft(0); + } + if (e.keyCode == 39) {//DOWN + $('html, body').scrollLeft(0); + } + if (e.keyCode == 38) {//UP suggestionChange=true; } @@ -67,6 +79,21 @@ $(document).keydown(function(e) { }); + +function textSelect(inp, s, e) { + e = e || s; + if (inp.createTextRange) { + var r = inp.createTextRange(); + r.collapse(true); + r.moveEnd('character', e); + r.moveStart('character', s); + r.select(); + }else if(inp.setSelectionRange) { + inp.focus(); + inp.setSelectionRange(s, e); + } + } + function changeType(arg, id) { if (arg === 'up') { if (typeindex < 4) typeindex++; @@ -249,7 +276,7 @@ function TextAnalyser2(newtext, finalize) { if (!abnormalGraph){graph.addLink(newnodes[nodeindex - 1], "new node", newlinks[linkindex], "temp"); ANDconnect("new node");} $('.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 arrows to pick a type</td></tr></table>'); + $('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>Use [TAB] key to pick a type</td></tr></table>'); break; case "NODE": |
