From d69fef47528c8ccb5e24eee05ac9ddadf94ef904 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 13 Aug 2014 16:16:53 +0300 Subject: Issue #38 --- scripts/textanalysis.js | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'scripts/textanalysis.js') 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('
Use arrows to pick a type
'); + $('.typeselection').html('
Use [TAB] key to pick a type
'); break; case "NODE": -- cgit v1.3.1