Changeset 18779

Show
Ignore:
Timestamp:
09/04/08 01:47:26 (4 months ago)
Author:
hajimehoshi
Message:

Refactoring

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/bokeshi/trunk/website/public/javascripts/bokeshi.js

    r18778 r18779  
    44    var stageHTML = $("#stage"); 
    55    for (var i = 0; i < stage.length; i++) { 
    6         var row = stage[i]; 
    76        var ul = $('<ul></ul>').addClass("row"); 
    8         for (var j = 0; j < row.length; j++) { 
    9             var id = "stick_" + i + "_" + j; 
    10             var li = $("<li>|</li>").attr("id", id); 
    11             li.data("row", i).data("col", j); 
    12             if (j < row.length - 1) { 
    13                 stageHTML.append(" "); 
    14             } 
    15             ul.append(li); 
     7        for (var j = 0; j < stage[i].length; j++) { 
     8            ul.append($("<li>|</li>").attr("id", "stick_"+i+"_"+j).data("row", i).data("col", j)); 
    169        } 
    1710        stageHTML.append(ul); 
     
    7972                    "player": "You Lose!", 
    8073                    "cpu": "You Win!" 
    81                 }[by]); 
    82                 $("#message").show(); 
     74                }[by]).show(); 
    8375                return; 
    8476            } 
     
    8678                $(".row").selectable("disable"); 
    8779                $("#waitingMessage").show(); 
    88                 var param = { 
     80                $.post("./", { 
    8981                    "stage": this.toRequestStr(), 
    9082                    "dummy": (new Date()).getTime() 
    91                 }; 
    92                 $.post("./", param, function (data) { 
     83                }, function (data) { 
    9384                    var nextRemoving = data.nextRemoving; 
    9485                    if (nextRemoving) {