codeclimate identified, fixes
Costa Tsaousis (ktsaou) committed
Jan 14, 2018 at 01:29 UTC
780aa0d5d22ab9e85426ec6c3b27cb02ecf9c75d
1 file changed
+5
-4
web/dashboard.js
+5
-4
@@ -2324,16 +2324,17 @@ var NETDATA = window.NETDATA || {};
2324
entries.forEach(function(entry) {
2325
var state = NETDATA.chartState(entry.target);
2326
2327
+ var idx;
2328
if(entry.intersectionRatio > 0) {
2328
- var idx = NETDATA.intersectionObserver.visible_targets.indexOf(state);
2329
- if(idx == -1)
2329
+ idx = NETDATA.intersectionObserver.visible_targets.indexOf(state);
2330
+ if(idx === -1)
2331
NETDATA.intersectionObserver.visible_targets.push(state);
2332
else if(state.__visibilityRatio === 0)
2333
state.log("was not visible until now, but was already in visible_targets");
2334
}
2335
else {
2335
- var idx = NETDATA.intersectionObserver.visible_targets.indexOf(state);
2336
- if(idx > -1)
2336
+ idx = NETDATA.intersectionObserver.visible_targets.indexOf(state);
2337
+ if(idx !== -1)
2338
NETDATA.intersectionObserver.visible_targets.splice(idx, 1);
2339
else if(state.__visibilityRatio > 0)
2340
state.log("was visible, but not found in visible_targets");