Let's just add some CoffeeScript flavor where possible <3

This commit is contained in:
Zixaphir 2013-08-06 22:07:21 -07:00
parent 3384c1b362
commit c325b9eeda
3 changed files with 34 additions and 23 deletions

View File

@ -4594,12 +4594,12 @@
api: function(uid) { api: function(uid) {
return "https://api.github.com/gists/" + uid; return "https://api.github.com/gists/" + uid;
}, },
text: function(data) { text: function(_arg) {
var file, response; var file, files;
response = data.files; files = _arg.files;
for (file in response) { for (file in files) {
if (response.hasOwnProperty(file)) { if (files.hasOwnProperty(file)) {
return file; return file;
} }
} }
@ -4662,8 +4662,11 @@
api: function(uid) { api: function(uid) {
return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + uid; return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + uid;
}, },
text: function(data) { text: function(_arg) {
return data.title; var title;
title = _arg.title;
return title;
} }
} }
}, },
@ -4708,8 +4711,11 @@
api: function(uid) { api: function(uid) {
return "https://vimeo.com/api/oembed.json?url=http://vimeo.com/" + uid; return "https://vimeo.com/api/oembed.json?url=http://vimeo.com/" + uid;
}, },
text: function(data) { text: function(_arg) {
return data.title; var title;
title = _arg.title;
return title;
} }
} }
}, },

View File

@ -4599,12 +4599,12 @@
api: function(uid) { api: function(uid) {
return "https://api.github.com/gists/" + uid; return "https://api.github.com/gists/" + uid;
}, },
text: function(data) { text: function(_arg) {
var file, response; var file, files;
response = data.files; files = _arg.files;
for (file in response) { for (file in files) {
if (response.hasOwnProperty(file)) { if (files.hasOwnProperty(file)) {
return file; return file;
} }
} }
@ -4667,8 +4667,11 @@
api: function(uid) { api: function(uid) {
return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + uid; return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + uid;
}, },
text: function(data) { text: function(_arg) {
return data.title; var title;
title = _arg.title;
return title;
} }
} }
}, },
@ -4713,8 +4716,11 @@
api: function(uid) { api: function(uid) {
return "https://vimeo.com/api/oembed.json?url=http://vimeo.com/" + uid; return "https://vimeo.com/api/oembed.json?url=http://vimeo.com/" + uid;
}, },
text: function(data) { text: function(_arg) {
return data.title; var title;
title = _arg.title;
return title;
} }
} }
}, },

View File

@ -257,9 +257,8 @@ Linkify =
src: "http://www.purplegene.com/script?url=https://gist.github.com/#{a.dataset.uid}.js" src: "http://www.purplegene.com/script?url=https://gist.github.com/#{a.dataset.uid}.js"
title: title:
api: (uid) -> "https://api.github.com/gists/#{uid}" api: (uid) -> "https://api.github.com/gists/#{uid}"
text: (data) -> text: ({files}) ->
response = data.files return file for file of files when files.hasOwnProperty file
return file for file of response when response.hasOwnProperty file
image: image:
regExp: /(http|www).*\.(gif|png|jpg|jpeg|bmp)$/ regExp: /(http|www).*\.(gif|png|jpg|jpeg|bmp)$/
@ -301,7 +300,7 @@ Linkify =
div div
title: title:
api: (uid) -> "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{uid}" api: (uid) -> "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{uid}"
text: (data) -> data.title text: ({title}) -> title
TwitchTV: TwitchTV:
regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/ regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/
@ -342,7 +341,7 @@ Linkify =
src: "//player.vimeo.com/video/#{a.dataset.uid}?wmode=opaque" src: "//player.vimeo.com/video/#{a.dataset.uid}?wmode=opaque"
title: title:
api: (uid) -> "https://vimeo.com/api/oembed.json?url=http://vimeo.com/#{uid}" api: (uid) -> "https://vimeo.com/api/oembed.json?url=http://vimeo.com/#{uid}"
text: (data) -> data.title text: ({title}) -> title
Vine: Vine:
regExp: /.*(?:vine.co\/)([^#\&\?]*).*/ regExp: /.*(?:vine.co\/)([^#\&\?]*).*/