JSLint /discourses
authorChloe Laisne <chloe.laisne@gmail.com>
Tue, 07 Jun 2016 12:18:53 +0200
changeset 178 4d051f080e7e
parent 177 5e93f5e5f8f9
child 179 9b703ece424f
JSLint /discourses
cms/app-client/app/components/discourses-component.js
--- a/cms/app-client/app/components/discourses-component.js	Tue Jun 07 12:00:40 2016 +0200
+++ b/cms/app-client/app/components/discourses-component.js	Tue Jun 07 12:18:53 2016 +0200
@@ -34,7 +34,7 @@
                 .attr("height", height)
                 .attr("class", "bubble");
 
-            var nodes = svg.selectAll(".node")
+            svg.selectAll(".node")
                 .data(bubble.nodes(self.createNodes(discourses)))
                 .enter().append("g")
                 .attr("width", function(d) { return 2.5 * d.r + 'px'; })
@@ -49,7 +49,7 @@
             leaf.append("circle")
                 .attr("r", function(d) { return d.r; })
                 .attr("fill", function(d) { return d.fill; })
-                .attr("stroke", function(d) { return "#000"; });
+                .attr("stroke", function() { return "#000"; });
             
             leaf.append("text")
                 .attr("dy", ".3em")
@@ -88,13 +88,15 @@
 
     setQueryString: function(field, value) {
         var hash = document.location.href.split('?');
-        var query_parameters = hash.pop();
+        var query_parameters = hash.length > 1 ? hash.pop() : '';
 
         // Unserialize
         var parameters = [];
         query_parameters.split('&').forEach(function(parameter){
             var object = parameter.split('=');
-            object[1] && (parameters[object[0]] = object[1]);
+            if(object[1]) {
+                parameters[object[0]] = object[1];
+            }
         });
 
         // Serialize