Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text
            @_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',
```

Response:
var clipboardData, file, i, len, ref, ref1, text;

reader.onload = (event) => {
  return this._handleImage(event.target.result);
};

reader.readAsDataURL(item.getAsFile());

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    setTimeout(() => {
      this._target.trigger('pasteText', {
        text: text
      });
      return this._target.trigger('_pasteCheckContainerDone');
    }, 1);
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
    }
    this._checkImagesInContainer(function(src) {});
  }
}

null;

({
  _handleImage: function(src) {
    var loader;
    if (src.match(/^webkit\-fake\-url\:\/\//)) {
      return this._target.trigger('pasteImageError', {
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
      });
    }
    loader = new Image();
    loader.crossOrigin = "anonymous";
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.onerror = () => {
      return this._target.trigger('pasteImageError');
    };
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var clipboardData, file, i, len, ref, ref1, text;

reader.onload = (event) => {
  return this._handleImage(event.target.result);
};

reader.readAsDataURL(item.getAsFile());

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    setTimeout(() => {
      this._target.trigger('pasteText', {
        text: text
      });
      return this._target.trigger('_pasteCheckContainerDone');
    }, 1);
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
    }
    this._checkImagesInContainer(function(src) {});
  }
}

null;

({
  _handleImage: function(src) {
    var loader;
    if (src.match(/^webkit\-fake\-url\:\/\//)) {
      return this._target.trigger('pasteImageError', {
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
      });
    }
    loader = new Image();
    loader.crossOrigin = "anonymous";
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.onerror = () => {
      return this._target.trigger('pasteImageError');
    };
  }
});
```

Response:
reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text
            @_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',


Prompt:
reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text
            @_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

Response:
_handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',


Response:
message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1


Prompt:
message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()

Response:
img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteImageError', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteImageError', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
```

Response:
var Paste;

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(paste._target).on('pasteImage', () => {
        return $(textarea).focus();
      });
      $(paste._target).on('pasteImageError', () => {
        return $(textarea).focus();
      });
      $(paste._target).on('pasteText', () => {
        return $(textarea).focus();
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      return $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {
        var clipboardData, ref;
        if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {
          return clipboardData = ev.originalEvent.clipboardData;
        }
      });
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Paste;

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(paste._target).on('pasteImage', () => {
        return $(textarea).focus();
      });
      $(paste._target).on('pasteImageError', () => {
        return $(textarea).focus();
      });
      $(paste._target).on('pasteText', () => {
        return $(textarea).focus();
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      return $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {
        var clipboardData, ref;
        if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {
          return clipboardData = ev.originalEvent.clipboardData;
        }
      });
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);
```

Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteImageError', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?

Response:
paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteImageError', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData


Response:
if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
```

Response:
var clipboardData, file, i, item, j, len, len1, reader, ref, ref1, ref2, text;

if (clipboardData.items) {
  ref = clipboardData.items;
  // Chrome
  for (i = 0, len = ref.length; i < len; i++) {
    item = ref[i];
    if (item.type.match(/^image\//)) {
      reader = new FileReader();
      reader.onload = (event) => {
        return this._handleImage(event.target.result);
      };
      reader.readAsDataURL(item.getAsFile());
    }
    if (item.type === 'text/plain') {
      item.getAsString((string) => {
        return this._target.trigger('pasteText', {
          text: string
        });
      });
    }
  }
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref1 = (text = clipboardData.getData('Text'))) != null ? ref1.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref2 = clipboardData.files;
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      file = ref2[j];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    if (src.match(/^webkit\-fake\-url\:\/\//)) {
      return this._target.trigger('pasteImageError', {
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
      });
    }
    loader = new Image();
    loader.crossOrigin = "anonymous";
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.onerror = () => {};
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var clipboardData, file, i, item, j, len, len1, reader, ref, ref1, ref2, text;

if (clipboardData.items) {
  ref = clipboardData.items;
  // Chrome
  for (i = 0, len = ref.length; i < len; i++) {
    item = ref[i];
    if (item.type.match(/^image\//)) {
      reader = new FileReader();
      reader.onload = (event) => {
        return this._handleImage(event.target.result);
      };
      reader.readAsDataURL(item.getAsFile());
    }
    if (item.type === 'text/plain') {
      item.getAsString((string) => {
        return this._target.trigger('pasteText', {
          text: string
        });
      });
    }
  }
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref1 = (text = clipboardData.getData('Text'))) != null ? ref1.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref2 = clipboardData.files;
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      file = ref2[j];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    if (src.match(/^webkit\-fake\-url\:\/\//)) {
      return this._target.trigger('pasteImageError', {
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
      });
    }
    loader = new Image();
    loader.crossOrigin = "anonymous";
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.onerror = () => {};
  }
});
```

