]> git.0d.be Git - nanofun.git/blobdiff - nanofun.js
add indicators for devices
[nanofun.git] / nanofun.js
index 6b8ba95700f9c0c466e39e84c223081b626fd68a..34e1dcc2184a1f675f4092afac24778c9776cccf 100644 (file)
@@ -54,10 +54,6 @@ onMIDIAccessChange: function(e) {
     console.log('on midi access change', e);
     //console.log(this);
     var port = e.port;
-    var portContainer = $("#midi" + port.type + "s");
-    if (portContainer.html().startsWith("<p>No connected")) {
-        portContainer.empty();
-    }
 
     if (port.state == "disconnected") {
       if (port.type == "input") {
@@ -65,12 +61,17 @@ onMIDIAccessChange: function(e) {
       } else {
         this.outputs[port.name] = undefined;
       }
+      if (port.name == 'nanoPAD2 MIDI 1') { $('#devices .nanopad').removeClass('on'); }
+      if (port.name == 'nanoKONTROL2 MIDI 1') { $('#devices .nanokontrol').removeClass('on'); }
     } else {
       if (port.type == "input") {
         if (this.inputs[port.name] === undefined) { this.registerPort(port); }
       } else {
         if (this.outputs[port.name] === undefined) { this.registerPort(port); }
       }
+            console.log('hello:', port.name);
+      if (port.name == 'nanoPAD2 MIDI 1') { $('#devices .nanopad').addClass('on'); }
+      if (port.name == 'nanoKONTROL2 MIDI 1') { $('#devices .nanokontrol').addClass('on'); }
       this.renderPort(port);
     }
 },