Merge pull request #175 from cormier/asciinema

Implement asciinema plugin
This commit is contained in:
David Cormier 2014-02-23 10:56:52 -05:00
commit b5afa48b54
1 changed files with 17 additions and 1 deletions

View File

@ -266,7 +266,23 @@ plugins.factory('userPlugins', function() {
}); });
googlemapPlugin.name = 'Google Map'; googlemapPlugin.name = 'Google Map';
/*
* Asciinema plugin
*/
var asciinemaPlugin = new Plugin(function(message) {
var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/;
var match = message.match(regexp);
if (match) {
var id = match[3];
return "<script type='text/javascript' src='https://asciinema.org/a/" + id + ".js' id='asciicast-" + id + "' async></script>";
}
});
asciinemaPlugin.name = "ascii cast";
return { return {
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin] plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin]
}; };
}); });