Response:
if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>


Prompt:
if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)

Response:
@_checkImagesInContainer ->

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>


Response:
@_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
    , 1


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
    , 1
```

Response:
this._target.trigger('pasteImageError', {
  message: `Failed to get image from: ${src}`,
  url: src
});

loader.src = src;

({
  _checkImagesInContainer: function(cb) {
    var i, img, len, ref, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref = this._container.find('img');
    for (i = 0, len = ref.length; i < len; i++) {
      img = ref[i];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var j, len1, ref1, results;
      ref1 = this._container.find('img');
      results = [];
      for (j = 0, len1 = ref1.length; j < len1; j++) {
        img = ref1[j];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        results.push($(img).remove());
      }
      return results;
    }, 1);
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this._target.trigger('pasteImageError', {
  message: `Failed to get image from: ${src}`,
  url: src
});

loader.src = src;

({
  _checkImagesInContainer: function(cb) {
    var i, img, len, ref, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref = this._container.find('img');
    for (i = 0, len = ref.length; i < len; i++) {
      img = ref[i];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var j, len1, ref1, results;
      ref1 = this._container.find('img');
      results = [];
      for (j = 0, len1 = ref1.length; j < len1; j++) {
        img = ref1[j];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        results.push($(img).remove());
      }
      return results;
    }, 1);
  }
});
```

Response:
@_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
    , 1


Prompt:
@_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->

Response:
timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
    , 1


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?

Response:
paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome


Response:
for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')


Prompt:
for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

Response:
_handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86

Response:
$(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items


Response:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
```

Response:
var clipboardData, file, i, len, reader, ref, ref1, text;

if (item.type.match(/^image\//)) {
  reader = new FileReader();
  reader.onload = (event) => {
    return this._handleImage(event.target.result);
  };
  reader.readAsDataURL(item.getAsFile());
}

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    loader = new Image();
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.src = src;
  },
  _checkImagesInContainer: function(cb) {
    var img, j, len1, ref2, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref2 = this._container.find('img');
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      img = ref2[j];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var k, len2, ref3, results;
      ref3 = this._container.find('img');
      results = [];
      for (k = 0, len2 = ref3.length; k < len2; k++) {
        img = ref3[k];
        if (!img[`_paste_marked_${timespan}`]) {
          results.push(cb(img.src));
        } else {
          results.push(void 0);
        }
      }
      return results;
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var clipboardData, file, i, len, reader, ref, ref1, text;

if (item.type.match(/^image\//)) {
  reader = new FileReader();
  reader.onload = (event) => {
    return this._handleImage(event.target.result);
  };
  reader.readAsDataURL(item.getAsFile());
}

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox & Safari(text-only)
  if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  }
  this._checkImagesInContainer((src) => {
    return this._handleImage(src);
  });
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    loader = new Image();
    loader.onload = () => {
      var blob, canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
        blob = dataURLtoBlob(dataURL);
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          blob: blob,
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.src = src;
  },
  _checkImagesInContainer: function(cb) {
    var img, j, len1, ref2, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref2 = this._container.find('img');
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      img = ref2[j];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var k, len2, ref3, results;
      ref3 = this._container.find('img');
      results = [];
      for (k = 0, len2 = ref3.length; k < len2; k++) {
        img = ref3[k];
        if (!img[`_paste_marked_${timespan}`]) {
          results.push(cb(img.src));
        } else {
          results.push(void 0);
        }
      }
      return results;
    });
  }
});
```

Response:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]


