plugins: (image) support fukung.net
Links to http://fukung.net/v/foobar.gif end by the actual image extensions, but the full image path is under http://media.fukung.net/imgs/foobar.gif. This commit replace the URL prefix if it matches fukung.net/v/.
This commit is contained in:
parent
ea65c5dc44
commit
55b720466b
1 changed files with 15 additions and 7 deletions
|
@ -152,14 +152,22 @@ plugins.factory('userPlugins', function() {
|
|||
var imagePlugin = new Plugin(function(message) {
|
||||
|
||||
var url = message.match(urlRegexp);
|
||||
var content = null;
|
||||
|
||||
if (url) {
|
||||
var url = url[0]; /* Actually parse one url per message */
|
||||
if (url) {
|
||||
var url = url[0]; /* Actually parse one url per message */
|
||||
if (url.match(/png$|gif$|jpg$|jpeg$/)) {
|
||||
return '<img src="' + url + '" height="300">';
|
||||
|
||||
/* A fukung.net URL may end by an image extension but is not a direct link. */
|
||||
if (url.indexOf("fukung.net/v/") != -1) {
|
||||
url = url.replace(/.*\//, "http://media.fukung.net/imgs/")
|
||||
}
|
||||
|
||||
content = '<img src="' + url + '" height="300">';
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
return content;
|
||||
});
|
||||
imagePlugin.name = 'image';
|
||||
|
||||
|
|
Loading…
Reference in a new issue