Skip to content

Instantly share code, notes, and snippets.

@betawaffle
Created June 27, 2011 18:40
Show Gist options
  • Save betawaffle/1049470 to your computer and use it in GitHub Desktop.
Save betawaffle/1049470 to your computer and use it in GitHub Desktop.
Create Method
@create: (msg, opts) ->
title = opts.title if typeof opts.title is 'string'
type = typeof msg
if type is 'object'
title or= msg.attr('title')
type = msg.get(0).nodeName
switch type
when 'string' then break
when 'INPUT', 'SELECT', 'TEXTAREA'
msg = msg.attr('value')
else
msg = msg.text()
return new Meow(msg,
message_type: type
trigger : opts.trigger
icon : opts.icon if typeof opts.icon is 'string'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment