define(function(require) {
    var init = require('init');

    var draw = require('./draw');
    var fill = require('./fill');
    var selectArea = require('./selectArea');
    var copy = require('./copy');
    var paste = require('./paste');
    var loadImage = require('./loadImage');
    var colors = require('./color');

    var canvas = init.getCanvas();
    var context = init.getContext();

    // canvasに対する操作
    // draw関係
    canvas.addEventListener('mousedown', function() {
        draw.mouseDown();
    });
    canvas.addEventListener('mousemove', function(e) {
        draw.mouseMove(e);
    });
    canvas.addEventListener('mouseup', function() {
        draw.mouseUp();
    });

    document.getElementById('draw').addEventListener('click', function(){
    });

    document.getElementById('erase').addEventListener('click', function(){

    });
    document.getElementById('fill').addEventListener('click', function(){
        fill.call();
    });
    document.getElementById('select-area').addEventListener('click', function(){
        selectArea.call();
    });
    document.getElementById('copy').addEventListener('click', function(){
        copy.call();
    });
    document.getElementById('paste').addEventListener('click', function(){
        paste.call();
    });
    document.getElementById('load-image').addEventListener('click', function(){
        loadImage.call();
    });
});

@@ -302,27 +302,448 @@
 s = 
-require('./color');
+document.getElementById('colors').childNodes;%0A    for (var i = 0, color; color = colors%5Bi%5D; i++) %7B%0A        if (color.nodeName.toLowerCase() != 'div') continue;%0A        color.addEventListener('click', function (e) %7B%0A            var style = e.target.getAttribute('style');%0A            var color = style.match(/background:(#......)/)%5B1%5D;%0A            context.strokeStyle = color;%0A            context.fillStyle = color;%0A        %7D,false);%0A    %7D;%0A
 %0A%0A  

edit main.js