Skip to main content
deleted 40 characters in body
Source Link
konijn
  • 33.8k
  • 5
  • 69
  • 264

There is not much you can do, the only thing I would suggest is to use concat instead of push, this way you can keep re-using commonLogs, and maybe have 1 commonLogs per group.

So

  var commonLogs = [ [] ];
  commonLogs[1]  = ["DCSext.common1","common1"];
  commonLogs[2]  = commonLogs[1].concat( ["DCSext.common2","common2"] );
  commonLogs[3]  = commonLogs[2].concat( ["DCSext.common3","common3"] );

Then you can

(function(){

  $("#a", "#main").bind("mouseover", function(){
          var id1 = $("#one").text(),
              args = commonLogs[2].concat["DCSextconcat( ["DCSext.title","one", "DCSext.ti", id1];id1] );
          dcsMultitrack.apply(this, args);
  });

  $("#b", "#cool").bind("click", function(){
       var id2 = $("#two").text(),
           args = commonLogs[2].concat["DCSextconcat( ["DCSext.title", "two", "DCSext.some", id2];
   id2] );
       dcsMultitrack.apply(this, args);
  });

  $("body").delegate("a", "click", function(){
     var id3 = $("#three").text(),
         args = commonLogs[2].concat["DCSextconcat( ["DCSext.new", "what", "DCSext.where", "us"];
   "us"] );
     dcsMultitrack.apply(this, args);
  });

}());

There is not much you can do, the only thing I would suggest is to use concat instead of push, this way you can keep re-using commonLogs, and maybe have 1 commonLogs per group.

So

  var commonLogs = [ [] ];
  commonLogs[1]  = ["DCSext.common1","common1"];
  commonLogs[2]  = commonLogs[1].concat( ["DCSext.common2","common2"] );
  commonLogs[3]  = commonLogs[2].concat( ["DCSext.common3","common3"] );

Then you can

(function(){

  $("#a", "#main").bind("mouseover", function(){
          var id1 = $("#one").text(),
              args = commonLogs[2].concat["DCSext.title","one", "DCSext.ti", id1];
          dcsMultitrack.apply(this, args);
  });

  $("#b", "#cool").bind("click", function(){
       var id2 = $("#two").text(),
           args = commonLogs[2].concat["DCSext.title", "two", "DCSext.some", id2];
           dcsMultitrack.apply(this, args);
  });

  $("body").delegate("a", "click", function(){
     var id3 = $("#three").text(),
         args = commonLogs[2].concat["DCSext.new", "what", "DCSext.where", "us"];
         dcsMultitrack.apply(this, args);
  });

}());

There is not much you can do, the only thing I would suggest is to use concat instead of push, this way you can keep re-using commonLogs, and maybe have 1 commonLogs per group.

So

  var commonLogs = [ [] ];
  commonLogs[1]  = ["DCSext.common1","common1"];
  commonLogs[2]  = commonLogs[1].concat( ["DCSext.common2","common2"] );
  commonLogs[3]  = commonLogs[2].concat( ["DCSext.common3","common3"] );

Then you can

(function(){

  $("#a", "#main").bind("mouseover", function(){
          var id1 = $("#one").text(),
              args = commonLogs[2].concat( ["DCSext.title","one", "DCSext.ti", id1] );
          dcsMultitrack.apply(this, args);
  });

  $("#b", "#cool").bind("click", function(){
       var id2 = $("#two").text(),
           args = commonLogs[2].concat( ["DCSext.title", "two", "DCSext.some", id2] );
       dcsMultitrack.apply(this, args);
  });

  $("body").delegate("a", "click", function(){
     var args = commonLogs[2].concat( ["DCSext.new", "what", "DCSext.where", "us"] );
     dcsMultitrack.apply(this, args);
  });

}());
Source Link
konijn
  • 33.8k
  • 5
  • 69
  • 264

There is not much you can do, the only thing I would suggest is to use concat instead of push, this way you can keep re-using commonLogs, and maybe have 1 commonLogs per group.

So

  var commonLogs = [ [] ];
  commonLogs[1]  = ["DCSext.common1","common1"];
  commonLogs[2]  = commonLogs[1].concat( ["DCSext.common2","common2"] );
  commonLogs[3]  = commonLogs[2].concat( ["DCSext.common3","common3"] );

Then you can

(function(){

  $("#a", "#main").bind("mouseover", function(){
          var id1 = $("#one").text(),
              args = commonLogs[2].concat["DCSext.title","one", "DCSext.ti", id1];
          dcsMultitrack.apply(this, args);
  });

  $("#b", "#cool").bind("click", function(){
       var id2 = $("#two").text(),
           args = commonLogs[2].concat["DCSext.title", "two", "DCSext.some", id2];
           dcsMultitrack.apply(this, args);
  });

  $("body").delegate("a", "click", function(){
     var id3 = $("#three").text(),
         args = commonLogs[2].concat["DCSext.new", "what", "DCSext.where", "us"];
         dcsMultitrack.apply(this, args);
  });

}());