Created
June 27, 2011 18:40
-
-
Save betawaffle/1049470 to your computer and use it in GitHub Desktop.
Create Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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