Revert "Add Edge - Alpha"
This reverts commit ac6d0c560e04e10e2a06302d1887725a45a369c7.
diff --git a/js/script.js b/js/script.js
index 6fcf868..5d7a5e4 100644
--- a/js/script.js
+++ b/js/script.js
@@ -63,7 +63,6 @@
s.graph.nodes().forEach(function(n) {
n.color = n.originalColor;
- n.label = n.originalLabel;
});
s.graph.edges().forEach(function(e) {
@@ -79,13 +78,6 @@
min: function() {
document.querySelector("#dialog").style.display = "none";
document.querySelector("#summary-dialog").style.display = "block";
- },
- addEdge: function() {
- document.querySelector("#addedge-input").style.display = "block";
- document.querySelector("#edge-list").style.display = "none";
- autocomplete(document.getElementById("addedge-input"), graf.nodes, "addEdge");
- // Focus on the addEdge input bar
- document.getElementById("addedge-input").focus();
}
};
@@ -130,7 +122,6 @@
s.graph.addNode({
id: graf.nodes[i].id,
label: graf.nodes[i].name,
- originalLabel: graf.nodes[i].name,
x: graf.nodes[i].x,
y: graf.nodes[i].y,
size: 10,
@@ -152,14 +143,32 @@
var nodeId = e.data.node.id,
toKeep = s.graph.neighbors(nodeId);
//toKeep[nodeId] = e.data.node;
- clickNode(s, nodeId, toKeep);
+
+ s.graph.nodes().forEach(function(n) {
+ if (toKeep[n.id] || n.id == nodeId) {
+ n.color = n.originalColor;
+ } else {
+ n.color = '#333';
+ }
+ });
+
+ s.graph.edges().forEach(function(e) {
+ if ((e.source == nodeId || e.target == nodeId) && (toKeep[e.source] || toKeep[e.target])) {
+ e.color = '#fff';
+ } else {
+ e.color = '#333';
+ }
+ });
+
+ s.refresh();
+
+ dialog.show(nodeId, toKeep);
});
document.querySelector("#quit-dialog").addEventListener("click", dialog.close);
document.querySelector("#quit2-dialog").addEventListener("click", dialog.close);
document.querySelector("#max-dialog").addEventListener("click", dialog.max);
document.querySelector("#min-dialog").addEventListener("click", dialog.min);
- document.querySelector("#addedge-button").addEventListener("click", dialog.addEdge);
document.querySelector("#zoomin").addEventListener("click", function() {
s.camera.goTo({
@@ -185,29 +194,4 @@
);
}
-function clickNode(s, nodeId, toKeep) {
- s.graph.nodes().forEach(function(n) {
- if (toKeep[n.id] || n.id == nodeId) {
- n.color = n.originalColor;
- n.label = n.originalLabel;
- console.log("Hola");
- } else {
- n.color = '#333';
- n.label = '';
- }
- });
-
- s.graph.edges().forEach(function(e) {
- if ((e.source == nodeId || e.target == nodeId) && (toKeep[e.source] || toKeep[e.target])) {
- e.color = '#fff';
- } else {
- e.color = '#333';
- }
- });
-
- s.refresh();
-
- dialog.show(nodeId, toKeep);
-}
-
window.addEventListener("load", init);