$(document).ready(function () {
  $.each($(".lightcontrol-btn"), function() {
    $(this).data("original-color", $(this).css("background-color"));
    $(this).on("click", function () {
        var main_elem = $(this);
        var original_classes = main_elem.children().attr("class");
        var command = main_elem.data("command");
        var group = main_elem.data("group") || "0";
        main_elem.animate({backgroundColor: "#ffffff"}, 250);
        main_elem.children().removeClass().addClass("fa fa-spinner fa-spin")
        function animate_success(icon) {
          main_elem.children().removeClass().addClass("fa fa-"+icon);
          var restore_classes = function () {
            main_elem.children().removeClass().addClass(original_classes);
            main_elem.stop().animate({backgroundColor: main_elem.data("original-color")}, 1000);
          }
          setTimeout(restore_classes, 2000);
        }

        $.ajax({
          url: "/homecontroller/lightcontrol/control/"+command+"/"+group,
          success: function () {
            animate_success("check");
          },
          error: function () {
            animate_success("times");
          }
        });
      });
  });
});

@@ -140,16 +140,89 @@
 lor%22));%0A
+    $(this).data(%22original-classes%22, $(this).children().attr(%22class%22));%0A%0A
     $(th
@@ -247,26 +247,24 @@
 nction () %7B%0A
-  
       var ma
@@ -292,71 +292,104 @@
     
-  var original_classes = main_elem.children().attr(%22class%22
+if (main_elem.data(%22running%22)) %7B%0A        return;%0A      %7D%0A      main_elem.data(%22running%22, true
 );%0A
-  
     
@@ -427,26 +427,24 @@
 %22command%22);%0A
-  
       var gr
@@ -479,34 +479,32 @@
 ) %7C%7C%C2%A0%220%22;%0A      
-  
 main_elem.animat
@@ -537,26 +537,24 @@
 ff%22%7D, 250);%0A
-  
       main_e
@@ -622,18 +622,16 @@
 )%0A      
-  
 function
@@ -653,24 +653,64 @@
 s(icon) %7B%0A  
+      main_elem.data(%22running%22, false);%0A
         main
@@ -769,26 +769,24 @@
 n);%0A        
- 
- 
 var restore_
@@ -801,34 +801,32 @@
 = function () %7B%0A
-  
           main_e
@@ -863,24 +863,40 @@
 ddClass(
+main_elem.data(%22
 original
 _classes
@@ -891,21 +891,21 @@
 inal
-_
+-
 classes
+%22)
 );%0A
-  
     
@@ -999,30 +999,26 @@
 0);%0A        
-  %7D%0A  
+%7D%0A
         setT
@@ -1058,15 +1058,11 @@
     
-  
 %7D%0A%0A
-  
     
@@ -1080,18 +1080,16 @@
         
- 
- 
 url: %22/h
@@ -1152,18 +1152,16 @@
         
-  
 success:
@@ -1167,34 +1167,32 @@
 : function () %7B%0A
-  
           animat
@@ -1223,15 +1223,11 @@
     
-  
 %7D,%0A
-  
     
@@ -1253,34 +1253,32 @@
  () %7B%0A          
-  
 animate_success(
@@ -1291,30 +1291,26 @@
 %22);%0A        
-  %7D%0A  
+%7D%0A
       %7D);%0A  
@@ -1307,18 +1307,16 @@
     %7D);%0A
-  
     %7D);%0A

Allow only one simultaneous command.