summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/buttons.js19
-rw-r--r--scripts/rhizicore.js112
-rw-r--r--scripts/robot.js5
-rw-r--r--scripts/textanalysis.js37
-rw-r--r--style.css8
5 files changed, 94 insertions, 87 deletions
diff --git a/scripts/buttons.js b/scripts/buttons.js
index b29e85e9..c1e63bd8 100644
--- a/scripts/buttons.js
+++ b/scripts/buttons.js
@@ -1,22 +1,3 @@
-$('.colorpicker').click(function(){Colorize();});
-
-var chosencolor;
-
-function Colorize(){
- $('.colorpicker').html("<table><tr><td class='td1'>person</td></tr><tr><td class='td2'>project</td></tr><tr><td class='td3'>question</td></tr><tr><td class='td4'>idea</td></tr></table>");
- $('.td1').css('background-color',customColor("person"));
- $('.td2').css('background-color',customColor("project"));
- $('.td3').css('background-color',customColor("skill"));
- $('.td4').css('background-color',customColor("deliverable"));
- $('.td5').css('background-color',customColor("objective"));
-
- $('.td1').click(function(){chosencolor="person"});
- $('.td2').click(function(){chosencolor="project"});
- $('.td3').click(function(){chosencolor="skill"});
- $('.td4').click(function(){chosencolor="deliverable"});
- $('.td5').click(function(){chosencolor="objective"});
-}
-
$('.tutorial').click(function(){});
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js
index 4d2356f5..31d30041 100644
--- a/scripts/rhizicore.js
+++ b/scripts/rhizicore.js
@@ -184,9 +184,27 @@ function myGraph(el) {
this.editName = function(id, type, newname) {
var index = findNode(id, type);
+ var index2 = findNode(newname, type);
+ var acceptReplace=true;
+
if ((index !== undefined)) {
- index.id = newname;
-
+ if ((index2 !== undefined)) {
+ acceptReplace = confirm(index2.id+" will replace "+index.id+", are you sure?");
+ if(acceptReplace){
+ for (var i = 0; i < links.length; i++) {
+ if (links[i].source === index) {
+ links[i].source = index2;
+ }
+
+ if (links[i].target === index) {
+ links[i].target = index2;
+ }
+ }
+ graph.removeNode(index.id,null);
+ }
+ }else{
+ index.id = newname;
+ }
}
}
@@ -299,7 +317,7 @@ function myGraph(el) {
var color = d3.scale.category20();
//Zoom scale behavior in zoom.js
- zoomObject = d3.behavior.zoom().scaleExtent([0.3, 3]).on("zoom", zoom);
+ zoomObject = d3.behavior.zoom().scaleExtent([0.1, 3]).on("zoom", zoom);
vis = this.vis = d3.select(el).append("svg:svg")
.attr("width", w * 5)
@@ -313,31 +331,28 @@ function myGraph(el) {
function zoom() {
if (graphstate === "GRAPH") vis.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
if (graphstate === "GANTT") vis.attr("transform", "translate(0,0)scale(1)");
- /*var threashhold=0;
- if(zoomObject.scale()>1.7){
- threashhold=1;
- }else{
- threashhold=2;
- }
-
- if(zoomLevel!==threashhold){
- zoomLevel=threashhold;
-
- if(zoomLevel===1){
- $('.linklabel').fadeIn(200);
- }
- if(zoomLevel===2){
- $('.linklabel').fadeOut(200);
- }
- }*/
-
-
+ }
+ var drag = d3.behavior.drag()
+ .origin(function(d) { return d; })
+ .on("dragstart", dragstarted)
+ .on("drag", dragged)
+ .on("dragend", dragended);
+ function dragstarted(d) {
+ d3.event.sourceEvent.stopPropagation();
+ d3.select(this).classed("dragging", true);
}
+ function dragged(d) {
+ d3.select(this).attr("cx", d.x = d3.event.x).attr("cy", d.y = d3.event.y);
+ }
-
+ function dragended(d) {
+ d3.select(this).classed("dragging", false);
+ d3.select(this).classed("fixed", true);
+ d3.select(this).attr("dx", d3.event.x).attr("dy", d3.event.y);
+ }
var force = d3.layout.force()
.distance(120)
@@ -429,7 +444,8 @@ function myGraph(el) {
});
var nodeEnter = node.enter()
- .append("g");
+ .append("g").call(drag);
+
nodetext = nodeEnter.insert("text")
.attr("class", "nodetext graph")
@@ -493,13 +509,13 @@ function myGraph(el) {
.attr("xlink:href", function(d) {
switch (d.status) {
case "done":
- return "images/delivcheck.png";
+ return "images/check.png";
break;
case "current":
- return "images/delivwait.png";
+ return "images/wait.png";
break;
case "waiting":
- return "images/delivcross.png";
+ return "images/cross.png";
break;
}
})
@@ -642,7 +658,7 @@ function tick(e) {
}
});
if(temptotal!==newnodes){
- newnodes+=temptotal/100;
+ newnodes+=temptotal/15/(newnodes*newnodes);
}
if(newnodes>=temptotal){
newnodes=temptotal;
@@ -655,8 +671,8 @@ function tick(e) {
d.x = window.innerWidth / 2;
d.y = window.innerHeight / 2;
}else{
- d.x = window.innerWidth / 2 + (60+newnodes*20) * Math.cos(Math.PI/2+Math.PI * 2 * (tempcounter-1) / newnodes+0.3);
- d.y = window.innerHeight / 2 + (60+newnodes*20) * Math.sin(Math.PI/2+Math.PI * 2 * (tempcounter-1) / newnodes+0.3);
+ d.x = window.innerWidth / 2 + (60+newnodes*20) * Math.cos(-Math.PI/2+Math.PI * 2 * (tempcounter-1) / newnodes-0.3);
+ d.y = window.innerHeight / 2 + (60+newnodes*20) * Math.sin(-Math.PI/2+Math.PI * 2 * (tempcounter-1) / newnodes-0.3);
}
}
});
@@ -753,7 +769,7 @@ http: //open.spotify.com/track/2ClxMaiC6wPP93pA0Ql0Vz
$('.info').fadeIn(300);
if (d.type === "deliverable") {
- $('.info').html('Name: ' + d.id + '<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>Status</label><input id="editstatus"/><label>Start date:</label><input id="editstartdate"/><label>End date:</label><input id="editenddate"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>');
+ $('.info').html('Name: ' + d.id + '<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>Status</label><select id="editstatus"><option value="waiting">Waiting</option><option value="current">Current</option><option value="done">Done</option></select><label>Start date:</label><input id="editstartdate"/><label>End date:</label><input id="editenddate"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>');
} else {
$('.info').html('Name: ' + d.id + '<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>URL:</label><input id="editurl"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>');
}
@@ -783,6 +799,8 @@ http: //open.spotify.com/track/2ClxMaiC6wPP93pA0Ql0Vz
$("#editbox").submit(function() {
if (d.type === "deliverable") graph.editDates(d.id, null, new Date($("#editstartdate").val()), new Date($("#editenddate").val()));
+
+ graph.update();
return false;
});
@@ -790,6 +808,8 @@ http: //open.spotify.com/track/2ClxMaiC6wPP93pA0Ql0Vz
if (confirm('This node and all its connections will be deleted, are you sure?')) {
graph.removeNode(d.id, null);
}
+
+ graph.update();
});
} else {
graph.removeHighlight();
@@ -806,8 +826,7 @@ function mousedown() {
$('.editlinkinfo').css('left', 0);
graph.removeHighlight();
$('.info').fadeOut(300);
-
- graph.update();
+ graph.update();
}
function AddedUnique(newnode) {
@@ -828,19 +847,18 @@ function editNode(d, i) {
$('.editinfo').css('left', d.x + 18);
$('#editname').val(oldname);
- $('#editform').submit(function() {
- if (AddedUnique($('#editname').val())) {
- $('.editinfo').css('top', -100);
- $('.editinfo').css('left', 0);
- graph.editName(oldname, "whatever", $('#editname').val());
- var index = addednodes.indexOf(oldname);
- addednodes[index] = $('#editname').val();
- console.log(addednodes[index]);
- } else {
- var choice = $('#editname').val();
- $('#editname').val(choice + "(2)");
- }
+ $('#editform').keypress(function(e) {
+ if (e.which == 13) {
+ $('.editinfo').css('top', -100);
+ $('.editinfo').css('left', 0);
+ graph.editName(oldname, "xx", $('#editname').val());
+
+
+ graph.update();
+
return false;
+ }
+
});
graph.update();
@@ -859,6 +877,8 @@ function editLink(d, i) {
graph.editLink(d.source.id, d.target.id, $('#editlinkname').val());
$('.editlinkinfo').css('top', -100);
$('.editlinkinfo').css('left', 0);
+ graph.update();
+
return false;
});
@@ -880,7 +900,7 @@ function customColor(type) {
color = '#62BB47';
break;
case "deliverable":
- color = '#CCC';
+ color = '#202020';
break;
case "objective":
color = '#933E99';
diff --git a/scripts/robot.js b/scripts/robot.js
index d0c7ef8b..5ffbebcd 100644
--- a/scripts/robot.js
+++ b/scripts/robot.js
@@ -54,7 +54,10 @@ function Robot(){
window.setTimeout( Robot, 50/speed+Math.round(Math.random()*100/speed) );
}
}else{
- $('#textanalyser').trigger("submit");
+ var e = jQuery.Event("keypress");
+ e.which = 13;
+ e.keyCode = 13;
+ $("#textanalyser").trigger(e);
window.setTimeout( Robot, 650/speed );
}
}else{
diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js
index af236170..3b97ee71 100644
--- a/scripts/textanalysis.js
+++ b/scripts/textanalysis.js
@@ -18,14 +18,20 @@ $('#textanalyser').autocompleteTrigger({
source: sugg
});
-$('#textanalyser').submit(function() {
- //finalize text input, empty
- text = $('#textanalyser').val();
- $('#textanalyser').val("");
- TextAnalyser2(text, true);
- typeStack=[];
+$("#textanalyser").keypress(function(e) {
+ if (e.which == 13) {
+ if(!suggestionChange){
+ text = $('#textanalyser').val();
+ $('#textanalyser').val("");
+ TextAnalyser2(text, true);
+ typeStack=[];
+ }else{
+ suggestionChange=false;
+ }
+
return false;
+ }
});
$(document).keydown(function(e) {
@@ -46,18 +52,13 @@ $(document).keydown(function(e) {
suggestionChange=true;
}
- if (e.keyCode == 13) {
- if(!suggestionChange){
- text = $('#textanalyser').val();
- $('#textanalyser').val("");
- TextAnalyser2(text, true);
- typeStack=[];
- }else{
- suggestionChange=false;
- }
+
+ if (e.keyCode == 9) {//TAB
+ text = $('#textanalyser').val();
+ $('#textanalyser').val(text+" ");
return false;
-
}
+
});
function changeType(arg, id) {
@@ -82,6 +83,8 @@ window.setInterval(function() {
if ($('#textanalyser').val() != text) {
$('.typeselection').css('top', -300);
$('.typeselection').css('left', 0);
+
+ if(text.length*8>300)$('#textanalyser').css('width',text.length*8);
// text changed
text = $('#textanalyser').val();
TextAnalyser2(text, false);
@@ -296,4 +299,4 @@ function Unique(newnode) {
}
}
return truth;
-} \ No newline at end of file
+}
diff --git a/style.css b/style.css
index e66f771e..4fcc3f5c 100644
--- a/style.css
+++ b/style.css
@@ -71,7 +71,7 @@ a:active {
}
#textanalyser{
- width:900px;
+ width:300px;
height:30px;
}
@@ -402,7 +402,7 @@ input:focus {
.onoffswitch {
z-index:100;
position: fixed;
- width: 140px;
+ width: 160px;
top:35px;
right: 180px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
@@ -430,7 +430,7 @@ input:focus {
}
.onoffswitch-inner:before {
- content: "GANTT VIEW";
+ content: "TIMELINE VIEW";
padding-left: 5px;
background-color: #080808; color: #FFFFFF;
}
@@ -446,7 +446,7 @@ input:focus {
display: block; width: 35px; margin: 0px;
background: #3D3D3D;
border: 1px solid #FFFFFF; border-radius: 5px;
- position: absolute; top: 0; bottom: 0; right: 105px;
+ position: absolute; top: 0; bottom: 0; right: 125px;
-moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);