(function() {

  L.Control.Layers.Search = L.Control.Layers.extend({
    onAdd : function(map) {
      location.search.replace("?", "").split("/").forEach(function(key) {
        for ( var a in this._layers) {
          var b = this._layers[a];
          if (b.name === key)
            b.layer.addTo(map);
        }
      }, this);
      map.on("layeradd layerremove", this._save, this);
      return L.Control.Layers.prototype.onAdd.call(this, map);
    },
    onRemove : function(map) {
      map.off("layeradd layerremove", this._save, this);
      L.Control.Layers.prototype.onRemove.call(this, map);
    },
    _save : function() {
      var x = [];
      for ( var a in this._layers) {
        var b = this._layers[a];
        if (this._map.hasLayer(b.layer))
          x.push(b.name);
      }
      if (x.length > 0)
        history.replaceState(null, "", "?" + x.join("/") + location.hash);
    }
  });

  L.control.layers.search = function(baseLayers, overlays, options) {
    return new L.Control.Layers.Search(baseLayers, overlays, options);
  };

})();
@@ -71,17 +71,16 @@
    onAdd
- 
 : functi
@@ -85,24 +85,24 @@
 tion(map) %7B%0A
+
       locati
@@ -168,33 +168,32 @@
  %7B%0A        for (
- 
 var a in this._l
@@ -462,17 +462,16 @@
 onRemove
- 
 : functi
@@ -612,17 +612,16 @@
    _save
- 
 : functi
@@ -623,24 +623,153 @@
 unction() %7B%0A
+%0A      if (this._timer)%0A        clearTimeout(this._timer);%0A%0A      var that = this;%0A      this._timer = setTimeout(function() %7B%0A  
       var x 
@@ -784,14 +784,15 @@
     
+ 
+ 
 for (
- 
 var 
@@ -790,34 +790,34 @@
 for (var a in th
-is
+at
 ._layers) %7B%0A    
@@ -812,32 +812,34 @@
 yers) %7B%0A        
+  
 var b = this._la
@@ -824,34 +824,34 @@
       var b = th
-is
+at
 ._layers%5Ba%5D;%0A   
@@ -855,24 +855,26 @@
         
+  
 if (th
-is
+at
 ._map.ha
@@ -900,16 +900,18 @@
         
+  
 x.push(b
@@ -918,16 +918,18 @@
 .name);%0A
+  
       %7D%0A
@@ -930,24 +930,26 @@
     %7D%0A      
+  
 if (x.length
@@ -954,16 +954,18 @@
 th %3E 0)%0A
+  
         
@@ -1030,16 +1030,33 @@
 n.hash);
+%0A%0A      %7D, 1000);
 %0A    %7D%0A 
@@ -1212,9 +1212,10 @@
 %7D;%0A%0A
-
 %7D)();
+%0A

Add delay to _save