From c8c4edc2fd30af8ef4b67d56c3c65974ff25e37e Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 10 Aug 2014 17:30:30 +0300 Subject: more 'use strict' and fallout handling Just defining some variables instead of them becoming properties on the global object Some whitespace fixes too. --- scripts/buttons.js | 1 + scripts/gant.js | 7 ++++--- scripts/robot.js | 14 ++++++++------ scripts/textanalysis.js | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/scripts/buttons.js b/scripts/buttons.js index 56592825..65536f35 100644 --- a/scripts/buttons.js +++ b/scripts/buttons.js @@ -1,3 +1,4 @@ +"use strict" $('.tutorial').click(function(){}); diff --git a/scripts/gant.js b/scripts/gant.js index 9b7fed4b..a89f9035 100644 --- a/scripts/gant.js +++ b/scripts/gant.js @@ -1,3 +1,4 @@ +"use strict" function checkSwitch(checkswitch) { @@ -26,7 +27,7 @@ function checkSwitch(checkswitch) { $('body').scrollLeft(scrollValue); graphstate = "GANTT"; - + graph.update(); $('.status').fadeIn(600); @@ -95,7 +96,7 @@ function initAxis() { ///update interval var timeDiff = Math.abs(max.getTime() - min.getTime()); var diffDays = timeDiff / (1000 * 3600 * 24); - w=Math.round(diffDays*15-100); + var w = Math.round(diffDays * 15 - 100); graphinterval = w / diffDays; @@ -130,7 +131,7 @@ function initAxis() { return i * row_height + paddingTop + bar_start_offset; } - labelY = function (i) { + var labelY = function (i) { return i * row_height + paddingTop + bar_start_offset + 13; } diff --git a/scripts/robot.js b/scripts/robot.js index 71679807..c1631263 100644 --- a/scripts/robot.js +++ b/scripts/robot.js @@ -1,3 +1,5 @@ +"use strict" + var sentence=""; /*sentence+=" #Rhizibot is showing you a #tutorial|"; sentence+="#Rhizi visualizes data with #Graphs and #relationships|"; @@ -43,8 +45,8 @@ setTimeout( Robot, 100 );*/ function Robot(){ - - + + if(counter<=sentence.length){ var text=$('#textanalyser').val(); counter++; @@ -60,7 +62,7 @@ function Robot(){ } }else{ var e = jQuery.Event("keypress"); - e.which = 13; + e.which = 13; e.keyCode = 13; $("#textanalyser").trigger(e); window.setTimeout( Robot, 650/speed ); @@ -68,10 +70,10 @@ function Robot(){ }else{ window.clearInterval(robot); } - - - + + + } diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index 940683a0..b50fd6d0 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -1,3 +1,5 @@ +"use strict" + var text = ""; var sugg = ["AJAX", "Neo4J", "Rhizi", "Research", "CRI", "SageBionetworks", "Hero.coli", "CSS", "NodeJS", "HTML5", "Angular", "D3", "ProofOfConcept", "Graphs", "CloudComputing", "BigData", "ProblemSolving", "PHP", "Javascript", "BackBone", "Cooperation", "SemanticWeb"]; var typeindex = 0; @@ -58,7 +60,7 @@ $(document).keydown(function(e) { if (e.keyCode == 40) {//DOWN suggestionChange=true; } - + if (e.keyCode == 9) {//TAB return false; } @@ -265,7 +267,7 @@ function TextAnalyser2(newtext, finalize) { //EXTERNAL AND CONNECTION CHECKING var verb = ""; - function ANDconnect(node) { + function ANDconnect(node) { for(var x=0;x