Prompt:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->

Response:
loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]


Response:
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'
```

Response:
var createHiddenEditable;

createHiddenEditable = function() {
  return $(document.createElement('div')).attr('contenteditable', true).css({
    width: 1,
    height: 1,
    position: 'fixed',
    left: -100,
    overflow: 'hidden'
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var createHiddenEditable;

createHiddenEditable = function() {
  return $(document.createElement('div')).attr('contenteditable', true).css({
    width: 1,
    height: 1,
    position: 'fixed',
    left: -100,
    overflow: 'hidden'
  });
};
```

Response:
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86

Response:
$(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome & Safari(text-only)
          for item in clipboardData.items


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      paste._container.focus() if ctlDown && ev.keyCode == 86

Response:
$(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome & Safari(text-only)
          for item in clipboardData.items


Response:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')


Prompt:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

Response:
_handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')


Response:
$.fn.pastableNonInputable = ->
  for el in @
    paste = Paste.mountNonInputable el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableNonInputable = ->
  for el in @
    paste = Paste.mountNonInputable el
  @
```

Response:
$.fn.pastableNonInputable = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountNonInputable(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableNonInputable = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountNonInputable(el);
  }
  return this;
};
```

Response:
$.fn.pastableNonInputable = ->
  for el in @
    paste = Paste.mountNonInputable el
  @


Prompt:
$.fn.pastableNonInputable = ->
  for el in @

Response:
paste = Paste.mountNonInputable el
  @


Response:
$.fn.pastableTextarea = ->
  for el in @
    paste = Paste.mountTextarea el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableTextarea = ->
  for el in @
    paste = Paste.mountTextarea el
  @
```

Response:
$.fn.pastableTextarea = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountTextarea(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableTextarea = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountTextarea(el);
  }
  return this;
};
```

Response:
$.fn.pastableTextarea = ->
  for el in @
    paste = Paste.mountTextarea el
  @


Prompt:
$.fn.pastableTextarea = ->
  for el in @

Response:
paste = Paste.mountTextarea el
  @


Response:
$.fn.pastableContenteditable = ->
  for el in @
    paste = Paste.mountContenteditable el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableContenteditable = ->
  for el in @
    paste = Paste.mountContenteditable el
  @
```

Response:
$.fn.pastableContenteditable = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountContenteditable(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableContenteditable = function() {
  var el, i, len, paste, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    paste = Paste.mountContenteditable(el);
  }
  return this;
};
```

Response:
$.fn.pastableContenteditable = ->
  for el in @
    paste = Paste.mountContenteditable el
  @


Prompt:
$.fn.pastableContenteditable = ->
  for el in @

Response:
paste = Paste.mountContenteditable el
  @


Response:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
      if dataURL
        @_target.trigger 'pasteImage',
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
      if dataURL
        @_target.trigger 'pasteImage',
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
```

Response:
var clipboardData, file, i, len, reader, ref, ref1, text;

if (item.type.match(/^image\//)) {
  reader = new FileReader();
  reader.onload = (event) => {
    return this._handleImage(event.target.result);
  };
  reader.readAsDataURL(item.getAsFile());
}

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox
  if (clipboardData.types.length) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    this._checkImagesInContainer((src) => {
      return this._handleImage(src);
    });
  }
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    loader = new Image();
    loader.onload = () => {
      var canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.src = src;
  },
  _checkImagesInContainer: function(cb) {
    var img, j, len1, ref2, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref2 = this._container.find('img');
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      img = ref2[j];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var k, len2, ref3, results;
      ref3 = this._container.find('img');
      results = [];
      for (k = 0, len2 = ref3.length; k < len2; k++) {
        img = ref3[k];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        results.push($(img).remove());
      }
      return results;
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var clipboardData, file, i, len, reader, ref, ref1, text;

if (item.type.match(/^image\//)) {
  reader = new FileReader();
  reader.onload = (event) => {
    return this._handleImage(event.target.result);
  };
  reader.readAsDataURL(item.getAsFile());
}

if (item.type === 'text/plain') {
  item.getAsString((string) => {
    return this._target.trigger('pasteText', {
      text: string
    });
  });
} else {
  // Firefox
  if (clipboardData.types.length) {
    text = clipboardData.getData('Text');
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    this._checkImagesInContainer((src) => {
      return this._handleImage(src);
    });
  }
}

// IE
if (clipboardData = window.clipboardData) {
  if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {
    this._target.trigger('pasteText', {
      text: text
    });
  } else {
    ref1 = clipboardData.files;
    for (i = 0, len = ref1.length; i < len; i++) {
      file = ref1[i];
      this._handleImage(URL.createObjectURL(file));
      this._checkImagesInContainer(function() {});
    }
  }
}

({
  _handleImage: function(src) {
    var loader;
    loader = new Image();
    loader.onload = () => {
      var canvas, ctx, dataURL;
      canvas = document.createElement('canvas');
      canvas.width = loader.width;
      canvas.height = loader.height;
      ctx = canvas.getContext('2d');
      ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
      dataURL = null;
      try {
        dataURL = canvas.toDataURL('image/png');
      } catch (error) {}
      if (dataURL) {
        return this._target.trigger('pasteImage', {
          dataURL: dataURL,
          width: loader.width,
          height: loader.height
        });
      }
    };
    return loader.src = src;
  },
  _checkImagesInContainer: function(cb) {
    var img, j, len1, ref2, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref2 = this._container.find('img');
    for (j = 0, len1 = ref2.length; j < len1; j++) {
      img = ref2[j];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var k, len2, ref3, results;
      ref3 = this._container.find('img');
      results = [];
      for (k = 0, len2 = ref3.length; k < len2; k++) {
        img = ref3[k];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        results.push($(img).remove());
      }
      return results;
    });
  }
});
```

Response:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

  _handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
      if dataURL
        @_target.trigger 'pasteImage',
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()


Prompt:
if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox
          if clipboardData.types.length
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          else
            @_checkImagesInContainer (src)=>
              @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          @_target.trigger 'pasteText', text: text
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
            @_checkImagesInContainer ->

Response:
_handleImage: (src)->
    loader = new Image()
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
      if dataURL
        @_target.trigger 'pasteImage',
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    return @mountContenteditable textarea unless window.ClipboardEvent
    # Firefox only
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    $(textarea).on 'keypress', (ev)=>
      return unless 'v' == String.fromCharCode ev.charCode
      return unless ev.ctrlKey || ev.metaKey
      paste._container.focus()
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome & Safari(text-only)
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    return @mountContenteditable textarea unless window.ClipboardEvent
    # Firefox only
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    $(textarea).on 'keypress', (ev)=>
      return unless 'v' == String.fromCharCode ev.charCode
      return unless ev.ctrlKey || ev.metaKey
      paste._container.focus()
    $(paste._target).on 'pasteImage', =>
      $(textarea).focus()
    $(paste._target).on 'pasteText', =>
      $(textarea).focus()

    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome & Safari(text-only)
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
```

Response:
var Paste;

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var paste;
      if (!window.ClipboardEvent) {
        return this.mountContenteditable(textarea);
      }
      // Firefox only
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      $(textarea).on('keypress', (ev) => {
        if ('v' !== String.fromCharCode(ev.charCode)) {
          return;
        }
        if (!(ev.ctrlKey || ev.metaKey)) {
          return;
        }
        return paste._container.focus();
      });
      $(paste._target).on('pasteImage', () => {
        return $(textarea).focus();
      });
      $(paste._target).on('pasteText', () => {
        return $(textarea).focus();
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      return $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {
        var clipboardData, i, item, len, reader, ref, ref1, results;
        if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {
          clipboardData = ev.originalEvent.clipboardData;
          if (clipboardData.items) {
            ref1 = clipboardData.items;
            // Chrome & Safari(text-only)
            results = [];
            for (i = 0, len = ref1.length; i < len; i++) {
              item = ref1[i];
              if (item.type.match(/^image\//)) {
                results.push(reader = new FileReader());
              } else {
                results.push(void 0);
              }
            }
            return results;
          }
        }
      });
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);